$(document).ready(function() {
    // Navigation highlights
    // Using the current path (e.g. /Section/Page)
    var path = location.pathname;

    // Handle links to the current path
    if (path) {
        $('a[href$="' + path + '"]').parents().filter('li').addClass('active');
    }

    // Handle links to parts of the current path
    var parts = path.split('/')
    for (i = 0; i < parts.length; i++) {
        if (parts[i].length > 0) {
            $('a[href$="/' + parts[i] + '"]').addClass('active');
        }
    }
});
