// JavaScript Document

//Declaration des variables globales--------------------------------
a_str_sections = new Array("entreprise","solutions","produits","carriere");
a_str_div = new Array("sous_menu_entreprise","sous_menu_solutions","sous_menu_produits","sous_menu_carriere");
str_location = "" + window.location + "";
str_section = str_location.slice(0, str_location.lastIndexOf("/"));
str_section = str_section.substring(str_section.lastIndexOf("/") + 1, str_section.length);

function chg_lang(lang_to) {
	if (lang_to == 'en') { lang_from='fr' } else { lang_from='en' };
	curLink= new String(window.location);
	swapLink = curLink.replace("/"+lang_from+"/","/"+lang_to+"/");
	window.location=swapLink;
}

function showhide(id) {
	var as = document.getElementById(id).style;
	var im = "i_"+id;
	var imsrc = document.getElementById(im);
	if (as.display == "none") {
		imsrc.src = "../../../medias/communs/minus.gif";
		as.display = "block";
	} else {
		as.display = "none";
		imsrc.src = "../../../medias/communs/plus.gif";
	}
}

function showover(id) {
	var style = document.getElementById(id).style
	if (style.visible == "hidden")
		style.visible = "visible";
	else
		style.visible = "hidden";
}

//Fonction lien accueil pour regler le bug dans firefox
function lien_accueil(){
	window.location.href = "../accueil/accueil.php";
}
//Fonction choisir_baniere-----------------------------------------
function choisir_baniere(){
	//Recherche de la section et page en cours
	var bol_section = false;
	//Affichage d'une baniere différente si nous sommes dans une grande section
	for (i=0; i<= a_str_sections.length; i++){
		if (a_str_sections[i] == str_section){
			document.write('<img src="../../../medias/communs/baniere_'+str_section+'.jpg" alt="Baniere JVM Informatique" name="baniere" width="805" height="230" border="0" id="baniere">');
			bol_section = true;
		}
	}
	if (bol_section == false){
		document.write('<img src="../../../medias/communs/baniere_commune.jpg" alt="Baniere JVM Informatique" name="baniere" width="805" height="230" border="0" id="baniere">');
	}
}
//Fonction préparer_sous_menu-----------------------------------------
function preparer_sous_menu(){
	//Recherche de la page en cours
	var str_page = str_location.substring(str_location.lastIndexOf("/") + 1, str_location.lastIndexOf("."));
	//Ouverture du sous menu désiré et état enfoncé de la page courante
	for (i=0; i<= a_str_sections.length; i++){
		if (a_str_sections[i] == str_section){
			ouvrir_sous_menu("sous_menu_" + str_section);
			document.getElementById(str_page).style.color = "#FFFFFF";
			document.getElementById(str_page).style.backgroundColor = "#A1A1A1";
		}
	}
}
//Fonctions ouvrir_sous_menu-----------------------------------------
function ouvrir_sous_menu(str_div_id){
	//Masquage de tous les div sous_menu
	for (i=0; i<a_str_div.length; i++){
		if (a_str_div[i] != str_div_id){
			document.getElementById(a_str_div[i]).style.display = "none";
			document.getElementById("nav_" + a_str_div[i]).style.color = "";
			document.getElementById("nav_" + a_str_div[i]).style.backgroundColor = "";
		}else{
			document.getElementById("nav_" + a_str_div[i]).style.color = "#FFFFFF";
			document.getElementById("nav_" + a_str_div[i]).style.backgroundColor = "#1E7CA6";
		}
	}
	//Affichage ou masquage de la Div en question
	var str_etat_div = document.getElementById(str_div_id).style.display;
	if (str_etat_div == "" || str_etat_div == "none"){
		document.getElementById(str_div_id).style.display = "block";
	}else{
		document.getElementById(str_div_id).style.display = "none";
		document.getElementById("nav_" + str_div_id).style.color = "";
		document.getElementById("nav_" + str_div_id).style.backgroundColor = "";
	}
	//Affichage de la bonne banière
	document.images['baniere'].src = "../../../medias/communs/baniere_" + str_div_id.substring(10,str_div_id.length) + ".jpg";
}


//Fonctions Dreamweaver----------------------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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];}
}