var tb_posX =196; //Posizione iniziale X (196)
var tb_posY = 31; //Posizione iniziale Y ( 31 )
var tb_spaceX = 6; //Spazio fra un menu e l'altro
var tb_width = 103; //Larghezza menu
var tb_height = 47; //Altezza menu

var tb_borderC = "#000000"; //Colore Bordo
var tb_bgTitle = ""; //Sfondo titolo
var tb_bgTitOn = "#FFEF39"; //Sfondo titolo
var tb_bgCorpo = "#FFFFFF"; //Sfondo Corpo
var tb_bgCOver = "#E7F0EA"; //Sfondo Corpo

var tb_bgCorpo2liv = "#FFFFFF"; //Sfondo menu 2°livello
//----------------------------------------------------------------------------------
function vis(n)  //Rende visibile od invisibile
//----------------------------------------------------------------------------------
{	for (var t = 0; t < 4; t++)  //chiusura menu già aperti
	{	if (t != n)  document.getElementById("d" + t).style.display="none"
	}
	if (document.getElementById("d" + n).style.display=="none") 
	{	status = "block";	// writeTxt(n + 1);
	} else 
	{	status = "none";	// writeTxt(0);
	}
	document.getElementById("d" + n).style.display = status;
}
//----------------------------------------------------------------------------------
function chBG(obj, status)  //Cambia il colore di sfondo
//----------------------------------------------------------------------------------
{
//	if (!(document.all)) //Impedisco la funzione per Netscape
//		return;
	bgCol = tb_bgCorpo;
	if (status==0) 
		bgCol = tb_bgCOver;
	obj.bgColor=bgCol;
}
//----------------------------------------------------------------------------------
function get_url(tb_url) 
//----------------------------------------------------------------------------------
{	document.location=tb_url;
}
//----------------------------------------------------------------------------------
function writeM() 
//----------------------------------------------------------------------------------
{	var out = "";
	var imgtype = ".gif";
	var j = 0;
	var ColorLine = "#b8b8b8";
	if (navigator.appName=="Netscape")	
	{
		tb_posX = tb_posX;
		tb_posY = tb_posY;
	}
	if (navigator.appName=="Netscapexx")		
// blocco Netscape =====================================================================
	{	for (var i = 0; i < tb_voci.length; i++) 
		{	var tb_bgTitapp = "";
			if (menunow==i + 1)
				tb_bgTitapp = tb_bgTitOn;
			else
				tb_bgTitapp = tb_bgTitle;
			//inserire controllo menu
			
			if (tb_voci[i].length==1) 	//	MenuTop 1° SingolaVoce ---------------------
			{	var j = 0;
				out = out + 
				"<div style='cursor:hand;position:absolute;top:" + tb_posY + ";left:" + 
						((i * (tb_width + tb_spaceX)) + tb_posX) + ";' onclick=\"get_url('" + tb_url[i][j] + "');\" onmouseover='writeTxt(" + i + "+1);'>";
								out = out + 
					"<table width='" + tb_width + "' cellpadding='1' cellspacing='1' border='0'>";
								out = out + 
						"<tr height='" + tb_height + "'>" + 
							"<td>" + 
								"<img width='" + tb_width + "' height='" + tb_height + "' src='/img/Menu"+ (i+1) +".gif' >"+
											"</td>" + 
						"</tr>" +
					"</table>" + 
				"</div>";
			} else 
			{	out = out + 
				"<div style='cursor:hand;position:absolute;top:" + tb_posY + ";left:" + 
						((i * (tb_width + tb_spaceX)) + tb_posX) + ";' onclick='vis(" + i + ");'>";
								out = out + 
					"<table width='" + tb_width + "' cellpadding='1' cellspacing='1' border='0'>";
								out = out + 
						"<tr height='" + tb_height + "'>" + 
							"<td>" + 
								"<img width='" + tb_width + "' height='" + tb_height + "' src='/img/Menu"+ (i+1) +".gif' >"+
									"</td>" + 
						"</tr>" + 
					"</table>" + 
				"</div>";
				out = out + 
				"<div id='d" + i + "' style='display:none;position:absolute;top:" + 
						(tb_posY + 18) + ";left:" + ((i * (tb_width + tb_spaceX)) + tb_posX) + ";'>";
								out = out + 
					"<table width='" + tb_width + "' cellpadding='0' cellspacing='1' border='0'>";
								out = out + 
						"<tr height='" + tb_height + "'>" + 
							"<td bgcolor=" + tb_bgCorpo2liv + ">";
								out = out + 
								"<table width='100%' bgcolor=" + tb_bgCorpo2liv + 
													" cellpadding='1' cellspacing='0' border='0'>";
								for (var j = 1; j < tb_voci[i].length; j++) 
								{	out = out + 
									"<tr>" + 
										"<td onmouseover='chBG(this, 0);' onmouseout='chBG(this,1, " + 
												i + ");' onclick=\"get_url('" + tb_url[i][j] + "');\">" + 
											"<a class='menualto' href='" + tb_url[i][j] + "'>" + 
												tb_voci[i][j] + 
											"</a>" + 
										"</td>" + 
									"</tr>" ;
								}
								out = out + 
								"</table>" +
							"</td>" + 
						"</tr>" + 
					"</table>" + 
				"</div>";
			}
		}
	} else 
// blocco IE ==========================================================================
	{	for (var i = 0; i < tb_voci.length; i++) 
		{	var tb_bgTitapp = "";
			if( i+3 == jsNumArea ) 
				imgtype = "_sel.gif";
			else
				imgtype = ".gif";
			if (menunow==i + 1)
				tb_bgTitapp = tb_bgTitOn;
			else
				tb_bgTitapp = tb_bgTitle; //inserire controllo menu //alert(tb_bgTitapp);
			if (tb_voci[i].length==1) 	  //setta voce principale alla stessa altezza
			{	out = out + 
				"<div style='cursor:hand;position:absolute;top:" + tb_posY + ";left:" + 
						((i * (tb_width + tb_spaceX)) + tb_posX) + ";' onclick=\"get_url('" + tb_url[i][0] + "');\" onmouseover='writeTxt(" + (i + 1) + ");'>";
				out = out + 
					"<table width='" + tb_width + "' cellpadding='1' cellspacing='1' border='0'>";

				//	MenuTop 1° SingolaVoce ----------------------------------------------------------
				out = out + 
						"<tr height='" + tb_height + "'>" + 
							"<td>" + 
								"<img "+ 
									"src='/img/Menu" + (i+1) + imgtype + "' onMouseOver= src='/img/Menu" + (i+1) + "_on.gif' onMouseOut= src='/img/Menu" + (i+1) + imgtype + "' >"+
							"</td>" + 
						"</tr>";
								
				//			out = out + 
				//		"</tr>";

					"</table>"+ 
				"</div>";
			} else //	MenuTop 1° Voci con sottomenu -----------------------------

			{	out = out + 
				"<div style='position:absolute;top:" + tb_posY + ";left:" + 
					((i * (tb_width + tb_spaceX)) + tb_posX) + ";' onmouseover='vis(" + i + ",0);' onmouseout='vis(" + i + ",1);' style='cursor:hand'>"
				out = out + 
					"<table width='" + tb_width + "' cellpadding='1' cellspacing='1' border='0'>"
				out = out + 
						"<tr height='" + tb_height + "'>" + 
							"<td>" + 
								"<img width='" + tb_width + "' height='" + tb_height + "' " + 
								"src='/img/Menu" + (i+1) + imgtype + "' onMouseOver= src='/img/Menu" + (i+1) + "_on.gif' onMouseOut= src='/img/Menu" + (i+1) + imgtype + "' >"+
							"</td>" + 
						"</tr>";
				
				out = out + 
						"<tr>" + 
							"<td bgcolor='" + tb_bgCorpo + "'>" + 
								"<div id='d" + i + "' style='display:none;'>"
								out = out + 
											"<table width='100%' cellpadding='2' cellspacing='0' border='0' bgcolor='" + tb_bgCorpo2liv + "'>" +
													"<td bgcolor='" + tb_bgCorpo + "'>"
															out = out + 
														"<table class='vocimenu' cellpadding='0' cellspacing=0 border='0'>"
											// style='border-style:solid; border-color:black; border-width:1px' 				

															
															
															for (var j = 1; j < tb_voci[i].length; j++) 
															{	if (j == tb_voci[i].length - 1) 
																{	var ColorLine = "#FFFFFF";
																}else
																{	var ColorLine = "#b8b8b8";
																}
																out = out + 
															"<tr>" + 
																"<td onmouseover=\"chBG(this, 0, "+
																	i+");\" onmouseout=\"chBG(this,1, "+
																	i+");\" bgcolor=\""+tb_bgCorpo+
																	"\" onclick=\"get_url('"+tb_url[i][j]+
																	"');\" class=\"corpomenu\">" +
																	"<table  width=100% cellpadding=\"0\" cellspacing=1 border=\"0\">" + 
																	"<tr>" + 
																		"<td width=6 valign=top>&nbsp;&raquo;&nbsp;" + 
																		"</td>" + 
																		"<td nowrap>" + 
																			"<a class=\"menualto\" href=\""+tb_url[i][j]+"\">" + 
																				tb_voci[i][j] + 
																			"</a>&nbsp;&nbsp;"+ 
																		"</td>" + 
																	"</tr>" + 
																	"</table>" + 
																"</td>" + 
															"</tr>" + 
															"<tr>" + 
																"<td bgcolor=" + ColorLine + ">" + 
																	"<img src=img/vuoto.gif height=1>" + 
																"</td>" + 
															"</tr>"
															}	// fine for menu 2° livello

											

																out = out + 
														"</table>" + 
													"</td>" + 
					//???						"</tr>" + 
											"</table>" +	
								"</div>" + 
							"</td>" + 
						"</tr>" + 
					"</table>" +
				"</div>"
			} //fine else

		}
	}
	return out;
}
// alert( jsNumArea );
document.write(writeM());
	//fineBloccoNetscape
