if (window.attachEvent){
window.attachEvent('onload', sfHover);
}

/*retourne la heuteur du navigateur*/
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-205;
}

function flash() {
	if (!document.getElementById('banner').getElementsByTagName('img').length>0 ) {
		document.getElementById('banner').innerHTML = '<object type="application/x-shockwave-flash" data="/images/bandeau-haut-'+document.documentElement.lang+'.swf" width="770" height="133"><param name="movie" value="/images/bandeau-haut-'+document.documentElement.lang+'.swf"><param name="quality" value="best"/><param name="play" value="true"/><param name="scale" value="exactfit"/></object>';
	}
}

/*gestion de la hauteur de la page en javascript*/
function overflowConteneur(){
	//window.alert(getWindowHeight()+" pixels de haut");
	document.getElementById("contents").style.height=getWindowHeight()+"px";
}
function resize(e){

	overflowConteneur();

}



window.onresize = resize;

// menu deroulant compatibilité IE
function sfHover() {
    correctPNG();
    if (document.getElementById("first_level")!=undefined)
    {
        var sfEls = document.getElementById("first_level").getElementsByTagName("LI");
    	for (var i=0; i<sfEls.length; i++) {
    	   sfEls[i].onmouseover=function() {
    	       this.className+=" sfhover";
    	   }
    	   sfEls[i].onmouseout=function() {
    	       this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    	   }
        }
    }
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
   for(var i=0; i<document.images.length; i++)
      {
 
   var img = document.images[i];
   var imgName = img.src.toUpperCase();
   
   
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
      if (imgName.indexOf("ENSAVOIRPLUS.PNG")==-1 && imgName.indexOf("LIRELASUITE.PNG")==-1) {
   

       var imgID = (img.id) ? "id='" + img.id + "' " : ""
       var imgClass = (img.className) ? "class='" + img.className + "' " : ""
       var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" +
    img.alt + "' "
       var imgStyle = "display:inline-block;" + img.style.cssText
       if (img.align == "left") imgStyle = "float:left;" + imgStyle
       if (img.align == "right") imgStyle = "float:right;" + imgStyle
       if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
       var strNewHTML = "<span " + imgID + imgClass + imgTitle
       + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" +
    imgStyle + ";"
          + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
       + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
       img.outerHTML = strNewHTML
       i = i-1
        }
      }
     }
      
   }

function getElementsByClass(maClass, fromTag)  {
    var tabRetour = new Array();
    var tabTmp = new Array();
    var arr_class;
    tabTmp = document.getElementsByTagName(fromTag||"*");
    var j=0;
    for (i=0; i<tabTmp.length; i++) {
    
        arr_class = tabTmp[i].className.split(" ");
        
        for(var k=0; k<arr_class.length;k++ )
            if(arr_class[k]== maClass) {
                tabRetour[j++]=tabTmp[i];
            }
    }
    return tabRetour;
}


