// #################################################################################
// MENU
// #################################################################################

sfHover = function() {
	if(document.getElementById("mMenu_RootMenu") != null){
		var sfEls = document.getElementById("mMenu_RootMenu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// #################################################################################
// FlaObj
// #################################################################################
function FlaObj(swf, id, width, height, ver, background, quality){
	this._init(swf, id, width, height, ver, background, quality);
}

FlaObj.prototype = {
	params:"",
	params2:"",
	variables:"",
	swf:"",
	id:"",
	width:0,
	height:0,
	ver:0,
	background:"",
	quality:"high",
	
	_init:function(swf, id, width, height, ver, background, quality){
		this.swf = swf;
		this.id = id;
		this.width = width;
		this.height = height;
		this.ver = ver;
		this.background = background;
		this.quality = quality;
		this.params2= "";
		this.params = "";
		this.variables = "";
		
		if(background){
			this.addParam('bgcolor', background);
		}
		quality = quality ? quality : 'high';
		this.addParam('quality', quality);
		this.addParam('allowFullScreen','true');
	},
	
	addParam:function(name, value){
		this.params += '<param name="'+name+'" value="'+value+'">';
		this.params2 += name+'="'+value+'" ';
	},
	
	addVar:function(name, value){
		this.variables += name+"="+value+"&";
	},
	
	code:function(idZone) {
		var codeFinal  = this.getCode();
		
		document.getElementById(idZone).innerHTML = codeFinal;
	},
	
	getCode:function(){
	    var codeFinal  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+this.id+'" name="'+this.id+'" width="'+this.width+'" height="'+this.height+'">';
		codeFinal += '<param name="movie" value="'+ this.swf +'">';

		if(this.params != ""){codeFinal += this.params;}
		if(this.variables != ""){codeFinal += '<param name="flashvars" value="'+this.variables+'">';}
		
		codeFinal += '<embed src="'+this.swf+'" width="'+this.width+'" height="'+this.height+'" ';
		if(this.params2 != ""){codeFinal += this.params2;}
		codeFinal += ' flashvars="'+this.variables+'" type="application/x-shockwave-flash"></embed>';
		codeFinal += "</object>";
		return(codeFinal);
	}
}

// #################################################################################
// PDFObj
// #################################################################################
function PDFObj(pdf, id, width, height){
	this._init(pdf, id, width, height);
}

PDFObj.prototype = {
	swf:"",
	id:"",
	width:0,
	height:0,
	
	_init:function(pdf, id, width, height){
		this.pdf = pdf;
		this.id = id;
		this.width = width;
		this.height = height;
	},
	
	code:function(idZone) {
		var codeFinal  = this.getCode();
		
		document.getElementById(idZone).innerHTML = codeFinal;
	},
	
	getCode:function(){
		var codeFinal  = '<object id="'+this.id+'" name="'+this.id+'" width="'+this.width+'" height="'+this.height+'" type="application/pdf" style="z-index:0;">';
		codeFinal += '<param name="src" value="'+ this.pdf +'">';
		codeFinal += '<embed src="'+ this.pdf +'" width="'+this.width+'" height="'+this.height+'"></embed>';
		codeFinal += "</object>";
		return(codeFinal);
	}
}

// #################################################################################
// formChangeLanguage
// #################################################################################
function formChangeLanguage(lang){
	var contentFR = document.getElementById("contentFR");
	var contentEN = document.getElementById("contentEN");
	switch (lang){
		case "FR":
				contentFR.style.display = "block"
				contentEN.style.display = "none"
				break;
		case "EN":
				contentFR.style.display = "none"
				contentEN.style.display = "block"
				break;
	}
}

// #################################################################################
// changeLanguage
// #################################################################################
function changeLanguage(sLang){
	var sLangCh;
	if (sLang=='FR') {
		sLangCh = 'EN';
	} else {
		sLangCh = 'FR'
	}
	var addressBar = document.location.href.split("?");
	var addressFinal = addressBar[0];
	if(addressBar[1] == undefined){
		addressFinal += "/?lang="+sLangCh;
	}else{
		addressFinal += "/?"+addressBar[1]+"&lang="+sLangCh;
	}
	document.location.href = addressFinal;
}
