$(function() {
    //dynamic menu highlight
    //grab the URL in the window's location bar
    var href = window.location.pathname;
    //split into an array of nested directories
    href = href.split("/");
    //for each link in your #nav, compare its href attribute to the stored location hash
    $("#nav a").each(function(){
        var thisHref = $(this).attr("href");
        thisHref = thisHref.split("/");
        //if there is a match at the first location, add a class of current to the link
        if (href[1]==thisHref[1]) { $(this).addClass("current"); }
        
    });
    $("#subnav a").each(function(){
        var thisHref = $(this).attr("href");
        thisHref = thisHref.split("/");
        //if there is a match at the first location, add a class of current to the link
        if ((href[1]==thisHref[1]) && (href[2]==thisHref[2]))
					$(this).addClass("current");        
    });
    
    $("#subnav.page a").each(function(){
        var thisHref = $(this).attr("href");
        thisHref = thisHref.split("/");
        //if there is a match at the first location, add a class of current to the link
        if (href[1]==thisHref[1])
					$(this).addClass("current");        
    });
});

