
// add an extra action once this page is completely loaded
function addOnLoadFunc (newfunc) { var oldLoad = window.onload;
 window.onload = function () { if (oldLoad) { oldLoad(); } newfunc(); } }



// checks to see if we have actually left a menu for onMouseOut
//  got inspiration from:
// http://www.quirksmode.org/js/events_mouse.html#mouseover
//  e == the event from onMouseOut="isInMenu(event,this)" or this => "getByID('base_id')"
//  b == the base element, are we really moving out of this?
function isInMenu (e,b)
{
	// adapt to NS/IE naming differences
	if (!e) { e = window.event; }
	var p = (e.relatedTarget ? e.relatedTarget : e.toElement);

	// check all parents, see if they are the base element
	while (p)
	{
		// one of the parents is the base element, we're still over it
		if (p == b) { return true; }

		// this parent is not the base, keep checking the next parent up
		p = p.parentNode;
	}

	// we never found the base in all parents of event's target
	//  ergo, we really are no longer over the base element
	return false;
}



function infoboxdropShow (a)
 { var d = a.getElementsByTagName('ul')[0]; return function () { d.style.display = 'block'; }; }

function infoboxdropHide (a)
 { var d = a.getElementsByTagName('ul')[0]; return function (e) { if (!isInMenu(e,a)) { d.style.display = 'none'; } }; }


function classOver_on () { this.className += " iehover"; }
function classOver_off () { this.className = this.className.replace(/\biehover\b/, ""); }



// adds the mouseover/etc events for the infodropboxes for logged in members at the top
function buildinfodropbox ()
{
	if (!document.getElementById) { return; }
	var elem = document.getElementById('subnav_btn'); if (elem) {
	var els = elem.getElementsByTagName('li'); for (var i in els) {
	if (els[i].className && els[i].className.match(/\baddinfodropbox\b/))
	{
		els[i].onmouseout = infoboxdropHide(els[i]);
		els[i].getElementsByTagName('a')[0].onmouseover = infoboxdropShow(els[i]);
		// now handle all the dropdown list items -- but only for IE!
		var els2 = els[i].getElementsByTagName('ul');
		if (!document.all || els2.length < 1) { continue; }
		els2 = els2[0].getElementsByTagName('li'); for (var j in els2)
		 { els2[j].onmouseover = classOver_on; els2[j].onmouseout = classOver_off; }
	}
}}}

addOnLoadFunc(buildinfodropbox)

