
/*	From jsdir.com - script n. 44	*/

/*	Versione 04-06-2011 - Inserito chiamata Google Analytics
/*	Menu verticale - sezione invariabile - Versione del 31/12/2006 - 28/1/2007 */

var borderstyle = "solid";
var borderwidth = "1";		// in pixel
var bordercolor = "#A70730";

var roff =  "rgb(255,240,224)"; // Colore di background, per il menu di primo livello
var ron =   "rgb(255,204,204)"; // Colore di background per il menu di primo livello al MouseOver

var roff2 =  "rgb(255,240,224)";	// Colore di background, per il menu di secondo livello
var ron2 =   "rgb(255,204,204)";	// Colore di background per il menu di secondo livello 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

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_a('mtop.') onMouseOut=unmroll_a('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_a('mtop"+i+".');menu_count++ onMouseOut=menu_last="+i+";unmroll_a('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_b('mdep"+n+"."+l+"');menu_count++ onMouseOut=unmroll_b('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_a('mtop.');\" onmouseout=\"unmroll_a('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_a('mtop"+n+".');menu_count++;\" onmouseout=\"menu_last="+n+";unmroll_a('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:"+roff2+";visibility:hidden;cursor:hand;\" onmouseover=\"mroll_b('mdep"+n+"."+l+"');menu_count++;\" onmouseout=\"unmroll_b('mdep"+n+"."+l+"');menu_count--;\" class='menuIE' onclick=\"go_to_page('"+links[i][l]+"',"+i+","+l+");\">&nbsp;"+voci[i][l]+"</div>");
			

		}
	}
}
	
	document.write("</div>");

	timer = setInterval("NascondiMenu()",1000);
	
	
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-8846198-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();	
	

	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?ron2:roff2;
	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) {
		i=0;	}
	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_a(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 mroll_b(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=ron2:(document.all)?document.all[l].style.background = ron2:document.getElementById(l).style.background=ron2;
	
	document.getElementById?document.getElementById(l).style.cursor = document.all?'hand':'pointer':'void(0)';
	
	return true;
	
}

/* ******************************************************************************** */

function unmroll_a(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;
}

function unmroll_b(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=roff2:(document.all)?document.all[l].style.background=roff2:document.getElementById(l).style.background=roff2;
	
	return true;
}






