// JavaScript Document
$(document).ready(function() {
	
	// On retire la class js de la sidebar qui active le hover
	$(".js").removeClass('js');
	
	// Corner sur le form du footer
	$("form input:not(.send),form textarea,.bouton-jaune").corner("5px");
	
	// Formulaire
	$(".wpcf7-not-valid-tip-no-ajax").parent("span").children("input,textarea").css('borderColor','#F00');
	
	// Oeuvre sur la home
	$('.details-home .photo').hover(function(){
		
		var	src		=	$(this).find("img").attr("src"); // On récupére l'attribut source de l'image
		var	alt		=	$(this).find("img").attr("alt"); // On récupére le alt de l'image qui sera le titre en H2
		
		$(this).css({'background' : 'url(' + src + ') no-repeat 0px -125px'});  // On applique le background
		
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide();
			$(this).parent("a").append("<h2 class='titre'>"+alt+"</h2>"); // On affiche le titre
		});
			
	},function(){
		$(this).find("span").stop().fadeTo('normal', 1).show();
		$(this).find(".titre").remove();
	});
	
	// Lightbox sur les oeuvres				
	$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:3000, autoplay_slideshow: false});
	

	
	// Menu de la sidebar
	var hauteur = 17 ;	
	$('.list_projets li').height(hauteur).each(function(){

		$a = $(this).find('a').css({
			position:	'absolute',
			'z-index':	10	
		});
		
		$a.hover(function(){
			$aHover = $(this);
			$aHover.prev().animate({
				width: $aHover.width()
			},250);	
		},function(){
			$aHover = $(this);
			$aHover.prev().animate({
				width: 0
			},250);		
		});
		
		var $span = $('<span>').addClass('bg-title').css({
			'background-color' : '#ffe400',
			display : 	'block',
			position :	'absolute',
			height:		hauteur+'px',
			width: 		0,
			'z-index':	5
		});
		
		$(this).prepend($span);	
	});	

});
