<!--
/////////////////////////////////////////////////////////
// This function dynamically import external javascripts
/////////////////////////////////////////////////////////
function importJavascript(src) 
{document.write("<script type='text/javascript' language='javascript' src='" + src + "'></scr" + "ipt>");}

/////////////////////////////////////////////////////////
// Return language code
var lang = "fr";
function getLang()
{
	var get_lang = getURLParam("lang");
	var cookie_lang = readCookie("lang");
	if(get_lang != "") {
		lang = get_lang;
	} else if(cookie_lang != "") {
		lang = cookie_lang.substring(0,2);
	}
	return lang;
}

/////////////////////////////////////////////////////////
// Load text library
var __dt = new Date();
importJavascript("/engine/js/text_library_"+getLang()+".js?"+ __dt.getTime());

/////////////////////////////////////////////////////////
// function writeCookie():
// sert a ecrire un cookie
/////////////////////////////////////////////////////////
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString()+";";
  }
  document.cookie = name + "=" + escape(value) + expire + "path=/";
}
////////////////////////////////////////////
// function readCookie():
// sert a lire un cookie
////////////////////////////////////////////
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

////////////////////////////////////////////
// Fonction popup
////////////////////////////////////////////
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//////////////////////////////////////////////////////
// function popupCenter():
// Ouverture de fenetre flotante centrale
//////////////////////////////////////////////////////
function popupCenter(page,winName,largeur,hauteur) {
	var top=(screen.height-hauteur)/2; 
	var left=(screen.width-largeur)/2; 
	newwindow=	window.open(page,winName,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+",location=no,toolbar=no,menubar=no,scrollbars=yes,statusbar=no,status=no");
	if (window.focus) {newwindow.focus()}
	return false;
}
////////////////////////////////////////////
// Fonction rollover table
////////////////////////////////////////////
function pviiW3Cbg(obj, pviiColor) { //v1.1 by Project VII
	obj.style.backgroundColor=pviiColor
}

////////////////////////////////////////////
// Function getURLParam return get param
// Add: 02FEV07 by BEN
////////////////////////////////////////////
function getURLParam(strParamName) {
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ) {
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) {
			if(aQueryString[iParam].indexOf(strParamName + "=") > -1 ) {
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}

////////////////////////////////////////////
// Fonction rollover BUTTON
////////////////////////////////////////////
//function switchClass(id,class){document.getElementById(id)className = class;}

////////////////////////////////////////////
// Switch display by id
////////////////////////////////////////////
function displayID(id, state)
{ 
	if(state==true)
		var state = "";
	else if(state==false)
		var state = "none";
	else
		var state = (document.getElementById(id).style.display=="none"?"":"none");
	
	if(document.getElementById(id))
		document.getElementById(id).style.display=state;
}
////////////////////////////////////////////
// Switch display by group id
////////////////////////////////////////////
function displayGroupID(id, group)
{ 
	if(group){ var group = group.split(","); } else { var group = new Array(); }
	for (var i in group)
	{
		if(document.getElementById(group[i]))
		{
			if(group[i] == id)
				document.getElementById(group[i]).style.display="";
			else
				document.getElementById(group[i]).style.display="none";
		}
	}
}

function setValueID(id, value)//this.options[this.selectedIndex].id
{
	if(document.getElementById(id))
		document.getElementById(id).value = value;
}

////////////////////////////////////////////
// Fonction de redirection
////////////////////////////////////////////
function goTo(where){window.location.href = where;}

////////////////////////////////////////////
// Array Libs
////////////////////////////////////////////
function compare_array(array1, array2)
{
	if(typeof(array1) != "object" || typeof(array2) != "object"){return false;}
	if(array1.length != array2.length){return false;}
	var temp_array1 = create_temp_array(array1);
	var temp_array2 = create_temp_array(array2);
	temp_array1.sort();
	temp_array2.sort();
	for(var x=0;x<temp_array1.length;x++)
		if(temp_array1[x] != temp_array2[x])
			return false;
	return true;
}
function create_temp_array(array)
{
	var temp_array = new Array();
	for(var x=0;x<array.length;x++)
		temp_array[x] = array[x];
	return temp_array;
}
function in_array(stringToSearch, arrayToSearch, return_index) 
{
	if(!return_index) var return_index = false;
	for(var x=0;x< arrayToSearch.length;x++) 
	{
		thisEntry = arrayToSearch[x].toString();
		if(thisEntry == stringToSearch)
			return (return_index?x:true);
	}
	return false;
}

function unset_in_array(array, element)
{
	var key = in_array(element, array, true);
	if(!isNaN(key)) array.splice(key, 1);
	return array;
}

function mergeArray(array1,array2)
{
	var merged = new Array();
	merged = array1;
	for (var key in array2)
		merged[key]=array2[key];
	return merged;
}

////////////////////////////////////////////
// Fonction de Dreamweaver
////////////////////////////////////////////

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_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; x.src=a[i+2];}
}
//-->
