$(document).ready(function() {
						   
	ppage = 6;
	page = 0;
											 
	$(".ts .listing img").mouseover(function(){
											 
		$(".listing strong").hide();
		
		$(".listing img").stop().css("width", 80);
		$(".listing img").stop().css("height", 190);
		
		offset = $(this).offset();
		listing = $(".listing").offset();
		
		decal =  offset.left-listing.left+(90-$(this).prev("strong").width())/2;
		if (decal/2 != Math.round(decal/2)) decal++;
							   
		$(this).prev("strong").css("margin-left", decal);
		$(this).prev("strong").show();
		
		$(this).stop().animate({width: "90px", height: "225px"}, "fast", function(){});
		
		
		
	});
	
	ref = -1
	
	$(".big").mouseover(function(){
								 
			if($(this).index(".big") != ref){		
							  
				ref = $(this).index(".big")
								 
				$(".sous_menus").hide();
				$(".big").removeClass("selected");
				$(this).addClass("selected");
				
				header = $(".main").offset();
				offset = $(this).offset();
				sous_menus = $(this).next(".sous_menus");
				
				
				decal = offset.left-header.left+($(this).width()-sous_menus.width())/2-12
				
				sous_menus.css("margin-left", decal);
				sous_menus.css("top", 100-(sous_menus.height()-100));		
				
	
				sous_menus.show();	
				
				
				
				sous_menus.stop().animate({top: "+=76px"}, "fast", function(){});
				
		  }
		  
	});
	
	$(".sous_menus").mouseleave(function(){
		ref = -1
		$(".sous_menus").hide();
		$(".big").removeClass("selected");
	});
	
	
	$(".top a").mouseover(function(){
		$(".top a").css("background-position", "center -100px");
		$(this).stop().animate({backgroundPositionY:-70}, "fast");
	});
	
	$(".top a").mouseout(function(){
		$(".top a").stop().css("background-position", "center -100px");
	});
	
	
	
	
	
	
	
	
	
	$(".ts .listing img").mouseout(function(){
											 
		$(".listing img").prev("strong").hide();
		
		$(".listing img").stop().css("width", 80);
		$(".listing img").stop().css("height", 190);
		
	});
	
	
	
	
	$(".droite").click(function(){
		if (page < Math.ceil($(".listing img").length/6)-1){
			$(".listing").animate({left: '-=640'}, "fast", function(){});
			page++;
		}
	})
	
	$(".gauche").click(function(){
		if (page>0){
			$(".listing").animate({left: '+=640'}, "fast", function(){});
			page--;
		}
	})
	
	
	

	$(".listing img").click(function(){
										 
		$(".more div").hide();
		$("#t"+$(this).attr("id")).show();
		
	
	})
	
	
	
	$(".team").click(function(){
										 
		$(".fiche").hide();
		$("#topo_"+$(this).attr("id")).show();
		
		$(".team").removeClass("selected");
		$(this).addClass("selected");
		$(this).attr("id").show();
	
	})
	
	
	
	
	
	

});
