/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \
|		
|		Copyright (c) 2007 Kipling
|		Design + HTML/CSS/DOM JavaScript : Smart Agence
|		http://www.smartagence.com/
|		
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


/* ______________________[ 01 | Interactivit� du menu principal (menu horizontal) ]________________________ */

/* A special thanks goes to Eric Shepherd for his ALA article about �Hybrid CSS Dropdowns�: http://www.alistapart.com/articles/hybrid/ 
and to Patrick Griffiths and Dan Webb for their htmldog.com article �Sons of Suckerfish�: http://www.htmldog.com/articles/suckerfish/ */

function SmartHover(who) {
	if (document.all&&document.getElementById&&document.getElementsByTagName&&document.getElementById(who)) {
		navRoot=document.getElementById(who);
		for (i=0;i<navRoot.childNodes.length;i++) {
			node=navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {this.className+=" over";}
				node.onmouseout=function() {this.className=this.className.replace(" over", "");}
			}
		}
	}
	SmartFocus(who);
}

function SmartFocus(who) {
	var navLnk=document.getElementById(who).getElementsByTagName("A");
	var navItm=document.getElementById(who).getElementsByTagName("LI");
	for (var n=0;n<navItm.length;n++) {
		if (navItm[n].className!="on") navItm[n].className="y";
	}
	for (var i=0;i<navLnk.length;i++) {
		navLnk[i].onfocus=function() {
			if (this.parentNode.parentNode.id==who) {
				this.parentNode.className+=" over";
			} else {
				this.parentNode.parentNode.parentNode.className+=" over";
			}
		}
		navLnk[i].onblur=function() {
			if (this.parentNode.parentNode.id==who) {
				this.parentNode.className=this.parentNode.className.replace(" over", "");
			} else {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(" over", "");
			}
		}
	}
}

function SmartSplash() {
	var args=SmartSplash.arguments;
	for (n=0;n<args.length;n++) {
		if (document.getElementById&&document.getElementsByTagName&&document.getElementById(args[n])) {
			navRoot=document.getElementById(args[n]).getElementsByTagName("LI");
			for (i=0;i<navRoot.length;i++) {
				node=navRoot[i];
				node2=navRoot[i].getElementsByTagName("UL");
				if (document.all) {
					node.onmouseover=function() {this.className+=" over";}
					node.onmouseout=function() {this.className=this.className.replace(" over", "");}
				}
				if (node2[0]) {
					var lP=node2[0].offsetWidth;
					var lC=node2[0].parentNode.firstChild.offsetWidth;
					pos2=lP>=lC?parseInt((lP-lC)/2):parseInt((lC-lP)/2);
					node2[0].style.marginLeft=lP>=lC?"-"+pos2+"px":pos2+"px";
				}
			}
		}
	}
}

/* ______________________[ 02 | Lancement des scripts ]________________________ */

window.onload=function() {
	if(document.getElementById("NavHaut")) SmartHover("NavHaut");
	SmartSplash("SplashList");
}

/* ______________________[ swap div : ]________________________ */
function swap_image(image_path, image_id){
				document.getElementById(image_id).src = image_path;
				
}
		