function getParam(param_str) {
	temp_array = new Array();
	urlParam = window.location.search.substring(1);
	aTempParam = new Array();
	aTempParam = urlParam.split("&");
	for(i=0; i < aTempParam.length; i++) {
		strId = aTempParam[i].split("=")[0];
		strValue = aTempParam[i].split("=")[1];
		temp_array[strId] = strValue;
	}
	if(param_str != undefined) {
		if(temp_array[param_str] == undefined) {
			return "";
		}
		else {
			return temp_array[param_str];
		}
	}
	else {
		return temp_array;
	}
}
//
function MM_findObj(n, d) { //v4.01
	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 && d.getElementById) x=d.getElementById(n); return x;
}
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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
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];}
}

var HEIGHT_MIN = 550;
var HEIGHT_MAX = 570;
var WIDTH_MIN = 967;
var footerHeight = 20;

function resizeWindow(){
	if (document.all) {
		top.window.resizeTo(screen.availWidth, screen.availHeight);
	} else if (document.layers || document.getElementById) {
		if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
	top.window.moveTo(0,0);
}
function resizeFooter(param_flashMaskWidth_int, paramFlashTotalWidth_int){
	var footer = MM_findObj("footer");
	var flashcontent = MM_findObj("flashcontent");
	var flashTop = 0;
	var windowHeight = getWindowHeight();
	footer.style.width = (param_flashMaskWidth_int) + 'px';
	if (document.all)	{
		footer.style.width = (param_flashMaskWidth_int + 5) + 'px';
	}
	footer.style.left = Math.round((paramFlashTotalWidth_int - param_flashMaskWidth_int) / 2) + 'px';
	//
	if(windowHeight >= HEIGHT_MAX + footerHeight){
		flashTop = Math.round(Math.abs(windowHeight - HEIGHT_MAX - footerHeight) / 2);
		if(flashTop < 15){
			flashTop = 0;
		}
	}
	flashcontent.style.top = flashTop + 'px';
	footer.style.top = (getFlashHeight() + flashTop) + 'px';
	footer.style.display = "block";
	//alert("footer.style.top=" + footer.style.top);
}

function getFlashWidth() {
	var flashWidth = getWindowWidth();
	if(flashWidth < WIDTH_MIN) {
		flashWidth = WIDTH_MIN;
	}
	//return flashWidth;
	return 967;
	
}
function getFlashHeight() {
	var flashHeight = getWindowHeight();
	if(flashHeight > HEIGHT_MAX) {
		flashHeight = HEIGHT_MAX;
	} else if (flashHeight < HEIGHT_MIN){
		flashHeight = HEIGHT_MIN - footerHeight;
	} else {
		flashHeight -= footerHeight;
	}
	//return flashHeight;
	return 570;
}
function getWindowHeight() {
	var windowHeight;
	if (document.all)	{
		windowHeight = document.body.offsetHeight;
	} else {
		windowHeight = window.innerHeight;
	}
	return windowHeight;
}
function getWindowWidth() {
	var windowWidth;
	if (document.all)	{
		windowWidth = document.body.offsetWidth - 29;
	} else {
		windowWidth = window.innerWidth;
	}
	return windowWidth;
}


function getMikadoFlashObject(param_directContent_str, param_directPage_str, param_directParameters_str,param_redirectFirstLink_bool,param_language_str,param_debug_str,param_rootDirectory){
	var flashHeight = getFlashHeight();
	var flashWidth = getFlashWidth();
	var so = new FlashObject(param_rootDirectory + "engine/engine.swf", "mainswf", flashWidth, flashHeight, "8,0,22,0", "#ffffff", true);  
	
	// ExpressInstall
	so.useExpressInstall(param_rootDirectory + 'engine/expressinstall/expressinstall.swf?lang=' + param_language_str);
	
	so.addParam("xiRedirectUrl", window.location);
	so.addParam("align", "top");
	so.addParam("scale", "noscale");
	so.addParam("salign", "T");
	so.addParam("allowScriptAccess", "always");
	so.addParam("loop", false);
	so.addParam("menu", false); 
	so.addParam("quality", "high");
	//so.addParam("wmode", "window");
	
	// Common FlashVars
	so.addVariable("fv_urlConfigurationXml", param_rootDirectory + "engine/data/" + param_language_str + "/configuration.xml"); // L'url de configuration.xml
	so.addVariable("fv_urlApplicationSwf", param_rootDirectory + "engine/applications/application.swf"); // L'url de application.swf
	so.addVariable("fv_urlGraphicApplicationSwf", param_rootDirectory + "graphics/common/common.swf"); // L'url de graphic-application.swf
	so.addVariable("fv_urlGraphicUserDetectConnection", param_rootDirectory + "graphics/common/test-connection.swf"); 
	
	
	//Special FlashVars
	if(param_redirectFirstLink_bool == undefined){
		param_redirectFirstLink_bool = false;
	}
	so.addVariable("fv_redirectFirstLink_bool", param_redirectFirstLink_bool);
	so.addVariable("fv_directContent", param_directContent_str); // Si on souhaite ouvrir une home ou une sous-section directement, on transmet son id
	so.addVariable("fv_directPage", param_directPage_str); // Si on souhaite une page precise du contenu charge directement, on transmet son id
	so.addVariable("fv_directParameters", param_directParameters_str);
	so.addVariable("fv_language", param_language_str);
	so.addVariable("fv_trace_bool", param_debug_str); // Si on veut l'affichage des traces ou pas	
	
	
	
	return so;
}
//popups
function pdf(pdf) {
	openPopupWindow(pdf, 'pdf', 'top=10,left=20,width=750,height=450,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes');
}
//

function openPopupWindow(url,name,param) {
	//'height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no'
	window.open (url, name, param);
}
function openSimplePopupWindow(url,name,width, height) {
	openPopupWindow(url, name, 'height=' +height + ', width=' +width + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
}
function openScrollablePopupWindow(url,name,width, height) {
	openPopupWindow(url, name, 'height=' +height + ', width=' +width + ', toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}
function popUnder( title, url, width, height, scrollbars) {
	window.open (url,title,'height=' +height + ', width=' +width + ', toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=yes, status=yes');
	window.focus();
}
//
/*
function videoscenedevie(num) {
	openSimplePopupWindow('/graphics/fondation/maisons-ronald/popup-films/popup-sdv' + num + '-flash.html','sdv',388,356);
}
function liencontactmecenat() {
	openScrollablePopupWindow('/graphics/fondation/contact/contact.html','mecenat',359,500);
}

function openPhotoContestUploadPhoto(){
	openPopupWindow("/graphics/currently/photo-contest/upload-popup.html", "uploadcontestphoto", "height=250, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no");
}
*/

