

$('document').ready(function(){
	$('a').click(function(){
		if($(this).attr('href').substr(0,domain.length)!=domain && $(this).attr('href').substr(0,1)!='#' && $(this).attr('href').substr(0,10)!='javascript'){
			window.open($(this).attr('href'),'_blank');
			return false;	
		}
	});
	/*$('.blank').click(function(){
		window.open($(this).attr('href'));
		return false;
	});*/
	$('.content_menu').each(function(){
		$(this).height($('.longue').height());
	});
	$('.fancy').fancybox();
	$('#slider').wslide({
                width: 445,
                height: 80,
                horiz: true
        });
carres();
slide();
box();
	$('.logoRef').tooltip({
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - "
	});
	
	var h = 0;
	var p =0;
	var e =0;
	var maxE=0;
	var maxP =0
	var maxH = 0;
	$('.box_produit').each(function(){
		h = $(this).height();
		p = $(this).children('.description_box').height();
		e = $(this).children('.box_caracTp').height();
		if(h > maxH) maxH=h;	
		if(p > maxP) maxP=p;
		if(e > maxE) maxE=e;	
	});
	$('.box_produit').height(maxH);
	$('.box_caracTp').height(maxE);	
	$('.description_box').height(maxP);
});

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');
});
}
