<!-- hide JS code

function validateForm(form)  // validate user input
  {

    var form_name=form.name; 
    
    if (form_name.search(/HIVattest/i)>=0) //HIVattest form validation
    {
      if (!validateFullName(form.realname.value))  // name valid?
       {
       form.realname.focus()
       return false
       }
      
     if (!validateID(form.ID.value))                   // ID valid?
      {
      form.ID.focus()
      return false
      }
       
     if (!validateEmail(form.email.value))              // Email valid?
      {
      form.email.focus()
      return false
      }
    if (!form.Statement.checked)
     { 
       alert("Please click the check box under Statement:");
       form.Statement.focus();
       return false;
     }

    }else if (form_name.search(/QuizTest/i)>=0) 
    { //check quiz form
      if (!validateFullName(form.Name.value))  // name valid?
       {
       form.Name.focus()
       return false
       }
  
     if (!validateEmail(form.Email.value))                   // Email valid?
      {
      form.Email.focus()
      return false
      }

     if (!validateID(form.SSN.value))                   // ID valid?
      {
      form.SSN.focus()
      return false
      }
   
    }
    return true; 
}

function validateFullName(Name) // valid the realname field
  {
  if (isBlank(Name))               // first name field blank?
    {
    alert("Enter your full name, please!")
    return false
    }
  return true
  }

function isBlank(testStr) // check if a field is blank
  {
  if (testStr.length == 0)                     // nothing entered?
    return true
  for (var i = 0; i <= testStr.length-1; i++)  // all spaces?
    if (testStr.charAt(i) != " ")
      return false
  return true
 }


function validateID(SSN) // check if phone is valid
  {
  if (isBlank(SSN))                     // numHours blank?
    {
    alert("Enter your ID number or department name, please!")
    return false
    }
  return true
  }



function validateEmail(email) // Check if email is valid, not use here
  {
    if (isBlank(email))                       // email blank?
    {
      alert("Please enter your valid email address. A vaild email address should be in the format of emailname@somewhere.com")
      return false
    }
    var atsignPos = email.indexOf("@", 0)     // check for @
    if (atsignPos == -1)  
    {
      alert("Please Eenter a valid email address in the format of emailname@somewhere.com:")
      return false
    }
    if (email.indexOf(".", atsignPos) == -1)  // check for . after @      
    {
      alert("Please enter a valid email domain after @:")
      return false
    }
    return true
  }



// end JS hide -->

