<!-- // Activate HTML comment cloak

// Function to check date entered for a semblance of validity.
function IsBDate(theElement) {
  var l_OK = false;
  var cString = theElement.value;
  // Check for empty and OK length.
  if(cString != "" && cString != null && cString.length > 7) {
    // Make sure we have '/' and not '-'
	cString = cString.replace(/[-]/g, '/');
	// Break up the date string.
  var darry = cString.split('/');
    // Assign the elements to separate variables.
	if ( darry.length == 3) {
      var cMM = darry[0];
      var cDD = darry[1];
      var cYY = darry[2];
      var nTmpMM = parseInt(cMM, 10);
      var nTmpDD = parseInt(cDD, 10);
      var nTmpYY = parseInt(cYY, 10);
      if ( !( isNaN(nTmpMM) || isNaN(nTmpDD) || isNaN(nTmpYY) ) ) {
        // Check for valid month number.
        if ( nTmpMM > 0 && nTmpMM < 13) {
          // Check for valid day number.
          if ( nTmpDD > 0 && nTmpDD < 32) {
            // If 2-digit year, convert to 4-digit year.
            if ( cYY.length == 2 ) {
              if ( nTmpYY > 25 && nTmpYY < 100 ) {
                cYY = '19' + cYY;
              }
              else {
                cYY = '20' + cYY;
              }
              // Note that we have a valid date.
              l_OK = true;
              // Cleaned up version of the date string.
              cString = cMM + '/' + cDD + '/' + cYY;
            }
            else {
              // A 4-digit year, check for reasonableness.
              if ( nTmpYY > 1900 && nTmpYY < 2025 ) {
                // Note that we have a valid date.
                l_OK = true;
                // Cleaned up version of the date string.
                cString = cMM + '/' + cDD + '/' + cYY;
              }
            }
          }
        }
      }
    }
  }

  if (l_OK) {
    // We have a valid date (sort of).
    // Use our cleaned up version of the string.
    theElement.value = cString;
    return true;
  }
  else {
    // Date entered not valid, phhht user.
    theElement.value = "";
    alert("Please enter a valid date of birth (MM/DD/YYYY).");
    theElement.focus();
    return false;
  }
}

// Validate the input form.
function formCheck(theForm) {
  if(IsEmpty(theForm.txtFirstName) == true) {
    alert("Please enter your first name.");
    theForm.txtFirstName.focus();
    return false;
  }

  if(IsEmpty(theForm.txtLastName) == true) {
    alert("Please enter your last name.");
    theForm.txtLastName.focus();
    return false;
  }

  if(IsEmpty(theForm.txtEmail) == true) {
    alert("Please enter your Email address.");
    theForm.txtEmail.focus();
    return false;
  }

  if(IsEmpty(theForm.txtBirthDate) == true) {
    // Include the following only if an entry is required.
    // alert("Please enter your date of birth.");
    // theForm.txtBirthDate.focus();
    // return false;
  }
  else {
    if (!IsBDate(theForm.txtBirthDate)) return false;
  }

  if(IsEmpty(theForm.txtUserID) == true) {
    alert("Please enter your UserName.");
    theForm.txtUserID.focus();
    return false;
  }

  if(IsEmpty(theForm.txtPassword) == true) {
    alert("Please enter your Password.");
    theForm.txtPassword.focus();
    return false;
  }

  // Only turn 'on' if require check of other fields.
  if (false) {
    return formCheckXtra(theForm);
  }

  return true;
}

// Validate the 'not required' fields on the input form.
function formCheckXtra(theForm) {

  if(IsEmpty(theForm.txtAddress1) == true && IsEmpty(theForm.txtAddress2) == true) {
    alert("Please enter your address.");
    theForm.txtAddress1.focus();
    return false;
  }

  if(IsEmpty(theForm.txtCity) == true) {
    alert("Please enter your city.");
    theForm.txtCity.focus();
    return false;
  }

  if(IsNoSelection(theForm.selState) == true) {
    alert("Please select your state.");
    theForm.selState.focus();
    return false;
  }

  if(IsEmpty(theForm.txtPostalCode) == true) {
    alert("Please enter your Zip/Postal Code.");
    theForm.txtPostalCode.focus();
    return false;
  }

  if(IsNoSelection(theForm.selCountry) == true) {
    alert("Please select your country.");
    theForm.selCountry.focus();
    return false;
  }

  if(IsEmpty(theForm.txtTelephone) == true) {
    alert("Please enter your telephone.");
    theForm.txtTelephone.focus();
    return false;
  }

  if(IsNoSelection(theForm.selReferredBy) == true) {
    alert("Please select how you found out about us.");
    theForm.selReferredBy.focus();
    return false;
  }

  return true;
}

// Deactivate HTML comment cloak -->

