/* MENU AGLETS */

//var ron="#A4B7D5"; // Colore al MouseOver
//var roff="#336AB4"; // Colore di default
var ron="#0000FF";
var roff="#000000";
var leftmargin=150; // Distanza dal margine sinistro della pagina --> V. riga 57 piu' sotto.
var topmargin=125; // Distanza dal margine superiore della pagina
var largo=144; // Larghezza dei layers. Ricordare che in questa versione le voci sono affiancate, quindi conviene tenere questo valore molto basso se si vogliono visualizzare molte opzioni

var Home =false; // Settare a "false" se non si desidera il link all'homepage
var HomeLink = "home.htm"; // URL della homepage
var HomeText = "Home"; // Testo del link alla homepage
var HomeWidth = 50; // Larghezza del livello che contiene il tasto alla homepage. (se "Home" viene impostato a "false" viene azzerato.

var voci=new Array();
  voci[0]=new Array("Aglets","What is it","History","Links");
  voci[1]=new Array("Documentation","Aglets API (Javadoc)","Tutorials/howtos","Papers");
  voci[2]=new Array("Download", "Stable code", "Unstable code","CVS Tree", "Third parties code");
  voci[3]=new Array("News", "User's Manual available!", "Aglets new mantainer");
  voci[4]=new Array("Developers", "Aglets Mailing Lists", "Aglets Net Mailing Lists", "Sourceforge.net", "AgentGroup");
  
var links=new Array();
  links[0]=new Array("home.htm","home.htm#whatisit","home.htm#history","links.html");
  links[1]=new Array("home.htm","doc/index.html","tutorials.htm","papers.html");
  links[2]=new Array("home.htm","http://sourceforge.net/projects/aglets/","unstable.html","http://cvs.sourceforge.net/viewcvs.py/aglets/","http://sourceforge.net/projects/agletsnet/");
  links[3]=new Array("", "usermanual.html", "mantainer.html");
  links[4]=new Array("home.htm","https://sourceforge.net/mail/?group_id=7905","https://sourceforge.net/mail/?group_id=21101","http://www.sourceforge.net","http://polaris.ing.unimo.it");

var targets=new Array();
	targets[0]=new Array("new","self","self","self","self");
	targets[1]=new Array("new","new","self","self");
	targets[2]=new Array("new","self","self","self","self");
	targets[3]=new Array("self","self","self","self");
    targets[4]=new Array("new","self");


var nn=document.layers?true:false,N6=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false,conta=0,last=0;
var op=navigator.userAgent.toLowerCase().indexOf("opera")!=-1?true:false
var MenuLength=50+largo*voci.length;
var BrowserWidth=nn||op?window.innerWidth:N6?document.width:document.body.clientWidth;
//leftmargin=parseInt((BrowserWidth-MenuLength)/2); // Commentare questa linea con // all'inizio per posizionare il menu all'esatta coordinata stabilita per "leftmargin" nelle variabili principali.
HomeWidth=Home?HomeWidth:0;

var browser = document.layers ? 0 : document.all ? 1 : 2;


if (nn)
	{
	if (Home)
		document.write("<LAYER NAME=mtop. position=absolute left="+leftmargin+" top="+topmargin+" width="+HomeWidth+" height=15 clip=0,0,"+HomeWidth+",15 bgColor="+roff+" visibility=visible onMouseOver=showdeps(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="+eval(leftmargin+HomeWidth+largo*i)+" top="+topmargin+" width="+largo+" height=15 clip=0,0,"+largo+",15 bgColor="+roff+" visibility=visible onMouseOver=MostraMenu("+i+");mroll('mtop"+i+".');conta++ onMouseOut=last="+i+";unmroll('mtop"+i+".');conta--><DIV ALIGN=center CLASS=menuNNb>&nbsp;<A HREF=javascript:mroll('mtop"+i+".') onClick=vai('"+links[i][0]+"',"+i+",0) CLASS=menuNNb>"+voci[i][0]+"</A></DIV></LAYER>");
		for (l=1;l<voci[i].length;l++)
			document.writeln("<LAYER NAME=mdep"+i+"."+l+" position=absolute left="+eval(leftmargin+HomeWidth+largo*i)+" top="+eval(topmargin+15*l)+" width="+largo+" height=15 clip=0,0,"+largo+",15 bgColor="+roff+" visibility=hidden onMouseOver=mroll('mdep"+n+"."+l+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta--  CLASS=menuNNb>&nbsp;<A HREF=javascript:mroll('mdep"+n+"."+l+"') onClick=vai('"+links[i][l]+"',"+i+","+l+") CLASS=menuNN>"+voci[i][l]+"</A></LAYER>");
		}
	}
	else
	{
	if (Home)
		document.write("<DIV ID=mtop. STYLE=\"position:absolute;left:"+leftmargin+";top:"+topmargin+";width:"+HomeWidth+";height:15;background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop.') onMouseOut=unmroll('mtop.')><A HREF='"+HomeLink+"' CLASS=menuIEb onFocus=this.blur()>&nbsp;"+HomeText+"</A></DIV>");
	for (i=0;i<voci.length;i++)
		{
		var n=i;
		if (browser==2)
		{
   		document.writeln("<DIV ID=mtop"+n+". STYLE=\"position:absolute;border-width:thin;border-color:#FFFFAA;border-style:solid;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+topmargin+";width:"+largo+";height:15;background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=MostraMenu("+n+");mroll('mtop"+n+".');conta++ onMouseOut=last="+n+";unmroll('mtop"+n+".');conta--><DIV ALIGN=center CLASS=menuIEb onClick=vai('"+links[i][0]+"',"+i+",0)>&nbsp;"+voci[i][0]+"</DIV></DIV>");
		for (l=1;l<voci[i].length;l++)
		    if (i==0)
  			  document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			else
		    if (i==1)
  			  document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			else
			  if (i==2)
  			    document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			  else
			    if (i==3)
  			      document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
    			else
			      document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
		}
		else
		if (browser==1)
		{
		document.writeln("<DIV ID=mtop"+n+". STYLE=\"position:absolute;border-width:thin;border-color:#FFFFAA;border-style:solid;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+topmargin+";width:"+largo+";height:15;background:"+roff+";visibility:visible;cursor:hand\" onMouseOver=MostraMenu("+n+");mroll('mtop"+n+".');conta++ onMouseOut=last="+n+";unmroll('mtop"+n+".');conta--><DIV ALIGN=center CLASS=menuIEb onClick=vai('"+links[i][0]+"',"+i+",0)>&nbsp;"+voci[i][0]+"</DIV></DIV>");
		for (l=1;l<voci[i].length;l++)
		    if (i==0)
  			  document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			else
		    if (i==1)
  			  document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			else
			  if (i==2)
  			    document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
			  else
			    if (i==3)
  			      document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");
    			else
			      document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"text-align:left;border-width:thin;border-color:#FFFFAA;border-style:solid;position:absolute;left:"+eval(leftmargin+HomeWidth+largo*i)+";top:"+eval(topmargin+15*l+8)+";width:"+largo+";height:15;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+")>&nbsp;"+voci[i][l]+"</DIV>");		
		}
		}
	}

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)
	{
   if (c>0)
		lev=nn?document.layers["mdep"+r+"."+c]:(document.all)?document.all["mdep"+r+"."+c].style:document.getElementById("mdep"+r+"."+c).style;
	else
		lev=nn?document.layers["mtop"+r+"."]:(document.all)?document.all["mtop"+r+"."].style:document.getElementById("mtop"+r+".").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)
		}
   	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && navigator.platform.toLowerCase().indexOf("mac")=="mac")
	   document.write("")  
	if (browser==1)
  	  timer=targets[r][c]=="self"?setTimeout("self.location.href='"+dove+"'",350):setTimeout("window.open('"+dove+"')",350);
	else
	if (browser==2)
	  timer=targets[r][c]=="self"?setTimeout("self.location.href='"+dove+"'",350):setTimeout("document.location='"+dove+"'",350);

 }
function mroll(l)
	{
	LTop="mtop"+l.substr(4,l.indexOf(".")-4)+".";
	nn?document.layers[LTop].bgColor=ron:(document.all)?document.all[LTop].style.background=ron:document.getElementById(LTop).style.background=ron;
	nn?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)';
	}

function unmroll(l)
	{
	LTop="mtop"+l.substr(4,l.indexOf(".")-4)+".";
	nn?document.layers[LTop].bgColor=roff:(document.all)?document.all[LTop].style.background=roff:document.getElementById(LTop).style.background=roff;
	nn?document.layers[l].bgColor=roff:(document.all)?document.all[l].style.background=roff:document.getElementById(l).style.background=roff;
	}

