$(document).ready(function() {
    // Work out id of current section from file path
    var filePath = document.location.pathname.split("/");
    var fpLength = filePath.length;
    var fileSection = filePath[fpLength -2];
    var fileName = filePath[fpLength -1].split(".")[0];
    var sectionID;
    if (fileName == "index") { sectionID = fileSection; }
    else { sectionID = fileName; }
    $('#'+sectionID).addClass('active'); 

// Provide nice animation and hide graphics on menu
    $('#menu li').hoverIntent(function(){
        $(this)
            .find('ul')
            .stop(true, true)
            .slideDown('fast')
            .parent().removeClass('expanding').addClass('expanded');
    }, function() {
        $(this)
            .find('ul')
            .stop(true, true)
            .fadeOut('fast')
            .parent().removeClass('expanded').addClass('expanding');
    });
});


