
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 checkForm(thisForm) {
	with (thisForm){
		if (chkF(txtName, "Please enter your name.", "asd")==false){
			txtName.focus();
			return false
		}
		
		if (chkE(txtEmail,"Sorry that isn't a valid Email Address")==false){
			txtEmail.focus();
			return false
		}
		
		if (chkF(mtxMessage, "Please enter a Message", "asd")==false){
			mtxMessage.focus();
			return false
		}
	}
}