/*******

function delaypub(divId, iframeUrl, width, height, showWaitingImage) {
	showWaitingImage = showWaitingImage == null ? true : showWaitingImage; // Valeur par défaut : true
	document.write('<div id="'+divId+'" style="width:'+width+'px; height:'+height+'px">');
	if ( showWaitingImage )
		document.write('<table width="100%" height="100%"><tr><td align="center" valign="middle"><img src="/wait.gif"></td></tr></table>');
	document.write('</div>');
	var funcName = 'delaypub_'+divId;
	eval(funcName+' = function() { document.getElementById(divId).innerHTML = \'<iframe src="'+iframeUrl+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="no" style="background-color:transparent" allowtransparency="true"></iframe>\';}');
	eval('delayedFunction='+funcName);
	if (window.addEventListener)
		window.addEventListener("load", delayedFunction, false);
	else if (window.attachEvent)
		window.attachEvent("onload", delayedFunction);
	else
		window.onload = delayedFunction;
}


******/





function delaypub2(divId, iframeUrl, width, height, showWaitingImage) {
	document.write('<div id="contentJeu" style="width:'+width+'px;height:'+height+'px;position:relative">');
	document.write('<div id="'+divId+'" style="width:'+width+'px; height:'+height+'px">');	
	document.write('</div>');
	document.write('</div>');
	var funcName = 'delaypub_'+divId;
	eval(funcName+' = function() { document.getElementById("'+divId+'").innerHTML = \'<iframe src="'+iframeUrl+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="no" style="background-color:transparent;" allowtransparency="true"></iframe>\'; var bloc_jeu = document.getElementById("contentJeu");var jeu= document.getElementById("'+divId+'");onStart(bloc_jeu, jeu, "Le jeu se lancera dans ", 10); }');	
	eval('delayedFunction='+funcName);	
	if (window.addEventListener)
		window.addEventListener("load", delayedFunction, false);
	else if (window.attachEvent)
		window.attachEvent("onload", delayedFunction);
	else
		window.onload = delayedFunction;
}


function onStart(obj, contenu, message, pubTime) {	
	var nombre = Math.floor(Math.random() * 3)+1;
	var pub = document.createElement("div");
	pub.id = "pubWait";
	pub.style.position='absolute';
	pub.style.left='0px';
	pub.style.top='0px'
	pub.style.backgroundColor='#FFFFFF';
	pub.style.width=obj.style.width;
	pub.style.height=obj.style.height;
	pub.innerHTML = "<p style='margin:0px;text-align:center;color:#FE7418;font-weight:bold;font-size:14px'>"+message+"<span id='rebours"+nombre+"'></span></p><p style='margin:0px;text-align:center;color:#FE7418;font-weight:bold;'>Un clic sur la publicit&eacute; n'interrompt pas le chargement et s'ouvre dans une nouvelle fen&ecirc;tre</p><iframe width="+pub.style.width+" height="+pub.style.height+" top=0 margin=0 hspace=0 vspace=0 frameborder=0 scrolling=no src='pubwait.html'></iframe>";
	obj.insertBefore(pub,contenu);
	Rebours(pubTime, nombre);
	setTimeout(function() {onEnd(obj);},pubTime*1000);

}
function onEnd(obj) {
	var pub = document.getElementById("pubWait");
	obj.removeChild(pub);
}

function Rebours(time, nombre) {
	if(document.getElementById('rebours'+nombre)) {
		var s = ' seconde';
		if(time > 1)
			s +='s';
		document.getElementById('rebours'+nombre).innerHTML=time+s;
		time = time-1;
		if(time >= 0)
			setTimeout(function() {Rebours(time, nombre);}, 1000);
	}
}
