$(function() {

    var newHash      = "",
        $mainContent = $("#main-content"),
        $pageWrap    = $("#container"),
        baseHeight   = 0,
        $el;

    $pageWrap.height($pageWrap.height());
    baseHeight = $pageWrap.height() - $mainContent.height();

    $("#sidemenu").delegate("a", "click", function() {
        window.location.hash = $(this).attr("href");
        return false;
    });

    $(window).bind('hashchange', function(){

        newHash = window.location.hash.substring(1);

        if (newHash) {
            $mainContent
                .find("#content")
                .fadeOut(200, function() {
                    $mainContent.hide().load(newHash + " #content", function() {
                        $mainContent.fadeIn(200, function() {
                            $pageWrap.animate({
                                height: baseHeight + $mainContent.height() - 150 + "px"
                            });
                        });
                        $("#sidemenu a").removeClass("current");
                        $("#sidemenu a[href='"+newHash+"']").addClass("current");
                    });
                });
        };

    });

    $(window).trigger('hashchange');

});

$(function() {

    var $el = $(),
        speed = 175;  //  1000 = 1 second

    // SECOND TECHNIQUE
    $("#second a").hover(function() {

        $el = $(this);

        $el.stop().animate({ backgroundPosition: "(0px 0px)", color: "white" }, speed);

    }, function() {

        $el = $(this);

        $el.stop().animate({ backgroundPosition: "(0px 15px)", color: "#900" }, speed);

    });

});
