<!-- FUNZIONI PER LA VISUALIZZAZIONE DHTML //-->

<!-- creazione della classe Browser per definire il tipo di browser //-->
function Browser() {
	this.n4 = (document.layers) ? 1 : 0;
	this.ie = (document.all) ? 1 : 0;
	this.n6 = (document.getElementById) ? 1 : 0;
}

<!-- definizione della posizione del layer sulla base del browser e dei dati ricevuti //-->
function centra(id,left) {
	if (bw.n4){
		this.obj = document.layers[id];
	}else if(bw.ie){
		this.obj = document.all[id].style;
	}else if(bw.n6){
		this.obj = document.getElementById(id).style;
	}
		this.obj.left = (left>50) ? left : 0;
		this.obj.top = 160;
		return this.obj;
}

<!-- definizione delle dimensioni utili della pagina, e di setup del layer al primo e successivi accessi //-->
function setup(prima){
	<!-- creazione di una istanza della classe Browser, di nome bw //-->
	bw = new Browser();
	if(bw.ie) {
		wdth = Math.round(document.body.clientWidth);
	}else if(bw.n4 || bw.n6){
		wdth = Math.round(window.innerWidth);
	}
	if(prima){
		lay = new centra('logo', Math.round((wdth/2)-390));
		DisplayInfo();
		scrivi()
	}else{
		if(bw.n4){
			location.reload();
		}else if(bw.ie || bw.n6){
			lay = new centra('logo', Math.round((wdth/2)-390));
		}
	}	
		
}

<!-- scelta del contenuto del layer in base al browser e all'accesso //-->
function scrivi() {
	var net = "<div style='position: absolute; left: 613; top: 273'><a href='top/servizi/showquestion_ser.asp?faq=3&fldAuto=44'><img border='0' src='http://www.valoreazienda.com/ValorePromo/Banner/PromoTopMail.gif' width='156' height='107'></a></div>";
	var exp = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH='780' HEIGHT='389'><PARAM NAME=movie VALUE='ValorePromo/Flashpop/banner.swf'><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src='ValorePromo/Flashpop/banner.swf' quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH='780' HEIGHT='389' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></OBJECT>"
	if (bw.n4) {
		document.layers.logo.document.close();
		document.layers.logo.document.write(net);
		document.layers.logo.document.close();
	}else if(bw.ie){
		if(document.readyState == "complete"){
			if(visitato || navigator.cookieEnabled == false){
				eval("document.all.logo.innerHTML = net");
			}else{
				eval("document.all.logo.innerHTML = exp");	
			}
		}else{
			timerID = setTimeout("scrivi()",100);
		}
	}else if(bw.n6){
		document.getElementById("logo").innerHTML = net;
	}
}

<!-- FUNZIONI PER LA GESTIONE DEL COOKIE //-->

<!-- funzione per il recupero della sottostringa nel cookie //-->
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

<!-- funzione per il recupero del cookie //-->
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}

<!-- funzione per la scrittura del cookie //-->
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

<!-- funzione per l'incremento del contatore e controllo sul numero di accessi //-->
function DisplayInfo() {
	var expdate = new Date();
	var visit;
	// expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); 
	expdate.setTime(expdate.getTime() + (43000 * 1000)); 
	if(!(visit = GetCookie("dhtmlFlash"))) visit = 0;
	visit++;
	SetCookie("dhtmlFlash", visit, expdate, "/", null, false);
	if(visit > 1){
		visitato = true;
	}else{
		visitato = false;
	}
}

<!-- funzione per resettare il cookie //-->
function ResetCounts() {
	var expdate = new Date();
	expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); 
	visit = 0;
	SetCookie("dhtmlFlash", visit, expdate , "/", null, false);
	leapto();
}