var popupOnCloseOnThisPage = true;
function popupOnClose(strUrlDestination)
{
// DEBUT PERSONNALISATION

	intNbJour = 1;    // Durée de vie du cookie en jour.

// FIN PERSONNALISATION
	
	
//	EffaceCookie("popupOnClose"); // Effacer le cookie si nécessaire

	myDate=new Date;
	myDate.setTime(myDate.getTime() + ((3600 * 24 * intNbJour) * 1000)); // durée de vie = n jours

	popupOnCloseOnThisPage = true;
	var bEcritCookie = false;
	
	// --- Lit la valeur du cookie s'il existe
	var valCookie = LireCookie("popupOnClose");
	
//	alert(valCookie);

    // --- Verifie si on doit ou non lancer la popup Under
	if (valCookie == "1")
		popupOnCloseOnThisPage = false;
	else
		bEcritCookie = true;
	
    // --- Ecrit un cookie si nécessaire	
	if (bEcritCookie == true)
		EcrireCookie("popupOnClose", "1", myDate);
		
	// --- Lance la popup OnClose
	callPopupOnClose(strUrlDestination);	

	
}

function callPopupOnClose(strUrlDestination)
{
	// Si on doit pas lancer la popup car le visiteur a déjà un cookie
	if (popupOnCloseOnThisPage == false)
		return;
		
	var intHeightPopup = screen.availHeight - 0;
	var intWidthPopup = screen.availWidth - 30;
	var popupDialogOptions = "dialogWidth:"+intWidthPopup+"px; dialogHeight:"+intHeightPopup+"px; dialogTop:0px; dialogLeft:0px; edge:Raised; center:0; help:0; resizable:1; scroll:1; status:0";
	var popupWindowOptions = "scrollbars=1, menubar=1, toolbar=1, location=1, personalbar=1, status=1, resizable=1";
	
	
	isXPSP2 = (window.navigator.userAgent.indexOf('SV1') != -1);

	// Cas Internet Explorer
	if (isNavIE6) 
	{
		if (isXPSP2)
		{
		    document.body.innerHTML+='<object id="objIEId" width="0" height="0" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"></object>';
			objIEId.launchURL(strUrlDestination);
		} 
		else // SP1
		{
			eval("window.showModalDialog(strUrlDestination,'grossesortie',popupDialogOptions)");
		}
		
		/*
	    if (typeMSG != "favoris")
	    {
	        alert(MessageAlerte);
	    }
		*/
	} 
	else if (isNavIE7) 
	{
	
		document.body.innerHTML+='<embed src="./popupIE.swf?popURL='+ strUrlDestination +'" autostart="true" width="0" height="0"></embed>';

/*
	 	if (typeMSG != 'favoris') 
			alert(MessageAlerte);
		else
			window.external.AddFavorite(bmURL,bmphrase);
*/		
	}
	else if (isTypeNavFirefox) // Firefox
	{
		strUrlEncoder = btoa(strUrlDestination);
		document.body.innerHTML+='<embed src="./popupFirefox.asx?url='+ strUrlEncoder +'" autostart="true" width="0" height="0"></embed>';

/*
		if (typeMSG == 'favoris')
			window.sidebar.addPanel(bmphrase, bmURL, "");
		else 
			alert(MessageAlerte);
*/		
	}			
}