$(document).ready(function() {
    $(window).hashchange(function() {
        var currentHash = location.hash ? location.hash : '#home';

        $('.content-tab').not(currentHash).hide();
        $(currentHash).show();

        $('.nav').removeClass('selected').filter('.' + currentHash.substring(1)).addClass('selected');
    });

    $(window).hashchange();
});

$(document).ready(function() {
    // Handles changing the view for navigation.
    $(window).hashchange(function() {
        var newHash = location.hash ? location.hash : '#home';

        $('.content-tab').not(newHash).hide();
        $(newHash).show();

        $('.nav').removeClass('selected').filter('.' + newHash.substring(1)).addClass('selected');
    });

    // Trigger the view to update onload, in case there is a hash in the url onload.
    $(window).hashchange();
});

Refactor a variable and add a comment to be more clear.
Refactor a variable and add a comment to be more clear.
