jQuery(document).ready (function($) {
    //Build and start the home slider
    $('#home-slider').anythingSlider({
        buildStartStop: false,
        autoPlay : true,
        pauseOnHover : true,
        buildNavigation : true,
        buildArrows : false,
        delay : 7000
    });
    //Start the project load via ajax
    $(".project-list li").click(function() {
        var post_id = this.id;
        $(".project-list").fadeOut("fast", function() {           
            $("#loading").fadeIn("fast").animate({
                left: '+=800'
            }, 2000, function (){
                $("#project-load").load("/?p=" + post_id + " .post", function() {
                    $('.slideit').anythingSlider({
                        buildStartStop: false,
                        autoPlay : true,
                        pauseOnHover : true,
                        buildNavigation : true,
                        expand : true,
                        resizeContents : false
                        
                    });
                });
            }).delay(1000).fadeOut("fast", function() {                
                $(".project-wrapper").fadeIn("slow", function(){
                    FB.XFBML.parse();
                    twttr.widgets.load();
                    gapi.plusone.go();
                });
            });
        });
    });
    //Show all the projects
    $("a[href=#allprojects]").click(function() {
        $(".project-wrapper").fadeOut("fast", function() {
            $(".project-list").fadeIn("fast", function() {
                $("#loading").css("left","0");
            });
        });
        return false;
    });
});
