startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					if(this.id)
					{
					submenu = this.id + "SUB";
					submenu_id = document.getElementById(submenu);
					submenu_id.style.display = "block";
					}
				}
				node.onmouseout=function() {
					if(this.id)
					{
					submenu = this.id + "SUB";
					submenu_id = document.getElementById(submenu);
					submenu_id.style.display = "none";
					}
				}
			}
		}
	}
}

function prepareNavigation()
{	
	window.defaultStatus='Welcome to homesabout';
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("nav_menu")) return false;
	var nav = document.getElementById("nav_menu");
	
	var links = nav.getElementsByTagName("a");
	for(i=0;i < links.length; i++)
	{
		var linkURL = links[i].getAttribute("href");
		var page = linkURL.substring(linkURL.lastIndexOf("/")+1, linkURL.lastIndexOf("."));
		switch(page)
		{
			case "home" : links[i].onmouseover=function(){window.status='Home page'; return true}; break;
			case "benefits" : links[i].onmouseover=function(){window.status='Why choose us?'; return true}; break;
			case "registerb" : links[i].onmouseover=function(){window.status='Register with homesabout'; return true}; break;
			case "services" : links[i].onmouseover=function(){window.status='Other services and links'; return true}; break;
			case "team" : links[i].onmouseover=function(){window.status='Meet our dedicated team'; return true}; break;
			case "contactus" : links[i].onmouseover=function(){window.status='Contact details'; return true}; break; 
		}       
		
		
	}
}
function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

addLoadEvent(prepareNavigation);
addLoadEvent(startList);