/**
 * The common code used for FLM form validations and submission
 * Depends on,
 * 1. validator; The validating object.
 */

/**
 * The submit action for basic contact form.
 * Expects validator variable.
 * @param strFormName the form name
 */
function cfFormSubmit(strFormName)
{
  var formElement = document.forms[strFormName];

  if(!validator.checkFirstName(formElement['firstName'].value))
  {
    return;
  }

  if(!validator.checkLastName(formElement['lastName'].value))
  {
    return;
  }

  if( !validator.checkAddress(formElement['street'].value))
  {
    return;
  }

  if(!validator.checkZip(formElement['postalCode'].value))
  {
    return;
  }

  if(!validator.checkPhone(formElement['phone'].value))
  {
    return;
  }

  if(!validator.checkEmail(formElement['email'].value))
  {
    return;
  }

  // Build the service comments
  formElement.submit();
}
