/* *********************************
 * Gestion des cookies
 * ---------------------------------
 * Base : code recupéré sur le net
 * modifié par Olivier Mayaud [2005-02]
 * ********************************* */



function getexpirydate( nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function getCookie(cookiename) {
	var cookiestring=""+document.cookie;
	var index1=cookiestring.indexOf(cookiename);
	if (index1==-1 || cookiename=="") return ""; 
	var index2=cookiestring.indexOf(';',index1);
	if (index2==-1) index2=cookiestring.length; 
	return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function setCookie(name,value,duration){
	cookiestring=name+"="+escape(value)+	
	((duration==null || duration==0) ? "" : ";EXPIRES="+getexpirydate(duration) );
	document.cookie=cookiestring;
}

function delCookie(name){
	setCookie(name,"",-1);
}
