<!-- Hide
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('</style>\n')
}
function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}
function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) { 
			offset += search.length
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}
function onloadfunction(){
	if (persistmenu=="yes"){
		var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
		var cookievalue=get_cookie(cookiename)
		if (cookievalue!="") {
			document.getElementById(cookievalue).style.display="block"
		}
	}
}
function savemenustate(){
/*
	var inc=1, blockid=""
	while (document.getElementById("sub"+inc)){
		if (document.getElementById("sub"+inc).style.display=="block"){
			blockid="sub"+inc
			break
		}
		inc++
	}
	var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
	var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
	document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener) {
	window.addEventListener("load", onloadfunction, false)
} else if (window.attachEvent) {
	window.attachEvent("onload", onloadfunction)
} else if (document.getElementById) {
	window.onload=onloadfunction
}
if (persistmenu=="yes" && document.getElementById) {
	window.onunload=savemenustate
*/
}
// The following code is copyright 2006 e-QualIT.  All rights reserved.
function trim(inStr) {
	if (inStr != null) {
		inStr = inStr.toString();
		var reBeg = /^\s/;
		var reEnd = /\s$/;
		while (inStr.length > 0) {
			if (inStr.match(reBeg) == null) {
				break;
			}
			inStr = inStr.replace(reBeg,"");
		}
		while (inStr.length > 0) {
			if (inStr.match(reEnd) == null) {
				break;
			}
			inStr = inStr.replace(reEnd,"");
		}
	}
	return inStr;
}
function validEmail(inStr) {
	var blnRes = false;
	if (inStr != null) {
		inStr = inStr.toString();
		var rePat = /^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))$/;
		var matches = inStr.match(rePat);
		if (matches) {
			blnRes = true;
		}
	}
	return blnRes;
}
function checkLogonSubord(fncTop) {
	if (fncTop != "") {
		fncTop = fncTop.toLowerCase();
		if (fncTop.indexOf("logon.asp") == -1) {
			top.location.href="http://www.laurel-hall.org/admin/logon.asp";
		}
	}
}
function verLogin(fncForm) {
	strUN = trim(fncForm.userName.value);
	strUPW = trim(fncForm.userPWord.value);
	if (strUN.length > 0 && strUPW.length > 5 && strUPW.length < 21) {
		return true;
	} else {
		aWin = alert("Your Username and/or your Password are not valid.\nThe Password must be at least 6 but not more than 20 characters.");
		return false;
	}
}
function verAccount(fncForm) {
	arrFields = Array("FirstName", "LastName", "userName", "userPWord", "EMail", "userLevel");
	blnErr = false;
	for (i=0;i<3;i++) {
		curFld = eval("fncForm." + arrFields[i]);
		curVal = trim(curFld.value);
		if (curVal == "") {
			blnErr = true;
			curFld.focus();
			aWin = alert("You must make an entry in this field!");
			return false;
		}
	}
	if (! blnErr) {
		curFld = eval("fncForm." + arrFields[3]);
		curVal = trim(curFld.value);
		if (curVal.length < 6 || curVal.length > 20) {
			blnErr = true;
			curFld.focus();
			aWin = alert("The password must be at least 6 but not\nmore than 20 characters!");
			return false;
		}
	}
	if (! blnErr) {
		curFld = eval("fncForm." + arrFields[4]);
		curVal = trim(curFld.value);
		if (! validEmail(curVal)) {
			blnErr = true;
			curFld.focus();
			aWin = alert("You must enter a valid e-mail address!");
			return false;
		}
	}
	if (! blnErr) {
		curFld = eval("fncForm." + arrFields[5]);
		curVal = trim(curFld.options[curFld.selectedIndex].value);
		if (curVal == "") {
			blnErr = true;
			curFld.focus();
			aWin = alert("You must select an Access Level!");
			return false;
		}
	}
	if (! blnErr) {
		return true;
	}
}
// Limit textarea input
function setMaxLength() {
	var x = document.getElementsByTagName("textarea");
	var counter = document.createElement("div");
	counter.className = "counter";
	for (var i=0;i<x.length;i++) {
		if (x[i].getAttribute("maxlength")) {
			var counterClone = counter.cloneNode(true);
			counterClone.relatedElement = x[i];
			counterClone.innerHTML = "<span>0</span> of "+x[i].getAttribute("maxlength")+" chars max";
			x[i].parentNode.insertBefore(counterClone,x[i].nextSibling);
			x[i].relatedElement = counterClone.getElementsByTagName("span")[0];
			x[i].onkeyup = x[i].onchange = checkMaxLength;
			x[i].onkeyup();
		}
	}
}
function checkMaxLength() {
	var maxLength = this.getAttribute("maxlength");
	var currentLength = this.value.length;
	if (currentLength > maxLength) {
		this.relatedElement.className = "toomuch";
	} else {
		this.relatedElement.className = "";
	}
	this.relatedElement.firstChild.nodeValue = currentLength;
}
// End textarea
// End e-QualIT
// Unhide -->
