function getWindowWidth() {
    var windowWidth=0;
    if (typeof(window.innerWidth)=='number') {
        windowWidth=window.innerWidth;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientWidth) {
         windowWidth = document.documentElement.clientWidth;
    }
    else {
     if (document.body&&document.body.clientWidth) {
         windowWidth=document.body.clientWidth;
      }
     }
    }
    return windowWidth;
}

function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientHeight) {
         windowHeight = document.documentElement.clientHeight;
    }
    else {
     if (document.body&&document.body.clientHeight) {
         windowHeight=document.body.clientHeight;
      }
     }
    }
    return windowHeight;
}

function resizeHauteur(calque){
	hauteur=getWindowHeight();
//alert("1 - " + document.getElementById(calque).style.height);
	document.getElementById(calque).style.height=(hauteur - (114 + 95)) + "px";//84:bandeau haut  80:bandeau bas
//alert("2 - " + document.getElementById(calque).style.height);
}

function gereClickMenu(type,bouton){
	//alert("type : " + type + " - bouton:" + bouton + " = " + "_images/" + bouton + "_ON.png");
	//gere le type d'action sur le bouton
	switch(type){
	case "init":
		document.getElementById(bouton).src="_images/" + bouton + "_ON.png";
		oldBouton=bouton;
		break;
	case "over":
		document.getElementById(bouton).src="_images/" + bouton + "_ON.png";
		break;
	case "out":
		//alert(oldBouton+"!="+bouton);
		if(oldBouton!=bouton){
		document.getElementById(bouton).src="_images/" + bouton + "_OFF.png";
		}
		break;
	case "click":
		if(oldBouton!=""){
		document.getElementById(oldBouton).src="_images/" + oldBouton + "_OFF.png";
		}
		document.getElementById(bouton).src="_images/" + bouton + "_ON.png";
		oldBouton=bouton;
		document.getElementById(bouton).click();
		break;
	}
}

function openWindow(url, width, height){ 
	window.open(url,"CB Consult","width=" + width + ",height=" + height + ",top=-10,left=0,toolbar=no,directories=no,status=no,scrollbar=no,resize=no,menubar=no");
} 


function showListeFormations(){
	//affiche ou masque la liste déroulante
	//alert(document.getElementById("listeFormations"));
	if(document.getElementById("listeFormations").style.visibility=="visible"){
		document.getElementById("listeFormations").style.visibility="hidden";
		document.getElementById("listeFormations_inside").style.visibility="hidden";
	}else{
		document.getElementById("listeFormations").style.visibility="visible";
		document.getElementById("listeFormations_inside").style.visibility="visible";
	}
}

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 showPage(page){
	<!-- affiche la page dans la balise div -->
	<!-- permet d'éviter la iFrame, et d'avoir un seul ascenseur à droite -->
		// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
	if(document.getElementById("pageInfos")){
		var xhr_object = null;
		if(window.XMLHttpRequest)  xhr_object = new XMLHttpRequest();
		else
		if (window.ActiveXObject)  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
			// On ouvre la requete vers la page désirée
			xhr_object.open("GET", page, true);
			xhr_object.onreadystatechange = function(){
			if ( xhr_object.readyState == 4 ){
				document.getElementById("pageInfos").innerHTML = xhr_object.responseText;
			}
		}
		// dans le cas du get
		xhr_object.send(null);
	}else{
		window.open(page,"","width=900,height=700top=10,left=10,toolbar=no,directories=no,status=no,scrollbar=yes,resize=no,menubar=yes");
	}
}

function editer(path,fichier){
	//edition d'un élément
	edit=window.open("edit.php?path=" + path + "&fichier=" + fichier,"Edition","width=500,height=265,top=0,left=0,toolbar=no,directories=no,status=no,scrollbar=no,resize=no,menubar=no");
}

function reloadPage(){
	window.location.reload();
}
