function valEmpty(entered, alertbox) {
	with (entered) {
		if (value==null || value=="") {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {return true;}
	}
}

function valEmail(entered, alertbox) {
	with (entered) {
		apos=value.indexOf("@"); 
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {return true;}
	}
}

function validate(thisform) {
	if(valEmpty(thisform.Email,"")==false){} else {
		if (valEmail(thisform.Email,"Please enter a valid email address.")==false) {thisform.Email.focus(); thisform.Email.select(); return false;}
	}
	if (valEmpty(thisform.Message,"Please enter a message.")==false) {thisform.Message.focus(); thisform.Message.select(); return false;}
	return true;
}

