/*-----------------------------------------------------------------------------
Primary Stellar computer Javascript

version:   1.0
author:    Weston Shaw
e-mail:    info@avallo.com
website:   http://www.avallo.com
-----------------------------------------------------------------------------*/

/* =Load Functions
-----------------------------------------------------------------------------*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(googleFocus);
addLoadEvent(startList);
addLoadEvent(doNewWin);



/* =Search Focus
-----------------------------------------------------------------------------*/
function googleFocus(){
	var gForm = document.getElementById("goosea");
	gForm.q.focus();
}

/* =Open a new window
-----------------------------------------------------------------------------*/
function doNewWin() {
  if (!document.getElementsByTagName) return false;
  var links=document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].title.match("Opens in a New Window")) {
      links[i].onclick=function() {window.open(this.href);return false;
      }
    }
  }
}


/* =IE Menu dropdown support
-----------------------------------------------------------------------------*/
function startList() {
	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() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
