var precL1="";
var precL2="";
var id=0;
var i=0;
var l=0;
var span=0;
var statoL1=0;
var statoL2=0;
var To="";
var tmpL1=0;
var tmpL2=0;
function carica(percorso,parametro){
	if (parametro==0){document.location=percorso;}
	if (parametro==1){window.open(percorso,"altraPagina");}
}
function apriTicker(){
	window.open(perc+"ticker/ticker.php?perc="+document.URL,"ticker",'menubar=0,personalbar=0,resizable=1,scrollbars=0,height=30,width=50')
}
function apriTickerNas(){
	window.open("http://ticker.nasdaq.com/tkr/TickerFrame.asp","tickerNas",'top=0,left=0,screenX=0,screenY=0,menubar=0,personalbar=0,resizable=1,scrollbars=0,height=90,width='+(screen.availWidth-15));
}
function over(id,col,liv,rif){
	try{
		try{
		if((statoL1<tmpL1)&&(statoL2==0)){
			document.getElementById(precL1).style.background="transparent";
			document.getElementById(precL1+"c").style.background="transparent";
			document.getElementById(precL1).style.color="#374f6b";
			if(liv>0)document.getElementById(precL1+"c").style.color="#374f6b";
		}
		tmpL1=statoL1;
		if((statoL2<tmpL2)){
			document.getElementById(precL2).style.background="transparent";
			document.getElementById(precL2+"c").style.background="transparent";
			document.getElementById(precL2).style.color="#374f6b";
			if(liv>0)document.getElementById(precL2+"c").style.color="#374f6b";
		}
		tmpL2=statoL2;
		}catch(errore){}
		document.getElementById(id).style.background="#374f6b";
		if(liv>0)document.getElementById(id+"c").style.background="#374f6b";
		document.getElementById(id).style.color="#d4dee8";
		if(liv>0)document.getElementById(id+"c").style.color="#d4dee8";
		if(liv>0)apri(eval(rif),liv,id,col);
		if(liv==1)statoL1=1;
		if(liv==2)statoL2=1;
	}catch(errore){}
}
function overIntermedio(liv){
	if(liv==1)statoL1=2;
	if(liv==2){statoL2=2;statoL1=1;}
}
function out(id,col,liv,rif){
	try{
		if(To)window.clearTimeout(To);
		document.getElementById(id).style.background='transparent';
		if(liv>0)document.getElementById(id+"c").style.background='transparent';
		document.getElementById(id).style.color="#374f6b";
		if(liv>0)document.getElementById(id+"c").style.color="#374f6b";
		statoL1=0;
		statoL2=0;
		if(liv==1)precL1=id;
		if(liv==2)precL2=id;
		To=window.setTimeout("kill()",100);
	}catch(errore){}
}
function kill(){
	try{
		if(statoL2<1){
			document.getElementById("L2").style.visibility="hidden";
			if(statoL1<1) {
				document.getElementById("L1").style.visibility="hidden";
				document.getElementById(precL1).style.background="transparent";
				document.getElementById(precL1+"c").style.background="transparent";
				document.getElementById(precL1).style.color="#374f6b";
				if(liv>0)document.getElementById(precL1+"c").style.color="#374f6b";
			}
		}
	}catch(errore){}
}
function chiudiAll(){
	window.setTimeout("kill()",100);
}
function dentro(liv){
	if(liv==1){statoL1=2;statoL2=0;}
	if(liv==2){statoL2=2;statoL1=1};
}
function evPrec(col){
	try{
		if(statoL1>0){
			document.getElementById(precL1).style.background="#374f6b";
			document.getElementById(precL1+"c").style.background="#374f6b";
			document.getElementById(precL1).style.color="#d4dee8";
			document.getElementById(precL1+"c").style.color="#d4dee8";
		}
		if(statoL2>1){
			document.getElementById(precL2).style.background="#374f6b";
			document.getElementById(precL2+"c").style.background="#374f6b";
			document.getElementById(precL2).style.color="#d4dee8";
			document.getElementById(precL2+"c").style.color="#d4dee8";
		}
	}catch(errore){}
}
function caricaMenu(oggetto){
	try{
		if(oggetto !=""){
			var n_og=10;
			document.writeln("<table width='100%' bgcolor='#d4dee8' cellspacing='0' cellpadding='0' class='bordo'>");
			l=oggetto.length;
			span=((l/n_og)*2)-1;
			for(i=0;i<l;i=i+n_og){
				document.writeln("<tr height='17' class='menu'>");
				document.write("<td ");
				if(oggetto[i+2]==0)document.write("colspan='2' ");
				document.write("id='"+id+"' onMouseOver='over("+id+",\""+oggetto[i+6]+"\","+oggetto[i+2]+",\""+oggetto[i+3]+"\")' onMouseOut='out("+id+",\""+oggetto[i+6]+"\","+oggetto[i+2]+",\""+oggetto[i+3]+"\")'");
				if(oggetto[i+1]!="")document.write(" onClick='carica(\""+perc+""+oggetto[i+1]+"\","+oggetto[i+9]+")'>");
				else document.write(">");
				document.write(oggetto[i]+"</td>");
				if(oggetto[i+2]==1)document.write("<td id='"+id+"c' width='10' onMouseOver='over("+id+",\""+oggetto[i+6]+"\",1,\""+oggetto[i+3]+"\")' onMouseOut='out("+id+",\""+oggetto[i+6]+"\",1,\""+oggetto[i+3]+"\")'><img src='"+perc+"img/triangolo2.gif'></td>");
				document.write("</tr>\r\n");
				if((i+n_og)<l)document.write("<tr height='1'><td colspan='2' background='"+perc+"img/barraMenu.gif'></td></tr>");
				id++;
			}
			document.writeln("</table>");
		}
	}catch(errore){}
}
function apri(ogg,liv,id,col){
	try{
		var n_og=10;
		var idL=0;
		var posY=ogg[4];
		var posX=ogg[5];
		if (!document.all){
			posY-=2;
			posX+=1;
		}
		document.getElementById("L"+liv).style.top=posY+"px";
		document.getElementById("L"+liv).style.left=posX+"px";
		var str="";
		str="<table bgcolor='#d4dee8' class='bordo' width='150' cellpadding='0' cellspacing='0' onMouseOver='evPrec(\""+ogg[6]+"\")'>\r\n";
		l=ogg.length;
		for(i=0;i<l;i=i+n_og){
			str=str+"<tr height='17' class='menu'><td nowrap ";
			if(ogg[i+2]==0)str=str+"colspan='2' ";
			str=str+"id='"+liv+"_"+idL+"' onMouseOver='dentro("+ogg[i+8]+");over(\""+liv+"_"+idL+"\",\""+ogg[i+6]+"\","+ogg[i+2]+",\""+ogg[i+3]+"\")' onMouseOut='out(\""+liv+"_"+idL+"\",\""+ogg[i+6]+"\","+ogg[i+2]+",\""+ogg[i+3]+"\")'";
			if(ogg[i+1]!="")str=str+" onClick='carica(\""+perc+""+ogg[i+1]+"\","+ogg[i+9]+")'>\r\n";
			else str=str+">\r\n";
			str=str+"&nbsp;&nbsp;"+ogg[i]+"</td>\r\n";
			if(ogg[i+2]==2)str=str+"<td id='"+liv+"_"+idL+"c' width='10' onMouseOver='dentro("+ogg[i+8]+");over(\""+liv+"_"+idL+"\",\""+ogg[i+6]+"\",2,\""+ogg[i+3]+"\")' onMouseOut='out(\""+liv+"_"+idL+"\",\""+ogg[i+6]+"\",2,\""+ogg[i+3]+"\")'><img src='"+perc+"img/triangolo2.gif'></td>";
			str=str+"</tr>\r\n";
			if((i+n_og)<l)str=str+"<tr height='1'><td colspan='2' background='"+perc+"img/barraMenu.gif'></td></tr>";
			idL++;
		}
		str=str+"</table>";
		document.getElementById("L"+liv).innerHTML=str;
		document.getElementById("L"+liv).style.visibility="visible";
	}catch(errore){}
}
caricaMenu(menuNuovo);
document.write("<div id='L1' name='L1' style='position:absolute;visibility:hidden;width:150px'></div>");
document.write("<div id='L2' name='L2' style='position:absolute;visibility:hidden;width:150px'></div>");
//document.write("&nbsp;<a href='javascript:apriTicker()' class='linkBlu'>Ticker Borsaoperativa</a><br>");
