sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	var sfEls = document.getElementById("depts").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function checksearch() {

	if (document.search_form.searchwhere[0].checked) { return true; }
	
	else { 
		document.search_form.action = "websearch.php";
		return true;
		
	}
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

function toggle(tgthisid) {
	var y = new getObj(tgthisid);
	if (y.style.display != 'none') {
		y.style.display = 'none';
	}
	else {	
		y.style.display = '';
	}
}

function showmenu(showthisid) {
	var y = new getObj(showthisid);
	y.style.left = '-999em';
	y.style.left = 'auto';
	y.style.zindex = '0';
	}

function hidemenu(showthisid) {
	var y = new getObj(showthisid);
	y.style.left = '-999em';
	}

function showid(showthisid) {
	var y = new getObj(showthisid);
	y.style.visibility = 'visible';
	y.style.display = 'inline';
	}

function hideid(hidethisid) {
	var y = new getObj(hidethisid);
	y.style.visibility = 'hidden';
	y.style.display = 'none';
}


function showid2(tgdiv) {
	var y = new getObj(tgdiv);
	y.style.visibility = 'visible';
 }

function showid3(tgdiv) {
	var y = new getObj(tgdiv);
	y.style.visibility = 'visible';
	y.style.display = 'block';
 }

function hideid2(tgdiv) {
	var y = new getObj(tgdiv);
	y.style.visibility = 'hidden';
 }
 
/* this is the event handler */
function OnOffsiteLinkClick() {
	window.open(this.href);
	return false;     /* cancel the default click action */
}

/* this is an alternative event handler which is specially crafted for Opera */
function OnOperaOffsiteLinkClick() {
	window.open(this.href, "", "location=1,scrollbars=1");
	return false;     /* cancel the default click action */
}

function AssignLinkClickHandler() {
	var i, l, anchors;
	var opera;


	if (!(window.document.getElementsByTagName && String.prototype.split && window.open))
		/* sorry, your user agent sucks! */
		return;

	opera = navigator.userAgent.toLowerCase().indexOf("opera") >= 0 ? 1 : 0;

	anchors = window.document.getElementsByTagName("a");
		/* you might want to extend this for 'area' elements */

	for (i=0; i < anchors.length; i++) {
		l = anchors[i];
		if (
		  l.getAttribute("href") &&                             /* is a link, not merely an anchor */
		  AttrListContains(l.getAttribute("rel"), "external")    /* refers to an extern location */
		)
			{
				l.onclick = opera ? OnOperaOffsiteLinkClick : OnOffsiteLinkClick;
			}
	}
}


function UnassignLinkClickHandler() {
	var i, l, anchors;


	if (!(window.document.getElementsByTagName && String.prototype.split && window.open))
		/* sorry, your user agent sucks! */
		return;

	anchors = window.document.getElementsByTagName("a");
		/* you might want to extend this for 'area' elements */

	for (i=0; i < anchors.length; i++) {
		l = anchors[i];
		if (
		  l.getAttribute("href") &&                             /* is a link, not merely an anchor */
		  AttrListContains(l.getAttribute("rel"), "external") && /* refers to an extern location */
		  1
		)
			{
				l.onclick = null;
			}
	}
}

function xlinks_on() {
	AssignLinkClickHandler();
	setCookie("xlinks","on");
}

function xlinks_off() {
	UnassignLinkClickHandler();
	setCookie("xlinks","off");
}

function fixSafari() {
//		if(window.navigator.userAgent.indexOf('Safari') != -1) {
//			document.write('<style type="text/css" html body #nav li ul { margin-top: -3.7em; } </style>');
//		}
}

function setCookie(cookieName,cookieValue) {
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 3600000*24*3000);
	document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
	}
	
function readCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
	}


function encrypt()
{
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "eyxm@xyvGaGrryQmG9or.Qyh"
  key = "l4S8zftpwVybMnCum3UKXcrDekJ2RP9NvL0AFaZ6hdIgjQxBo1Wq7EiYOHT5sG"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href='mailto:"+link+"'>Email me</a>")
}
}
