var specialsTopDefault;
var isDown = false;

$(document).ready(function() {

	//Hide all the sub menus in the nav
	$("#nav li ul").hide();
	
	//Set event for menu rollover
	$("#nav li").hoverIntent(showSubMenu, hideSubMenu);

	//Alternate the rows of the menu table
	$("#menu table tr:odd").addClass("alt");


	//Set the default position for the specials board
	specialsTopDefault = $("#specialsBoard").css("top");


	//Add listener for specials board
	$(".specialsLink a, a.specialsInline").click(function() {
	
		//Call the toggle function
		toggleSpecialsBoard();
		
		return false;	
	});

});


//Function to show the sub menus
function showSubMenu()
{
	//Set the submenus
	var subMenu = $(this).children("ul");

	//Check to see if there is a submenu
	if (subMenu.length > 0)
	{
		//Set this as active
		$(this).addClass("selectedPage");
	
		//Slide down the sub menu
		subMenu.slideDown();
	}
}

//Function to hide the sub menus
function hideSubMenu()
{
	//Roll up the sub menus
	$(this).children("ul").slideUp();
	
	//Set this as inactive
	$(this).removeClass("selectedPage");
}







//Function to toggle the board
function toggleSpecialsBoard()
{
	//Check to see if the board is down or not
	if (!isDown)
	{
		//It is, so we better show it
		showSpecialsBoard();
	}
	else
	{
		//It's not, so we better put it back up
		hideSpecialsBoard();
	}
}


//Function to show the specials board
function showSpecialsBoard()
{
	//Set that the board is down
	isDown = true;
	
	//Change the class of the special button
	$(".specialsLink a").addClass("specialsDown");

	//Slide the board down
	$("#specialsBoard").stop();
	$("#specialsBoard").animate({top: 0}, 500);
}


//Function to hide the specials board
function hideSpecialsBoard()
{
	//Set that the board is down
	isDown = false;
	
	//Change the class of the special button
	$(".specialsLink a").removeClass("specialsDown");

	//Slide the board up
	$("#specialsBoard").stop();
	$("#specialsBoard").animate({top: specialsTopDefault}, 300);
}







