<!--
function checkEmail (mystring) {
var error="";
if (mystring == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(mystring))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (mystring.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkPhone (mystring) {
var error = "";
if (mystring == "") {
   error = "You didn't enter a phone number.\n";
}

var stripped = mystring.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
  
    }
    if (!(stripped.length == 10)) {
	error = "The phone number is the wrong length. Make sure you included an area code.\n";
    } 
return error;
}

// non-empty textbox

function isEmpty(mystring, fieldName) {
var error = "";
  if (mystring.length == 0) {
     error = fieldName + " has not been filled in.\n"
  }
return error;	  
}



function validateForm(theForm) {
	var why = "";
	
	why += checkEmail(theForm.email.value);
	why += isEmpty(theForm.name.value, "Name");
	why += isEmpty(theForm.address.value, "Address");
	why += isEmpty(theForm.phone.value, "Phone");
	
  if (why != "")
  {
  	alert(why);
  	return false;
  }
  
  return true;

}
//-->
