$(document).ready(function(){
	$('#header-stripe .menu li').mouseover(function(){
		$(this).css('background-color', '#2F7F10');
	}).mouseout(function(){
		$(this).css('background-color', 'transparent');
	});
});

$(document).ready(function(){
	$('#primary-navigation .menu li').mouseover(function(){
		$(this).css('background-color', '#C9E3B6');
		$('a', this).css('color','#0B6909');
	}).mouseout(function(){
		if ($(this).attr('class') != 'selected'){
			$(this).css('background-color', 'transparent');
			$('a', this).css('color','#fff');	
		}
		
	});
});


$(document).ready(function(){
	
	var selected = $('#primary-navigation ul.menu li div.hidden ul.menu li a.selected');
	var secondaryNavigation = selected.parents('div.hidden').html();
	
	// now if there is a selected secondary navigation then show the secondary navigation and setup so the menus look nice
	if (secondaryNavigation != null){
		$('#secondary-navigation').html(secondaryNavigation).show();
		
		var primaryMenuItem = selected.parents('div.hidden').parent();
		var primaryLink = selected.parents('div.hidden').siblings();
		
		// selected added so that the hover doesn't remove the css that shows we are in "that" menu
		primaryMenuItem.css('background-color', '#C9E3B6').addClass('selected');
		primaryLink.css('color','#0B6909');		
		
	} else {
		// what if the top menu has it's own content? Have to check here
		var parentSelected = $('#primary-navigation ul.menu li a.selected');
		var parentSecondaryNavigation = $('#primary-navigation ul.menu li a.selected').siblings('div.hidden').html();

		var parentPrimaryMenuItem = parentSelected.parent();
		
		parentPrimaryMenuItem.css('background-color', '#C9E3B6').addClass('selected');
		parentSelected.css('color','#0B6909');
		
		// top menu was selected and does have it's own content
		if (parentSecondaryNavigation != null){
			$('#secondary-navigation').html(parentSecondaryNavigation).show();
			
			var primaryMenuItem = selected.parents('div.hidden').parent();
			var primaryLink = selected.parents('div.hidden').siblings();
			
			// selected added so that the hover doesn't remove the css that shows we are in "that" menu
			primaryMenuItem.css('background-color', '#C9E3B6').addClass('selected');
			primaryLink.css('color','#0B6909');
			
			
		}
		
	}
	
	$('#secondary-navigation .menu li').mouseover(function(){
		$(this).css('background', 'transparent url(\'/img/secondary-nav-bg-hover.jpg\') repeat-x scroll bottom left');
	}).mouseout(function(){
		
		if ($(this).attr('class') != 'selected'){
			$(this).css('background-image', 'none');
		}
	});
	
});
