	function validName(theName) {
		if (theName.length < 3) {
			return false;
		}
		return true;
	}
	
	function validEmail(email) {
			invalidChars = " /:,;"
			if (email == "") {
				return false;
			}
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i);
				if (email.indexOf(badChar,0) != -1) {
					return false;
				}
			}
			atPos = email.indexOf("@",1);
			if (atPos == -1) {
				return false;
			}
			if (email.indexOf("@",atPos+1) != -1) {
				return false;
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false;
			}
			if (periodPos+3 > email.length)	{
				return false;
			}
			return true;
	}
	

		
function validPhone(ph) {
	if (ph == "") {
		return false;	
    }
	var Nbrs = 0;
	for (i=0; i<ph.length; i++) {
		ch = ph.charAt(i);
		 if (ch != "0" && ch != "1" && ch != "2" && ch != "3" &&
		     ch != "4" && ch != "5" && ch != "6" && ch != "7" &&
             ch != "8" && ch != "9" && ch != ")" && ch != "(" && ch != "-" && ch != " " 
			 && ch != "e" && ch != "x" && ch != "t" && ch != ".") {
			return false;
		}
		
			if (ch != "(" && ch != ")" && ch != "-" && ch !=" " && ch !="e" && ch !="x" && ch !="t" && ch !=".") {
				Nbrs++;
			}
		}
	
	if (Nbrs < 7) {
		return false;
	}			
	return true;
}
function submitIt(theForm) { 
		if (!(validName(theForm.name.value)) || theForm.name.value.length < 2) {
			alert("Please enter your full name");
			theForm.name.focus();
			theForm.name.select();
			return false;
		} 
		if (!(validPhone(theForm.phone.value))) {
			alert("Please enter a valid phone number\rlike (xxx) xxx-xxxx");
			theForm.phone.focus();
			theForm.phone.select();
			return false;
		} 
		if (!(validEmail(theForm.email.value))) {
			alert("Please enter a valid email adddress\rso we may reply to you");
			theForm.email.focus();
			theForm.email.select();
			return false;
		}
	
		if (theForm.comments.value.length < 2) {
			alert("Please enter your message");
			theForm.comments.focus();
			theForm.comments.select();
			return false;
		} 
	return true;
} 
