function initNav(category,currentItem){
		
	try {
	
	// Affichage de la nav
	$('nav5').style.display = "block";
	
	// on masque tous les éléments
	$$('#nav5 ul').each(function(elmt,i){
		elmt.hide();
	});
	}catch(e){}
	
	try {
	// Affichage de la nav
	$('nav8').style.display = "block";
	
	// on masque tous les éléments
	$$('#nav8 ul').each(function(elmt,i){
		elmt.hide();
	});
	}catch(e) {}
	
	// si on a passé le menu à déplier en paramètre
	if(category){
		// on déplie la catégorie
		$$('#'+category).each(function(elmt,i){
			if((currentItem)&&($(currentItem))&&($(currentItem).ancestors()[4].descendants()[0].id == category)) elmt.ancestors()[0].addClassName("open"); // si l'item "allumé" est différent de rien, s'il existe effectivement dans le DOM et si son ancêtre est bien la catégorie passée en paramètre, alors on met l'ancêtre à "open"
			else elmt.ancestors()[0].addClassName("on");
			if (elmt.next('ul')) elmt.next('ul').show();
		});
		// gestion des clicks
		$$('ul.withArrows li a').each(function(elmt,i){
			elmt.valClick = 0;
			if(elmt.next('ul')){
				elmt.onclick = function() {return false;}
				Event.observe(elmt, 'click', function(){
					$$('ul.withArrows li').each(function(elmt2,i){
						// tous les éléments à off
						elmt2.removeClassName("on");
					});
					elmt.ancestors()[2].removeClassName("on");
					elmt.ancestors()[2].addClassName("open");
					elmt.valClick++;

					if(elmt.valClick%2 != 0){
						// ouverture
						$$('ul.withArrows li a').each(function(elmt2,i){
							// cachage des autres éléments
							if(elmt2.next('ul')){
								elmt2.ancestors()[0].removeClassName("on");
								elmt2.ancestors()[0].removeClassName("open");
								elmt2.valClick = 0;
								elmt2.next('ul').hide();
							}
						});
						// ouverture du bon
						elmt.valClick = 1;
						elmt.ancestors()[0].addClassName("on");
						elmt.next('ul').show();
					}
					else{
						// fermeture
						elmt.ancestors()[0].removeClassName("on");
						elmt.ancestors()[0].removeClassName("open");
						elmt.ancestors()[2].removeClassName("open");
						elmt.ancestors()[2].addClassName("on");
						elmt.next('ul').hide();
					}
					return false;
				});
			}
		});
		// ouverture du bon élément s'il est passé en parametre

		if((currentItem)&&($(currentItem))&&(
			($(currentItem).ancestors()[4].descendants()[0].id == category) || // ancêtre niveau 2
			($(currentItem).ancestors()[2].descendants()[0].id == category) // ancêtre niveau 1
		)){
			$(currentItem).ancestors()[2].addClassName("open");
			$(currentItem).ancestors()[2].descendants()[0].valClick = 1;
			$(currentItem).ancestors()[0].addClassName("on");
			$(currentItem).ancestors()[1].show();
		}
	}
}

// gestion des pictos "sacs" gérés en théorie uniquement via CSS
// script pour pallier à une insuffisance CSS de IE6
function rollPictosSacs(){
	if((navigator.appName=="Microsoft Internet Explorer")&&(navigator.userAgent.indexOf("MSIE 6") != -1)){
		$$('#rolloverPictos ul li a').each(function(elmt,i){
			if(elmt.descendants()[0]){
				Event.observe(elmt, 'mouseover', function(){
					elmt.descendants()[0].style.display = 'block';
				});
				Event.observe(elmt, 'mouseout', function(){
					elmt.descendants()[0].style.display = 'none';
				});
			}
		})
	}
}

// gestion des pictos "lignes"
function rollPictosLignes(){
	if ($('rollOverLignes')){
		// on masque les images au load
		$('rollOverLignes').hide();
		$$('#rollOverLignes img').each(function(elmt,i){
			elmt.hide();
		});
		
		
		if(Prototype.Browser.IE){
		
			// on rajoute les événements de roll
			Event.observe($('rolloverPictosLignes'), 'mouseenter', function(){
				$('rollOverLignes').show();
			});
			Event.observe($('rolloverPictosLignes'), 'mouseleave', function(){
				$('rollOverLignes').hide();
			});
			
			if ($('rolloverPictosLignes2')) Event.observe($('rolloverPictosLignes2'), 'mouseenter', function(){
				$('rollOverLignes').show(); 
			});
			if ($('rolloverPictosLignes2')) Event.observe($('rolloverPictosLignes2'), 'mouseleave', function(){
				$('rollOverLignes').hide();
			});
			
			if ($('rolloverPictosLignes3')) Event.observe($('rolloverPictosLignes3'), 'mouseenter', function(){
				$('rollOverLignes').show(); 
			});
			if ($('rolloverPictosLignes3')) Event.observe($('rolloverPictosLignes3'), 'mouseleave', function(){
				$('rollOverLignes').hide();
			});
			$$('#rolloverPictosLignes li a, #rolloverPictosLignes2 li a, #rolloverPictosLignes3 li a').each(function(elmt,i){
				Event.observe(elmt, 'mouseenter', function(){
					$$('#rollOverLignes img').each(function(elmt2,i){
						elmt2.hide();
					});
					
					if ($('img'+elmt.ancestors()[0].id)) $('img'+elmt.ancestors()[0].id).show();
					//else $('imgligne00').show();
				});
			})
			$('rollOverLignes').style.visibility = 'visible';
		}else{
			
			// on rajoute les événements de roll
			Event.observe($('rolloverPictosLignes'), 'mouseover', function(){
				$('rollOverLignes').show();
			});
			Event.observe($('rolloverPictosLignes'), 'mouseout', function(){
				$('rollOverLignes').hide();
			});
			
			if ($('rolloverPictosLignes2')) Event.observe($('rolloverPictosLignes2'), 'mouseover', function(){
				$('rollOverLignes').show(); 
			});
			if ($('rolloverPictosLignes2')) Event.observe($('rolloverPictosLignes2'), 'mouseout', function(){
				$('rollOverLignes').hide();
			});			
			if ($('rolloverPictosLignes3')) Event.observe($('rolloverPictosLignes3'), 'mouseover', function(){
				$('rollOverLignes').show(); 
			});
			if ($('rolloverPictosLignes3')) Event.observe($('rolloverPictosLignes3'), 'mouseout', function(){
				$('rollOverLignes').hide();
			});
			$$('#rolloverPictosLignes li a, #rolloverPictosLignes2 li a, #rolloverPictosLignes3 li a').each(function(elmt,i){
				Event.observe(elmt, 'mouseover', function(){
					$$('#rollOverLignes img').each(function(elmt2,i){
						elmt2.hide();
					});
					
					if ($('img'+elmt.ancestors()[0].id)) $('img'+elmt.ancestors()[0].id).show();
					//else $('imgligne00').show();
				});
			})
			$('rollOverLignes').style.visibility = 'visible';
		}

	}
}

function initNavItem(){}

Event.observe(document,"dom:loaded",function(){

    var centerValue;

	$$('.submenu').each(function(elmt,i){
		if(elmt.childElements('li').length == 1){
			elmt.childElements('li.animPM')[0].childElements('a')[0].addClassName('lonely');
		}
	});
	
	//if (nav5opened == "articles") {rollPictosSacs();}
	//else if ((nav5opened == "lignes")||(nav5opened == "produits")) {rollPictosLignes();}
	initNav(nav5opened,currentNav5Item);
	
	$("rolloverPictosLignes") ? rollPictosLignes() : "" ;
	
	if(Prototype.Browser.IE){
		if($('sliderBar')){
			$$(".lignes").invoke('observe','mouseenter', function(){
				$('sliderBar').style.display = 'none';
			});
			$$(".lignes").invoke('observe','mouseleave', function(){
				$('sliderBar').style.display = 'block';
			});
		}
	}
   
	$$("#nav-menu li.hover").each(function(s){
	      var sectionMenu = s.select(".submenu")[0],
    		topMarge = 25,
			centerValue = 0
			coreDiv = ( $("standardCore") ? $("standardCore") : $("wideCore") );
             // topMarge = sectionMenu.id=='rolloverPictosLignes' ? 10 : 10;
              topMarge = 10;
              var hauteurSectionMenu=Math.round(sectionMenu.getHeight()/2);
              if(((sectionMenu.up().offsetTop - hauteurSectionMenu) < $("nav-menu").offsetTop + topMarge) || ((sectionMenu.up().offsetTop + sectionMenu.getHeight()) > (coreDiv.getHeight() + coreDiv.offsetTop)) ){
			centerValue = -( sectionMenu.up().offsetTop );
		}else{
			centerValue = Math.round( -( (sectionMenu.getHeight()/2) - (s.getHeight()/2) ) );
		}
		/**if( ((sectionMenu.up().offsetTop - sectionMenu.offsetTop) < $("nav-menu").offsetTop + topMarge) || ((sectionMenu.up().offsetTop + sectionMenu.getHeight()) > (coreDiv.getHeight() + coreDiv.offsetTop)) ){
			centerValue = -( sectionMenu.up().offsetTop );
		}else{
			centerValue = Math.round( -( (sectionMenu.getHeight()/2) - (s.getHeight()/2) ) );
		}*/

		s.select('.submenu').invoke('setStyle',{
			top:centerValue+"px",
			left:$("nav-menu").getWidth()-2+"px"
		});

        s.select('#rollOverLignes').invoke('setStyle',{
			top:"0px"
		});

});

var topMarge=0;
	
	if(Prototype.Browser.IE){
		$$("#nav-menu li.hover").invoke('observe','mouseenter', function(){
			this.select('.submenu').invoke('setStyle',{
				visibility:'visible'
			});
			if ($('rolloverPictosLignes')){
				 $('rolloverPictosLignes').style.top = topMarge+'px';//0px';
			}
		});
		$$("#nav-menu li").invoke('observe','mouseleave', function(){
			this.select('.submenu').invoke('setStyle',{
				visibility:'hidden'
			});
		});
	}else{
		$$("#nav-menu li.hover").invoke('observe','mouseover', function(){
			this.select('.submenu').invoke('setStyle',{
				visibility:'visible'
			});
			
			if ($('rolloverPictosLignes')){
				$('rolloverPictosLignes').style.top = topMarge+'px';//0px';
			}
			
		});
		$$("#nav-menu li").invoke('observe','mouseout', function(){
			this.select('.submenu').invoke('setStyle',{
				visibility:'hidden'
			});
		});		
	}
})
