function openPopUp(sUrl, iWidth, iHeight, sName) {
	iTop	= (screen.height - iHeight) / 2 - 26;
	iLeft	= (screen.width - iWidth) / 2;
//	var sOptions = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes'
	var oWin = window.open(sUrl, sName, 'width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft + '');
}

function openPopUpMarquees(sUrl, iWidth, iHeight, sName) {
	var options = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,";
	iTop	= (screen.height - iHeight) / 2 - 26;
	iLeft	= (screen.width - iWidth) / 2;
	var oWin = window.open(sUrl, sName, options + 'width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft + '');
}

function openPopUpWithScroll(sUrl, iWidth, iHeight, sName) {
	var options = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,";

	iTop	= (screen.height - iHeight) / 2 - 26
	iLeft	= (screen.width - iWidth) / 2
	var oWin = window.open(sUrl, sName, options + 'width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft + '');
	oWin.focus();
}

/*function openBigPopUp(sUrl) {
	var iWidth 	= 650;
	var iHeight = 544;
	openPopUp(sUrl, iWidth, iHeight, 'winexoliens')
}*/

function openBigPopUpSsoptions(sUrl) {
	var iWidth 	= 650;
	var iHeight = 544;
	if (arguments.length > 1)
	{
		sNom = arguments[1]
	}else{
		sNom = 'winexoliens'
	}
	openPopUp(sUrl, iWidth, iHeight, sNom);
}

function openBigPopUp(sUrl) {
	var iWidth 	= 800;
	var iHeight = 600;
	if (arguments.length > 1)
	{
		sNom = arguments[1]
	}else{
		sNom = new Date().getTime();
	}
	//openPopUp(sUrl, iWidth, iHeight, sNom);
	
	var options = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,'+'width=' + iWidth + ',height=' + iHeight;
	w = window.open(sUrl,sNom,'\''+options+'\'');
	w.focus();
	
}


function openBigPopUp2(sUrl) {
	var iWidth 	= 800;
	var iHeight = 600;
	if (arguments.length > 1)
	{
		sNom = arguments[1]
	}else{
		sNom = new Date().getTime();
	}
		
	//openPopUp(sUrl, iWidth, iHeight, sNom);
	var options ='menubar=0,tollbar=0,location=0,directories=0,status=0,scrollbars=0,'+'width=' + iWidth + ',height=' + iHeight;
	w = window.open(sUrl,sNom,'\''+options+'\'');
	w.focus();
	
}


function openMiniWordPopUp(sUrl) {
	var iWidth 	= 700;
	var iHeight = 594;
	openPopUp(sUrl, iWidth, iHeight, 'winexoliens')
}

/*function openMediumPopUp(sUrl) {
	var iWidth 	= 480;
	var iHeight = 422;
	openPopUp(sUrl, iWidth, iHeight, 'winexoliens');
}*/

function openMediumPopUp(sUrl) {
	//var iWidth 	= 480;
	//var iHeight = 422;
	var iWidth 	= 480;
	var iHeight = 640;
	if (arguments.length > 1)
	{
		sNom = arguments[1]
	}else{
		sNom = 'winexoliens'
	}
	openPopUp(sUrl, iWidth, iHeight, sNom);
}


function openSmallPopUp(sUrl) {
	var iWidth 	= 400;
	var iHeight = 300;
	openPopUp(sUrl, iWidth, iHeight, 'winexoliens');
}

//open a pop up
function openWindow(theURL,theWindow) {
  w = window.open(theURL,theWindow,'scrollbars=yes,resizable=yes,status=yes,width=550,height=500');
  w.focus();
}

function openAidePopup(theURL) {
	w = window.open(theURL,'a','scrollbars=yes,resizable=yes,status=yes,width=550,height=500');
	w.focus();
}


function openNewWindow(page,nom,opts) {
  id=window.open(page,nom,opts);
  id.focus();
}

function openWindowPopupModifCategorie(dest,id) {
  id=window.open(dest,id,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openWindowModifArticle(dest) {
	sNom = new Date().getTime();
	//alert(sNom);
  id=window.open(dest,sNom,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openWindowModifLien(id) {
  id=window.open('popup_modif_lienexterne.html',id,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openWindowModifDossier(id) {
  id=window.open('popup_modif_contenudossier.html',id,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openWindowModifCarrousel(id) {
  id=window.open('popup_modif_programmation.html',id,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openWindowPopupSelectionVignette(id) {
  id=window.open('popup_selection_vignette.html',id,'width=800,height=600,left=0,top=0,resizable,scrollbars');
  id.focus();
}

function openPopupImage(sUrl,sName) {
	var sOptions = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'
	var oWin = window.open('/jsp/bo/popupImageVisu.jsp?'+sUrl, sName, sOptions);
}

// CI-DESSOUS : gestion des popup modales

var modalPopup;
var modalPopupIsOpen = false;


// Cf Nicolas
window.onunload = closeModalPopup;
window.onerror = focusOnModalPopup;
window.onfocus = focusOnModalPopup;
window.onblur = focusOnModalPopup;
window.onmove = focusOnModalPopup;
window.onresize = focusOnModalPopup;
window.onscroll = focusOnModalPopup;

function focusOnModalPopup() {
	if (modalPopup && !modalPopup.closed && modalPopupIsOpen) {
		modalPopup.focus();
	}
}

function closeModalPopup() {
	if (modalPopup && !modalPopup.closed && modalPopupIsOpen) {
		modalPopup.close();
		modalPopupIsOpen = false;
	}
}

function openModalPopup(sUrl,sParam) {
	if (modalPopupIsOpen) closeModalPopup();
	modalPopup = window.open(sUrl,new Date().getTime(),sParam);
	setTimeout("modalPopup.focus()", 4000);
	
	modalPopupIsOpen = true;
}

function launchVideo(id) {
	for (i=0;i<document.forms.length;i++)
	{
		for (j=0;j<document.forms[i].length;j++)
		{
		  if ((document.forms[i][j].value==id)&&(document.forms[i].name!='myformembedde'))
		   {
			document.forms[i].courant.value=id;
			window.open('/common/playerVideo.php','myPopUp','width=634,height=469,status=no,location=no,toolbar=no,scrollbars=auto,menubar=no,resizable=auto');
			document.forms[i].submit();
		   }
		}
	}
}

function launchVideoEmbed(id,embedVideo,embedVideoName) {
	if (getVideoUrl(id).indexOf(".rm")>0)
	{
		if ((navigator.appName == 'Microsoft Internet Explorer')&&!(navigator.appVersion.indexOf('Mac',0)>0)&&!( navigator.userAgent.indexOf('Opera')>0))
		{
			embedVideo.Source=getVideoUrl(id);
			embedVideo.DoPlay();
		}
		else
		{
			//document.embeds[embedVideoName].Source=getVideoUrl(id);
			//document.embeds[embedVideoName].DoPlay();
			launchVideo(id);
		}
	} else if (getVideoUrl(id).indexOf(".wmv")>0) {
		if ((navigator.appName == 'Microsoft Internet Explorer')&&!(navigator.appVersion.indexOf('Mac',0)>0)&&!( navigator.userAgent.indexOf('Opera')>0))
		{
			embedVideo.FileName=getVideoUrl(id)+"?WMCache=0";
			setTimeout('document.'+embedVideoName+'.play()',0);
		}
		else
		{			
			//document.embeds[embedVideoName].FileName=getVideoUrl(id)+"?WMCache=0";
			//setTimeout('document.embeds['+embedVideoName+'].play()',0);
			//document.getElementById(embedVideoName).FileName=getVideoUrl(id)+"?WMCache=0";
			//document.getElementById(embedVideoName).play();
			launchVideo(id);
		}
	}
}

function getVideoUrl(id) {
	for (i=0;i<document.forms.length;i++)
	{
		for (j=0;j<document.forms[i].length;j++)
		{
		  if (document.forms[i][j].value==id)
		   {
			return document.forms[i][j+5].value;
		   }
		}
	}
	return "";
}

function highlight(id){
	for (i=0;i<1000;i++){
		if (document.getElementById(i)!=null) {
			document.getElementById(i).className='etxtnoir11';
		}
	}
	document.getElementById(id).className='etxtnoir11g';
}

function launchVisionneuse(formName,img) {
	for (i=0;i<document.forms.length;i++)
	{
	  if (document.forms[i].name==formName)
	   {
		document.forms[i].img.value=img;
		document.forms[i].submit();
	   }
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function clk(_el,_class,_page) {if(document.images){(new Image()).src="http://prof.estat.com/cgi-bin/ft/01113?class="+escape(_class)+"&page="+escape(_page)+"&estat_url="+escape(_el.href)+"?";}return true;}

if (document.location.href.indexOf('france2')>=0)
 {
  document.write("<LINK REL='SHORTCUT ICON' HREF='http://medias2.francetv.fr/bitmaps/f2/favicon.ico'>")
 }
if (document.location.href.indexOf('france3')>=0)
 {
  document.write("<LINK REL='SHORTCUT ICON' HREF='http://medias2.francetv.fr/bitmaps/f3/favicon.ico'>")
 }