$(document).ready(function(){
    //slide footer

    $('#slider_ul li:first').before($('#slider_ul li:last'));

        total =  $('#slider_ul li').length;
        for(i=0;i<total;i++){
            clone = $('#slider_ul li').eq(i).clone();
            $('#slider_ul li:last').after(clone);
        }
$('#slider_ul li:first').before($('#slider_ul li:last'));

        $('#slider_ul li img').css("width","190px");
        $('#slider_ul li img').eq(2).css({'width' : '300px', 'height' : '120px'});
        $('#slider_ul li img').eq(2).css("margin-top","-20px");



        $('#slider_droite img').click(function(){

            $('#slider_ul li img').eq(2).animate({width: "190px", height:"76px", marginTop: "0px"});
            $('#slider_ul li img').eq(3).animate({width: "300px", height:"120px", marginTop: "-20px"})

            $('#slider_ul:not(:animated)').animate({'left' : -457},500,function(){
                $('#slider_ul li:last').after($('#slider_ul li:first'));
                $('#slider_ul').css({'left' : '-220px'});
            });
        });

        $('#slider_gauche img').click(function(){

            $('#slider_ul li img').eq(2).animate({width: "190px", height:"76px", marginTop: "0px"});
            $('#slider_ul li img').eq(1).animate({width: "300px", height:"120px", marginTop: "-20px"})

                $('#slider_ul:not(:animated)').animate({'left' : 17},500,function(){
                    $('#slider_ul li:first').before($('#slider_ul li:last'));
                    $('#slider_ul').css({'left' : '-220px'});
                });
        });
//fin slide footer

    // slide portfolio
    total = $('.slide-img').length;
    num = 0;
    $('.slide-img').hide();
    $('.slide-img').eq(num).show();
    $('#img-droite').click(function(){
       if(!$('.slide-img').is(':animated') ){
            var now = num;
            num++;
            if(num == total) num = 0;
            $('.slide-img').eq(num).show('slide', {direction: 'right'}, 500);
            $('.slide-img').eq(now).hide('slide', {direction: 'left'}, 500);
            
        }
    });
    $('#img-gauche').click(function(){
        if(!$('.slide-img').is(':animated') ){
            var now = num;
            num--;
            if(num < 0) num = (total-1);
            $('.slide-img').eq(num).show('slide', {direction: 'left'}, 500);
            $('.slide-img').eq(now).hide('slide', {direction: 'right'}, 500);
        }
    });
    // Fin slide portfolio

    //Images Noir et Blanc

        $(".portfolio-item").hover(function() {

		var thumbover = $(this).find("img").attr("src");

		$(this).css({'background' : 'url(' + thumbover + ') no-repeat bottom left'});
                //$(this).css({'background-position' : 'top left'});
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).find("span").hide();
		});
	} , function() { 
		
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});






    //Fin Images Noir et Blanc

    



})
