$(document).ready(
    function () {

        //Look through all the links in the sidebar
        var currentLink = $("ul#menu li a").filter(function () {

            //Take the current URL and split it into chunks at each slash
            var currentURL = window.location.toString().split("/");

            //return true if the bit after the last slash is the current page name
            return $(this).attr("href") == currentURL[currentURL.length - 1];

            //when the filter function is done, you're left with the links that match.
        });

        $(currentLink).parent('li').addClass("active");

        //if ($(currentLink).parent('li').hasClass("active") == false) {
        //    $(currentLink).parent('li').addClass("active");
        //}

    }
)


