/**********************************************
* Browser definition                          *
**********************************************/
var browserOK = false;
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1 && navigator.userAgent.toLowerCase().indexOf('opera') == -1) {
	var isIE = true;
	var menutimer;
	//get IE version
	if (navigator.userAgent.toLowerCase().indexOf("msie 5.5") != -1) {
		var isIE55 = true;
		browserOK = true;
	} else if (navigator.userAgent.toLowerCase().indexOf("msie 6") != -1)  {
		var isIE6 = true;
		browserOK = true;
	} else if (navigator.userAgent.toLowerCase().indexOf("msie 7") != -1)  {
		var isIE7 = true;
		browserOK = true;
	}
	var timerdiv;
	var timerli;
	var elementdiv;
	var elementli;
} else if (navigator.userAgent.toLowerCase().indexOf('opera') != -1) {
	//not compatible for now (tried with opera 8 & 9)
	var isOp = true;
} else if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1 || 
		  (navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && (navigator.userAgent.toLowerCase().indexOf('rv:1.7') != -1 || navigator.userAgent.toLowerCase().indexOf('rv:1.8') != -1))) {
	browserOK = true;
	var isMoz = true;
}

function CMS_addEvent(obj, evType, fcn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fcn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fcn);
		return r;
	} else {
		return false;
	}
	return true;
}

/*add some events on menu for IE compatibility only*/
function startMenu() {
	if (isIE && !isIE7) {
		var liMenu = document.getElementById("menuTopBlock").getElementsByTagName('li');
		for (var i=0; i<liMenu.length; i++) {
			li = liMenu[i];
		  	if (li.nodeName=="LI" && li.className.substring(9) == "link3") {
		  		li.onmouseenter=function() {
		  			this.className = "CMS_lvl1 over link3";
		    	}
		  		li.onmouseleave=function() {
		  			this.className = "CMS_lvl1 link3";
				}
			}

		  	if (li.nodeName=="LI" && li.className.substring(9) == "link24") {
		  		li.onmouseenter=function() {
		  			this.className = "CMS_lvl1 over link24";
		    	}
		  		li.onmouseleave=function() {
		  			this.className = "CMS_lvl1 link24";
				}
			}
			
		  	if (li.nodeName=="LI" && li.className.substring(9) == "link31") {
		  		li.onmouseenter=function() {
		  			this.className = "CMS_lvl1 over link31";
		    	}
		  		li.onmouseleave=function() {
		  			this.className = "CMS_lvl1 link31";
				}
			}
		}
	}
}

CMS_addEvent(window, 'load', function() {
	startMenu();
	if(typeof sIFR == "function"){
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:".parent h1", sFlashSrc:"/swf/ChollaSans.swf", sColor:"#4f3366", sBgColor:"Null", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:".parent3 h1", sFlashSrc:"/swf/ChollaSans.swf", sColor:"#2f8baa", sBgColor:"Null", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:".parent24 h1", sFlashSrc:"/swf/ChollaSans.swf", sColor:"#942f7b", sBgColor:"Null", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:".parent31 h1", sFlashSrc:"/swf/ChollaSans.swf", sColor:"#7da108", sBgColor:"Null", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent"}));
		}
});


$(document).ready(function(){
	$('a.gDefinition').each(function(){
		$(this).hover(
			function(e){
				$('#gtextDefinition').html($(this).attr('title'));
				$(this).attr({'title':''});
				$('#gDefinition').css({'top' : e.pageY-50, 'left' : e.pageX+20, 'display':'block'});
			},
			function(e){
				$(this).attr({'title':$('#gtextDefinition').html()});
				$('#gDefinition').css({'display':'none'});
			}
		)
	});
	
	$("a").removeClass("nojs");
	$(".recherche input:text").focus(function(){
		if($(".recherche input:text").val() == "Mots clés"){
			$(".recherche input:text").val("");
		}
	})
	$(".recherche input:text").blur(function(){
		if($(".recherche input:text").val() == ""){
			$(".recherche input:text").val("Mots clés");
		}
	})
});



