var Nome, Valore, cPath, Scad;

function scriviCookie(Nome, Valore, cPath, Scad) {
 
 cPath = (typeof cPath !="undefined" && cPath != '') ? cPath : '/';

 expires = (typeof Scad!="undefined" && Scad != '') ? ' expires='+Scad : '';
 cookieval = Nome+'='+Valore+'; path='+cPath+';'+expires;
 
 document.cookie = cookieval;
}

function leggiCookie(Nome) {
 var ck = document.cookie;
 if(ck.length > 0) {
  if(ck.indexOf(Nome + '=') != -1) 
  {
   var inizio = ck.indexOf(Nome + '=')+Nome.length+1;
   var fine = (ck.indexOf('; ', inizio) != -1) ? ck.indexOf('; ', inizio) : ck.length;
   
   return unescape(ck.substring(inizio, fine));
  } 
  else 
  { 
   
   return null;
  }
 }
 
}
