var nn=document.layers?true:false,liv;
function inizia() {
liv=nn?document.layers.livelloNN:top.frames.livelloIE;
}

function ChangeLang(numContatto) {
nn?liv.src="index.php?Lang="+numContatto:liv.location.replace("include/header.inc");
}

//Function LOADIMAGES (Preload immagini e gestione layer)
function loadImages() {
if (document.getElementById) {  	// DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  			// Netscape 4
document.hidepage.visibility = 'hidden';
}
else { 								// IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}

//Function NOSPAM (Elimina gli indirizzi email per evitare lo spider)
function NoSpam(nome) {
 switch(nome) {
  case "SEM" : location.href='mail'+'to'+':'+'sem83'+unescape('%40')+'tele2'+unescape('%2E')+'it';
  			     break;
  case "KLEINE" : location.href='mail'+'to'+':'+'dayel'+unescape('%40')+'freemail'+unescape('%2E')+'it'; 
  			     break;
  case "RAS" : location.href='mail'+'to'+':'+'ras78'+unescape('%40')+'caltanet'+unescape('%2E')+'it'; 
  			     break;
  case "DESY" : location.href='mail'+'to'+':'+'dederex'+unescape('%40')+'tiscali'+unescape('%2E')+'it'; 
  			     break;
  case "PECOS" : location.href='mail'+'to'+':'+'francescosavi'+unescape('%40')+'libero'+unescape('%2E')+'it'; 
  			     break;
  case "BERT" : location.href='mail'+'to'+':'+'regolo23'+unescape('%40')+'interfree'+unescape('%2E')+'it'; 
  			     break;
  case "ONDA" : location.href='mail'+'to'+':'+'palobru'+unescape('%40')+'libero'+unescape('%2E')+'it'; 
  			     break;
  case "WALLACE" : location.href='mail'+'to'+':'+'wallacius'+unescape('%40')+'libero'+unescape('%2E')+'it'; 
  			     break;
  case "SILVIA" : location.href='mail'+'to'+':'+'silvia02'+unescape('%40')+'tiscali'+unescape('%2E')+'it'; 
  			     break;
  case "LIDIA" : location.href='mail'+'to'+':'+'lidiadria'+unescape('%40')+'tiscali'+unescape('%2E')+'it'; 
  			     break;
  case "LOPE" : location.href='mail'+'to'+':'+'lopeliz'+unescape('%40')+'libero'+unescape('%2E')+'it'; 
  			     break;
  case "INFO" : location.href='mail'+'to'+':'+'informazioni'+unescape('%40')+'agescicodogno'+unescape('%2E')+'org'; 
  			     break;
  case "BASEMONTI" : location.href='mail'+'to'+':'+'basemonticelli'+unescape('%40')+'agescicodogno'+unescape('%2E')+'org'; 
  			     break;
  case "BASEMONTIPRE" : location.href='mail'+'to'+':'+'basemonticelli'+unescape('%40')+'agescicodogno'+unescape('%2E')+'org?Subject=Prenotazione'; 
  			     break;
  case "NEWSITE" : location.href='mail'+'to'+':'+'segnalazioni'+unescape('%40')+'agescicodogno'+unescape('%2E')+'org?Subject=Seganalazione nuovo sito'; 
  			     break;
  case "ADMIN" : location.href='mail'+'to'+':'+'admin'+unescape('%40')+'agescicodogno'+unescape('%2E')+'org?Subject=Seganalazione anomalia'; 
  			     break;
 }
}
//Function GETCOOKIE (Legge in contenuto del cookie specificato)
function GetCookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

//Function SETCOOKIE (Scrive un nuovo cookie)
function SetCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

//Function DELETECOOKIE (Elimina il cookie specificato)
function DeleteCookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

var cookieName = 'testCookie' + (new Date().getTime());
   document.cookie = cookieName + '=cookieValue';
   var cookiesEnabled = document.cookie.indexOf(cookieName) != -1;

//Function ISCOOKIEENABLED (Testa se il client ha i cookie abilitati) 
function isCookieEnabled() {
   if (document.all) return navigator.cookieEnabled;
   Set_Cookie('testcookie',today.getTime());
   var tc = Get_Cookie('testcookie');
   Delete_Cookie('testcookie');
   return (tc == today.getTime());
}

