window.onload = function() {
	adjustAnchors();
	setupMenu();
	document.getElementById( 'footer' ).setAttribute( 'id', 'footer' );
}

function adjustAnchors()
{
	if ( document.createElement && document.getElementsByTagName )
	{
		var l_lAnchors = document.getElementsByTagName("a");
		for ( var i = 0; i < l_lAnchors.length; i++ )
		{
			var l_eAnchor = l_lAnchors[i];
			if ( l_eAnchor.getAttribute( "rel" ) == "ext" )
			{
				l_eAnchor.target = "_blank";
			}
		}
	}
}


/*
* Add functions to the images and input-buttons with the 'rel' attibute set to 'mouseover'.
*/
function setupMenu()
{
	if ( document.getElementById )
	{
		var l_eNavigation = document.getElementById( "navigation" );

		for( var i = 0; i < l_eNavigation.childNodes.length; i++ )
		{
			var l_eElement = l_eNavigation.childNodes[ i ];

			if( l_eElement.nodeName == "LI" )
			{
				l_eElement.l_bSubmenu = ( l_eElement.getAttribute( "rel" ) == "submenu" ) ? true : false;
				
				l_eElement.onmouseover = function() { 
					this.className = "over";
					if( this.l_bSubmenu ) document.getElementById( this.getAttribute( "id" ) + "-sub" ).style.display = 'block';
				}
				l_eElement.onmouseout = function() { 
					this.className = ""; 
					if( this.l_bSubmenu ) document.getElementById( this.getAttribute( "id" ) + "-sub" ).style.display = 'none';
				}				
			}
		}		
	}
}
