var _menu = null;
var _timer = null;

function doMenu(arr)
{
	if(doMenu.arguments.length < 1)
	{
		// Reset timer
		clearInterval(_timer);
		_timer = null;
	
		// Hide current menu
		if(_menu != null)
		{
			for(i = 0; i < _menu.length; i++)
			{
				hideMenu(_menu[i]);
			}
		}
	}
	else
	{
		if(arr == null)
		{
			if(_timer == null) // Not trying to hide menu already
			{
				_timer = setInterval('doMenu()', 1200);
			}
		}
		else
		{
			// Reset timer
			clearInterval(_timer);
			_timer = null;
			
			// Hide current menu
			if(_menu != null)
			{
				for(i = 0; i < _menu.length; i++)
				{
					hideMenu(_menu[i]);
				}
			}

			// Show this menu
			for(i = 0; i < arr.length; i++)
			{
				showMenu(arr[i]);
			}

			// Store menu path
			_menu = arr;
		}
	}
}

function showMenu(obj)
{
	if(obj != null)
	{
		try
		{
			document.getElementById(obj).style.visibility = 'visible';
		}
		catch(e)
		{

		}
	}
}

function hideMenu(obj)
{
	if(obj != null)
	{
		try
		{
			document.getElementById(obj).style.visibility = 'hidden';
		}
		catch(e)
		{

		}
	}
}