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 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 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 printElement(idDiv){
	window.open('/index_print.php?idDiv='+idDiv, 'Imprimer', 'width=600,height=600,scrollbars=auto,status=no');
}

function closeFlashPS() {
	if (document.getElementById('flashcontent') && document.getElementById('h1')) { // si les div existent
		document.getElementById('flashcontent').innerHTML = document.getElementById('h1').innerHTML;
		document.getElementById('flashcontent').style.border = "2px solid #000000";
		document.getElementById('flashcontent').style.paddingTop = "26px";
	}
}


document.image_chargee = new Array();

function preloadImage(idImage, urlImage) {
	if ( ! document.image_chargee[idImage] ) {
		document.image_chargee[idImage] = new Image;
		document.image_chargee[idImage].src = urlImage;
	}
}
