// Fonctions principales - SVI eSolutions
var curSection;
var langue;
// ------- Detections ------- 
var agent = String(navigator.userAgent).toLowerCase();
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? (agent.indexOf("opera") == -1) : false; // Detection Internet Explorer
var isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false; // Detection de Netscape
var isRecentBrowser = (parseInt(navigator.appVersion) >= 5) || (isIE && parseInt(navigator.appVersion) >= 4) ? true : false; // Version 5+
var isIE55 = false;
if(isIE && (agent.indexOf("msie") > -1)) {
	// Version d'IE >= 5.5? (pour support des filtres)
	ieVer = agent.substring(agent.indexOf("msie") + 5, agent.indexOf(";",agent.indexOf("msie")));
	isIE55 = (parseInt(ieVer) > 5 || (parseInt(ieVer) == 5 && parseInt(ieVer.charAt(2)) > 4));
	delete ieVer;
	if(agent.indexOf("opera") != -1) {
		isIE55 = false;
		isRecentBrowser = true;
	}
}
var isMac = (agent.indexOf("mac")>-1);
var documentInitiated = false;
	
	// Fonction qui crit le bloc Flash
	var flashPicLast = 1;
	var flashPicCount = 0;
	var flashPicID = null;
	var flashPicSrc = null;
	function writeFlashAnim(src, width, height, altImagesCount, altImagesLink, customSettings) {
		// src: String. Nom du fichier Flash  insrer (.swf sera ajout)
		// width, height: Number. Dimensions de la zone Flash et de l'image alternative
		// altImagesCount: Number. Nombre d'images alternatives. Si 0 ou null, une seule image sera affiche
		// altImagesLink: String. Adresse associe  l'image alternative.
		
		// Settings par défaut
		var settings = new Object();
			settings.flashVer = 6;
			settings.altImagesDelay = 8; // Delais (sec.) entre les images alternatives
			settings.animID = "flashAnim";
			settings.scriptAccess = "sameDomain";
			settings.swLiveConnect = "true";
			settings.quality = "high";
			settings.menu = "false";
			settings.bgColor = "#ffffff";
			settings.align = "middle";
			settings.flashVars = null;
			
		if(customSettings) {
			for(var prop in customSettings) {
				settings[prop] = customSettings[prop];
			}
		}
		
		if(DetectFlashVer(settings.flashVer,0,0)){
			// On a Flash, ok
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + settings.flashVer + ',0,0,0" width="' + width + '" height="' + height + '" name="' + settings.animID + '" id="' + settings.animID + '" align="' + settings.align + '">');
				document.write('<param name="allowScriptAccess" value="' + settings.scriptAccess + '" />');
				document.write('<param name="movie" value="' + src + '.swf" />');
				document.write('<param name="swLiveConnect" value="' + settings.swLiveConnect + '" />');
				document.write('<param name="menu" value="' + settings.menu + '" />');
				document.write('<param name="quality" value="' + settings.quality + '" />');
				document.write('<param name="bgcolor" value="' + settings.bgColor + '" />');
				if(settings.flashVars != null) document.write('<param name="flashVars" value="' + settings.flashVars + '" />');
				document.write('<embed src="' + src + '.swf" menu="' + settings.menu + '" quality="' + settings.quality + '" bgcolor="' + settings.bgColor + '" width="' + width + '"' + (settings.flashVars != null ? ' flashVars="' + settings.flashVars + '"' : '') + ' height="' + height + '" swLiveConnect="' + settings.swLiveConnect + '" name="' + settings.animID + '" id="' + settings.animID + '-embed" align="' + settings.align + '" allowScriptAccess="' + settings.scriptAccess + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
			document.write('</object>');
		} else {
			// Mode compatibilite, on invite  telecharger Flash
			var makeSlideShow = Boolean(!isNaN(altImagesCount) && altImagesCount > 1);
			if(makeSlideShow) {
				// Mini slide-show
				flashPicID = settings.animID;
				flashPicSrc = src + '_' + langue;
				flashPicCount = altImagesCount;
				flashPicLast = Math.round(Math.random() * (altImagesCount-1)) + 1;
				setInterval("nextFlashPic();", (settings.altImagesDelay * 1000)); // Changement auto des images aprs x secondes
				// Preloads
				for(var i=2; i <= altImagesCount; i++) {
					MM_preloadImages('images/' + src + '_' + langue + String(i) + '.jpg');
				}
			}
			document.write('<img src="images/' + src + '_' + langue + (makeSlideShow ? flashPicLast : '1') + '.jpg" width="' + width + '" height="' + height + '" border="0" name="noFlash_' + settings.animID + '" id="noFlash_' + settings.animID + '" usemap="#noFlash_' + settings.animID + 'map"><br>');
			document.write('<map name="noFlash_' + settings.animID + 'map">');
				document.write('<area alt="' + (langue == "en" ? 'Get Macromedia Flash Player' : 'Obtenir Macromedia Flash Player') + '" coords="0,' + (height - 38) + ',' + width + ',' + height + '" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
				document.write('<area alt="" coords="0,0,' + width + ',' + (height - 38) + '" href="' + altImagesLink + '">');
			document.write('</map>');
		}
		
	}
	function nextFlashPic(){
		flashPicLast++;
		if(flashPicLast > flashPicCount) flashPicLast = 1;
		var obj = MM_findObj('noFlash_' + flashPicID);
		
		if(isIE55 && obj.filters.length > 0) {
			var transition = Math.round(Math.random() * (obj.filters.length-1));
			if(obj.filters[transition]) obj.filters[transition].Apply();
			obj.src = 'images/' + flashPicSrc + flashPicLast + '.jpg';
			if(obj.filters[transition]) obj.filters[transition].Play();
		} else {
			obj.src = 'images/' + flashPicSrc + flashPicLast + '.jpg';
		}
	}

// ------- Gestion des menus
	var menuDivs = ["solutions","qui"];
 	var menuAutoHideDelay = 1000; // Dlais (millisecondes) avant la disparission auto. des menus
	var menuAutoHideTimer = null;
	var openedMenu = null;
	var lastZIndex = menuDivs.length;
	
	// Positionnement initial des menus
	function positionMenus(){
		var menu = getDiv("menu");
		var p = menu.offsetParent;
		var xPos = menu.offsetLeft + p.offsetLeft;
		var levels = 0;
		while(p.offsetParent && levels < 50){
			p = p.offsetParent;
			xPos += p.offsetLeft;
			levels++;
		}
		xPos -= 208;
	}
	function initMenus(){
		positionMenus();
		for(var i=0; i<menuDivs.length; i++){
			var menu = getDiv("menu_" + menuDivs[i]);
			if(curSection[0] == menuDivs[i]) {
				showDiv("menu_" + menuDivs[i]);
				openedMenu = menuDivs[i];
			}
			
			// Internet Explorer supporte les mouseover/out sur les divs
			menu.onmouseover = function(){
				if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
			}
			menu.onmouseout = function(){
				if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
				var myID = this.id;
				myID = myID.substring(myID.indexOf("_")+1, myID.length);
				if(curSection[0] != myID) menuAutoHideTimer = setTimeout("outNavig('" + myID + "', true, '', true, false, true);", menuAutoHideDelay);
			}
		}
		window.onresize = function() {
			positionMenus();
		}
		
		// Init niveau 1
		var curMnuObj = document.getElementById("navig_" + curSection[0]);
		if(curMnuObj) curMnuObj.className = (curSection[0] == "solutions" || curSection[0] == "qui" ? "navig_on_opened" : "navig_selected");
		
		// Init niveau 2
		if(curSection[1] != null) {
			var curMnuObj = document.getElementById("navig_" + curSection[1]);
			if(curMnuObj) curMnuObj.className = "navig_selected";
		}
		
		// Sous-navig
		if(curSection[2] != null) {
			var isFolder = String(getDiv("snavig_" + curSection[2] + "_t").className).indexOf("folder") != -1;
			getDiv("snavig_" + curSection[2] + "_t").className = isFolder ? "snavig_folder_selected" : "snavig_selected";
			if(isFolder) collapseLayer("snavig_" + curSection[2], false);
			if(curSection[3] != null) getDiv("snavig_" + curSection[1] + "_" + curSection[3]).className = "snavig_selected2";
		}
	}
	function overNavig(itemID, asSubMenu, isLevel2, desc, firstLevelID) {
		//trace("overNavig: " + itemID + ", " + asSubMenu + ", " + isLevel2);
		
		if(itemID != curSection[0] && !isLevel2) {
			var curMnuObj = document.getElementById("navig_" + itemID);
			if(curMnuObj) curMnuObj.className = "navig_over";
		}
		if(itemID != curSection[1] && isLevel2) {
			var curMnuObj = document.getElementById("navig_" + itemID);
			if(curMnuObj) curMnuObj.className = "navig_over";
		}
		
		if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
		
		//trace("over: " + itemID + ", " + Boolean(asSubMenu) + ", " + Boolean(isLevel2) + ", " + desc, true);
		
		if(!isLevel2){
			var closedMenu = null
			// Fermeture du menu affich
			if(openedMenu != null && openedMenu != itemID){
				closedMenu = openedMenu;
				outNavig(openedMenu, true, '', true, true);
			}
			
			// Fermeture temporaire du menu de la section active
			for(var i=0; i<menuDivs.length; i++){
				if(((asSubMenu && menuDivs[i] == curSection[0]) || (!asSubMenu && menuDivs[i] != curSection[0])) && menuDivs[i] != itemID && menuDivs[i] != closedMenu) {
					hideDiv("menu_" + menuDivs[i]);
					openedMenu = null;
				}
			}
			
			// Affichage du menu associ
			if(asSubMenu) {
				showDiv("menu_" + itemID);
				openedMenu = itemID;
				
				var curMnuObj = document.getElementById("navig_" + itemID);
				if(curMnuObj) curMnuObj.className = (curSection[0] == itemID ? "navig_on_opened" : "navig_opened");
			}
		} else {
			if(firstLevelID != null && String(firstLevelID) != "undefined" && openedMenu != firstLevelID) {
				// Ouverture du premier niveau
				overNavig(firstLevelID, 1, 0);
			}
		}
		if(desc != null) {
			window.status = desc;
			return true;
		}
	}
	function outNavig(itemID, asSubMenu, firstLevelID, doHide, noAutoShow, autoShowNoDelay) {
		//trace("outNavig: " + itemID + ", " + asSubMenu + ", " + firstLevelID + ", " + doHide);
		
		if(asSubMenu && curSection[0] != firstLevelID && doHide) {
			var curMnuObj = document.getElementById("navig_" + itemID);
			if(curMnuObj) curMnuObj.className = (curSection[0] == itemID && asSubMenu ? "navig_selected" : "");
			
		} else if(itemID != curSection[0] && itemID != curSection[1] && !asSubMenu) {
			var curMnuObj = document.getElementById("navig_" + itemID);
			if(curMnuObj) curMnuObj.className = "";
		}
		
		//trace("out: " + itemID + " (" + typeof(itemID) + "), " + Boolean(asSubMenu) + ", " + firstLevelID + ", " + Boolean(doHide) + ", " + Boolean(noAutoShow) + ", " + Boolean(autoShowNoDelay), true);
		
		if(firstLevelID != "" && firstLevelID != itemID && firstLevelID != null){
			// Level 2
			if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
			menuAutoHideTimer = setTimeout("outNavig('" + firstLevelID + "', true, '', true);", menuAutoHideDelay);
			
		} else {
			if(asSubMenu){
				if(doHide){
					// Fermeture du menu associ
					if(itemID.indexOf("menu_") == -1) hideDiv("menu_" + itemID);
					else hideDiv(itemID);
					openedMenu = null;
					
				} else if(curSection[0] != itemID) {
					// Auto-hide aprs un certain temps	
					if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
					menuAutoHideTimer = setTimeout("outNavig('" + itemID + "', true, '', true, false, true);", menuAutoHideDelay);
				}
			}
			// Affichage du menu de la section active, apres un court dlais
			if(!noAutoShow && ((asSubMenu && doHide) || !asSubMenu)){
				for(var i=0; i<menuDivs.length; i++){
					if(menuDivs[i] == curSection[0] && menuDivs[i] != itemID) {
						if(autoShowNoDelay){
							overNavig(menuDivs[i], 1, 0)
							//showDiv("menu_" + menuDivs[i]);
							openedMenu = menuDivs[i];
						} else {
							if(menuAutoHideTimer != null) clearTimeout(menuAutoHideTimer);
							menuAutoHideTimer = setTimeout("overNavig('" + menuDivs[i] + "',1,0);");
							//menuAutoHideTimer = setTimeout("showDiv('menu_" + menuDivs[i] + "'); openedMenu = '" + menuDivs[i] + "';", menuAutoHideDelay);
						}
					}
				}
			}
		}
		
		window.status = "";
		return true;
	}
	function collapseLayer(itemID, flag){
		var itm = getDiv(itemID);
		var curProp = getStyleProp(itm, "display");
		
		if(flag == null) flag = (curProp != "none" && curProp != ""); // Auto.
		
		setStyleProp(itm, "display", (!flag ? "block" : "none"));
		setStyleProp(getDiv(itemID + "_t"), "backgroundImage", (!flag ? "url('images/snavig_folder_opened.gif')" : "url('images/snavig_folder_closed.gif')"));
	}
	function getDiv(id){
		// Comment on rejoint le layer?
		if (document.getElementById) return document.getElementById(id);
		if (document.layers) return document.layers[id];
		if (document.all) return document.all[id];
		return null;
	}
	function showDiv(id){
		var obj = getDiv(id);
		//trace("showDiv: " + id, true);
		
		// On place au dessus
		lastZIndex++;
		setStyleProp(obj, "zIndex", lastZIndex);
		
		if(isIE55 && obj.filters && obj.filters.length > 0 && obj.style){
			// On utilise la transition spcifie
			if(obj.filters[0]) obj.filters[0].Apply();
			obj.style.visibility = "visible";
			if(obj.filters[0]) obj.filters[0].Play();
		} else {
			var wasVisible = ( (isNav && !isRecentBrowser && obj.visibility == "show") || (obj.style && obj.style.visibility == "visible") );
			if(isRecentBrowser && !wasVisible) {
				setOpacity(obj, 0);
				startFadeIn(obj, 0.1);
			}
			if (isNav && !isRecentBrowser) obj.visibility = "show" // Nav code
			else if(obj.style) obj.style.visibility = "visible" // IE code
		}
	}
	function hideDiv(id){
		var obj = getDiv(id);
		//trace("hideDiv: " + id, true);
		if(isIE55 && obj.filters && obj.filters.length > 1 && obj.style){
			// On utilise la transition spcifie
			if(obj.filters[1]) obj.filters[1].Apply();
			obj.style.visibility = "hidden";
			if(obj.filters[1]) obj.filters[1].Play();
		} else {
			if(isRecentBrowser) {
				startFadeOut(obj, 0.1, true);
			} else {
				if (isNav && !isRecentBrowser) obj.visibility = "hide" // Nav code
				else if(obj.style) obj.style.visibility = "hidden" // IE code
			}
		}
	}
	function startFadeIn(obj, duration) {
		clearInterval(obj.fadeInterval);
		obj.fadeValue = 10;
		obj.hideAtFadeEnd = false;
		obj.fadeInterval = setInterval(doFadeIn, (duration / obj.fadeValue) * 1000, obj);
	}
	
	function startFadeOut(obj, duration, hideAtEnd) {
		clearInterval(obj.fadeInterval);
		obj.fadeValue = 10;
		obj.hideAtFadeEnd = Boolean(hideAtEnd);
		obj.fadeInterval = setInterval(doFadeOut, (duration / obj.fadeValue) * 1000, obj);
	}
	function clearFade(obj) {
		clearInterval(obj.fadeInterval);
	}
	
	// Fade-in step
	function doFadeIn(obj) {
		var alpha = getOpacity(obj);
		if(alpha == null) alpha = 100; // Pas paramtr encore
		alpha += obj.fadeValue;
		if(alpha > 100) alpha = 100;
		else if(alpha < 0) alpha = 0;
		setOpacity(obj, alpha);
		if(alpha >= 100) {
			// Fin
			clearInterval(obj.fadeInterval);
		}
		
	}
	
	// Fade-out step
	function doFadeOut(obj) {
		var alpha = getOpacity(obj);
		if(alpha == null) alpha = 100; // Pas paramtr encore
		alpha -= obj.fadeValue;
		if(alpha > 100) alpha = 100;
		else if(alpha < 0) alpha = 0;
		setOpacity(obj, alpha);
		if(alpha <= 0) {
			// Fin
			clearInterval(obj.fadeInterval);
			if(obj.hideAtFadeEnd) {
				// hide final
				if (isNav && !isRecentBrowser) obj.visibility = "hide" // Nav code
				else if(obj.style) obj.style.visibility = "hidden" // IE code
			}
		}
	}
	
	// Get object's opacity
	function getOpacity(obj) {
		if(obj.style){
			if(obj.style["opacity"]) return Number(obj.style["opacity"]) * 100;
			if(obj.style["MozOpacity"]) return Number(obj.style["MozOpacity"]) * 100;
			if(obj.style["KhtmlOpacity"]) return Number(obj.style["KhtmlOpacity"]) * 100;
			if(obj.style["filter"]) {
				var fil = String(obj.style["filter"]);
				if(fil.indexOf("opacity") != -1) return parseInt( fil.substring( fil.indexOf("opacity=") + 8, fil.indexOf(")", fil.indexOf("opacity=")) ) );
			}
		}
		return null;
	}
	
	// Set object's opacity
	function setOpacity(obj, opacity) {
		if(obj.style){
			obj.style.opacity = (opacity / 100);
			obj.style.MozOpacity = (opacity / 100);
			obj.style.KhtmlOpacity = (opacity / 100);
			obj.style.filter = "alpha(opacity=" + opacity + ")";
		}
	}
	

// ------- Plus d'infos -----
	function showMoreInfo(linkID, linkObj, flag) {
		var itm = getDiv("moreInfoText_" + linkID);
		var curProp = getStyleProp(itm, "display");
		
		if(flag == null) flag = (curProp != "none" && curProp != ""); // Auto.
		
		setStyleProp(itm, "display", (!flag ? "block" : "none"));
		
		var parentItm = getDiv("moreInfo_" + linkID);
		if(!flag) {
			setStyleProp(parentItm, "borderColor", "#b1b9bf");
			setStyleProp(linkObj, "backgroundColor", "#f5f8d9");
			setStyleProp(linkObj, "color", "#4e6172");
			setStyleProp(linkObj, "textDecoration", "none");
			setStyleProp(linkObj, "fontWeight", "bold");
			setStyleProp(linkObj, "borderBottom", "solid #e3e6e7 1px");
			linkObj.wereAnX = (linkObj.innerHTML.indexOf("+") != -1);
			if(linkObj.wereAnX) {
				// On change le "+" pour un "-"
				linkObj.innerHTML = linkObj.innerHTML.substring(0, linkObj.innerHTML.indexOf("+")) + "-" + linkObj.innerHTML.substring(linkObj.innerHTML.indexOf("+")+1, linkObj.innerHTML.length);
			}
		} else {
			setStyleProp(parentItm, "borderColor", "");
			setStyleProp(linkObj, "backgroundColor", "");
			setStyleProp(linkObj, "color", "");
			setStyleProp(linkObj, "textDecoration", "");
			setStyleProp(linkObj, "fontWeight", "");
			setStyleProp(linkObj, "borderBottom", "");
			if(linkObj.wereAnX) {
				// On change le "+" pour un "-"
				linkObj.innerHTML = linkObj.innerHTML.substring(0, linkObj.innerHTML.indexOf("-")) + "+" + linkObj.innerHTML.substring(linkObj.innerHTML.indexOf("-")+1, linkObj.innerHTML.length);
			}
		}
	}

// ------- Gestion des images / roll-overs
	
	// Prchargement pour la plupart des pages du site
	function preloadImages() {
		// Images générales (communes à toutes les pages
		var imgList = ["images/navigBtn_bg-on.gif","images/navigBtn_bg-on-opened.gif","images/navigBtn_bg-opened.gif"];
		
		// Ajout des images spécifiées
		if(arguments.length > 0){
			for(var i=0; i<arguments.length; i++) {
				imgList[imgList.length] = arguments[i];
			}
		}
		
		// Code generique de prechargement (fonction MM_preloadImages)
	  	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=imgList; 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 doRollOver(imgID, imgSrc, desc, flag) {
		// Pour afficher la description, utilisez return avant l'appel de la fonction
		if(flag != false && flag != 0) flag = 1;
		MM_swapImage(imgID, '', imgSrc, flag);
		if(desc != null) {
			window.status = desc;
			return true;
		}
	}
	function doRollOut() {
		MM_swapImgRestore();
		window.status='';
		return true;
	}
	
	// Fonctions gnriques Macromedia
		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_swapImgRestore() { //v3.0
		  var i,x,a=document.MM_sr;
		  for(i=0; a && i<a.length && (x=a[i]) && x.oSrc; i++) {
			if(isIE55 && x.filters && x.filters.length > 0 && x.filters[1]){
				// On utilise la transition spcifie
				x.filters[1].Apply();
				x.src=x.oSrc;
				x.filters[1].Play();
			} else {
				x.src=x.oSrc;
			}
		  }
		}
		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_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;
					if(isIE55 && x.filters && x.filters.length > 0 && x.filters[0]){
						// On utilise la transition spcifie
						x.filters[0].Apply();
						x.src = a[i+2];
						x.filters[0].Play();
					} else {
				   	x.src = a[i+2];
					}
				}
			}
		}

// ----- Gestion des animations Flash
	
	function beginAnimation(newAnim, animHeight, noReturn) {
		setAnimProperty("openAnim", newAnim + "|" + (noReturn ? "1" : "0"));
		if(!isNaN(animHeight)) setAnimHeight(animHeight);
	}
	function setAnimProperty(propName, propValue){
		// References  l'objet Flash
		var fObj = document.getElementById("flashAnim");
		var fEmb = document.getElementById("flashAnim-embed");
		
		if(isIE) { // Internet Explorer (fObj avant fEmb pour IE seulement)
			if(fObj) fObj.SetVariable(propName, propValue);
			else if(fEmb) fEmb.SetVariable(propName, propValue);
			else if(document.flashAnim) document.flashAnim.SetVariable(propName, propValue);
		} else {
			if(fEmb) fEmb.SetVariable(propName, propValue);
			else if(fObj) fObj.SetVariable(propName, propValue);
			else if(document.flashAnim) document.flashAnim.SetVariable(propName, propValue);
		}
	}
	
	// Fonction pour redimensionner la zone Flash
	function setAnimHeight(height) {
		var found = false;
		// Rfrences  l'objet Flash
		var fObj = document.getElementById("flashAnim");
		var fEmb = document.getElementById("flashAnim-embed");
		
		if(fObj && fObj.style) {
			fObj.setAttribute("height", height);
			fObj.style.height = height + "px";
			found = true;
		}
    	if(fEmb != null) { 
			fEmb.height = height;
			if(fEmb.style) fEmb.style.height = height + "px";
			found = true;
		}
		if(found) {
			// Emplacement du contenu
			var placer = document.getElementById("contentPlacer");
			if(placer) {
				if(placer.style) placer.style.height = (height + 85) + "px";
				else placer.height = (height + 85) + "px";
			}
			var snav = document.getElementById("snavig");
			if(snav){
				if(snav.style) snav.style.height = (height + 85) + "px";
				else snav.height = (height + 85) + "px";
			}
		}
	}
	function getAnimProperty(propName) {
		// Rfrences  l'objet Flash
		fObj = document.getElementById("flashAnim");
		fEmb = document.getElementById("flashAnim-embed");
	
		if(isIE) { // Internet Explorer (fObj avant fEmb pour IE seulement)
			if(fObj) return fObj.GetVariable(propName);
			else if(fEmb) return fEmb.GetVariable(propName);
			else return window.document.flashAnim.GetVariable(propName);
		} else {
			if(fEmb) return fEmb.GetVariable(propName);
			else if(fObj) return fObj.GetVariable(propName);
			else return window.document.flashAnim.GetVariable(propName);
		}
	}
	
	// Ouverture d'un lien email
	function openEmail(emailURL, subjectText, bodyText) {
		var zeLink = "mailto:" + escape(emailURL);
		if(subjectText) zeLink += "?subject=" + escape(subjectText) + ((bodyText) ? "&" : "");
		else if(bodyText) zeLink += "?";
		if(bodyText) zeLink += "body=" + escape(bodyText);
		document.location = zeLink;	
	}

// ----- Zoom d'images
	function zoomPic(picSource, picWidth, picHeight) {
		// Image
		MM_swapImage("zoomedPicHolder", "", "images/" + picSource, 1);
		var img = MM_findObj("zoomedPicHolder");
		img.width = picWidth;
		img.height = picHeight;
		
		// Positionnement
		var imgHolder = getDiv("zoomedPic");
		imgHolder.picWidth = picWidth;
		imgHolder.picHeight = picHeight;
		centerZoomedPic();
		
		// Affichage
		showDiv("zoomedPic");
	}
	function unzoomPic() {
		hideDiv("zoomedPic");
	}
	function centerZoomedPic() {
		var imgHolder = getDiv("zoomedPic");
		var newLeft = (getWindowWidth() - imgHolder.picWidth) / 2;
		var newTop = (getWindowHeight() - imgHolder.picHeight) / 2;
		if(newLeft < 0) newLeft = 0;
		if(newTop < 0) newTop = 0;
		setStyleProp(imgHolder, "left", String(newLeft) + "px" );
		setStyleProp(imgHolder, "top", String(newTop) + "px" );
	}
	function getWindowWidth(){
		if(window.innerWidth) return window.innerWidth;
		if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
		if(document.body && document.body.clientWidth) return document.body.clientWidth;
		return screen.width;
	}
	function getWindowHeight(){
		if(window.innerHeight) return window.innerHeight;
		if(document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
		if(document.body && document.body.clientHeight )return document.body.clientHeight;
		return screen.height;
	}

// ----- Barre de liens -----

// ----- Debug -----
	function trace(txt, append) {
		if(!documentInitiated) return;
		var traceHolder = getDiv("debugInfos");
		if(traceHolder) {
			if(append) traceHolder.innerHTML += "<br>" + txt;
			else traceHolder.innerHTML = txt;
		} else { 
			document.body.innerHTML += '<div class="moreInfo" id="debugInfos" style="position:absolute; left: 0.5em; top: 1.5em;"><b>Console</b></div>';
			trace(txt, append);
		}
	}
	
// ----- Gestion CSS
	function setStyleProp(obj, propName, newVal) {
		if(obj.style) obj.style[propName] = newVal; // Browser recent
		else obj[propName] = newVal; // Old browser
	}
	function getStyleProp(obj, propName){
		if(obj.style) return obj.style[propName]; // Browser recent
		else if(obj[propName]) return obj[propName]; // Old browser
	}

// ----- Initialisation de la page
	
	function initPageContent(chooseBackground, noMenuInit) {
		// Ajustement pour affichage dans Opera
		if(!isIE && navigator.userAgent.toLowerCase().indexOf("opera") != -1 && document.body.style) document.body.style.width = "100%";
		
		// Patch de dimension pour Safari (force le 100%)
		writeSafariPatch();
		
		// Initialisation des menus
		if(!noMenuInit) initMenus();
		
		// Resize de la fentre
		window.onresize = function() {
			positionMenus();
			//if(getDiv("zoomedPic")) centerZoomedPic();
			writeSafariPatch();
		}

		// Initialisation du background de page
		if(chooseBackground){
			var availBackgrounds = 3;
			var ctn = document.getElementById("footer");
			var foot = document.getElementById("piedPageTexte");
			var num = Math.round(Math.random() * (availBackgrounds-1)) + 1;
			if(ctn.style) {
				ctn.style.backgroundImage = "url('images/content_bg" + num + "a.jpg')";
				foot.style.backgroundImage = "url('images/content_bg" + num + "b.jpg')";
			} else {
				ctn.backgroundImage = "url('images/content_bg" + num + "a.jpg')";
				foot.backgroundImage = "url('images/content_bg" + num + "b.jpg')";
			}
		}
		documentInitiated = true;
	}
	function writeSafariPatch() {
		if(isMac && agent.indexOf("safari") != -1) {
			// Patch de dimension pour Safari, si on ne fait pas cela, le browser n'utilise que l'espace utilisÃ©
			// (ex: si du texte utilise au total 600px, et bien le 100% Ã©quivaut Ã  cette taille).
			// Donc on doit le forcer Ã  prendre toute l'espace disponible dans la fenÃªtre)
			winW = window.innerWidth;
			if(document.getElementById("safari_sizer") != null) document.getElementById("safari_sizer").width = winW;
			else document.body.innerHTML = "<img id=\"safari_sizer\" width=" + winW + " height=0 border=0><br>" + document.body.innerHTML;
		}
	}	

// ----- Pop-Ups
	function PopupCenter(pageURL, target, largeur, hauteur, langString, options, returnWin) {
		if (pageURL == null) return null;
		if (target == null) target = "";
		var screenWidth = screen.availWidth ? screen.availWidth : screen.width;
		var screenHeight = screen.availHeight ? screen.availHeight : screen.height;
		var top = 0; var left = 0;
		var deltaL = 0; var deltaH = 0;
		if (largeur == null) {
			largeur = screenWidth;
			if (isIE) deltaL = 12;
		} else {
			left = (screenWidth - largeur) / 2;
		}
		if (hauteur == null) {
			hauteur = screenHeight;
			if (isIE) deltaH = 38;
		} else {
			top = (screenHeight - hauteur) / 2;
		}
		var newWin = window.open(pageURL, target, "top=" + top + ", left=" + left + ", width=" + (largeur-deltaL) + ", height=" + (hauteur-deltaH) + ", " + options);
		if (newWin == null){ // Bloque par un popup bloquer
			if (langString == "en") alert("Error: You must autorize the site to execute such script.\n\nTo do so, simply click on the yellow bar, upper on this page, and click on \"Autorize blocked content...\".");
			else alert("Erreur: Vous devez autoriser le site à éxcuter ce script.\n\nPour ce faire cliquez sur la bande jaune, plus haut sur cette page, et cliquez sur \"Autoriser le contenu bloqué...\".");
		}
		newWin.focus();
		if(returnWin != false) return newWin;
	}