var opActual = "";
var desplegado = false;
var mausaut = true;

function calcX(){
	if(inicio==1){
		if (document.layers){wWindow = window.innerWidth - 16;}
		else {wWindow = document.body.scrollWidth;}
		xInicial = ((wWindow/2) - 390);
	}
}


function DynMouseMove(x,y) {
	if (home == 1){
		minSpace = 175;
		maxSpace = 177;
	}else{
		minSpace = 29;
		maxSpace = 31;
	}
	incremX = 0;
	for (j=1;j<opActual;j++){
		incremX = incremX + (document.images["op" + j].width + 7);
	}
	minX = xInicial + distanciaX + incremX;
	maxX = minX + 261;
	if (opActual != ""){
		opc = opActual.split('p')[1];
		if (cont[opc-1].length > 1){maxSpace += cont[opc-1].length * 16 + 2;} // El 2 son los pixeles q hacen arriba y abajo del marco
	}
	
	if (desplegado){
		if (((x > maxX)||(y > maxSpace)||(y < minSpace)||(x < minX)) && (mausaut==false)){hideSubmenu();}
	}
}

function hideSubmenu(){
	submenu.hide();
	submenuTrans.hide();
	desplegado = false;
	canvia(opActual,'off');
}

cont = new Array()
cont[0] = new Array("Qué es l'A·B·A","Sector Bancari financer a Andorra","Mesures contra el delicte financer","Entitats associades");
cont[0].enlaces = new Array("inner.htm","inner.htm","inner.htm","inner.htm")
cont[1] = new Array("");
cont[2] = new Array("");
cont[3] = new Array("");
cont[4] = new Array("");
cont[5] = new Array("");
cont[6] = new Array("");


function creaMenu(op){
	incremX = xInicial + distanciaX;
	
	for (j=1;j<op;j++){
		incremX = incremX + (document.images["op" + j].width + 7);
	}
		
	if (cont[op-1].length > 1){
	desplegado = true;
	maqueta = '<table border=0 cellpadding=0 cellspacing=0 bgcolor="white">'
			+ '<tr>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=' + (document.images["op" + op].width-2) + '  height=1></td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=' + (261 - (document.images["op" + op].width)) + ' height=1></td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '<tr>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td colspan=3>'
				+ '<table border=0 cellpadding=0 cellspacing=0>'
				+ '<tr>'
					+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '</tr>';
		
	maqueta2 = '<table border=0 cellpadding=0 cellspacing=0>'
			+ '<tr>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=' + (document.images["op" + op].width-2) + '  height=1></td>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=' + (261 - (document.images["op" + op].width)) + ' height=1></td>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '<tr>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '<td colspan=3>'
				+ '<table border=0 cellpadding=0 cellspacing=0>'
				+ '<tr>'
					+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
				+ '</tr>';
				
	
				for (i=0;i < cont[op-1].length;i++){
				maqueta	+= '<tr>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=14 height=15 name="fl' + i + '"></td>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
						+ '<td width=242><img src="images/pix_trans.gif" border=0 width=242 height=15 name="bl' + i + '"></td>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
					+ '</tr>'
					+ '<tr>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
						+ '<td colspan=3><img src="images/pix_trans.gif" border=0 width=14 height=1></td>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
					+ '</tr>';
					
				maqueta2+= '<tr>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>';
						if (document.layers){maqueta2 += '<td><img src="images/pix_trans.gif" border=0 width=14 height=15></td>';}
						else {maqueta2 += '<td onMouseOver="mostraOver(\'' + i + '\',\'1\')" onMouseOut="mostraOver(\'' + i + '\',\'0\')"><img src="images/pix_trans.gif" border=0 width=14 height=15></td>'}
						
						maqueta2 += '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
						
						if (document.layers){maqueta2 += '<td width=242><a href="" onMouseOver="mostraOver(\'' + i + '\',\'1\')" onMouseOut="mostraOver(\'' + i + '\',\'0\')"><img src="images/pix_trans.gif" border=0 width=3 height=1>' + cont[op-1][i] + '</a></td>';}
						else {maqueta2 += '<td width=242 onMouseOver="mostraOver(\'' + i + '\',\'1\')" onMouseOut="mostraOver(\'' + i + '\',\'0\')"><a href="javascript:void(0);"><img src="images/pix_trans.gif" border=0 width=3 height=1>' + cont[op-1][i] + '</a></td>';}
						
						maqueta2 += '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
					+ '</tr>'
					+ '<tr>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
						+ '<td colspan=3 bgcolor="#D4CAB3"><img src="images/pix_trans.gif" border=0 width=14 height=1></td>'
						+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
					+ '</tr>';
					
				}
				
				maqueta	+= '</table>'
				+ '</td>'
				+ '<td><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '<tr>'
				+ '<td colspan=5><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '</table>';
			
			maqueta2+= '</table>'
				+ '</td>'
				+ '<td bgcolor="#9A9895"><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '<tr>'
				+ '<td bgcolor="#9A9895" colspan=5><img src="images/pix_trans.gif" border=0 width=1 height=1></td>'
			+ '</tr>'
			+ '</table>';
	
	}else{
		maqueta = "";
		maqueta2 = "";
	}
	
	submenu.moveTo(incremX,null);
	submenuTrans.moveTo(incremX,null);
	submenu.show();
	submenuTrans.show();
	submenu.write(maqueta);
	submenuTrans.write(maqueta2);
}

function mostraOver(ide,stat){
	if (stat == 0){
		imagen = "images/pix_trans.gif";
		imagenfl = "images/pix_trans.gif";
	}else{
		imagen = "images/bloq_over.gif";
		imagenfl = "images/ic_flecha.gif";
	}
	
	fletx = "fl" + ide;
	blq = "bl" + ide;
	

	if (document.layers){
		document.submenuDiv.document.images[fletx].src = imagenfl;
		document.submenuDiv.document.images[blq].src = imagen;
	}else{
		document.images[fletx].src = imagenfl;
		document.images[blq].src = imagen;
	}
	
}

function canvia(opc,stat){
	if (inicio == 1){
		if (!desplegado){
			document.images[opc].src = "images/bt_" + opc + "_" + stat + ".gif";
		}
	}
}

function canviaEng(opc,stat)
{
	if (inicio == 1)
	{
		if (!desplegado)
		{
			document.images[opc].src = "../images/eng/bt_" + opc + "_" + stat + ".gif";
		}
	}
}

var myImage = null;

function verGrafico(img){
	myImage = new Image() 
	
	myImage.src = img
	
	//myImage.onLoad=imageLoaded(1);
	setTimeout("imageLoaded('"+img+"')",500);
	
	

}

function imageLoaded(img){
	imgw = myImage.width
	imgh = myImage.height
	
	lefts=(screen.width-imgw)/2
	tops=(screen.height-imgh)/2

	win1 = window.open ("popupGrafico.htm?src="+img+"&width="+(imgw+50)+"&height="+(imgh+50),"win1","menubar=0,resizable=0,width="+imgw+",height="+imgh+",top="+tops+",left="+lefts); 
	win1.focus();	
	
}

function canviaEs(opc,stat)
{
	if (inicio == 1)
	{
		if (!desplegado)
		{
			document.images[opc].src = "../images/es/bt_" + opc + "_" + stat + ".gif";
		}
	}
}