/* Form Hints: */
	function focused(obj,val){
		if(obj.value==val){obj.value=''}
	}

	function blurry(obj,val){
		if(obj.value==''){obj.value=val}
	}

/* Menu:*/
function go() {
descendMenu();
//Main menu..
/* thanks to http://www.alistapart.com/articles/dropdowns/ */
navRoot = document.getElementById("site_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", "");
	submenuovers(getFirstUL(this));
   }
   }
  }
}

function descendMenu(){
menu0=document.getElementById('menu');
ulist=getFirstChild(menu0.childNodes);
for(i=0;i<ulist.childNodes.length;i++){
if(ulist.childNodes[i].nodeType==1 && ulist.childNodes[i].nodeName=="LI"){
mainMenuItem=ulist.childNodes[i];
moveMenuItem(mainMenuItem); 
}
}

}

function submenuovers(navRoot ){
 if(navRoot!=null){
  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", "");
	 }
	}
  }
 }
}

function getFirstChild(cld){ //this is a FF workaround, to get the first ELEMENT, not whitespace, etc.
i=0;
while(cld[i].nodeType!=1){
i++;
}
return cld[i];
}


function getFirstUL(cld){ //this is a FF workaround, to get the first ELEMENT, not whitespace, etc.
out=null;
for(i=0; i<cld.childNodes.length; i++){
if(cld.childNodes[i].nodeType==1 && cld.childNodes[i].nodeName=="UL"){
return cld.childNodes[i];
}
}
return out;
}

/*
           _________
 _________|____b____|__
|________d|_c_|________| = z

*/
function moveMenuItem(mainMenuItem){
menu0=document.getElementById('menu');
for(oi=0;oi<mainMenuItem.childNodes.length;oi++){
if(mainMenuItem.childNodes[oi].nodeType==1 && mainMenuItem.childNodes[oi].nodeName=="UL"){
subMenuArea=mainMenuItem.childNodes[oi];
b=subMenuArea.offsetWidth;
c=mainMenuItem.offsetWidth; 
d=0;	//d=0 means it's always a right-facing menu
//mainMenuItem.offsetLeft-menu0.offsetLeft;
z=menu0.offsetWidth;
popLeft=c+d-b;
popRight=(z-(d+b)); 

//	if(Math.max(popRight,popLeft)==popRight){	// pop wherever there's greater room: no ie7
if(mainMenuItem.childNodes[oi].id!="s_id"){	//unless it's the search, popLeft
	a=d;
	}else{
	a=popLeft;
	}

subMenuArea.style.width=""+b+"px";	//hack for IE
subMenuArea.style.left=""+a+"px";
}
}
}


/* basic 4-line script to include on any/all pages for 'is private' header */
path=document.location.pathname;
pname=path.substring(1,path.indexOf('/',1));
dl=location.search;
if(dl.indexOf('isprivate')>-1) document.write("<div style='color:white;font-family:Verdana,Arial,sans-serif;font-size:11px;padding-left:20px;background-color:#944;line-height:20px;height:20px;'>This site is currently INTERNAL ONLY. Outsiders will require a password. <a style='color:#eee;text-decoration:underline;' href='/wsadmin/modules/setAuth/index.php?pname="+pname+"'>Make this site public</a></div>");

