function validate_phone(form)
{
   //the regex below will test for a phone number that includes spaces, periods or dashes as delimiters
   //and optionally may have parentheses around the area code
   var valid = true;
   var regex = /^\s*\(?\s*[0-9]{3}\s*\)?\s*[-.]?\s*[0-9]{3}\s*[-.]?\s*[0-9]{4}\s*$/;
   if (form.qp.value == null || !regex.test(form.qp.value))
      valid = false;

   if (!valid)
   {
      var errmsg = document.getElementById("phone_validation");
      errmsg.innerHTML = "Please enter a valid 10-digit phone number.";
      errmsg.style.display = "block";
   }

   return valid;
}

function validate_people(form)
{
   //replace dashes with spaces
   form.qf.value = form.qf.value.replace(/-/g, " ");
   form.qn.value = form.qn.value.replace(/-/g, " ");

   var valid = true;
   var count = 0;
   var regex_nonempty = /[a-zA-Z]+/;
   if (form.qf != null && regex_nonempty.test(form.qf.value))
      count++;
   if (form.qn != null && regex_nonempty.test(form.qn.value))
      count++;
   if (form.qs.selectedIndex > 0)
      count++;
   if (count < 2)
      valid = false;

   //ensure that the field has a value that is not just whitespace or invalid characters
   var regex_blacklist = /[^a-zA-Z \']/;
   if (regex_blacklist.test(form.qf.value))
      valid = false;
   if (regex_blacklist.test(form.qn.value))
      valid = false;

   if (!valid)
   {
      var errmsg = document.getElementById("people_validation");
      errmsg.innerHTML = "Please enter at least two of the following: First Name, Last Name, State.";
      errmsg.style.display = "block";
   }

   return valid;
}
