	//Menu initialization
	if(document.getElementById)
	{
		//Hides all the menus. If JavaScript is disabled then all menus remain visible and thus usable
		var menuCss = document.createElement('link');
		menuCss.setAttribute('rel', 'stylesheet');
		menuCss.setAttribute('type', 'text/css');
		menuCss.setAttribute('href', '/styles/menu.css');
		document.getElementsByTagName('head')[0].appendChild(menuCss);
		
		var links = document.getElementById('menu').getElementsByTagName('a');
		var thisLink;
		
		//Look for the link to this page among all links in the menu.
		for(var i = 0; links[i]; i++)
		{
			if(document.URL == links[i].href)
			{
				thisLink = links[i];
				break;
			}
		}

		//If no link to the current page can be found, try looking for one to the same directory.
		if(!thisLink)
		{
			for(var i = 0; links[i]; i++)
			{
				var lastSlash = document.URL.lastIndexOf('/');

				if((lastSlash > -1) && ((lastSlash + 1) < document.URL.length))
				{
					if(document.URL.substr(0, lastSlash + 1) == links[i].href)
					{
						thisLink = links[i];
						break;
					}
				}
			}
		}

		//Opens up the menu so that the link to the current page is visible.
		if(thisLink)
		{
			var node = thisLink.parentNode;

			if(node.className == 'subsubsubsubmenu')
			{
				node.style.display = "block";
				node = node.parentNode;
			}

			if(node.className == 'subsubsubmenu')
			{
				node.style.display = "block";
				node = node.parentNode;
			}

			if(node.className == 'subsubmenu')
			{
				node.style.display = "block";
				node = node.parentNode;
			}

			if(node.className == 'submenu')
				node.style.display = "block";
		}
	}

	//Opens or closes menu when clicked
	function SwitchMenu(obj)
	{
		if(document.getElementById)
		{
			var el = document.getElementById(obj);
			
			if(el.style.display != "block")
				el.style.display = "block";
			else
				el.style.display = "none";
		}
	}