// JavaScript Document

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("leftnav");
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", "");
   }
   }
  }
 }
}
window.onload=startList;

/*This function obfuscates email addresses to inhibit spammers from harvesting our email addresses
	To make this work, add the following statement instead of the typical email link:
	
	<a href="javascript:void(0)" onclick="obfuscate('','uname')">User Name</strong></a>
	
	The first parameter is the domain for the user's email address. The second is the user's email account.
	If the first parameter is left blank, the function will automatically append "csuchico.edu".
	To further obfuscate a user's email, you can change the "." in the domain name to "%%%", like so: "yahoo%%%com".
	The percent signs make it harder for the bots to parse.
		
*/

function obfuscate(domain, name) {
	if(domain == "") { // if you leave the domain blank
		domain = "csuchico.edu"; // the script assumes csuchico.edu
	}
	window.location.href=('mailto:' + name + '@' + domain.replace(/%%%/g,".")); // write out email address
}


function validateAndSubmitSearch(form) {
	if(form.search.value == "Accounting" || form.search.value == "") {
		// no search submitted on "Accounting Operations" or empty searches
		form.search.focus() // places cursor back in the search field
		return false //stops the form from being submitted
	} else {
		form.search.value = form.search.value + " site:www.csuchico.edu/ao/" //search only ao site
		return true
	}
}

