<!-- START SCRIPT

window.onload=Reset;

// Clears all fields and puts focus on the NAME field.
function Reset(){
// NAME
document.forms[0].elements[0].value = "";
// COMPANY
document.forms[0].elements[1].value = "";
// EMAIL
document.forms[0].elements[2].value = "";
// TELEPHONE
document.forms[0].elements[3].value = "";
// COMMENT
document.forms[0].elements[6].value = "";
// focus on NAME
document.forms[0].elements[0].select();
document.forms[0].elements[0].focus();
}

function submitForms(){
   if ( (isName() ) && (isCompany()) && (isEmail()) && (isPhone()) && (isComment()) )
      if (confirm("\nAll fields are complete.\n\n\nClick on OK to submit.\n\nClick on CANCEL to abort."))
         return true;
      else
         {
         alert("\nYou have chosen to abort the submission.");
         return false;      
         }
   else
      {
      return false;
      }
}

function isName(){
var str = document.forms[0].elements[0].value;
// Return false if name field is blank.
   if (str == "")
      {
      alert("\nThe NAME field is blank.\n\nPlease enter your name.")
      document.forms[0].elements[0].select();
      document.forms[0].elements[0].focus();
      return false;
      }
   // Return false if characters are not a-z, A-Z, or a space.
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
         {
         alert("\nThe NAME field only accepts letters & spaces.\n\nPlease re-enter your name.");
         document.forms[0].elements[0].select();
         document.forms[0].elements[0].focus();
         return false;
         }
      }
   return true;
}

function isCompany(){
var str = document.forms[0].elements[1].value

// If company field is blank, asks for confirmation that no comment is desired.
if (str == "")
  {
  if (confirm("\nYou're about to submit without listing your company.\n\nClick on CANCEL to include your company.\n\nClick on OK to continue without showing a company.")) 
     return true;
  else
     {
     document.forms[0].elements[1].select();
     document.forms[0].elements[1].focus();
     return false;      
     }
  }
else
   {
   return true;   
   }
}

function isEmail(){
var str = document.forms[0].elements[2].value;

// If email field is blank, asks for confirmation that no address is desired.
if (str == "")
  {
  if (confirm("\nYou're about to submit without listing your email address.\n\nClick on CANCEL to include your address.\n\nClick on OK to continue without showing an address.")) 
     return true;
  else
     {
     document.forms[0].elements[2].select();
     document.forms[0].elements[2].focus();
     return false;      
     }
  }
   // Return false if e-mail field does not contain a '@' and '.' .
  if (document.forms[0].elements[2].value.indexOf ('@',0) == -1 || 
      document.forms[0].elements[2].value.indexOf ('.',0) == -1)
      {
      alert("\nYour email address does not appear to be a valid name.\n\nPlease re-enter your e-mail address.")
      document.forms[0].elements[2].select();
      document.forms[0].elements[2].focus();
      return false;
      }
   else return true;
}

function isPhone(){
var str = document.forms[0].elements[3].value;

// Return false if PHONE field is blank.
if (str == "")
   {
   alert("\nThe TELEPHONE # field is blank.\n\nPlease enter your phone number.")
   document.forms[0].elements[3].select();
   document.forms[0].elements[3].focus();
   return false;
   }
   // Return false if characters are not 0-9, (, ), -, or a space.
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if ((ch < '0' || '9' < ch) && ch != '-' && ch != ' ' && ch != '\(' && ch != '\)') 
         {
         alert("\nThe TELEPHONE # field only accepts numbers, spaces,\nor these special characters: \(  \)  - \n\nPlease re-enter your phone number.");
         document.forms[0].elements[3].select();
         document.forms[0].elements[3].focus();
         return false;
         }
      }
   return true;
}

function isComment(){
var str = document.forms[0].elements[6].value;

// If favorite field is blank, asks for confirmation that no comment is desired.
if (str == "")
   {
   if (confirm("\nYou're about to submit without leaving a comment.\n\nClick on CANCEL to include a comment.\n\nClick on OK to continue without leaving a comment.")) 
   return true;
   else
      {
      document.forms[0].elements[6].select();
      document.forms[0].elements[6].focus();
      return false;      
      }
   }
   else return true;   
}
// END SCRIPT -->
