
/*	From jsdir.com - script n. 44	*/

/*	Menu verticale - sezione invariabile - Versione del 31/12/2006 - 1/1/2007	*/

/*	Versione del 21-09-2009														*/

var borderstyle = "solid";
var borderwidth = "1";		// in pixel
var bordercolor = "black";

var roff =  "#e0e0e0"; // Colore di background, per il menu primo livello e secondo livello
var ron =   "rgb(255,204,0)"; // Colore di background menu al MouseOver
/* Il colore del testo è dichiarato in CSS e non si può modifica al MouseOver	*/

/* **************************************************************************** */

/* Inizio generazione menu verticale 											*/

/* **************************************************************************** */

var browser_old = document.layers?true:false;	// varibaile interna

var menu_count = 0;				// varibaile interna

var menu_last = 0;				// varibaile interna

/* **************************************************************************** */

/*	Questa funzione contiene il codice Google Analytics							*/

function visualizza_menu(lang) {

	document.write("<div class='onoff'>");

	if (browser_old)
	{
	
	if (Home)
		document.write("<LAYER NAME=mtop. position=absolute left="+leftmargin+" top="+topmargin+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(menu_last,false);mroll('mtop.') onMouseOut=unmroll('mtop.') CLASS=menuNNb>&nbsp;<A HREF='"+HomeLink+"' CLASS=menuNNb>"+HomeText+"</A></LAYER>");
	for (i=0;i<voci.length;i++)
		{
		var n=i;
		document.writeln("<LAYER NAME=mtop"+n+". position=absolute left="+leftmargin+" top="+eval(alto+topmargin+alto*i)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=MostraMenu("+i+");mroll('mtop"+i+".');menu_count++ onMouseOut=menu_last="+i+";unmroll('mtop"+i+".');menu_count-- CLASS=menuNNb>&nbsp;<A HREF=javascript:mroll('mtop"+i+".') onClick=go_to_page('"+links[i][0]+"',"+i+",0) CLASS=menuNNb>"+voci[i][0]+"</A></LAYER>");
		for (l=1;l<voci[i].length;l++)
			document.writeln("<LAYER NAME=mdep"+i+"."+l+" position=absolute left="+eval(leftmargin+largo)+" top="+eval(topmargin+alto*i+alto*l)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=hidden onMouseOver=mroll('mdep"+n+"."+l+"');menu_count++ onMouseOut=unmroll('mdep"+n+"."+l+"');menu_count-- CLASS=menuNNb>&nbsp;<A HREF=javascript:mroll('mdep"+n+"."+l+"') onClick=go_to_page('"+links[i][l]+"',"+i+","+l+") CLASS=menuNN>"+voci[i][l]+"</A></LAYER>");
		}
	}
	


	else		/* Caso IE6 e FF 1.5	*/
	{
	
/*	Gestione Home	*/	

	if (Home)
		document.write("<a href='"+HomeLink+"' class='menuIEb' onfocus='this.blur();'><div id='mtop.' style=\"border-style:"+borderstyle+";border-width:"+borderwidth+"px; border-color:"+bordercolor+";position:absolute;left:"+leftmargin+"px;top:"+topmargin+"px;width:"+largo+"px;height:"+alto+"px;background-color:"+roff+";visibility:visible;cursor:hand;\" onmouseover=\"showdeps(menu_last,false);mroll('mtop.');\" onmouseout=\"unmroll('mtop.');\"><div style='position: relative;' class='menuIEb'>&nbsp;"+HomeText+"</div></div></a>");
	
/*	Gestione Menu principale	*/		
	
	for (i=0;i<voci.length;i++)
	{	var n=i;
		document.writeln("<div id='mtop"+n+".' style=\"border-style:"+borderstyle+";border-width:"+borderwidth+"px; border-color:"+bordercolor+";position:absolute;left:"+leftmargin+"px;top:"+eval(alto+topmargin+alto*i)+"px;width:"+largo+"px;height:"+alto+"px;background:"+roff+";visibility:visible;cursor:hand;\" onmouseover=\"MostraMenu("+n+");mroll('mtop"+n+".');menu_count++;\" onmouseout=\"menu_last="+n+";unmroll('mtop"+n+".');menu_count--;\"><div style='position: relative;' class='menuIEb' onclick=\"go_to_page('"+links[i][0]+"',"+i+",0);\">&nbsp;"+voci[i][0]+"</div></div>");
		 
		
/*		Gestione sotto-menu	*/		
		
		
		for (l=1;l<voci[i].length;l++)
			document.writeln("<div id='mdep"+i+"."+l+"' style=\"border-style:"+borderstyle+";border-width:"+borderwidth+"px; border-color:"+bordercolor+";position:absolute;left:"+eval(leftmargin+largo+1)+"px;top:"+eval(topmargin+alto*i+alto*l)+"px;width:"+largo2+"px;height:"+alto+"px;background:"+roff+";visibility:hidden;cursor:hand;\" onmouseover=\"mroll('mdep"+n+"."+l+"');menu_count++;\" onmouseout=\"unmroll('mdep"+n+"."+l+"');menu_count--;\" class='menuIE' onclick=\"go_to_page('"+links[i][l]+"',"+i+","+l+");\">&nbsp;"+voci[i][l]+"</div>");
	}
	}
	
	document.write("</div>");
	

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-8846198-3");
pageTracker._trackPageview();
} catch(err) {}

	timer = setInterval("NascondiMenu()",1000);

	return true;

}

/* ******************************************************************************** */


function NascondiMenu() {

	if (menu_count == 0)
	{	coloratutti(true)
		timer = setTimeout("coloratutti(false)",20);		/* 200	*/
		timer = setTimeout("showdeps(menu_last,false)",25);	/* 250	*/	
	}
}
	
/* ******************************************************************************** */

function coloratutti(col) {

	colore = col?ron:roff;
	for (i=0;i<voci.length;i++)
		for (j=1;j<voci[i].length;j++)
		{	if (browser_old)
				document.layers["mdep"+i+"."+j].bgColor = colore;
			else	if(document.all)
					document.all["mdep"+i+"."+j].style.background = colore;
				else
					document.getElementById('mdep'+i+"."+j).style.background = colore;
		}
}
	
/* ******************************************************************************** */

function MostraMenu(n)
{
	showdeps(menu_last,false);
	showdeps(n,true);
	menu_last = n;
}

/* ******************************************************************************** */


function showdeps(n,act)
{
	if (menu_count==0)
	{
		act?stat="visible":stat="hidden";
		if (browser_old)
		for (i=1;i<voci[n].length;i++)
			document.layers["mdep"+n+"."+i].visibility=stat;
		else
		for (i=1;i<voci[n].length;i++)
			if(document.all)
				document.all["mdep"+n+"."+i].style.visibility=stat;
				else
				document.getElementById('mdep'+n+"."+i).style.visibility=stat;
	}
}

/* ******************************************************************************** */

function go_to_page(dove,r,c) {

/*	dove: URL della pagina dove andare */
/*	r : links[i][j]		*/
/*	c = 0: menu principale	*/
/*	c = 1: menu secondario	*/

	var pathname = "";
	var result;
	
/*	Per evitare di andare nella pagina dove ci troviamo già		*/
	   
	pathname = window.location.pathname; 
	result = pathname.indexOf(dove);
	if (result >= 0) return true;

	if (c>0)
		lev = browser_old?document.layers["mdep"+r+"."+c]:(document.all)?document.all["mdep"+r+"."+c].style:document.getElementById("mdep"+r+"."+c).style;
	else
		lev = browser_old?document.layers["mtop"+r+"."]:(document.all)?document.all["mtop"+r+"."].style:document.getElementById("mtop"+r+".").style;
	
	if (browser_old) {
		lev.bgColor = roff;
		timer = setTimeout("lev.bgColor=ron",50)
		timer = setTimeout("lev.bgColor=roff",100)
		timer = setTimeout("lev.bgColor=ron",150)
		timer = setTimeout("lev.bgColor=roff",200)
		timer = setTimeout("lev.bgColor=ron",250)
	}
	else lev.background = roff;
		
   	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && navigator.platform.toLowerCase().indexOf("mac")=="mac")
	   document.write("");
	   
	timer = setTimeout("self.location.href='"+dove+"'",35);	/* 350 */
	
	return true;
	
}

/* ******************************************************************************** */

function mroll(l) {

	LTop="mtop"+l.substr(4,l.indexOf(".")-4)+".";
	
	browser_old?document.layers[LTop].bgColor=ron:(document.all)?document.all[LTop].style.background = ron:document.getElementById(LTop).style.background=ron;
	
	browser_old?document.layers[l].bgColor=ron:(document.all)?document.all[l].style.background = ron:document.getElementById(l).style.background=ron;
	
	document.getElementById?document.getElementById(l).style.cursor = document.all?'hand':'pointer':'void(0)';
	
	return true;
	
}

/* ******************************************************************************** */

function unmroll(l) {

	LTop="mtop"+l.substr(4,l.indexOf(".")-4)+".";
	
	browser_old?document.layers[LTop].bgColor=roff:(document.all)?document.all[LTop].style.background=roff:document.getElementById(LTop).style.background=roff;
	
	browser_old?document.layers[l].bgColor=roff:(document.all)?document.all[l].style.background=roff:document.getElementById(l).style.background=roff;
	
	return true;
}




