// JavaScript Document
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}
mcAccessible = function() {
	var mcEls = document.getElementById("nav").getElementsByTagName("A");
	for (var i=0; i<mcEls.length; i++) {
		mcEls[i].onfocus=function() {
			this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
			this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
				}
			}
		}
		mcEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
			this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				}
			}
		}
	}
}

// only ie needs the sfHover script. all need the accessibility script...
// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventListener) window.addEventListener('load', mcAccessible, false); // gecko, safari, konqueror and standard
else if(document.addEventListener) document.addEventListener('load', mcAccessible, false); // opera 7
else if(window.attachEvent) { // win/ie
	window.attachEvent('onload', sfHover);
	window.attachEvent('onload', mcAccessible);
} else { // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			existing();
			sfHover();
			mcAccessible();
		}
	} else {
		window.onload = function() {
			sfHover();
			mcAccessible();
		}
	}
}

if (document.images) {
    welcome_up       = new Image();
    welcome_up.src   = "images/btn_bienvenue.gif";
	welcome_over       = new Image();
    welcome_over.src   = "images/btn_bienvenue_over.gif";
	
	jumpin_up       = new Image();
    jumpin_up.src   = "images/btn_allezy.gif";
    jumpin_over       = new Image();
    jumpin_over.src   = "images/btn_allezy_over.gif";
	
	lr_up       = new Image();
    lr_up.src   = "images/btn_ressources.gif";
    lr_over       = new Image();
    lr_over.src   = "images/btn_ressources_over.gif";
	
	coach_up       = new Image();
    coach_up.src   = "images/btn_formateur.gif";
    coach_over       = new Image();
    coach_over.src   = "images/btn_formateur_over.gif";
	
	prev_up       = new Image();
    prev_up.src   = "images/btn_precedent.gif";
    prev_over       = new Image();
    prev_over.src   = "images/btn_precedent_over.gif";
	
	next_up       = new Image();
    next_up.src   = "images/btn_suivant.gif";
    next_over       = new Image();
    next_over.src   = "images/btn_suivant_over.gif";
	
	print_up       = new Image();
    print_up.src   = "images/btn_print.gif";
	print_over       = new Image();
    print_over.src   = "images/btn_print_over.gif";
	
	prev_btm_up       = new Image();
    prev_btm_up.src   = "images/btn_precedent_bottom.gif";
    prev_btm_over       = new Image();
    prev_btm_over.src   = "images/btn_precedent_bottom_over.gif";
	
	next_btm_up       = new Image();
    next_btm_up.src   = "images/btn_suivant_bottom.gif";
    next_btm_over       = new Image();
    next_btm_over.src   = "images/btn_suivant_bottom_over.gif";
	
	print_btm_up       = new Image();
    print_btm_up.src   = "images/btn_print_bottom.gif";
	print_btm_over       = new Image();
    print_btm_over.src   = "images/btn_print_bottom_over.gif";
}
function buttonover(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "_over.src");
    }
}
function buttonup(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "_up.src");
    }
}