var Navigation = Class.create
({
	initialize: function(options)
	{
		var currentUrl = document.location.href;

		if (currentUrl.include("/umas/"))
		{
			this.showMainNav("umas");
		}
		else if (currentUrl.include("/reporting/"))
		{
			this.showMainNav("reporting");
		}
		else if (currentUrl.include("/about/"))
		{
			this.showMainNav("about");
		}
		else
		{
			this.showMainNav("#");
		}

		this.highlightCurrentSubnav(currentUrl);
	},
	
	showMainNav: function(classToShow)
	{
		$("navigation").getElementsBySelector("a").each(function(element)
		{
			if (element.className.include(classToShow))
			{
				element.addClassName("currentArea");
			}
		});
	},
	
	/*--------------------------------------------------------------------------
		Find the current url in the href strings of the current menu.
		Set the background to the selected style and remove the link.
	--------------------------------------------------------------------------*/
	highlightCurrentSubnav: function(currentUrl)
	{
		$("secondaryNav").getElementsBySelector("a").each(function(element)
		{
			urlString = element.readAttribute("href");

			if (currentUrl.include(urlString))
			{
				element.addClassName("currentPage");
				throw $break;
			}
		});
	}
});
