function openWin(lnk,nameWin,_width,_height){
	if (document.all){
		var x = window.screenLeft;
		var y = window.screenTop;
		var w = window.document.body.offsetWidth;
		var h = window.document.body.offsetHeight;
	}else{
		  var x = window.screenX;
		  var y = window.screenY;
		  var w = window.outerWidth;
		  var h = window.outerHeight;
	}
	var cntx = x + Math.round((w - _width) / 2);
	var cnty = y + Math.round((h - _height) / 2);
	window.open (lnk,nameWin,'left='+cntx+',top='+cnty+',width='+_width+',height='+ _height+',scrollbars=yes');
}

// imposta il cookie sNome = sValore
// per la durata di iGiorni
function setCookie(sNome, sValore, iGiorni) {
	var dtOggi    = new Date()
	var dtExpires = new Date()
	dtExpires.setTime
	(dtOggi.getTime() + 24 * iGiorni * 3600000)
	document.cookie = sNome + "=" + escape(sValore) +
	"; expires=" + dtExpires.toGMTString();
}

// restituisce il valore del cookie sNome
function getCookie(sNome) {
	// genera un array di coppie "Nome = Valore"
	// NOTA: i cookies sono separati da ';'
	var asCookies = document.cookie.split("; ");
	// ciclo su tutti i cookies
	for (var iCnt = 0; iCnt < asCookies.length; iCnt++)
	{
		// leggo singolo cookie "Nome = Valore"
		var asCookie = asCookies[iCnt].split("=");
		if (sNome == asCookie[0]) { 
			return (unescape(asCookie[1]));
		}
	}
	// SE non esiste il cookie richiesto
	return("");
}

// rimuove un cookie
function delCookie(sNome) {
	setCookie(sNome, "");
}


