function parseNavigation(id) {
	
	$("#"+id+" li:first").addClass("first");
	$("#"+id+" li:last").addClass("last");
	
	$("#"+id+" li").each(function(){
		if ($('ul',this).length != 0) {
			$(this).addClass("hassub");
						
			$(this).bind("mouseover",function(){
				$(this).addClass("hover");
				$("ul:first",this).addClass("over");
			})
			//si c'est ie on utilise mouseleave pour eviter le flickering
			if (brows.indexOf("microsoft") != -1 || brows.indexOf("msie") != -1) {
				$(this).bind("mouseleave",function(){
					$(this).removeClass("hover");
					$("ul:first",this).removeClass("over");
				})
			} else {
				$(this).bind("mouseout",function(){
					$(this).removeClass("hover");
					$("ul:first",this).removeClass("over");
				})
			}
		} else {
			this.onmouseover = function() {	$(this).addClass("hover"); }
			
			//si c'est ie on utilise mouseleave pour eviter le flickering
			if (brows.indexOf("microsoft") != -1 || brows.indexOf("msie") != -1) {
				this.onmouseleave = function() { $(this).removeClass("hover"); }
			} else {
			 	this.onmouseout = function() {	$(this).removeClass("hover"); }
			}
		}
	});
}




$(function(){
	brows = navigator.appName.toLowerCase();	
	parseNavigation("nav");
	
	
	// hack pas super correct pour ie
	if (navigator.appVersion.toLowerCase().indexOf("msie 6.0") != -1) {
		$("ul#nav li a span:not(ul li ul li a span)").each(function(){				
			len = $(this).text();
			len = len.length;
			
			if (len < 10)
				$(this).css("width", 60);
			else if (len < 15) {
				$(this).css("width", 91);	
			} else if (len >= 16 && len <= 20) 
				$(this).css("width", 120);
			else {
				$(this).css("width", 134);	
			}
		});
	}	
});

