function showNav(level)
{
	$(".menu").children("li:nth-child("+level+")").children("ul").css("display", "block");
}


$(document).ready( function() {

	//add css styles to each top level menu item.
	$(".menu li:nth-of-type(1) a").attr("id", "big-picture");
	$(".menu li:nth-of-type(2) a").attr("id", "explore");
	$(".menu li:nth-of-type(3) a").attr("id", "companies");
	$(".menu li:nth-of-type(4) a").attr("id", "research");
	$(".menu li:nth-of-type(5) a").attr("id", "living");
	$(".menu li:nth-of-type(6) a").attr("id", "business");
	$(".menu li:nth-of-type(7n) a").attr("id", "priorities");
	
	
	
	//reset the nonsense above for chrome issues
	$(".menu li:nth-child(1) a").attr("id", "big-picture");
	$(".menu li:nth-child(2) a").attr("id", "explore");
	$(".menu li:nth-child(3) a").attr("id", "companies");
	$(".menu li:nth-child(4) a").attr("id", "research");
	$(".menu li:nth-child(5) a").attr("id", "living");
	$(".menu li:nth-child(6) a").attr("id", "business");
	$(".menu li:nth-child(7) a").attr("id", "priorities");
	
	//clear subnav
	$("#subMenu ul li ul li a").each( function() {
		$(this).removeAttr("id");
	});
	
	//add css styles to subnav
	$("#subMenu ul li ul").each( function() {
		$(this).addClass("subnav-v");
	});
	
	//set menu to display depending on what page you are on.
	var href = jQuery(location).attr('href');
	
	if(href.indexOf("/the_big_picture") != -1)
	{
		showNav(1);

	}else if(href.indexOf("/explore_pellissippi_place") != -1)
	{
		showNav(2);
		
	}else if(href.indexOf("/companies_that_fit") != -1)
	{
		showNav(3);
		
	}else if(href.indexOf("/regional_research_resources") != -1)
	{
		showNav(4);
		
	}else if(href.indexOf("/living_at_its_best") != -1)
	{
		showNav(5);
		
	}else if(href.indexOf("/business_site_selection_data_center") != -1)
	{
		showNav(6);
		
	}else if(href.indexOf("/properties") != -1)
	{
		showNav(7);
	}

});
