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){

	if (!checkStr(theForm.first_name.value)){
		theForm.first_name.value="";
		theForm.first_name.focus();
		return (false);
	}
	if (!checkStr(theForm.last_name.value)){
		theForm.last_name.value="";
		theForm.last_name.focus();
		return (false);
	}
	if (!checkStr(theForm.email.value)){
		theForm.email.value="";
		theForm.email.focus();
		return (false);
	}
	if (!checkStr(theForm.phone.value)){
		theForm.phone.value="";
		theForm.phone.focus();
		return (false);
	}

	if (theForm.first_name.value == ""){
		alert("Please enter your first name.");
		theForm.first_name.focus();
		return (false);
	}
	if (theForm.last_name.value == ""){
		alert("Please enter your last name.");
		theForm.last_name.focus();
		return (false);
	}
	if (theForm.email.value == "" || !isEmailAddr(theForm.email.value)){
		alert("Please enter your email address.");
		theForm.email.focus();
		return (false);
	}  

	return (true);

}


