$(document).ready(function(){
	

	// Over sur les thumbs
	$(".post_home a").hover(function() {
		$(this).find("img").animate({opacity: "0.2"}, "fast");
	}, function() {
		$(this).find("img").animate({opacity: "1"}, "slow");
	});


    $("ul.sub-menu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.nav li*)  

    $("ul.sub-menu").parent().append("<em>Click here to show categories</em>");
    
    $("ul.nav li span").hover(function() { //When trigger is overed  
  	   	$(this).next("em").animate({opacity: "show", top: "-44"}, "slow");
  	   	$(this).prevAll("a").css({color: "#B5AA00"}); //Drop down the subnav on click  
    }, function(){ 
  	   	$(this).next("em").animate({opacity: "hide", top: "-54"}, "fast");
  	   	$(this).prevAll("a").css({color: "#818491"}); //Drop down the subnav on click  
    });  
    
    $("ul.nav a").hover(function() { //When trigger is overed  
  	   	$(this).css({color: "#B5AA00"}); //Drop down the subnav on click  
    }, function(){ 
  	   	$(this).css({color: "#818491"}); //Drop down the subnav on click  
    });  
  
    $("ul.nav li span").click(function() { //When trigger is clicked...  
  
        //Following events are applied to the subnav itself (moving subnav up and down)  
        $(this).parent().find("ul.sub-menu").slideDown('fast').show(); //Drop down the subnav on click  
  
        $(this).parent().hover(function() {  
    }, function(){  
    	$(this).parent().find("ul.sub-menu").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up  
    });  
  
    //Following events are applied to the trigger (Hover events for the trigger)  
    }).hover(function() {  
    	$(this).addClass("subhover"); //On hover over, add class "subhover"  
	}, function(){  //On Hover Out  
		$(this).removeClass("subhover"); //On hover out, remove class "subhover"  
	});  
    

	/* Affiche le bloc About */
	$("#page-wrapper").show();
	$(function(){
		$("#about").hide();
  		$("ul.nav li:contains(About)").click(function(){
  			$("a.close").animate({opacity: "0"}, "fast");
        	$("div.pages").slideUp("fast");
        	$("#about").delay("fast").slideToggle();
   			$("a.close").delay(800).animate({opacity: "1"}, "slow");
        	return false; })

	/* Affiche le bloc Client List */
		$("#client").hide();
  		$("ul.nav li:contains(Client list)").click(function(){
  			$("a.close").animate({opacity: "0"}, "fast");
        	$("div.pages").slideUp("fast");
        	$("#client").delay("fast").slideToggle("slow");
   			$("a.close").delay(800).animate({opacity: "1"}, "slow");
        	return false; })

	/* Affiche le bloc Contact */
 		$("#contact").hide();
  		$("ul.nav li:contains(Contact)").click(function(){
			$("a.close").animate({opacity: "0"}, "fast");
        	$("div.pages").slideUp("fast");
        	$("#contact").delay("fast").slideToggle();
			$("a.close").delay(800).animate({opacity: "1"}, "slow");
        	return false; })

	/* Fermer les blocs */
  		$("a.close").click(function(){
			$("a.close").animate({opacity: "0"}, "slow");
        	$("div.pages").delay(600).slideUp("fast"); })
	})

}); 
