/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function(){
	 $('ul#horizontal>li').each(function(){
	 	var childClasses = $(this).find('a').attr('class');
	 	$(this).addClass(childClasses);
	 });
	 $('ul#horizontal>li>a').addClass('fixedWidth');
	 $('ul#horizontal>li:last-child>a').addClass('acheter');
	 
	 
	 
	 
	 
 // ------------------------------------------------------------------------------------
// Slide produits
// ------------------------------------------------------------------------------------
		
		// Création des div supplémentaires
		
		$(".item_menu_off").animate({"opacity" : 0},500);
		
		$("#gamme > li").live("mouseenter",function(){
		  	// Animate BG
		  	$(this).children(".item_menu_off").addClass("item_menu_on").removeClass("item_menu_off");
		  	$(".item_menu_off").css({"z-index": "175"});
	    	$(".item_menu_off").stop().animate({"opacity" : 0.5},{queue:false,duration:400});
		 });
		 
		 $("#gamme > li").live("mouseleave",function(){
		  	$(this).children(".item_menu_on").addClass("item_menu_off").removeClass("item_menu_on");
		  	$(".item_menu_off").css({"z-index": "100"});
		    $(".item_menu_off").stop().animate({"opacity" : 0},{queue:false,duration:400});
		 });
		 
		
		
		var i_li = 0;
		var li_width = 0;
		$("#gamme > li").each(function(){
			li_width = $(this).width() + 3;
			return 0;
		});
		var li_nb = $("#gamme > li").size();
		var nb_li_pp = 3;
		
		
		$("#left_arrow").live("click", function(){
			//alert(i_li);
			if(i_li != parseInt(i_li)) i_li = parseInt(i_li) - 1;
			//alert(i_li);
			if(i_li < 0){
				i_li++;
				$('#gamme').animate({'marginLeft' : li_width*i_li},200);
			}
			return false;
		});
		
		$("#right_arrow").live("click", function(){
			i_li = parseInt(i_li);
			if(i_li > (li_nb*-1) + nb_li_pp){
				i_li--;
				$('#gamme').animate({'marginLeft' : li_width*i_li},200);
			}
			return false;
		});
		
		
		
		

	 
	 
	 
	 
	 
	 
	 
	 });


