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;
      }
     }
    }
	//alert("getWindowWidth=>" + windowWidth);
    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;
      }
     }
    }
	//alert("getWindowHeight -> " + windowHeight);
    return windowHeight;
}


function resizeHauteur(calque){
//alert("resizeHauteur(" + calque + ")");
	hauteur=getWindowHeight();
	if(!(basPage)){
		basPage=0;
	}
//alert("1 - " + document.getElementById(calque).style.height);
	document.getElementById(calque).style.height=(((hauteur-20)-basPage) - calqueTop) + "px";
//alert("2 - " + document.getElementById(calque).style.height);
}

function gereClick(type,bouton){
	//gere le type d'action sur le bouton
	switch(type){
	case "over":
		document.getElementById(bouton).src="_images/" + bouton + "_ON.png";
		break;
	case "out":
		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 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++) 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; x.src=a[i+2];}
}

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 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 reloadPage(){
	window.location='index.php';
}

function showListe(type,nomListe){
//alert("showListe type:" + type + " - nomListe:'" + nomListe + "'");
	switch(type){
	//case "over":
	//	document.getElementById(nomListe).style.visibility='visible';
	//	break;
	case "out":
		if(nomListe=="all_profession"){
		document.getElementById('ssMenu_profession').style.visibility='hidden';
		document.getElementById('ssMenu_cartes').style.visibility='hidden';
		document.getElementById('ssMenu_formation').style.visibility='hidden';
		}else if(nomListe=="ssMenu_formation"){
		document.getElementById('ssMenu_formation').style.visibility='hidden';
		}else if(nomListe=="ssMenu_cartes"){
		document.getElementById('ssMenu_cartes').style.visibility='hidden';
		}else if(nomListe=="ssMenu_profession"){
		document.getElementById('ssMenu_profession').style.visibility='hidden';
		}else{
			if(nomListe!=""){
				document.getElementById(nomListe).style.visibility='hidden';
			}
		}
		break;
	case "click":
		if(document.getElementById(nomListe).style.visibility=='visible'){
			document.getElementById(nomListe).style.visibility='hidden'
		}else{
			document.getElementById(nomListe).style.visibility='visible'
		}
		break;
	}
}

function getPositions(evt) {
//alert('getPositions');
if (navigator.appName=="Microsoft Internet Explorer") {
	x = event.x + document.body.scrollLeft;
  	y = event.y + document.body.scrollTop;
}  else {
	if(!evt) evt = window.event;    
	x = evt.clientX;
   y = evt.clientY;	
}
//window.status="x:"+x+" - y:"+y;
}
