// JavaScript Document FOR LEFT NAV

$(document).ready(function() {

$("#openleftnav li").addClass("c");  //add close class to all li's in #nav

/*
This menu script requires the jQuery library.  It will turn a standard html list (using ul/li tags) into a basic menu THAT OPENS TO THE APPROPRIATE SUB SECTION. It has been altered to work with the above script which target the link to the active page.  This will open the menu to the link to the current page, in addition to adding a class to it.

To use:
1. Add the id "openleftnav" to the containing ul tag of the entire left menu.
2. add the following style to a linked stylesheet.
.c ul {display: none}
*/

//2nd & 3rd level LEFT NAV highlight - Adds underline to the active link on the left menu
$('#openleftnav a[@href$="' + location.href.substring(1) + '"]').addClass("activeLink").parents().removeClass("c");

//3rd level LEFT NAV highlight - Used on 4th levels on down, to open & highlight the 3rd level in the nav.  The class "highlight-left" gets added to the breadcrumb on the 'matching link'.
//if ($(".highlight-left").children().is("a")) {
$("#openleftnav a[@href=" + $(".highlight-left a").attr("href") + "]").addClass("activeLink").parents().removeClass("c");
//}

//5th level 'LINKS NAV TOP' highlight - Adds underline to the active link for the 5th level navigation
$('ul#navlinkstop li a[@href$="' + location.href.substring(1) + '"]').addClass("activeLink");

//5th level 'LINKS NAV TOP' highlight - Used on 6th levels on down, to underline the 5th level in the UL.  The class "highlight-topul" gets added to the breadcrumb on the 'matching link'.  This allows the 'LINKS NAV TOP' UL to be an include since the highlight is added via javascript
if ($(".highlight-topul").children().is("a")) {
$("ul#navlinkstop li a[@href=" + $(".highlight-topul a").attr("href") + "]").addClass("activeLink");
}

//4th Level Highlight
$('#contentright ul li a[@href$="' + location.href.substring(1) + '"]').addClass("activeLink");

//4th Level 'RIGHT NAV' highlight - Used on 4th levels on down, to underline the 4th level in the UL.  The class "highlight-right" gets added to the breadcrumb on the 'matching link'.  This allows the 'RIGHT NAV' UL to be an include since the highlight is added via javascript
if ($(".highlight-right").children().is("a")) {
$("#contentright ul li a[@href=" + $(".highlight-right a").attr("href") + "]").addClass("activeLink");
}

/* Manual Override - this is a hidden div at the top of the page.  Add the div "navmatch" to pages where the item you need to highlight is not in the breadcrumb.  Inside the div put the URL you need to match. */
if ($("#navmatch").children().is("a")) {
	$("a[@href=" + $("#navmatch a").attr("href") + "]").addClass("activeLink").parents().removeClass("c");
}

// New, easier matching! You can skip the above steps and just add links to the page you want to match in the hidden div "navmatch"
if ($("a.leftmatch")) {
	$("a[@href=" + $("a.leftmatch").attr("href") + "]").addClass("activeLink").parents().removeClass("c");
}
if ($("a.rightmatch")) {
	$("a[@href=" + $("a.rightmatch").attr("href") + "]").addClass("activeLink").parents().removeClass("c");
}
if ($("a.centermatch")) {
	$("a[@href=" + $("a.centermatch").attr("href") + "]").addClass("activeLink").parents().removeClass("c");
}
});