function checkStr(str){
	var result = true;
	validate = new String(str);
	re = /<|>|&/g;
	if (validate.search(re)>-1){
		alert("Sorry, special characters are not allowed.");
		result=false;
	}
	return result;
}

function isEmailAddr(email){
	var result = false
	var theStr = new String(email)
	var index = theStr.indexOf("@");
	if (index > 0){
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1)){
			result = true;
		}
	}
	return result;
}

function valForm(theForm){
	var result = true;

	if (!checkStr(theForm.name.value)){
		theForm.name.value="";
		theForm.name.focus();
		return (false);
	}
	if (!checkStr(theForm.phone.value)){
		theForm.phone.value="";
		theForm.phone.focus();
		return (false);
	}
	if (!checkStr(theForm.email.value)){
		theForm.email.value="";
		theForm.email.focus();
		return (false);
	}
	if (!checkStr(theForm.message.value)){
		theForm.message.value="";
		theForm.message.focus();
		return (false);
	}
	if (theForm.name.value == "" || theForm.name.value == "Name"){
		alert("Please enter your name to request information.");
		theForm.name.focus();
		return (false);
	}
/*For both phone and email*/
	if (theForm.phone.value == "" || theForm.phone.value == "Phone" || theForm.phone.value.length < 10 || theForm.phone.value.length > 20 ){
		alert("Please enter your phone number with area code in the format ###-###-#### to request information.");
		theForm.phone.focus();
		return (false);
	}
	if (!isEmailAddr(theForm.email.value) || theForm.email.value == "" ){
		alert("Please enter either a valid email address to request information.");
		theForm.email.focus();
		return (false);
	}
/*For either phone or email*/
/*
	if (theForm.phone_work.value == "" || theForm.phone_work.value == "Phone" || theForm.phone_work.value.length < 10 || theForm.phone_work.value.length > 20 ){
		if (theForm.email1.value == ""){
			alert("Please enter either an email address or phone number with area code in the format ###-###-#### to request information.");
			theForm.phone_work.focus();
			return (false);
		}
		if (!isEmailAddr(theForm.email1.value)){
			alert("Please enter either a valid email address or phone number with area code in the format ###-###-#### to request information.");
			theForm.email1.focus();
			return (false);
		}  
	}
*/
  return (true);

}

