/* 
ReefNet improved IE menu rollover. 

Based on an initial idea from http://www.alistapart.com/articles/horizdropdowns/

This version uses an array of items 'toClose', and timeouts to introduce a slight delay, which makes
the menu work much more smoothly in IE. 
*/
var toClose=Array();

crawl = function(startnode)
{
	var node;
	var subnode;
	var i,j;
	var ID;
	
	for (i=0; i<startnode.childNodes.length; i++) 
	{
		node = startnode.childNodes[i];

		if (node.nodeName=="LI") 
		{
			node.onmouseover=function() 
			{
				if (this.className!="nosub")
				{
					clearTimeout(ID);
					menuClose();
					this.className+="over";

				}				
			}
			node.onmouseout=function() 
			{
				if (this.className!="nosub")
				{
					toClose.push(this);
					ID=setTimeout("menuClose()",100);
				}
			}

			if (node.childNodes.length>0)
			{
				for(j=0;j<node.childNodes.length;j++)
				{
					subnode=node.childNodes[j];

					if (subnode.nodeName=="UL")
					{
						crawl(subnode);
					}
				}
			}
		}
	}
	return true;
}

startList = function() 
{
	if (document.all&&document.getElementById) 
	{
		navRoot=document.getElementById("topnav_start");
		crawl(navRoot);
 	}
}

function menuClose()
{
	for(var i=0;i<toClose.length;i++)
	{
		toClose[i].className=toClose[i].className.replace("over", "");
	}
	toClose=Array();
}
	
window.onload=startList;


