function checkForm(){
/*====================================================
  This function checks the form for required
  fields and validates the data input by the user.
  ____________________________________________________
  By: Jose Rivera, Dynamic Decisions, Inc.
  http://www.ddidynex.com
====================================================*/
var form = document.infoRequest;

 //check for first name:
 if (form.fName.value == ""){
 alert('You must provide your First Name');
 return false;
 }
 //check for last name:
 if (form.lName.value == ""){
   alert('You must provide your Last Name');
   return false;
 }
 //check for address:
 if (form.add1.value == ""){
   alert('You must provide your street address');
   return false;
 }
 if (form.city.value == ""){
   alert('You must provide your city name');
   return false;
 }
 if (form.state.value == ""){
   alert('You must provide a state');
   return false;
 }
 if (form.zip.value.length < 5){
   alert('You must provide a 5-digit zip code');
   return false;
 }

 //check for phone:
 if (form.phone.value.length < 10){
   alert('You must provide a 10-digit phone number');
   return false;
 }



/*
 //check for email:
         if (form.email.value == ""){
           alert('You must provide a valid  E-Mail Address');
           return false;
         }

 //-E-Mail Validation------------------------------
 // there must be >= 1 character before @, so we
 // start looking at character position 1
 // (i.e. second character)
    var e = form.email.value
    var i = 1;
    var eLength = e.length;
 // look for @
    while ((i < eLength) && (e.charAt(i) != "@"))
    { i++
    }
    if ((i >= eLength) || (e.charAt(i) != "@")){
     alert('Invalid E-Mail Address!');
     return false;
    }
    else i += 2;
 // look for .
    while ((i < eLength) && (e.charAt(i) != "."))
    { i++
    }
 // there must be at least one character after the .
    if ((i >= eLength - 1) || (e.charAt(i) != ".")){
     alert('Invalid E-Mail Address!');
     return false;
    }
 //-End E-Mail Validation---------------------------
*/


 //check for address is requesting information:
 if ( (form.methLit.checked) || (form.coLit.checked)){
  if (form.add1.value == ""){
    alert('You have not provided a street address');
    return false;
  }
  if ( (form.city.value == "") || (form.state.value == "") || (form.zip.value == "") ){
    alert('Please provide your City, State, and Zip Code');
    return false;
  }
 }

 //check for clinic selection if Clinical Director contact is desired:
 if ( (form.clinDir.checked) && (form.clinic.selectedIndex == "") ){
   alert('You have requested for a Clinical Director to contact you,\n' +
         'but you have NOT selected a valid Clinic Location.\n\n' +
         'Please select a clinic closest to you.');
   return false;
 }
return true; //returns true if all conditions met
}//end function: checkForm()

