/*
//THE FUNCTION FOR THE CASCADING MENU

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"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/

function chkF(field,alerttxt,reject){
	with (field) {
		if (value==null||value==""||value==reject){
			alert(alerttxt);
			return false
		} else { return true }
	}
}

function chkE(field,alerttxt){
	with (field){
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false}
		else {return true}
	}
}

function contactForm(thisForm) {
	with (thisForm){
		if (chkF(lhlName, "Please enter your name.", "asd")==false){
			lhlName.focus();
			return false
		}
		
		if (chkE(lhlEmail,"Sorry that isn't a valid Email Address")==false){
			lhlEmail.focus();
			return false
		}
		
		if (chkF(lhlContact,"Please enter your Contact Number", "asd")==false){
			lhlContact.focus();
			return false
		}
		
		if (chkF(lhlMessage, "Please enter a Message", "asd")==false){
			lhlMessage.focus();
			return false
		}
	}
}

function changeImg(img) {
	if(img.src.match("-over")) {
		img.src = img.src.split("-over").join("-butt");
	} else {
		img.src = img.src.split("-butt").join("-over");
	}
}