// Déclaration des variables 'domaine' et 'date d'expiration'
var v_Pathname=location.pathname;
var v_Domain=v_Pathname.substring(0,v_Pathname.lastIndexOf('/')) +'/';
var v_Date_Expiration = new Date();
v_Date_Expiration.setTime(v_Date_Expiration.getTime()+(365*24*3600*1000));

function f_Del_Ck(p_Nom) {
// 	"Supprimer une information"
	if (p_Nom!="") {
		f_DelCookie(p_Nom,'/');
	}
}

function f_Let_Ck(p_Nom,p_Valeur) {
// 	"Stocker une information"
	if (p_Nom!="") {
		if (p_Valeur!="") {
			f_SetCookie(p_Nom,p_Valeur,v_Date_Expiration,'/');
		}
	}
}

function f_Get_Ck(p_Nom) {
// "Récupérer une information"
	if (p_Nom!="") {
		var valeur=f_GetCookie(p_Nom);
		if (valeur!=null) {
			//alert("valeur cookie = "+valeur)
			return(valeur);
		}
		else {
			//alert("cookie vide")
			return null;
		}
	}
	else {
		//alert("pas de nom de cookie")
	}
}


function f_SetCookie (name,value,expires,path,domain,secure) { // Domain MUST have two dots .domain.com !!!
   var theCookie = name + "=" + escape (value) + 
   ((expires) ? "; expires=" + expires.toGMTString() : "") + 
   ((path)    ? "; path="    + path   : "") + 
   ((domain)  ? "; domain="  + domain : "") + 
   ((secure)  ? "; secure"            : ""); 
   if ((f_Get_Ck(name))==null) {
		document.cookie = theCookie;
	}
} 

function f_GetCookie(Name) { 
   var search = Name + "=" 
   if (document.cookie.length > 0) { // if there are any cookies 
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value 
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value 
         if (end == -1) end = document.cookie.length 
         return unescape(document.cookie.substring(offset, end)) 
      } 
   } 
} 

function f_DelCookie(name,path,domain) { // All three must match to modify (delete)
   if (getCookie(name)) document.cookie = name + "=" +
      ((path)   ? ";path="   + path   : "") +
      ((domain) ? ";domain=" + domain : "") +
      ";expires=Thu, 01-Jan-70 00:00:01 GMT";
}
 
