/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 * Sezione personalizzabile.
 * Modificare le variabili e gli array seguenti per adattare il menu al propri sito.
 * L'ultima voce di questo menu e' un link a JsDir, se credete potete toglierlo, ma in tal caso vi preghiamo
 * di lasciare il riferimento della riga seguente... dopotutto non l'avete pagato nulla, quindi... che vi costa? :-)
 *
 * Questo menu e' (C)2001 ri.riccardi@agora.stm.it - Lo script e' reperibile al sito http://www.jsdir.com - JavaScript Directory
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var ron="#80BBD9"; // Colore al MouseOver
var roff="#BFDAED"; // Colore di default
var leftmargin=(window.innerWidth-748.5)/2 // Distanza dal margine a seconda della dimensione della pagina solo per ns
//var leftmargin=10; // Distanza dal margine sinistro della pagina
var topmargin=70; // Distanza dal margine superiore della pagina
var largo=140; // Larghezza dei layers, quindi dei bottoni del menu
var alto=22; // Altezza dei layers, quindi distanza (verticale) fra le voci del menu

/* L'array seguente contiene i testi che verranno visualizzati dal menu.
 * Nell'esempio (il menu di JsDir) trovate quattro elementi dell'array "voci" corrispondenti alle quattro voci del menu principale
 * Il primo elemento degli array e' il nome del menu, gli elementi successivi sono i links contenuti nel singolo menu.
 * Il tasto "Home" non compare in questo array perche' viene inserito di default come primo elemento */
var voci=new Array();
	voci[0]=new Array("What's New","Events","News","Press")
	voci[1]=new Array("iSeries","Consulting","Software development","iSeries for web");
	voci[2]=new Array("Pc & Web","Consulting","Software development","Web design","Multimedia technology");
	voci[3]=new Array("Networking","Consulting","Network","Security","Storage");
	voci[4]=new Array("Product & Services","Business intelligence","Service desk","Management","NOC","Security","Storage","Web promotion","Web hosting","Mail & Fax","Virtualization");
	voci[5]=new Array("About Us","Story","Mission","Partners","Staff","Case history");

/* Questo array contiene invece i links che saranno aperti dalle singole voci dei sottomenu.
 * Da notare che il primo elemento degli array dev'essere una stringa vuota, infatti corrisponde non ad un link
 * da aprire, ma al titolo del sottomenu, cioe' al primo elemento dell'array "voci"
 * In quest'esempio (menu verticale) dato che nel sito si apre in finestra per essere provato, tutti i links sono stati sostituiti
 * con dei #. Abbiamo lasciato gia' pronto solo il link a JsDir. */
var links=new Array();
	links[0]=new Array("/aree.asp?id=2","/sottoaree.asp?id=1","/notizie.asp","/notizie.asp?tp=Press")
	//links[0]=new Array("/aree.asp?id=2","/20050525.asp","/notizie.asp")
	links[1]=new Array("/aree.asp?id=3","/sottoaree.asp?id=3","/sottoaree.asp?id=4","/sottoaree.asp?id=5")
	links[2]=new Array("/aree.asp?id=4","/sottoaree.asp?id=10","/sottoaree.asp?id=11","/sottoaree.asp?id=12","/sottoaree.asp?id=13")
	links[3]=new Array("/aree.asp?id=5","/sottoaree.asp?id=6","/sottoaree.asp?id=7","/sottoaree.asp?id=8","/sottoaree.asp?id=9")
	links[4]=new Array("/aree.asp?id=6","/sottoaree.asp?id=15","/sottoaree.asp?id=16","/sottoaree.asp?id=17","/sottoaree.asp?id=18","/sottoaree.asp?id=19","/sottoaree.asp?id=20","/sottoaree.asp?id=21","/sottoaree.asp?id=22","/sottoaree.asp?id=23","/sottoaree.asp?id=51")
	links[5]=new Array("/aree.asp?id=7","/sottoaree.asp?id=25","/sottoaree.asp?id=26","/sottoaree.asp?id=27","/sottoaree.asp?id=28","/sottoaree.asp?id=47")

/* Ultimo array.
 * Contiene i testi che saranno visualizzati nella barra di stato del browser quando il mouse e' sopra una voce del menu 
 * Anche in questo caso il primo elemento degli array contiene il testo relativo alla voce principale dei sottomenu */
var wst=new Array();
	wst[0]=new Array("News ed eventi","Gli eventi", "Le news","Rassegna stampa");
	wst[1]=new Array("Area iSeries","Consulenza","Sviluppo software","iSeries nel web");
	wst[2]=new Array("Area Pc & Web","Consulenza","Sviluppo software","Web design","Tecnologie multimediali");
	wst[3]=new Array("Area Networking","Consulenza","Reti","Sicurezza","Storage");
	wst[4]=new Array("I prodotti ed i servizi","Business intelligence","Service desk","Management","NOC","Security","Storage","Web promotion","Web hosting","Mail & Fax","Virtualization");
	wst[5]=new Array("Qualcosa sulla SIES","La storia","La missione","I partners","Chi lavora in SIES","Casi di successo");
	//da qui in poi ci sono altri indici. Solo su testi perchè per il resto mi arrangio col codice
	wst[6]=new Array("Area clienti");
	wst[7]=new Array("Area dipendenti");
	wst[8]=new Array("Opportunità di lavoro");
	wst[9]=new Array("Informazioni");

//serve per memorizzare numero di sottomenu
maxl=new Array();

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 * Fine sezione personalizzabile.
 * Le righe che seguono costituiscono il menu vero e proprio.
 * La personalizzazione e' consigliata solo a webmaster un po' esperti di JavaScript.
 * Per la descrizione dello script si veda lo StaffScript "Menu a tendine" in JsDir.
 *    Questo menu differisce dall'altro "orizzontale" solo per i document.write che stampano i livelli, e per
  *   l'aggiunta di un rollon nelle voci principali quando il menu e aperto.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

var nn=document.layers?true:false,conta=0,last=0;
if (nn)
	{
	//var topmargin=230;
	document.writeln("<LAYER NAME=mtop. position=absolute left="+leftmargin+" top="+topmargin+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(last,false);mroll('mtop.') onMouseOut=unmroll('mtop.')>&nbsp;<A HREF='/default.asp' STYLE=text-decoration:none CLASS=menuNNb>Home</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+".');conta++ onMouseOut=last="+i+";unmroll('mtop"+i+".');conta-->&nbsp;<A HREF=javascript:mroll('mtop"+i+".') CLASS=menuNNb><table width="+largo+" height="+alto+"><tr><td>"+voci[i][0]+"</td><td width=10 valign=middle><img src=menu/freccia.gif width=3 height=5 align=right></td></td></tr></table></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+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta-->&nbsp;<A HREF=javascript:mroll('mdep"+n+"."+l+"') onClick=vai('"+links[i][l]+"',"+i+","+l+") CLASS=menuNN><table width="+largo+" height="+alto+" class=menuNNTB><tr><td>"+voci[i][l]+"</td></tr></table></A></LAYER>");
		}
	}
	else
	{
	//il nuovo netscape viene riconoscuto come un IE però il comando per calcolare
	//dinamicamente la posizione su ie nn va bene in NS. Quindi verifico se il 
	//calcolo fatto prima è numerico (ns) altrimenti (ie) lo ricalcolo per IE.
	if (isNaN(leftmargin)){
		var leftmargin=(document.body.clientWidth-731)/2;
	}	
	else
	{
		//var topmargin=230;
	}
	document.writeln("<DIV ID=mtop. STYLE=\"position:absolute;left:"+leftmargin+";top:"+topmargin+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop.') onMouseOut=unmroll('mtop.')><table width="+largo+" height="+alto+"><tr><td valign=middle><span class=menuIEb><A HREF='/default.asp' STYLE=text-decoration:none CLASS=menuIEb onFocus=this.blur()>&nbsp;Home</A></span></td></tr></table></DIV>");
	for (i=0;i<voci.length;i++)
		{
		var n=i;
		document.writeln("<DIV ID=mtop"+n+". STYLE=\"position:absolute;left:"+leftmargin+";top:"+eval(alto+topmargin+alto*i)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=MostraMenu("+n+");mroll('mtop"+n+".');conta++ onMouseOut=last="+n+";unmroll('mtop"+n+".');conta-- onClick=document.location.href='"+links[i][0]+"' CLASS=menuIEb><table width="+largo+" height="+alto+"><tr><td><span class=menuIEb>&nbsp;"+voci[i][0]+"</td><td width=10><img src=menu/freccia.gif width=3 height=5 align=right></span></td></tr></table></DIV></DIV>");
		//modificato da qui
		l=1
		document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"position:absolute;left:"+eval(leftmargin+largo)+";top:"+eval(topmargin+alto*i+alto*l)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:hidden;cursor:hand\" onMouseOver=;mroll('mdep"+n+"."+l+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta-- CLASS=menuIE onClick=vai('"+links[i][l]+"',"+i+","+l+")><table width="+largo+" height="+alto+" cellspacing=0 cellpadding=0 id=tb"+i+"."+l+" class=topleftright><tr><td>&nbsp;"+voci[i][l]+"</td></tr></table></DIV>");
		l++
			for (l=2;l<voci[i].length;l++){
				if (l==voci[i].length-1){
					document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"position:absolute;left:"+eval(leftmargin+largo)+";top:"+eval(topmargin+alto*i+alto*l)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:hidden;cursor:hand\" onMouseOver=;mroll('mdep"+n+"."+l+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta-- CLASS=menuIE onClick=vai('"+links[i][l]+"',"+i+","+l+")><table width="+largo+" height="+alto+" cellspacing=0 cellpadding=0 id=tb"+i+"."+l+" class=leftrightbottom><tr><td><span class=menuIE>&nbsp;"+voci[i][l]+"</span></td></tr></table></DIV>");
					}
				else{
					document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"position:absolute;left:"+eval(leftmargin+largo)+";top:"+eval(topmargin+alto*i+alto*l)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:hidden;cursor:hand\" onMouseOver=;mroll('mdep"+n+"."+l+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta-- CLASS=menuIE onClick=vai('"+links[i][l]+"',"+i+","+l+")><table width="+largo+" height="+alto+" cellspacing=0 cellpadding=0 id=tb"+i+"."+l+" class=leftright><tr><td><span class=menuIE>&nbsp;"+voci[i][l]+"</span></td></tr></table></DIV>");
					}
				}
				maxl[i]=l
			}
	}
tmpmaxi=i

if (nn)
	{
	document.writeln("<LAYER NAME=mtop"+i+". position=absolute left="+leftmargin+" top="+eval(alto+topmargin+alto*i)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')>&nbsp;<A HREF='/customer_access.asp' STYLE=text-decoration:none CLASS=menuNNb>Customer access</A></LAYER>");
	i++;
	document.writeln("<LAYER NAME=mtop"+i+". position=absolute left="+leftmargin+" top="+eval(alto+topmargin+alto*i)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')>&nbsp;<A HREF='http://sd.sies.it/' target='_blank' STYLE=text-decoration:none CLASS=menuNNb>Staff access</A></LAYER>");
	i++;
	document.writeln("<LAYER NAME=mtop"+i+". position=absolute left="+leftmargin+" top="+eval(alto+topmargin+alto*i)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')>&nbsp;<A HREF='/sottoaree.asp?id=37' STYLE=text-decoration:none CLASS=menuNNb>Job opportunities</A></LAYER>");
	i++;
	document.writeln("<LAYER NAME=mtop"+i+". position=absolute left="+leftmargin+" top="+eval(alto+topmargin+alto*i)+" width="+largo+" height="+alto+" clip=0,0,"+largo+","+alto+" bgColor="+roff+" visibility=visible onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')>&nbsp;<A HREF='/sottoaree.asp?id=33' STYLE=text-decoration:none CLASS=menuNNb>Info</A></LAYER>");
	i++;
	}
	else
	{
	document.writeln("<DIV ID=mtop"+i+". STYLE=\"position:absolute;left:"+leftmargin+";top:"+eval(alto+topmargin+alto*i)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')><table width="+largo+" height="+alto+"><tr><td valign=middle><span class=menuIEb><A HREF='/customer_access.asp' STYLE=text-decoration:none CLASS=menuIEb onFocus=this.blur()>&nbsp;Customer access</A></span></td></tr></table></DIV>");
	i++;
	document.writeln("<DIV ID=mtop"+i+". STYLE=\"position:absolute;left:"+leftmargin+";top:"+eval(alto+topmargin+alto*i)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')><table width="+largo+" height="+alto+"><tr><td valign=middle><span class=menuIEb><A HREF='http://sd.sies.it/' target='_blank' STYLE=text-decoration:none CLASS=menuIEb onFocus=this.blur()>&nbsp;Staff access</A></span></td></tr></table></DIV>");
	i++
	document.writeln("<DIV ID=mtop"+i+". STYLE=\"position:absolute;left:"+leftmargin+";top:"+eval(alto+topmargin+alto*i)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')><table width="+largo+" height="+alto+"><tr><td valign=middle><span class=menuIEb><A HREF='/sottoaree.asp?id=37' STYLE=text-decoration:none CLASS=menuIEb onFocus=this.blur()>&nbsp;Job opportunities</A></span></td></tr></table></DIV>");
	i++
	document.writeln("<DIV ID=mtop"+i+". STYLE=\"position:absolute;left:"+leftmargin+";top:"+eval(alto+topmargin+alto*i)+";width:"+largo+";height:"+alto+";background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop"+i+".') onMouseOut=unmroll('mtop"+i+".')><table width="+largo+" height="+alto+"><tr><td valign=middle><span class=menuIEb><A HREF='/sottoaree.asp?id=33' STYLE=text-decoration:none CLASS=menuIEb onFocus=this.blur()>&nbsp;Info</A></span></td></tr></table></DIV>");
	i++
	}
maxi=i
leftm=leftmargin
lrg=largo
timer=setInterval("NascondiMenu()",1000)

function NascondiMenu()
	{
	if (conta==0)
		{
		//coloratutti(true)
		timer=setTimeout("coloratutti(false)",200);
		timer=setTimeout("showdeps(last,false)",250);
		}
	}

function coloratutti(col)
	{
	colore=col?ron:roff;
	for (i=0;i<voci.length;i++)
		for (j=1;j<voci[i].length;j++)
			{
		if (nn)
			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(last,false);
	showdeps(n,true);
	last=n;
	}

function showdeps(n,act)
	{
	if (conta==0)
		{
		act?stat="visible":stat="hidden";
	if (nn)
		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 vai(dove,r,c)
	{
	lev=nn?document.layers["mdep"+r+"."+c]:(document.all)?document.all["mdep"+r+"."+c].style:document.getElementById("mdep"+r+"."+c).style;
	if (nn)
		{
		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;
		timer=setTimeout("lev.background=ron",50)
		timer=setTimeout("lev.background=roff",100)
		timer=setTimeout("lev.background=ron",150)
		timer=setTimeout("lev.background=roff",200)
		timer=setTimeout("lev.background=ron",250)
		}
	timer=setTimeout("self.location.href='"+dove+"'",350)
	}

function mroll(l)
	{
	toplayer="mtop"+l.substring(4,l.indexOf(".")+1);
	nn?document.layers[l].bgColor=ron:(document.all)?document.all[l].style.background=ron:document.getElementById(l).style.background=ron;
	nn?document.layers[toplayer].bgColor=ron:(document.all)?document.all[toplayer].style.background=ron:document.getElementById(toplayer).style.background=ron;
	document.getElementById?document.getElementById(l).style.cursor=document.all?'hand':'pointer':'void(0)';
	if (l.substr(0,4)=="mdep")
		stringa=wst[l.substr(4,l.indexOf(".")-4)][l.substring(l.indexOf(".")+1,l.length)];
			else if (l.length>5)
			stringa=wst[l.substr(4,l.indexOf(".")-4)][0];
				else stringa="Home Page";		
	window.status=stringa;
	timer=setTimeout("window.status=stringa",20);
	}

function unmroll(l)
	{
	toplayer="mtop"+l.substring(4,l.indexOf(".")+1);
	nn?document.layers[l].bgColor=roff:(document.all)?document.all[l].style.background=roff:document.getElementById(l).style.background=roff;
	nn?document.layers[toplayer].bgColor=roff:(document.all)?document.all[toplayer].style.background=roff:document.getElementById(toplayer).style.background=roff;
	window.status="";
	}
function reloadmenu()
	{
	var leftmargin=(window.innerWidth-748.5)/2
	if (isNaN(leftmargin)){
		var leftmargin=(document.body.clientWidth-731)/2;
		}
	if (leftmargin < 0){
		leftmargin=0;
		}
	document.getElementById("mtop.").style.left=leftmargin

	for (i=0;i<maxi;i++){
		document.getElementById("mtop"+i+".").style.left=leftmargin
		}
	//alert(lrg)
	for (i=0;i<tmpmaxi;i++){
		for (j=0;j<maxl[i]-1;j++){
			//alert(i)
			//alert("mdep"+i+"."+(j+1))
			document.getElementById("mdep"+i+"."+(j+1)).style.left=eval(leftmargin+lrg)
			}
		}
	}


//gestisco l'evento resize
window.onresize=reloadmenu;

