
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

/*************************************************************************
  Code communiqué par François Pumir... Voir si pas un peu vieux maintenant
*************************************************************************/


var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
var NS6 = (document.getElementById) ? 1: 0;
		
		function hide(calque){
	if(IE4 && document.all[calque]){
		document.all[calque].style.visibility="hidden";
	}
	if(NS4 && document.layers[calque]){
		document[calque].visibility="hidden";
	}
	if(NS6 && document.getElementById(calque)){
		document.getElementById(calque).style.visibility="hidden";
	}
		}
		function show(calque){
	if(IE4 && document.all[calque]){
		document.all[calque].style.visibility="visible";
	}
	if(NS4 && document.layers[calque]){
		document[calque].visibility="show";
	}
	if(NS6 && document.getElementById(calque)){
		document.getElementById(calque).style.visibility="visible";
	}
		}
		
/*************************************************************************
 Permet de contourner le fait que IE ne comprend pas li:hover 
 voir l'article  http://www.pompage.net/pompe/deroulants/
*************************************************************************/		
		sfHover = function() {
	var sfEls = document.getElementById("menu").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"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
