// Active menu item script for accordion left nav

function initMenu() {
	$('#menu ul').hide();
	
	// Gets menu title with .active class
	var menuName = $('.active').text();

	// Gets first 3 letters of menu title
	var menuName = menuName.substr(0,3);
	
	// Switch statement to show() the .active menu items
	switch(menuName)
	{
	
		case "Pro":
		$("li:nth-child(5) ul").show();
		break;
		
		case "Ben":
		$("li:nth-child(4) ul").show();
		break;

		case "Get":
		$("li:nth-child(3) ul").show();
		break;

		case "Eve":
		$("li:nth-child(2) ul").show();
		break;
		
		default:
		$("li:nth-child(1) ul").show();
		
	}
	
	// Hover show() of menu items
	$('#menu li a').hover(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#menu ul:visible').slideUp('slow');
				checkElement.slideDown('slow');
				return false;
			}
		}
	);
}
$(document).ready(function() {initMenu();});
