  // Function to validate form information
  function CheckForm()
  {
    var f = window.document.forms[1];		// shortcut names for form
    var fn = f.FULLNAME.value;			//   and names on form
    var fc = f.COMPANYNAME.value;		 
    var fa = f.STREETADDRESS.value;
    var fs = f.CITYSTATEZIP.value;	
    var ft = f.TELEPHONE.value;
    var ff = f.FAX.value;
    var fe = f.EMAIL.value; 
    var fa2 = f.STREETADDRESS2.value;
    var fs2 = f.CITYSTATEZIP2.value;	
    var ftxt = f.MESSAGE.value;			

    if (IsBlank(fn))
    {
      alert("You must enter your name.");
      return false;
    }

    if (IsBlank(fc))
    {
      f.COMPANYNAME.value="none";
    }

    if (IsBlank(fa))  
    {
      alert("You must enter your street address.");
      return false;
    }
 
    if (IsBlank(fs))  
    {
      alert("You must enter your city/state/zip.");
      return false;
    }

    if  (IsBlank(ft) && IsBlank(ff) && IsBlank(fe)  )  
    {
      alert("You must enter at least one of the following:  telephone, fax or email.");
      return false;
    }

    if (IsBlank(ft))  
    {
       if (f.CONTACT_PHONE.checked)
       {
          alert("You must enter a telephone number if you wish us to contact you by phone.");
           return false;
        }
       else
       {
          f.TELEPHONE.value="none";
       }
    }

    if (IsBlank(ff))  
    {
       if (f.CONTACT_FAX.checked)
       {
          alert("You must enter a fax  number if you wish us to contact you by fax.");
           return false;
        }
       else
       {
            f.FAX.value="none";
       }
    }

    if (IsBlank(fe))
    {
       if (f.CONTACT_EMAIL.checked)
       {
          alert("You must enter an email address  if you wish us to contact you by email.");
           return false;
        }
       else
       {
            f.EMAIL.value="none";
        }
    }
    else
    {
         // check for @ sign in email address
         if (fe.search("@") == -1)
        {
          alert("Your email address is invalid.");
           return false;
         }
    }

    if (IsBlank(fa2))  
    {
      f.STREETADDRESS2.value="none";
    }
 
    if (IsBlank(fs2))  
    {
        f.CITYSTATEZIP2.value="none";
    }

    if (IsBlank(ftxt))  
    {
      ftxt="No message given";
      f.MESSAGE.value = ftxt;
    }

    return true;		// submit form
 }


  // Function to check for whether string is blank or not
  function IsBlank(txt)
  {
    var ch="";
    
    // check for null or empty string
    if ((txt==null) || (txt==""))
      return true;
    
    // check for white space
    for (i = 0; i < txt.length; i++)
    {
      ch = txt.charAt(i);
      if((ch != ' ') && (ch != '\n') && (ch != '\t'))
        return false;					// found white space character
     }

     return true;					// all tests passed
  }