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);
}