var counter = 0;
var popUnderData=new Array();
// ce parametre peut contenir plusieurs valeurs afin d'ouvrir different popunder de facon aleatoire
popUnderData[counter++]="http://www.club-internet.fr/pagespersos/infopagespersos/infopagespersos.phtml";

function ReadCookie (CookieName) {
	var search = CookieName + "=";
	var returnvalue = ""; 
	if (document.cookie.length > 0) { 
		offset = document.cookie.indexOf(search);
		if (offset != -1) {	//	if the cookie exists 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);	//	set the index of beginning value 
			if (end == -1)	//	set the index of the end of cookie value 
				end = document.cookie.length;
			returnvalue = unescape(document.cookie.substring(offset, end));
		} 
	} 
	return returnvalue; 
}

function WriteCookie (cookieName, cookieValue, expiry) {
	// Ecrit un cookie
	// Fixe le cookie cookieName avec la valeur cookieValue pendant expiry1/1000
	// secondes Remarque : un an= 31536000000 1/1000 secondes
	var expDate = new Date();
	if(expiry)
	{
		expDate.setTime (expDate.getTime() + expiry);
		document.cookie = cookieName + "=" + escape (cookieValue) + ";"
			+ " EXPIRES=" + expDate.toGMTString() + ";"
			+ " DOMAIN=" + "perso.club-internet.fr" + ";"
			+ " PATH=" + "/" ;
	} else {
		document.cookie = cookieName + "=" + escape (cookieValue);
	}
}

function dailyPopUnder(title, url, width, height) {
	var windowprops = "hotkeys=no,directories=no,screenY=50,screenX=50,resizable=no,dependent=yes,status=no,toolbar=no,menubar=no,scrollbars=no,location=yes,titlebar=no,width=" + width + ",height=" + height;
	if (ReadCookie ('dailyPopUnder') == 'noMoreDailyPopUnder') {
//		WriteCookie ('dailyPopUnder', 'NULL', 86400000);
	} else {
		WriteCookie ('dailyPopUnder', 'noMoreDailyPopUnder', 24*60*60*1000);
		winPopUnder = window.open(url, 'popunder', windowprops);
		winPopUnder.blur();
		window.focus();
	}
}