/*************************************************************************\
*   Description : Certains scripts légers     							  *
*   Par         : Pierre-Michel Morais-Godin                              *
*   Courriel    : pm [AT] NOSPAM [dot] adncomm [DOT] com                  *
*   Date        : 28 Avril 20079                                          *
*   Dependant de: prototype.js                                            *
\*************************************************************************/

// Bouton OverTweek ...
function ie(sender){
	if(document.all) sender.href='javascript:;';
}
function btn(sender){
	sender.childNodes[0].onclick=function(){window.location=this.parentNode.href};
}

// Good Old HTML Dog Succkerfish Dropdown modifié ...
function startList(elementID){
	if(window.attachEvent){
		var browser_is_ie = ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) );
		var browser_is_ie7 = ( browser_is_ie && /msie 7\.0/i.test(navigator.userAgent) );
		var inbackend = false;
		var iTest = (typeof(base2Test)!="undefined");
		
		if(document.getElementById(elementID)){
			if (browser_is_ie7 && inbackend == true) {
				/*document.getElementById("nav").onmouseout = function() {
					var itms = this.getElementsByTagName('*');
					for (var x=0;x<itms.length;x++) {
						itms[x].className=itms[x].className.replace(new RegExp(" sfhover\\b"), "");	
					}
					lastmouseover = false;
					lastmouseoveritem = null;
				}
				*/
				var sfEls = document.getElementById(elementID).getElementsByTagName("LI");
				for (var i=0; i<sfEls.length; i++) {
					sfEls[i].onmouseover=function() {
						if (lastmouseover) {
							lastmouseover = false;
							lastmouseoveritem.className = lastmouseoveritem.className.replace(new RegExp(" sfhover\\b"), "");
							lastmouseoveritem = null;
						}
						this.className+=" sfhover";
						this.style.zIndex=200;
						lastmouseover = true;
						lastmouseoveritem = this;
					}
					sfEls[i].onmouseout=function() {
						//document.getElementById('debug').innerHTML = this.innerText + ': ' + this.className.replace(new RegExp(" sfhover\\b"), "") + '<br />' + document.getElementById('debug').innerHTML;
						
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
						
						this.style.zIndex=10;
					}
				}
				
			}else{
				var sfEls = document.getElementById(elementID).getElementsByTagName("LI");
				if(iTest) alert(sfEls);
				for (var i=0; i<sfEls.length; i++) {
					sfEls[i].onmouseover=function() {
						this.className+=" sfhover";
						this.style.zIndex=200;
					}
					sfEls[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
						this.style.zIndex=10;
					}
				}
			}
		}
	}
}
// s'exécute une fois le dom loadé ...
//document.observe("dom:loaded", function() {startList("navigation");});