function readCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return "";
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function setCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function eraseCookie ( nome ) {
	setCookie(nome,"",-1);
}

function isCookies(){
	var test = Math.floor(1000*Math.random());
	setCookie("test",test);
	if ( test == parseInt(readCookie("test")) || navigator.cookieEnabled) {
		eraseCookie("test");
		return true;
	} else {
		alert ("Il tuo browser non ha i cookies abilitati o non li supporta!\n"+
			   "      Controlla le impostazioni e riprova ad entrare.       ");
		return false;
	}
}