/*******************************************************

Auteur : 				Clement Caubet
Mail :		 			clement.caubet@gmail.com
Site :		 			http://clement-caubet.fr
Date de création : 	 	23 Mars 2010
Date de MàJ : 	 		19 Avril 2010
Version : 				1.0

*******************************************************/



$(function()
{
    /*******************************************************
					GESTION BLOC AU HASARD
	*******************************************************/
	
	/* Style cursor et effet texte au survol */
	$('#au-hasard .hasard-vide').hover(function(){
		$(this).children('span').stop(true,true).show();
		$(this).css('cursor','help');
	}, function(){
		$(this).children('span').stop(true,true).fadeOut('fast');
	});
	
	/* Effet au survol des images */
	$('#au-hasard li img').parents('li').css({'background':'#000'});
	$('#au-hasard li img').css({'opacity':0.8});
	$('#au-hasard li img').hover(function(){
		$(this).stop(true,true).animate({
		    opacity:1
		},300);
	},function(){
		$(this).stop(true,true).animate({
	   	 	opacity:0.8
		},300);
	});

	
	/*******************************************************
					GETION DU CARROUSEL
	*******************************************************/

	/* Masquage des titres */
	$('#a-la-une strong').css({
		opacity: 0
	});
		
	/* Cycle */
	$('#a-la-une ul').cycle({ 
    	fx: 'scrollLeft', 
    	sync: true,
    	before: prevTitle,
    	after: afterTitle
	});
		
	/* Animation exécutée avant le cycle */
	function prevTitle(){
		$(this).children().children().children('strong').delay(1200).animate({
			opacity: 1
		}, 500);
	}
	
	/* Animation exécutée après le cycle */
	function afterTitle(){
		$(this).children().children().children('strong').delay(1800).animate({
			opacity: 0
		}, 500);
	}
	
	/* Survol image relation titre */
	$('#a-la-une img').hover(function(){
		$(this).parents('li').children().children().children('strong').css({
			'color':'#ae1010',
			'background':'#fff'
		});
	},function(){
		$(this).parents('li').children().children().children('strong').css({
			'color':'#fff',
			'background':'#ae1010'
		});
	});
	
	
	/*******************************************************
					GETION DU BLOC DANS LE MEME ESPRIT
	*******************************************************/

	/* Effet au survol des images  */
	$('#dans-le-meme-esprit li img').hover(function(){
		$(this).animate({
		    opacity:1
		},300);
	},function(){
		$(this).animate({
	   	 	opacity:0.8
		},300);
	});
	
	
	/*******************************************************
					GETION DES ANCRES
	*******************************************************/

	$('.scrollTo').click(function(){
		$.scrollTo($(this).attr('href'),2000,{easing:'swing'});
	});
	
	
	/*******************************************************
					GETION DU BLOC SUIVEZ
	*******************************************************/

	$('#sidebar #suivez a').hover(function(){
		$(this).stop(true,true).animate({
		    'background-position-y':0
		},200);
	},function(){
		$(this).stop(true,true).animate({
	   	 	'background-position-y':3
		},50);
	});
});




