var tmr;

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}


function hideSubNav() {
	tmr = setTimeout("hideMenus()", 100);
}


// Hides any submenus that are currently visible
function hideMenus() {
	var nav = document.getElementById('nav');
	var liTags = nav.getElementsByTagName('li');
	
	for (var x = 0; x < liTags.length; x++) {
		if (String(liTags[x].className).indexOf('over') > -1) {
			if (String(liTags[x].className).indexOf('selected') > -1) {
				liTags[x].className = 'selected';
			}
			else {
				liTags[x].className = '';
			}
		}
	}
}


// Gets the top and left positions of the object
function findPos(obj) {
  var curtop = 0;
  var curleft = 0;
  if (obj.offsetParent) {
	  while (obj.offsetParent) {
		  curtop += obj.offsetTop;
		  curleft += obj.offsetLeft;
		  obj = obj.offsetParent;
	  }
  }
  else {
	  if (obj.y) curtop += obj.y;
	  if (obj.x) curleft += obj.x;
  }
  var r=Array();
  r[0]=curtop;
  r[1]=curleft;
  return r;
}
