// unobtrusive javascript
document.getElementsByTagName("html")[0].className = "has_js";

$(document).ready(function(){ 
	//calcul de la hauteur des menus
	$('#menu ul li .wagram').show();
	$("#menu ul li:has(ul)").children(".wagram").each(function(){
		var maxHeight = 0;
		$(this).children("ul").each(function() {
			if($(this).outerHeight() > maxHeight){
				maxHeight = $(this).outerHeight();
			}
		});
		$(this).css('height', + maxHeight +"px");
	});
	
	//menu
	$('#menu ul li .wagram').hide();
	
	// corner under IE
	if($.browser.msie) {
		$('#menu ul li .wagram').corner("5px");
	}
	
	$("#menu ul li:has(ul)").hoverIntent({
		sensitivity: 8,
		interval: 50,
		over: deploy,
		timeout: 200,
		out: retract
	});

	//focus navigation
	$("#menu ul li:has(ul) > a").focus(function () {
		$(this).parents('li').focus();
	  });
	$("#menu ul li:has(ul)").focus(function () {
    retract2($(this));
    deploy2($(this));
  });

	$('#identifiant, #mdp, #Searchtext').focus(function(){
        if (this.value == this.defaultValue) this.value = '';
    }).blur(function(){
        if (this.value == '') this.value = this.defaultValue;
    }); 

}); // end dom ready

//function navigation over
	function deploy(){
		$(this).addClass('withVisible');
		completeWidth = 0;
		$(this).children('.wagram').slideDown('fast').css('left','0');
		$(this).children(".wagram").children("ul").each(function() {
			completeWidth = completeWidth + $(this).outerWidth({margin:true});
		});
		$(this).children('.wagram').css('width', + completeWidth +"px");
	}

//function navigation out
	function retract(){
		$(this).removeClass('withVisible');
		$(this).children('.wagram').slideUp('fast');
	}

//function focus navigation over
	function deploy2(elem){
		elem.addClass('withVisible');
		completeWidth = 0;
		elem.children('.wagram').slideDown('fast').css('left','0');
		elem.children(".wagram").children("ul").each(function() {
			completeWidth = completeWidth + $(this).outerWidth({margin:true});
		});
		elem.children('.wagram').css('width', + completeWidth +"px");
	}

//function focus navigation out
	function retract2(elem){
		$("#navigation ul li:has(ul)").removeClass('withVisible');
		$('.wagram').slideUp('fast');
	}

