

function affichage_popup(url){
	popupCentre(url,700,500);
	/*
	var dessus=(screen.height/2)-(500/2);
	var gauche=(screen.width/2)-(700/2);
	var features='height=650, width=700, top='+dessus+',left='+gauche;
	*/
	/*window.open(page, 'fenetre','width=700, height=650, scrollbars=no');*/
	//window.open(page,'',features);
	return false;
}
function popupCentre(url, largeur, hauteur) {
	var dessus=(screen.height/2)-(hauteur/2);
	var gauche=(screen.width/2)-(largeur/2);
	var features='height='+hauteur+',width='+largeur+',top='+dessus+',left='+gauche;
	window.open(url,'popup',features);
}
function popup() { 
	window.open('fullscreen.html','SPTPopup','width=200, height=200,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes'); 
}

// **********************************************************************************************************************************
// **************************************** RECUPERE LES PARAMETRE PASSES DANS l'URL *************************************************
// **********************************************************************************************************************************

function PrmUrl()
{
 var prm = new Array();
 var tmp = unescape(window.location.search).substr(1).split("&");
 var inter;
 for ( i=0; i<tmp.length; i++)
 {
  inter=tmp[i].indexOf("=");
  if ( inter>=0 )
    {
     prm[tmp[i].substr(0,inter)]=tmp[i].substr(inter+1)
    }
  else {
     prm[tmp[i]]="";
    }
 }
 return prm;
}
// **********************************************************************************************************************************
// **************************************** SITESTAT *************************************************
// **********************************************************************************************************************************
function sitestat(ns_l)
{
                var bln_flash=ns_l.indexOf("http://fr.sitestat.com/renault-group/securite/s");
	if(bln_flash<0)
	{	// Si on passe par le flash country il faut refaire un traitement pour ajouter le début du tag!
	ns_l = "http://fr.sitestat.com/renault-group/securite/s?"+ns_l+"&ns_type=flash"+"&ns__t="+(new Date()).getTime();
	}
	else
	{
	ns_l+="&ns__t="+new Date().getTime();
	}
	ns_pixelUrl = ns_l;
	
	
	// referrer part
	// récupère la variable s'il y en a une
	var ns_0=location.search.substring(1);
	// Retourne la position d'une sous-chaîne "ns_or=" dans une chaîne, à partir de la position debut
	// Si la sous-chaîne n'est pas trouvée, indexOf() retourne -1
	var ns_1=ns_0.indexOf("ns_or=");
	if(ns_1>-1) ns_0=unescape(ns_0.substring(ns_1+6,ns_0.length)); else ns_0="";
	if(ns_0.length==0) ns_0=document.referrer;
	ns_0=(ns_0.lastIndexOf("/")==ns_0.length-1)?ns_0.substring(ns_0.lastIndexOf("/"),0):ns_0;
	if(ns_0.length>0) ns_l+="&ns_referrer="+escape(ns_0);
	//end referrer part
	if(document.images){ ns_1=new Image();ns_1.src=ns_l; } else { $("body").append("<img src="+ns_l+" width=1 height=1 class=hidden />"); }
//	if(jQuery.browser.mozilla) console.log("Sitestat : %s", ns_l);
}



function ns_flashcounter(ns_flashn) 
{
	var ns_flash = "http://fr.sitestat.com/renault-group/securite/s?video."+ns_flashn+"&ns_type=flash"+"&ns__t="+(new Date()).getTime();
	document.ns_flashp.src=ns_flash;
	//if(jQuery.browser.mozilla) console.log("ns_flashcounter : %s", ns_flash);
}
// **********************************************************************************************************************************
// **************************************** INITIALISATION *************************************************
// **********************************************************************************************************************************
function initSPT(ns_l)
{
	var strIDNews="";
	var parametre=PrmUrl();
	if(parametre['id'])
	{
		strIDNews= "."+parametre['id'];
	}
	if(ns_l) sitestat(ns_l+strIDNews);
}



// **********************************************************************************************************************************
// **************************************** POPIN *************************************************
// **********************************************************************************************************************************
function denied_popin(url)
{
	$("body").append('<iframe src="'+url+'" name="IF_DeniedBarometre" style="display:none;">');
}
// **********************************************************************************************************************************
// **************************************** LANCEMENT  DU SWFOBJECT  *************************************************
// **********************************************************************************************************************************
var boolSwfobject = false;
function playMediaFlash(idElem,pathMedia,l,h)
{
	if($('#'+idElem).length)
	{
		var so = new SWFObject(pathMedia,"flash",l,h,"8","#FFFFFF");
		so.addVariable("langue","en");
		so.write(idElem);
		boolSwfobject = true;
	}
	else
	{
		if(!boolSwfobject)
			setTimeout('playMediaFlash("'+idElem+'","'+pathMedia+'","'+l+'","'+h+'");', 25);
	}
}