// JavaScript Document
$(document).ready(function(){
						   
// this section opens and shuts the navigation lists
// first, hide the lower level navigation lists
	$("ul#navlist ul").hide();	
	$("ul#newslist").hide();
// then, open the section that matches the body id
	$("body#zero ul#sectionzero").show();
	$("body#one ul#sectionone").show();
	$("body#two ul#sectiontwo").show();
	$("body#three ul#sectionthree").show();
	$("body#four ul#sectionfour").show();
	$("body#five ul#sectionfive").show();
	
// if user clicks on section head (the href='#'), open the subnav menu and make sectionhead orange
	$("ul#navlist a[@href*=#]").click(function(){
			$(this).next().toggle('slow');
			$(this).parent().toggleClass("onlevel2");
	});
	
// this section puts 'on' state on the active page
$("#navlist li a#index").each(function() {
	if ( $(this).attr("href") == location.pathname) {
		  $(this).parent().addClass("onlevel1");
		 }
});

$("#navlist li a:not(#index)").each(function() {
	if ( $(this).attr("href") == location.pathname) {
		  $(this).parent().addClass("onlevel1");
		  $("#navigation p a#plan").removeClass("topLevel1");
		  $("#navigation p a#plan").addClass("topLevel2");
		 }
});

$("#navlist li ul.subnav a").each(function() {
	if ( $(this).attr("href") == location.pathname) {
		 $(this).parent().addClass("onlevel3");
		 $(this).parent().parent().parent().addClass("onlevel2");
		 $("#navigation p a#plan").removeClass("topLevel1");
		 $("#navigation p a#plan").addClass("topLevel2");
		}
});

$("#navigation p a:not(#plan)").each(function() {
	if ( $(this).attr("href") == location.pathname) {
		  $(this).addClass("on");
		  $("ul#navlist").hide();
		  $("#navigation p a#plan").removeClass("topLevel1");
		  $("#navigation p a#plan").addClass("topLevel3");
		 }
});

//handles the navigation for the news items. You must add additional news item to navigation ssi.
$("#newslist li a").each(function() {
	if ( $(this).attr("href") == location.pathname) {
		 $("ul#navlist").hide();
		 $("#navigation p a#news").addClass("on");
		 $("#navigation p a#plan").removeClass("topLevel1");
		 $("#navigation p a#plan").addClass("topLevel3");
		 }
});

// this section opens and shuts the core and flagship initiatives
	$("dd").hide();
	$("dt a")
	.filter(".showme").click(function() {
			$(this).parent().next().toggle('slow'); 
			$(this).siblings('a').show('fast');
			$(this).hide('fast');
			return false;
			})
	.end()
	.filter(".hideme").click(function() {
			$(this).parent().next().toggle('slow'); 
	 		$(this).siblings('a').show('fast');
			$(this).hide('fast');
 		  	return false;
 			})
	.end()
	
	
		
		
});	