$(document).ready(function(){
	/* PORTFOLIO */
	$("a.gallery").fancybox({
		'titlePosition'	: 'inside'
	});
	$("a.zoom").fancybox({
		'titlePosition'	: 'inside'
	});
	/* ANIMATION HOME */
	image_actu=0;

	$('#roue').click(
		function () {
			$(this).animate({rotate: '+=90deg'}, {queue: false, duration: 1000});
			if(image_actu==3){
				$(".illu img").fadeOut(500, function() {
						$(".illu img").css("top","0px").fadeIn(500);			
					});
				$(".comment span").fadeOut(500, function() {
						$(".comment span").css("top","0px").fadeIn(500)			
					});;
				image_actu=0;
				}else{
					$(".illu img").animate({top: '-=590px'}, {queue: false, duration: 1000});					
					$(".comment span").animate({top: '-=150px'}, {queue: false, duration: 1000});
					image_actu++;
				}
		}
	);
	
	$(".lien_rea").click(function(){
		id = $(this).attr("title");
		$("#"+id_prec).fadeOut(500, function () {
			$(".bloc_rea").css({display:'none'});
			$("#" + id).css({display:'block'});
			$("#" + id).fadeOut(0);
			$("#" + id).fadeIn(500);
			id_prec = id;
		});
	});
	// catégorie par défaut
	$("#rea_web").fadeOut(0);
	$("#rea_web").fadeIn(500);
	id_prec = "rea_web";
	
	$(".lien_rea").click(function(){
		 $(".lien_rea").removeClass("lien_hover");
		 $(this).addClass("lien_hover"); 
		 });
	/* ANIMATION PARTIE WEB */
	$('.preview').hover(function() {
	$('.preview').children('.legende').stop().css("top","216px");
		$(this).children('.legende').animate({
			top: '138px'
		  }, 500, function() {
			//Animation complete.
		  });
	},function(){
			$(this).children('.legende').css("top","216px");
	});

});

