//window.addEvent('domready', init() );
window.onload = function() { init(); }

//---------------------------------- init -----------------------------------------------------------------------------------

function init() {
	initSearchInput();
	sfHover();
	initMooquee();
}

function selectMenuItem(menuItem_p) {
	$(menuItem_p).className="activeItem";
}

function initSearchInput() {
	//Ajoute l interactivite
	$('recherche').addEvent('click', function(e){
		e = new Event(e);
		if ( !this.i ) { this.i=0; }
		this.i ++
		if (this.i ==1) { this.setProperty('value',""); }
		e.stop(); }
	);
}

function sfHover() {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		if (ieversion<8) {
			var sfEls = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
							
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
					
					//Correction bug IE7
					if ( ieversion==7 ) { if ( $(this).getElement('ul') != null ) { $(this).getElement('ul').setStyle('left','auto'); }}
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
					
					//Correction bug IE7
					if ( ieversion==7 ) { if ( $(this).getElement('ul') != null ) {
						//$(this).getElement('ul').setStyles('left: -999em; '); mootols 1.1
						$(this).getElement('ul').setStyle('left','-999em');
						}
					}
				}
			}		 
		}
	}
}

function initMooquee() {
	var obj;
	obj = new mooquee($('mooquee1'), {marWidth: 960,marHeight: 30,speed:35,pauseOnOver:true} );
}