$(function(){
/**************************/



	// hydrodynamic model
	$("#hydrodynamic >>div, .upstream ul, #upstream, #hydrodynamic h2").not("#down01").hide();
	$("a:contains('Downstream Flow'), .downstream > a, .downstream li a:first").addClass("linkOff");
	$("#anchors li li a").prepend('» ')
	$("#anchors li li a").click(function(){
		$("#hydrodynamic >>div").hide();
		$("#anchors li li a").removeClass("linkOff");
		$(this).addClass("linkOff");
		$($(this).attr("href")).show();
		return false;
	});
	$("#anchors a").focus(function(){
		$(this).blur();
	});
	$("a:contains('Downstream Flow')").click(function(){
		$("#anchors a").removeClass("linkOff");
		$(this).add(".downstream li a:first").addClass("linkOff");
		$("#hydrodynamic >>div, #upstream, .upstream ul").hide();
		$("#downstream, #downstream div:first, .downstream ul").show();
		return false;
	});
	$("a:contains('Upstream Flow')").click(function(){
		$("#anchors a").removeClass("linkOff");
		$(this).add(".upstream li a:first").addClass("linkOff");
		$("#hydrodynamic >>div, #downstream, .downstream ul").hide();
		$("#upstream, #upstream div:first, .upstream ul").show();
		return false;
	});



/**************************/
});



function include(section){

	//close the curtain
	$("#sidenav").hide();
	
	// sets td width of sidenav
	$("#sidenav").parent().css("width","210px");
	
	// load and swap content
	$("#sidenav").load("sitemap.htm #" + section + " > ul", function(){
		markLocation();
		$("#sidenav >>> a").addClass("main");
		$("#sidenav >>>>>>> a").prepend('» ');
		
		// logic to figure out if you are in section ri but not in ri>r2r so hide the r2r menu
		$("#sidenav a:contains('Round Two Report')").parent().addClass("roundTwo");
		$(".roundTwo > ul").hide();
		
		// if you ARE in r2r then hide the other menus and make sure the r2r menu is showing.
		$("#sidenav a:contains('Round Two Report').selected").parents("#sidenav").find("ul ul").hide();
		$("#sidenav a:contains('Round Two Report').selected").parents("#sidenav").find(".roundTwo ul").show()
		$(".hidden").hide();
		
		// open curtain
		$(this).show();
	});
}
function markLocation(){
	$('#sidenav a').each(function(){
		if(this.href == location){
			$(this).parents("li").not($("div").parents()).children("a").addClass("selected");
		}
	}).focus(function(){
		$(this).blur();
	});
};

