function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1)
      return element;
    elements.push(element);
  }
  return elements;
}

function winHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function fixHeight(el){
  var h_ = winHeight()-370;
  if (el.offsetHeight>h_)
		return;
  if (el.style.height<h_)
    el.style.height = h_ + "px";
}

function fixHeightIndex(el){
  var h_ = winHeight()-405;
  if (el.offsetHeight>h_)
		return;
  if (el.style.height<h_)
    el.style.height = h_ + "px";
}

function checkEnter(e){
		var cc_;
		if(e && e.which){ e = e; cc_ = e.which; }
		else { e = event; cc_ = e.keyCode; }
		if(cc_ == 13) {
			//alert($('query').value);
			document.forms[0].action = '/search.aspx?q=' + encodeURIComponent($('q').value);
			document.location.href = '/search.aspx?q=' + encodeURIComponent($('q').value);
			return false;
			}
		else { return true; }
}


function startList() {
				if (document.all&&document.getElementById) {
					navRoot = document.getElementById("ulMainMenu");
					for (i=0; i<navRoot.childNodes.length; i++) {
						node = navRoot.childNodes[i];
						if (node.nodeName=="LI") {
							node.onmouseover=function() {	this.className+=" selected"; }
							node.onmouseout=function() { this.className=this.className.replace(" selected", ""); }
							}
						}
				}
}

//Start up function

startStack=function() { };  // A stack of functions to run onload/domready

registerOnLoad = function(func) {
   var orgOnLoad = startStack;
   startStack = function () {
      orgOnLoad();
      func();
      return;
   }
}

var ranOnload=false; // Flag to determine if we've ran the starting stack already.

if (document.addEventListener) {
  // Mozilla actually has a DOM READY event.
   document.addEventListener("DOMContentLoaded", function(){if (!ranOnload) {ranOnload=true; startStack();}}, false);
}  else if (document.all && !window.opera) {
  // This is the IE style which exploits a property of the (standards defined) defer attribute
  document.write("<scr" + "ipt id='DOMReady' defer=true " + "src=//:><\/scr" + "ipt>");  
  document.getElementById("DOMReady").onreadystatechange=function(){
    if (this.readyState=="complete"&&(!ranOnload)){
      ranOnload=true;
      startStack();
    }
  }
}

var orgOnLoad=window.onload;
window.onload=function() {
   if (typeof(orgOnLoad)=='function') {
      orgOnLoad();
   }
   if (!ranOnload) {
     ranOnload=true;
     startStack();
   }
}	
//
//
//
//