NAV=0;
IE=0;
UFO=false;
VER = parseInt(navigator.appVersion);
LAST_SEL=0;
WIN = 0;

var n = navigator.appName;

if (n.indexOf("Netscape")>=0) NAV=VER;
if (n.indexOf("Microsoft")>=0) IE=VER;

n = navigator.platform;

if (n.indexOf("Win")>=0) WIN=1;

if ((NAV==0)&&(IE==0)) UFO=true;

function indice(e) {
	for (f=0; f<document.layers.length; f++) {
		if (document.layers[f].name == e) {
			return f;
		}
	}
	return null;
}

function posiziona_Y() {
	Y = document.layers[IN1].top + document.layers[IN1].document.height;
	for (i=IN1+1; i<document.layers.length; i++) {
		e = document.layers[i];
		if ((e.id.indexOf("c") == 0)||(e.id.indexOf("p") == 0)) {
			if (e.visibility != "hide") {
				e.pageX = MN_X;
				e.pageY = Y;
				Y += e.document.height;
			}
		}
	}
}

function startup(n){
	bat=0;
	if (NAV==4) {
		IN1 = indice("p1");
		
		document.layers[IN1].pageY = MN_Y;
		document.layers[IN1].pageX = MN_X;
		for (i=0; i<document.layers.length; i++) {
			e = document.layers[i];
			if (e.id.indexOf("c") == 0) e.visibility = "hide";
			if (e.id.indexOf("p") == 0) e.visibility = "show";
		}
		posiziona_Y();
		if (n>0) espandi(n);	
	} else if (IE>=4) {
		t = document.all.tags("DIV");
		for (i=0; i<t.length; i++) {
			if (t(i).className == "child") t(i).style.display = "none";
			if (t(i).className == "lastchild") t(i).style.display = "none";
		}
		if (n>0) espandi(n);
	}


}



function startuphome(n){
	bat=0;
	if (NAV==4) {
		IN1 = indice("p1");
		
		document.layers[IN1].pageY = MN_Y;
		document.layers[IN1].pageX = MN_X;
		for (i=0; i<document.layers.length; i++) {
			e = document.layers[i];
			if (e.id.indexOf("c") == 0) e.visibility = "hide";
			if (e.id.indexOf("p") == 0) e.visibility = "show";
		}
		posiziona_Y();
		if (n>0) espandi(n);	
	} else if (IE>=4) {
		t = document.all.tags("DIV");
		for (i=0; i<t.length; i++) {
			if (t(i).className == "child") t(i).style.display = "none";
			if (t(i).className == "lastchild") t(i).style.display = "none";
		}
		if (n>0) espandi(n);
	}

//--------------------------------------------------per il bunner
preload();
}

function espandi(e) {
	if (LAST_SEL==e) LAST_SEL=0;
	if (IE>=4) {
		if (LAST_SEL>0) MSespandi(LAST_SEL);
		MSespandi(e);
	} else if (NAV==4) {
		if (LAST_SEL>0) NSespandi(LAST_SEL);
		NSespandi(e);
	}
}

function MSespandi(e) {
	ele = eval("c" + e);
	if (ele.style.display == "none") {
		ele.style.display = "block";
		LAST_SEL=e;
	} else {
		ele.style.display = "none";
		if (e==LAST_SEL) LAST_SEL=0;
	}
}

function NSespandi(e) {
	ele = eval("document.c" + e);
	if (ele.visibility == "hide") {
		LAST_SEL=e;
		ele.visibility = "show";
	} else {
		ele.visibility = "hide";
		if (e==LAST_SEL) LAST_SEL=0;
	}
	posiziona_Y();
}

with (document) {
	write("<STYLE TYPE='text/css'><!--");
	if (NAV==4) {
		write(".wait { position:absolute; visibility:block; z-index:1; top: 20; left: 18; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;  font-weight:normal; color: #000000; text-decoration: none;}");
		write(".parent { position:absolute; visibility:hidden; width: 140px; height: 16px; }");
		write(".alwayson { position:absolute; visibility:hidden;}");
		write(".child { position:absolute; visibility:hidden; border-bottom: 2px solid #FFFFFF;}");
		write(".header { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt;  font-weight:normal; color: #FFFFFF; text-decoration: none; }");
		write(".opt { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;  font-weight:normal; color: #000000; text-decoration: none}");
	} else if (IE>=4) {
		write(".wait { display:none; }");
//Colore Background
		write(".parent { width:140px; height:16px;  background-color: #3942CE; border-top: 1px solid #FFFFFF;}");
		write(".alwayson { position:absolute;}");
//Colore Elenco 
		write(".child { display:none; z-index:1; noborder-top: 1px solid #FFFFFF; width:140px; background-color: #24CCD6}");
		write(".header { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;  font-weight:normal; color: #FFFFFF; text-decoration: none; width: 140px; height: 16px;}");
//Colore Elenco 
		write(".header:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;  font-weight:normal; color: #000000; text-decoration: none; background-color: #24CCD6}");
		write(".opt { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;  font-weight:normal; color: #000000; text-decoration: none}");
		write(".opt:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;  font-weight:normal; color: #000000; text-decoration: underline;}");
	} else {
		write(".header { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt;  font-weight:normal; color: #FFFFFF; text-decoration: none; }");
		write(".opt { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;  font-weight:normal; color: #000000; text-decoration: none}");
	}
	write("//--></STYLE>");
}