$(function() { 

	$(document).pngFix(); 

/* 	AJOUTS */
	$("#portfolio").append('<img id="load" src="http://www.agence-fold.fr/wp-content/themes/fold/images/ajax-loader.gif" />');
	$(".scrollable .items div a").prepend( '<span class="zoom">zoomer la photo</span>');
	$(".scroll .items .real div a").prepend( '<span></span>');
	$(".blogPostCat .real div a").prepend( '<span></span>');
	$(".related-posts li a").prepend( '<span></span>'); 
	$(".addspan a").append( '<span></span>');
	$(".creaG").append( '<span></span>');
	$(".creaS").append( '<span></span>');
	$(".inteR").append( '<span></span>');
	
/* 	CAROUSSEL */
	$("#lastRL div.scrollable").scrollable({size:1, interval: 4000, loop: true, speed: 600});
	$("#portfolio div.scrollable").scrollable({size:1, speed: 600});        
	/* $("div.scroll").scrollable({size:4}); */
	$(".scrollable .items a").fancybox(); 
	
/* 	DISPARITIONS + CSS */
	$(".ssMenu li a span").css("opacity","0");
	$(".scroll .items .real span").css("opacity","0");
	$(".blogPostCat .real span").css("opacity","0");
	$(".blogPostCat .real span").css("opacity","0");
	$(".creaG span").css("opacity","0");
	$(".related-posts li a span").css("opacity","0"); 
	$(".inteR span").css("opacity","0");
	$("#portfolio").css({'height' : '450px', 'overflow' : 'hidden'}); 
	
/* 	SURVOL ITEMS CAROUSSEL */
	$(".scroll .items .real span").hover(function() {
		$(this).stop().animate({opacity: 1}, "normal");
	}, function() {
		$(this).stop().animate({opacity: 0}, "normal");
	});
	
/* 	SURVOL CAT BLOG */
	$(".blogPostCat .real span").hover(function() {
		$(this).stop().animate({opacity: 1}, "normal");
	}, function() {
		$(this).stop().animate({opacity: 0}, "normal");
	});
	
	$(".related-posts li a span").hover(function() {
		$(this).stop().animate({opacity: 1}, "normal");
	}, function() {
		$(this).stop().animate({opacity: 0}, "normal");
	});
	
/* 	SURVOL SSMENU */
	$(".ssMenu li a em").hover(function() {
		$(this).next("span").stop().animate({opacity: 1}, "normal");
	}, function() {
		$(this).next("span").stop().animate({opacity: 0}, "normal");
	});
	
/* 	SURVOL SSMENU SERVICES */
	$(".ssMenu li a").hover(function() {
		$(this).children("span").stop().animate({opacity: 1}, "normal");
	}, function() {
		$(this).children("span").stop().animate({opacity: 0}, "normal");
	});	
	
/* 	CHANGEMENT CLASS .ON + CHARGEMENT AJAX PORTFOLIO */
	$("#portfolio .ssMenu li a em").click(function () {
	
    	$(".ssMenu li a").removeClass("on");
    	$(this).parent().addClass("on");
    	var urlLoad = $(this).parent().attr("href")+' .current';
    	$(".current").fadeOut("fast", function() {
    		
    		$('#load').fadeIn('fast');
      		$(".current").load(urlLoad, function() { 
      		
        		$(".current").fadeIn("fast", function() {
        		
        			$('#load').fadeOut('fast');	
        			$("div.scrollable").scrollable({size:1, speed: 600});
					$(".scrollable .items a").fancybox();
					$(document).pngFix();
					$(".scrollable .items div a").prepend( '<span class="zoom">zoomer la photo</span>'); 	
					     
        		}); 
      		}); 
    	}); 
    return false;
    });
   
/* 	COMPTE TWITTER */
	$("#twitterF").getTwitter({
		userName: "agencefold",
		numTweets: 3,
		loaderText: "Chargement...",
		slideIn: true,
		showHeading: false,
		headingText: "Latest Tweets",
		showProfileLink: false,
		showTimestamp: false
	});

    		
});



