/**
 * Menu
 * Set the menu appearance & behavior
 */

function Menu(game)
{
	this.game = game;
}

/**
 * Callback function called when the menu is loaded.
 */
Menu.prototype.init = function()
{
	var game = this.game;
	
	//find the #menu and set it as draggable
	$("#menu").draggable();
	$("#menu").css("cursor", "move");
	
	//Center the buttons text
	$(".menu_button > p").each(function()
	{
		$(this).css( "top", $(this).parents(".menu_button").height() / 2 - $(this).height()/2 );
	});
	
	//Set the buttons behavior
	$(".menu_button").each(function()
	{
		//cursor
		$(this).css("cursor","pointer");
		
		//hover
		$(this).hover(function()
		{
			$(this).css("opacity","0.6");
			$(this).css("filter","alpha(opacity=60)");
		},function()
		{
			$(this).css("opacity","1");
			$(this).css("filter","alpha(opacity=100)");
		});
		
		//click
		$(this).click(function()
		{
			game.openDialog($(this).attr("id"), false);
		});
	});
}
