function _PopUpParam (iwidth, iheight, mb, rs, sb, st, tb) {
	var strProperties;
	if (screen ) {
		var iPosL = (screen.width-iwidth)/2;
		var iPosT = (screen.height-iheight)/2;
	} else {
		var iPosL = 100;
		var iPosT = 100;
	}
	if (navigator.appVersion.indexOf("MSIE") != -1 ) {
		iwidth = iwidth+26;
	}
	strProperties = "width=" + iwidth + ",height=" + iheight;
	strProperties += ",left=" + iPosL + ",top=" + iPosT + ",directories=0";
	strProperties += ",hotkeys=1,location=0,menubar=" + mb;
	strProperties += ",resizable=" + rs + ",scrollbars=" + sb;
	strProperties += ",status=" + st + ",titlebar=0,toolbar=" + tb;
	return strProperties;
}
 
function popupSimpleNoScroll(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth, iheight, 0, 0, 0, 0, 0));
}
 
function popupSimple(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth, iheight, 0, 0, 1, 1, 0));
}
 
function popupMenuSimple(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth, iheight, 1, 0, 1, 1, 0));
}
 
function CheckWindow (obj) {
	if (obj && !obj.closed )
		obj.close();
}
 
function popupColor(obj, obj2) {
	 
	args = obj;
	var arr = showModalDialog(libDir+"/form_tools/editor/popup_colorpicker.htm", args, "dialogWidth:430px; dialogHeight:270px; scroll:no; status:no; center:yes; help:no" );
	 
	if (arr != null) {
		obj.value = arr.toUpperCase();
		obj2.style.backgroundColor = arr.toUpperCase();
		obj.focus();
	}
}
 
var editor;
 
function popupEditor(boxName, subfolder) {
	if (editor) {
		editor.close();
	}
	editor = window.open(libDir+"/form_tools/editor/dhtml_editor.php?boxName=" + boxName + "&subfolder=" + subfolder, 'popup_editor', 'width=700,height=500,toolbar=no,status=yes,resizable=yes,menubar=no,scrollbars=no');
}
 
function resizeInner(width, height) {
	if (window.innerWidth) {
		window.innerWidth = width;
		window.innerHeight = height;
	} else {
		width += 5;
		height += 30;
		resizeTo(width, height);
	}
}
/*Lien vers la poup*/
function openPopupVideo(cid, getTitle) {
	strUrl='/index_popup.php?1=1&tpl=108';
	if(cid){
		strUrl+='&cid='+cid;
	}
	if(getTitle){
		strUrl+='&getTitle=1';
	}
	window.open(strUrl, 'Vidéo','height=720,width=780');
}
/*Lien vers la galerie photo*/
function openPopupGallery(gallery_id2, gallery_id3, gallery_id4, type) {
	strUrl='/index_popup.php?tpl=135&from=js';
	
	if(gallery_id2){
		strUrl +='&gallery_id2='+gallery_id2;
	}
	if(gallery_id3){
		strUrl +='&gallery_id3='+gallery_id3;
	}
	if(gallery_id4){
		strUrl +='&gallery_id4='+gallery_id4;
	}
	if(type){
		strUrl +='&type='+type;
	}
	window.open(strUrl, 'Galerie','height=720,width=780');
}
/*Lien vers la poup*/
function openPopupEnsavoirPlus(cid, thePath) {
	strUrl= thePath+'/index_popup.php?tpl=124';	
	if(cid){
		strUrl+='&cid='+cid;
	}
	window.open(strUrl, 'savoirplus','height=650,width=650,left=0,top=0,scrollbars=no');
}

function openNewPopup(cid) {
	strUrl= 'index_popup.php?tpl=184';	
	if(cid){
		strUrl+='&cid='+cid;
	}
	window.open(strUrl, 'thePopUp','height=650,width=650,left=0,top=0,scrollbars=no');
}

function openPopupMosaique() {
	strUrl='index_popup.php?tpl=119&annee=2004';	
	window.open(strUrl, 'Mosaique','height=730,width=796,scrollbars=yes');
}

function getFileExtension(strPath) {
	var strfileName, valPosition, strfileExtension
	valPosition = String(strPath).lastIndexOf('\\',0);
	strfileName = String(strPath).substr(valPosition+1);
	valPosition = strfileName.lastIndexOf('.');
	strfileExtension = strfileName.substr(valPosition+1);
	return strfileExtension;
}

/*Lien vers la poup*/
function openPopupRich(cid, largeur, hauteur, path) {
	var theLargeur, theHauteur, thePath;
	var nombre_args = arguments.length;
	if (nombre_args == 1)
	{
	theLargeur = 650;
	theHauteur = 650;
	thePath = "";
	}
	else if (nombre_args == 2)
	{
	theLargeur = largeur;
	theHauteur = 650;
	thePath = "";
	}
	else if (nombre_args == 3)
	{
	theLargeur = largeur;
	theHauteur = hauteur;
	thePath = "";
	}
	else if (nombre_args == 4)
	{
	theLargeur = largeur;
	theHauteur = hauteur;
	thePath = path;
	}
	strUrl= thePath + '/index_popup.php?tpl=124';
	if(cid){
		strUrl+='&cid='+cid;
	}
	window.open(strUrl, 'savoirplus','width='+theLargeur+',height='+theHauteur+',left=0,top=0,scrollbars=yes');
}

/*Lien vers la poup d'un contenu Son unique*/
function openPopupSonUnique(cid) {
	strUrl='index_popup.php?tpl=279';
	if(cid){
		strUrl+='&cid='+cid;
	}
	window.open(strUrl, 'Vidéo','height=365,width=218');
}

/*Lien vers la poup text Riche*/
function openPopupTextRich(pid,tpl,cid, height, width, scroll) {
	strUrl='index_popup.php?tpl='+tpl;
	if(pid){
		strUrl+='&pid='+pid;
	}
	if(cid){
		strUrl+='&cid='+cid;
	}
	if(!height) height=400;
	if(!width) width=610;
	if(scroll){
		scroll='yes';
	}else{
		scroll='no';
	}
	window.open(strUrl, 'TexteRiche','height='+height+',width='+width+',scrollbars='+scroll);
}

function openPopupTextRichSlogo(pid,tpl,cid, height, width, scroll) {

	strUrl='index_popup.php?tpl='+tpl;
	if(pid){
		strUrl+='&pid='+pid;
	}
	if(cid){
		strUrl+='&cid='+cid;
	}
	if(!height) height=400;
	if(!width) width=610;
	if(scroll){
		scroll='yes';
	}else{
		scroll='no';
	}
	window.open(strUrl,'Riche' ,'height='+height+',width='+width+',scrollbars='+scroll);
}

function videoPlayer(contentId){
	//alert(contentId);
	window.scrollTo(0,0);
	videoPlayerSwf.addVariable("directContentId", contentId);
	videoPlayerSwf.addVariable("contentId", 0);	
	videoPlayerSwf.write("divPlayerVideo");
	//displayPlayer();
	displayPlayerNoWrite();
}

function displayEpg(){
	document.getElementById('epg').style.zIndex='3';
	document.getElementById('flashContentEpg').style.zIndex='3';
}

function hideEpg(){
	document.getElementById('epg').style.zIndex='0';
	document.getElementById('flashContentEpg').style.zIndex='0';
}

// Variable Temp pour gerer les vidéo Media_player :
var isPlayerInfoSport = false;

function displayPlayer(){	
	
	videoPlayerSwf.addVariable("directContentId", 0);
	videoPlayerSwf.addVariable("contentId", 0);	
	displayPlayerNoWrite();
	
	/**
	// Masque la page qui reste en dessous :
	//document.getElementById('zones').style.visibility="hidden";
	document.getElementById('zones').style.display="none";
	// Change la couleur de fond :
	document.body.style.backgroundColor="#000000";

	// Cas du player Info Sport
	if(document.getElementById('fluxPlayer') != null){
		isPlayerInfoSport = true;
		document.getElementById('fluxPlayer').innerHTML = "";
	}
	
	
	// Mise a jour de la variable javascript pour distinguer le grandPlayer/petitPlayer
	isFullPlayer = 1;
	
	document.getElementById('player_video').zIndex='4';
	document.getElementById('player_video').style.height='100%';
	document.getElementById('player_video').style.width='980px';
	document.getElementById('player_video').style.marginLeft='0px';
	//document.getElementById('player_video').onclick=hidePlayer;
	document.getElementById('player_video').onclick="";
	document.getElementById('player_video').style.backgroundColor='#000000';
	document.getElementById('divPlayerVideo').style.display='block';
	document.getElementById('bt_player_video').style.display='none';
	hideSelectTags();
	
	*/
	
	videoPlayerSwf.write("divPlayerVideo");
	
}

function displayPlayerNoWrite(){	

	// Masque la page qui reste en dessous :
	//document.getElementById('zones').style.visibility="hidden";
	document.getElementById('zones').style.display="none";
	// Change la couleur de fond :
	document.body.style.backgroundColor="#000000";

	// Cas du player Info Sport
	if(document.getElementById('fluxPlayer') != null){
		isPlayerInfoSport = true;
		document.getElementById('fluxPlayer').innerHTML = "";
	}
	
	
	// Mise a jour de la variable javascript pour distinguer le grandPlayer/petitPlayer
	isFullPlayer = 1;
	
	document.getElementById('player_video').zIndex='4';
	document.getElementById('player_video').style.height='100%';
	document.getElementById('player_video').style.width='980px';
	document.getElementById('player_video').style.marginLeft='0px';
	//document.getElementById('player_video').onclick=hidePlayer;
	document.getElementById('player_video').onclick="";
	document.getElementById('player_video').style.backgroundColor='#000000';
	document.getElementById('divPlayerVideo').style.display='block';
	document.getElementById('bt_player_video').style.display='none';
	hideSelectTags();
	
	//videoPlayerSwf.write("divPlayerVideo");
	
}

function hidePlayer(){
	
	
	// Affiche la page qui reste en dessous :
	//document.getElementById('zones').style.visibility="visible";
	document.getElementById('zones').style.display="block";
	// Change la couleur de fond :
	document.body.style.backgroundColor="";
	
	
	// Cas du player Info Sport
	if(isPlayerInfoSport){
		history.go(0);
	}else{
	
		// Mise a jour de la variable javascript pour distinguer le grandPlayer/petitPlayer
		//isFullPlayer = 0;
	
		//alert("YOYOYOYO fermeture du player");
		document.getElementById('player_video').zIndex='1';
		document.getElementById('player_video').style.width='20px';
		document.getElementById('player_video').style.height='auto';
		document.getElementById('player_video').style.marginLeft='960px';
		//document.getElementById('player_video').onclick=displayPlayer;
		document.getElementById('player_video').style.backgroundColor='#FFFFFF';
		document.getElementById('divPlayerVideo').style.display='none';
		document.getElementById('bt_player_video').style.display='block';
		showSelectTags();
	
		if (typeNavForFlash == "ie_6.0"){
			document.getElementById('bt_player_video').style.height = "800px";
		}else{
			document.getElementById('bt_player_video').style.height = "100%";
		}	
	}
}

function hideSelectTags(){
	iNbCombo = document.getElementsByTagName('select').length;
	for (i=0; i<iNbCombo; i++) {
		document.getElementsByTagName('select')[i].style.visibility = "hidden";
	}
}
function showSelectTags(){
	iNbCombo = document.getElementsByTagName('select').length;
	for (i=0; i<iNbCombo; i++) {
		document.getElementsByTagName('select')[i].style.visibility = "visible";
	}
}


function displayPubHome(){
	document.getElementById('publicite_home').style.left='658px';
	document.getElementById('publicite_home').style.top='190px';
	document.getElementById('publicite_home').style.width='300px';
	document.getElementById('publicite_home').style.height='250px';
	document.getElementById('publicite_home').style.display='block';
	//xajax_wwwplus_load_pub_home('publicite_home','pave');
	setTimeout("hidePubHome()",10000);
}

function hidePubHome(){
	document.getElementById('publicite_home').style.left='808px';
	document.getElementById('publicite_home').style.top='315px';
	document.getElementById('publicite_home').style.width='150px';
	document.getElementById('publicite_home').style.height='125px';
	//xajax_wwwplus_load_pub_home('publicite_home','vignette');
}

function onloadcall(){
	//swfmenu.write('nav');
	/*if(document.getElementById('publicite_home')){
		displayPubHome();
	}*/
}

function goToLog(){
	//alert("Activation Du Panneau");
	showIndification();
	
	//Je masque le player + la pub + l'encart Pub:
	document.getElementById('embed_playercontent_full').innerHTML = '';
	document.getElementById('advertmessagecontent_full').innerHTML = '';
	document.getElementById('advertcontent_full').innerHTML = '';
	hideEmbedPlayer();
	
	//alert("Fermeture du player");
	closeVideoPlayer(); // Dans le fichier External-interface du rep flash/javascript
}
