<!--


//=============================================
// 				ANIMATION CHARGEMENT
//=============================================
function animation_chargement() {	
	$('#menu_content').stop().animate({top: 0}, {queue: false, duration: 450, complete: function() {
			$('#logo_01').stop().animate({top: '33px'}, {queue: false, duration: 150, complete: function() {
					$('#logo_02').stop().animate({width: '197px'}, {queue: false, duration: 800, easing: 'easeOutCubic'});
				}
			});
		}
	});	
}


function display_menu() {	
	$('#menu_content').stop().animate({top: 0}, {queue: false, duration: 0, complete: function() {
			$('#logo_01').stop().animate({top: '33px'}, {queue: false, duration: 0, complete: function() {
					$('#logo_02').stop().animate({width: '197px'}, {queue: false, duration: 0, easing: 'easeOutCubic'});
				}
			});
		}
	});	
}


//=============================================
//=============================================



//=============================================
// 						MENU TOP
//=============================================
$(function() {    
    $('#menu .menu').hover(function(){
        $(this).find('span').stop().animate({bottom: 0}, {queue:false, duration:500})
		$(this).find('a').each(function(){
				if($(this).attr("class") != "no_touch"){
					
					$(this).stop().animate({color: '#507b2a'}, {queue:false, duration:350});
				}
				
			});
    },
        function(){
            $(this).find('span').stop().animate({bottom: '-58px'}, {queue:false, duration:350});
			$(this).find('a').each(function(){
				if($(this).attr("class") != "no_touch"){
					
					$(this).stop().animate({color: '#fff'}, {queue:false, duration:150});
				}
				
			});
	});     
	
	
	
});




	
	
$(function() {    
	
	$("#produc_menu").mouseover(function(evt){
		$("#subMenuProduct").css("display", "block");
	});
	
	$("#produc_menu").mouseout(function(evt){
		
		$("#subMenuProduct").css("display", "none");
	});
});
//=============================================
//=============================================



//=============================================
// 						MENU LEFT
//=============================================
function open_subMenu(_item_click) {
	var _this = $('#left_menu .menu:eq('+_item_click+')');
	_this.attr('class', 'menu activ');
	_this.css('background', '#7b7979');
	_this.find('.second_nav').css('background', '#231f20');
	_this.find('ul.subMenu').slideDown(600);	
}

var controlAutoOpen = false;

$(function() {    
    $('#left_menu .menu').click(function(){
		
		if(controlAutoOpen){
				if($(this).find('ul.subMenu').css('display') == 'none') {
					
					var _this = $(this);
					var mon_elemnt_click = $(this).find('.first_nav');
					
					$('#left_menu .menu').attr('class', 'menu');
					$('#left_menu .menu').css('background', '#231f20');
					$('#left_menu ul.subMenu').slideUp(250);
					
					var indice_tilte_click = 0 ;
					$('#left_menu li.menu').each(function (indice, blabla) {				
						if($(this).find('.first_nav').html() == mon_elemnt_click.html()){
							_item_click = indice;
							setTimeout('open_subMenu('+_item_click+')', 300);
						}					
					});
									
				}else{
					
					$(this).attr('class', 'menu');
					$(this).css('background', '#231f20');
					$(this).find('ul.subMenu').slideUp(250);
					
				}
		}
    });
	
	$('#left_menu .menu').hover(function(){
		if($(this).attr('class') != 'menu activ')
        $(this).stop().animate({backgroundColor: '#7b7979'}, {queue:false, duration:150});
    },
        function(){
			if($(this).attr('class') != 'menu activ')
            $(this).stop().animate({backgroundColor: '#231f20'}, {queue:false, duration:350});
    });
	
	$('#left_menu .second_nav').hover(function(){
		if($(this).attr('class') != 'subMenu_list activ')
        $(this).stop().animate({backgroundColor: '#393637'}, {queue:false, duration:150});
    },
        function(){
			if($(this).attr('class') != 'subMenu_list activ')
            $(this).stop().animate({backgroundColor: '#231f20'}, {queue:false, duration:350});
    }); 
	   
});
//=============================================
//=============================================



//=============================================
// 						SLIDER
//=============================================
$(function() {
	if(typeof($('#slider').nivoSlider) == "function"){
		$('#slider').nivoSlider({
			effect: 'boxRandom', // Specify sets like: 'fold,fade,sliceDown'
			slices: 15, // For slice animations
			boxCols: 8, // For box animations
			boxRows: 4, // For box animations
			animSpeed: 500, // Slide transition speed
			pauseTime: 3000, // How long each slide will show
			startSlide: 0, // Set starting Slide (0 index)
			directionNav: false, // Next & Prev navigation
			directionNavHide: false, // Only show on hover
			controlNav: true, // 1,2,3... navigation
			controlNavThumbs: false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel: false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav: true, // Use left & right arrows
			pauseOnHover: true, // Stop animation while hovering
			manualAdvance: false, // Force manual transitions
			captionOpacity: 0.8, // Universal caption opacity
			prevText: 'Prev', // Prev directionNav text
			nextText: 'Next', // Next directionNav text
			beforeChange: function(){}, // Triggers before a slide transition
			afterChange: function(){}, // Triggers after a slide transition
			slideshowEnd: function(){}, // Triggers after all slides have been shown
			lastSlide: function(){}, // Triggers when last slide is shown
			afterLoad: function(){} // Triggers when slider has loaded
		});
	}
});
//=============================================
//=============================================



//=============================================
//		LISTING 01 (brands / products ...)
//=============================================
$(function() {
	
	$('#listing_01 .item').hover(function(){
		var _this = $(this);
		_this.find('.hover').css('display','block');
        _this.find('.hover_borderTop').css('width','321px');
		_this.find('.hover_borderRight').stop().animate({height: '259px'}, {queue:false, duration:150, easing: 'easeInCirc', complete: function() {
				_this.find('.hover_borderBottom').stop().animate({width: '321px'}, {queue:false, duration:150, easing: 'easeOutCirc', complete: function() {
						_this.find('.hover_borderLeft').stop().animate({height: '259px'}, {queue:false, duration:150, easing: 'easeInOutCirc'});
					}
				});
			}
		});
    },function(){
		var _this = $(this);
		_this.find('.hover').css('display','none');
		_this.find('.hover_borderLeft').css('height','0');
		_this.find('.hover_borderBottom').css('width','0');
		_this.find('.hover_borderRight').css('height','0');
		_this.find('.hover_borderTop').css('width','0');
    });
	   
});
//=============================================
//=============================================



//=============================================
//					HOVER BTN
//=============================================
$(function() {
	
	$('.bt_02, .bt_03').hover(function(){
		$(this).find('.hover').animate({opacity: 1}, {queue: false, duration: 150});
    },function(){
		$(this).find('.hover').animate({opacity: 0}, {queue: false, duration: 250});
    });
	   
});
//=============================================
//=============================================



//=============================================
// 				LISTING 02 (open) 
//=============================================
$(function() {
	/* View More */    
    $('ul#listing_02 .open_view_more').click(function(){
		
		if($(this).parent().parent().find('.view_more').css('display') == 'none') {
			
			$(this).fadeOut(600);
			$(this).parent().find('.bt_03').fadeIn(350);
			$(this).parent().parent().find('.view_more').slideDown(600, 'easeOutCubic');
							
		}else{
			
			$(this).fadeOut(600);
			$(this).parent().find('.bt_02').css('display', 'block');
			$(this).parent().parent().find('.view_more').slideUp(600, 'easeOutCubic');
			
		}
		
		return false;
		
    });
	
	
	/* Image Box */
	$('ul#listing_02 .image_box').click(function(){
		
		var _link = $(this).attr('href');
		console.log(_link);
		$.fancybox(
			{
				'autoDimensions'	: true,
				'width'         		: 'auto',
				'height'        		: 'auto',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'href' : _link
			}
		);
		
		/*var _this = $(this);
		
		
		$('ul#listing_02 .image_box').parent().css('z-index', 333);
		if($('#image_open').length == 1) {
			$('#image_open').css('display', 'none');
			$('#image_open').remove();
		}
		
		$('ul#listing_02 .image_box').parent().find('.image_zoom').animate({height: 0, width: 0, borderWidth: 0}, {queue: false, duration: 150, complete: function() {
				_this.parent().css('z-index', 444);
				_this.parent().find('.image_zoom').animate({height: '500px', width: '670px', borderWidth: '4px'}, {queue: false, duration: 800});
			}
		});
		
		
		//_this.parent().find('.image_zoom').append('');
		
		var mon_img = new Image();
		$(mon_img).load(function(){
			_this.parent().find('.image_zoom').append('<img id="image_open" src="'+_link+'" />');
		})
		.attr("src", _link);
		
		
		$('#image_open').fadeIn(2000);
		
		$.ajax({
			type: 'GET',
			url: _link,
			data: 'content=1',
			error:function(msg){
			 alert( "Error !: " + msg );
			},
			success:function(reponse){
				temp = reponse;
				console.log(reponse);				
			}
			
		});*/
		
		return false;
		
    });
	
	
	$('ul#listing_02 .image_zoom').click(function(){
		
		if($(this).width() == '670') {
		
			$('ul#listing_02 .image_box').parent().css('z-index', 333);
			if($('#image_open').length == 1) {
				$('#image_open').css('display', 'none');
				$('#image_open').remove();
			}
			$('ul#listing_02 .image_box').parent().find('.image_zoom').animate({height: 0, width: 0, borderWidth: 0}, {queue: false, duration: 450});
		
		}
		
	});
	
});
//=============================================
//=============================================


function connexion(){
		$.ajax({
		   type: "POST",
		   url: "/ajax/log-in.php",
		   data: "email="+$("#email_connexion").val()+"&pass="+$("#pass_connexion").val(),
		   success: function(msg){
				var t_msg = msg.split("{#}");
				if(t_msg[0] == 1){
					document.location.href = "/"; 
				}else{
					alert(t_msg[1]);	
				}
		   }
		 });
}


function inscriptionNewsletter(){
		$.ajax({
		   type: "POST",
		   url: "/ajax/add-newsletter.php",
		   data: "email="+$("input[name='nl_mail']").val(),
		   success: function(msg){
				var t_msg = msg.split("{#}");
				alert(t_msg[1]);	
		   }
		 });
}



function addToCart(element){
	var parent = $(element).parent();
	
	var quantity = parent.children("input[name='quantity']").val();
	var id_product = parent.children("input[name='product_id']").val();
	
	if(typeof(quantity) == "undefined" || (typeof(quantity) != "undefined" && quantity == 0) || (typeof(quantity) != "undefined" && quantity == "") ){
		alert("Vous devez renseigner une quantité supérieur à 0");
		return ;
	}
	
		$.ajax({
		   type: "POST",
		   url: "/ajax/addToCart.php",
		   data: "id_product="+id_product+"&quantity="+quantity,
		   success: function(msg){
				var t_msg = msg.split("{#}");
				if(t_msg[0] == 1){
					$("#nbre_produit").html(t_msg[1]);
					alert("Your product has been added to your cart");
				}else{
					alert(t_msg[1]);	
				}
		   }
		 });
}


function justNumber(element){
      	var re = new RegExp("[^0-9]", "g");

		$(element).val($(element).val().replace(re, ""))	
		
}


-->
