$(document).ready( function() {
    $("#mainNav li").hover( function() {
        $(this).stop(true, true).animate({marginLeft: "-3.125em", opacity: 1}, 500);
    }, function() {
        $(this).animate({marginLeft: 0, opacity: .5}, 1000);
    });

    $(".navigation").click( function() {
        var target = $(this).attr("id").substr(3);
        window.location.hash = "!"+target;
        $(".contentSection").fadeOut(100);
        $(".contentSection").promise().done( function() {
            $("#content"+target).fadeIn();
        });
    });

    if (location.hash == "") {
        $("#contentWeb").show();
    } else {
        var target = location.hash.substr(2);
        $("#content"+target).show();
    }
});
