// JavaScript Document

function openPopup(theURL,winName,features) {
	// exemple "features"
	// features="directories=no, width=350,height=350, location=no, menubar=no, resizable=no, statut=yes";
	myWin = window.open(theURL,winName,features);
	myWin.focus();	
}

function setCookie(nom, valeur) {	
	var argv=setCookie.arguments;
	var argc=setCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	stCookie = nom+"="+escape(valeur)
	stCookie = stCookie +  ((expires==null) ? "" : ("; expires="+expires.toGMTString()))
	stCookie = stCookie +  ((path==null) ? "" : ("; path="+path))
	stCookie = stCookie +  ((domain==null) ? "" : ("; domain="+domain))
	stCookie = stCookie +  ((secure==true) ? "; secure" : "");
	document.cookie = stCookie;
}

function getCookieVal(offset){
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(nom){
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)	{
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

function delCookie(nom){
	date=new Date;
	date.setFullYear(date.getFullYear()-1);
	EcrireCookie(nom,null,date);
}
