// JavaScript for Media Center (PRN)...
$(document).ready(function () {
	// leadership & board of directors: enhance the left nav to highlight it showing which has been clicked...
	$(".wd_leadership #aside").each( function() {
		var current = $(".wd_leadership-detail .detail_header").text(), itemname = "";
		$(this).children(".item").each( function() {
			itemname = $(this).find(".item_name").text();
			if ( itemname == current) {
				$(this).addClass("current");
			}
		});
	});
	
	// removing the .active class for clean up...
	$("ul#globalnav").find("li.active").removeClass("active");
	
	// add a class to the div#page based on the h1...
	$("h1").each( function() {
		if ( $(this).parents("#nav").length == 0 ) {
			var pageclass = $(this).text().toLowerCase().replace(/[&\s\'-]/g,"");
			$("#page").addClass(pageclass);
		}
		
		// placing the .active class on the correct li inside ul#globalnav...		
		switch (pageclass)
		{
		case 'leadership':
		case 'boardofdirectors':
		case 'awardsrecognitions':
			$("ul#globalnav").find("li:nth-child(2)").addClass("highlighted");
			break;
		default:
			$("ul#globalnav").find("li:nth-child(5)").addClass("highlighted");
		}
	});
	
	// move the "Share" button to the bottom of the #wd_printable_content div...
	$(".wd_page_toolbar").each( function() {
		var $sharetool = $(this).find(".wd_page_tool a[href='http://www.addthis.com/bookmark.php']");
		
		if ($sharetool.length > 0) {
			var $parent = $sharetool.parent();
			$sharetool.attr("id","addthistool").appendTo("#wd_printable_content");
			$parent.remove();
		}
		$(this).css("display","block");
	});

	// remove the vert line bkg on the first span.wd_page_tool...
	$(".wd_page_toolbar").find("span:first").addClass("nobkg");
	
	// add the class of .last to the last li in the div#breadcrumb...
	$("#breadcrumbs").find("li:last").addClass("last");
	
});

