function isURL(s)
  { 
  if (isBlank(s)) 
    return false;
  
  // there must be >= 1 character before ., so we start
  // start looking at character position 1 (i.e. second character)
  var i = 1;
  var sLength = s.length;

  // look for .
  while ((i < sLength) && (s.charAt(i) != "."))
    i++

  // there must be at least one character after the .
  if ((i >= sLength - 1) || (s.charAt(i) != ".")) 
    return false;
  else 
    return true;
  }
  
  
function validateForm(form)
  {
  form.Question1.value = stripLeadingTrailingBlanks(form.Question1.value );
  if (isBlank(form.Question1.value ))
    {
    alert("Please answer Question #1.");
    form.Question1.focus();
    return false;
    }
  form.Question2.value = stripLeadingTrailingBlanks(form.Question2.value );
  if (isBlank(form.Question2.value ))
    {
    alert("Please answer Question #2.");
    form.Question2.focus();
    return false;
    }
 if ((getCheckedSelectOptions(form.prefixSelect) == -1) || 
      (getCheckedSelectOptions(form.prefixSelect) == 0))
    {
    alert("Please select your prefix.");
    return false;
    }
  form.firstnameText.value = stripLeadingTrailingBlanks(form.firstnameText.value);
  if (isBlank(form.firstnameText.value))
    {
    alert("Please enter your first name.");
    form.firstnameText.focus();
    return false;
    }
  form.lastnameText.value = stripLeadingTrailingBlanks(form.lastnameText.value);
  if (isBlank(form.lastnameText.value))
    {
    alert("Please enter your last name.");
    form.lastnameText.focus();
    return false;
    }
  form.jobtitleText.value = stripLeadingTrailingBlanks(form.jobtitleText.value);
  if (isBlank(form.jobtitleText.value))
    {
    alert("Please enter your title.");
    form.jobtitleText.focus();
    return false;
    }
  form.companyText.value = stripLeadingTrailingBlanks(form.companyText.value);
  if (isBlank(form.companyText.value))
    {
    alert("Please enter your Company.");
    form.companyText.focus();
    return false;
    }
  form.addressText.value = stripLeadingTrailingBlanks(form.addressText.value);
  if (isBlank(form.addressText.value))
    {
    alert("Please enter your Address.");
    form.addressText.focus();
    return false;
    }
  form.cityText.value = stripLeadingTrailingBlanks(form.cityText.value);
  if (isBlank(form.cityText.value))
    {
    alert("Please enter your city.");
    form.cityText.focus();
    return false;
    }
  form.zipText.value = stripLeadingTrailingBlanks(form.zipText.value);
  if (isBlank(form.zipText.value))
    {
    alert("Please enter your Zip/Postal Code.");
    form.zipText.focus();
    return false;
    }
  form.countrySelect.value = stripLeadingTrailingBlanks(form.countrySelect.value );
  if (isBlank(form.countrySelect.value ))
    {
    alert("Please enter your country.");
    form.countrySelect.focus();
    return false;
    }
  form.phoneText.value = stripLeadingTrailingBlanks(form.phoneText.value );
  if (isBlank(form.phoneText.value ))
    {
    alert("Please enter your phone number.");
    form.phoneText.focus();
    return false;
    }
  form.emailText.value = stripLeadingTrailingBlanks(form.emailText.value);
  if (!isEmail(form.emailText.value))
    {
    alert("Please enter a valid email address: yourname@company.com");
    form.emailText.focus();
    return false;
    }
  form.companyurlText.value = stripLeadingTrailingBlanks(form.companyurlText.value);
  if (!isURL(form.companyurlText.value))
    {
    alert("Please enter a valid domain. (company.com)");
    form.companyurlText.focus();
    return false;
    }

} 

