function switchRef() {
    if ($("#projectsThumbs").css("left") == "0px"){
        $("#projectsThumbs").animate({left: "-534px"},'slow');
    }
    else {
        if ($("#projectsThumbs").css("left") == "-534px"){
            $("#projectsThumbs").animate({left: "-1068px"},'slow');
        }
        else {
            $("#projectsThumbs").animate({left: "0px"},'slow');
        }
    }
    var t=setTimeout("switchRef()",3000);
}

$(document).ready( function () {
    
    $("#switchContainer").each(function () {
        var htmlSwitch = $(this).html(); 
        $(this).replaceWith('<a href="">' + htmlSwitch + '<\/a>') ; 

    });
    
    $("img#switch").click(function () {
        if ($("#projectsThumbs").css("left") == "0px"){
            $("#projectsThumbs").animate({left: "-536px"});
        }
        else {
            if ($("#projectsThumbs").css("left") == "-536px"){
                $("#projectsThumbs").animate({left: "-1072px"});
            }
            else {
                $("#projectsThumbs").animate({left: "0px"});
            }
        }
        if ($("img#switch").attr("src") == "wp-content/themes/creaJuice/images/switchUp.png"){
            $("img#switch").attr("src","wp-content/themes/creaJuice/images/switchDown.png");
        }
        else {
            $("img#switch").attr("src","wp-content/themes/creaJuice/images/switchUp.png");
        }
        return false;
    });
    
    var t=setTimeout("switchRef()",3000);
    
    
})
