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?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() {
	strUrl='index_popup.php?tpl=135';	
	window.open(strUrl, 'Galerie','height=720,width=780');
}
/*Lien vers la poup*/
function openPopupRich(cid, largeur, hauteur) {
	var theLargeur, theHauteur;
	var nombre_args = arguments.length;
	if (nombre_args == 1)
	{
	theLargeur = 650;
	theHauteur = 650;
	}
	else if (nombre_args == 2)
	{
	theLargeur = largeur;
	theHauteur = 650;
	}
	else if (nombre_args == 3)
	{
	theLargeur = largeur;
	theHauteur = hauteur;
	}
	strUrl= 'index_popup.php?tpl=124';	
	if(cid){
		strUrl+='&cid='+cid;
	}
	window.open(strUrl, 'savoirplus','width='+theLargeur+',height='+theHauteur+',left=0,top=0,scrollbars=yes');
}

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;
}


function onloadcall(){
	// Lancement ajax pour Fiche Emission Programme et corriger le bug d'IE6
	if(typeof(omnAlerte)=='function'){
		omnAlerte();
	}
	
	if(typeof(omnCompteAlerte)=='function'){
		omnCompteAlerte();
	}

}


function openStoreLocator(url) {
	if (document.getElementById('listeDistributeurs').value != '') {
		if (document.all) {
			var winWidth = document.body.offsetWidth;
			var winHeight = document.body.offsetHeight;
		}
		else {
			var winWidth = window.innerWidth;
			var winHeight = window.innerHeight;
		}
		url = url.replace('[POSTAL_CODE]', document.getElementById('listeDistributeurs').value);
		window.open( url, "storeLocator", "width=550,height=500,scrollbars=yes,top="+((winHeight-500)/2)+",left="+((winWidth-550)/2));
	}
}
