// JavaScript Document
function setLang(lang) {
// Called from links which switch the language.
// Sets cookie with "lang=fr" or other language code, valid for 1 year, on all the site
var expire = new Date();
expire.setTime(expire.getTime() + 3600000*24*365);  // 1 anno
//expire.setTime(expire.getTime() + 180000);
document.cookie = 'lang='+lang+";expires="+expire.toGMTString()+";path=/";
}

/* Menu di navigazione: imposto cookie per ricordare il menu corrente*/
function setCurrMenu(item) {
  var e;
  e = new Date();
  e.setTime(e.getTime() + 3600000*24);  // 24 ore
  document.cookie = 'currItem='+item+";expires="+e.toGMTString()+";path=/";
}


// Gestione display indirizzi e-mail
function Display(Server, Login, Display){
 if ((Display.length == 0) || (Display.indexOf('@')+1)) {
   document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Login + "@" + Server + "</a>");
 } else {
   document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Display + "</a>"); }
 }

// Funzione per l'aggiunta di richiami di funzioni sull'evento onload
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
