
$('document').ready(function(){
	$('.content_menu').each(function(){
		
		$(this).height($('.longue').height());
	});
	$('.fancy').fancybox();
	$('#slider').wslide({
                width: 550,
                height: 80,
                horiz: true
        });
		
	$('.nyroModal').nyroModal();
	$('.nyroModal').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ",
		extraClass: "right", 
		left : -300, 
		fade: 250, 
		bodyHandler: function() { 
        	return $(this).next('.textTooltipC').html(); 
    	} 
	});
	$('#showCondition').click(function(){
		$('#conditionIns').toggle();
	});
	boutique();
	carres();
	slide();

		box();
});
function boutique(){
	var h;
	
		var maxH=0;
	$('.box_produit').each(function(index,elm){
		
		if($(this).children('.box_img').children('img').height() > maxH){
			
			maxH = $(this).children('.box_img').children('img').height();
		}
		
	});
	
	h = maxH+10;
		$('.box_img').height(h);
}
function carres(){
	$('.menu a').hover(function(){
		$(this).parent().addClass('hover')
	});
	$('.menu a').mouseout(function(){
		$(this).parent().removeClass('hover');
	});
}

function slide(){
	var rel = 0;
	var doca = window.location.href;
	var doc = doca.split("#");
	
	var url = new Array();
	$('.lien').each(function(index,elm){
		var e=$(elm).attr('href').split('#');
		url[index] = e[1];
	});

	if (doc[1]===url[0]) rel = 0;
	else if (doc[1]===url[1]) rel=1;
	else if (doc[1]===url[2]) rel = 2;
	else if (doc[1]===url[3]) rel = 3;
	else if (doc[1]===url[4]) rel = 4;
	else if (doc[1]===url[5]) rel = 5;
	
	marginDefault=0;
	marge = parseInt($('.longue').css("margin-left"));
	
	$('.longue').animate({
		marginLeft: marginDefault - (rel*990)+'px'
	},500);
	
	$('.lien').click(function(){
		if($('.lien').hasClass('selected')){
			$('.lien').removeClass('selected');
		}
		rel = $(this).attr('rel');
		
		$('.longue').animate({
			marginLeft: marginDefault - (rel*990)+'px'
		},500);
	});
	$('.lien').hover(function(){
		$(this).children('.titleSlide').css('color', '#A85D42')
	},function(){
		$(this).children('.titleSlide').css('color', '#FFFFFF')
	}); 	
}

function box(){
$('.special').hover(function(){
	$(this).find('.contenu_box').css("display", 'block');
	$(this).find('.box_bottom').css("display", 'block');
}, function(){
	$(this).find('.contenu_box').css("display", 'none');
	$(this).find('.box_bottom').css("display", 'none');
});
}