function test(theForm)
{
// 1st check if all required fields are filled in
        checkedOK = true
        str = "Please fill in your "
        for (i = 0; i < theForm.length; i++)
        {
               if (theForm.elements[i].id !='')
               {
                  if ((theForm.elements[i].id.match('req')) && (theForm.elements[i].value==''))
                  {
                     str += theForm.elements[i].name + "!!!\n"
                     theForm.elements[i].name.focus;
                     checkedOK = false
                     break
                  }
               }
               if (theForm.elements[i].name.match('mail'))
               {
                  //check the syntax of the email address
                  email = theForm.elements[i].value
                  if (!email.match('@'))
                  {
                     str += "VALID email address!!!\n"
                     checkedOK = false
                     break
                  }
               }
        }
        if (!checkedOK) alert(str);
        return (checkedOK)
}

function showElements(theForm) {
        str = "Form Elements of form " + theForm.name +": \n "
        for (i = 0; i < theForm.length; i++)
            str += theForm.elements[i].name + "--" + theForm.elements[i].id + "\n"
        alert(str)
}
