/* Javascripts utilisés sur le site
 * Mettez l'ensemble de vos fonctions générique javascript ici
 * 
 * La liaison avec les page se fait à l'aide du code ci-dessous :
 * <script type="text/javascript" src="css-js/scripts.js"></script>
 */



/* GESTION PIEDS DE PAGE */

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 setFooter(){

	var maxHeight = getWindowHeight();
	// récuopération de la hauteur du footer
	var footer = document.getElementById('footer');
	var menuTop = document.getElementById('menu-top');
	var container = document.getElementById('container');
	var footerHeigth = footer.offsetHeight;
	var topHeight = menuTop.offsetHeight;
	var containerHeight = container.offsetHeight;
	var inHeight=footerHeigth+topHeight+containerHeight;
	if (maxHeight > inHeight){
		var divHeight = (maxHeight - footerHeigth - topHeight);
		document.getElementById('contenu').style.height=divHeight+'px';
		document.getElementById('container').style.height=divHeight+'px';
	}

}

function centreFenetre(){
	var maxHeight = getWindowHeight();
	// récuopération de la hauteur du footer
	var container = document.getElementById('container-intro');
	var containerHeigth = container.offsetHeight;
	if (containerHeigth < maxHeight) {
		yContainer = (maxHeight-containerHeigth)/2;
		container.style.marginTop=yContainer+'px';
		}

}

/** infos bulle miniature accueil */
var IB=new Object;
var posX=0;posY=0;
var xOffset=50;yOffset=0;
function AffBulle(texte) {
  var contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"' width='"+IB.taille+"'><TR><TD style='font:11px Verdana; color:"+IB.ColTexte+";text-align:center;'>"+texte+"</TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
  var finalPosX=posX-xOffset;
  var posYFixe=239;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {
    document.layers["bulle"].document.write(contenu);
    document.layers["bulle"].document.close();
    document.layers["bulle"].top=posYFixe+yOffset;
    document.layers["bulle"].left=finalPosX;
    document.layers["bulle"].visibility="show";}
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    bulle.innerHTML=contenu;
    document.all["bulle"].style.top=posYFixe+yOffset;
    document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
    document.all["bulle"].style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    document.getElementById("bulle").innerHTML=contenu;
    document.getElementById("bulle").style.top=posYFixe+yOffset+"px";
    document.getElementById("bulle").style.left=finalPosX+"px";
    document.getElementById("bulle").style.visibility="visible";
  }
}
function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}
function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel,taille) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;IB.taille=taille;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}


