if (document.customers.elements['entry_country_id'].type != "hidden") {
    if (document.customers.entry_country_id.value == 0) {
      error_message = error_message + "<?php 
    echo xtc_js_lang(JS_COUNTRY);
    ?>
";
      error = 1;
    }
  }

  if (customers_telephone == "" || customers_telephone.length < <?php 
    echo ENTRY_TELEPHONE_MIN_LENGTH;
    ?>
) {
    error_message = error_message + "<?php 
    echo xtc_js_lang(JS_TELEPHONE);
    ?>
";
    error = 1;
  }

  if (error == 1) {
    alert(unescape(error_message));
    return false;
  } else {
    return true;
  }
}
//-->
</script>
<?php 
 function javascript_validation()
 {
     $js = 'if (payment_value == "' . $this->code . '") {' . "\n" . '  var pp_payment = ppp.getPaymentMethod();' . "\n" . '  if (!pp_payment || pp_payment.length === 0) {' . "\n" . '    error_message = error_message + unescape("' . xtc_js_lang(JS_ERROR_NO_PAYMENT_MODULE_SELECTED) . '");' . "\n" . '    error = 1;' . "\n" . '  }' . "\n" . '}' . "\n";
     return $js;
 }
?>
, "<?php 
echo xtc_js_lang(ENTRY_PASSWORD_ERROR);
?>
", "<?php 
echo xtc_js_lang(ENTRY_PASSWORD_ERROR_NOT_MATCHING);
?>
");
  check_password_new("password_current", "password_new", "password_confirmation", <?php 
echo xtc_js_lang(ENTRY_PASSWORD_MIN_LENGTH);
?>
, "<?php 
echo xtc_js_lang(ENTRY_PASSWORD_ERROR);
?>
", "<?php 
echo xtc_js_lang(ENTRY_PASSWORD_NEW_ERROR);
?>
", "<?php 
echo xtc_js_lang(ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING);
?>
");

  if (error == true) {
    alert(unescape(error_message));
    return false;
  } else {
    submitted = true;
    return true;
  }
}
//--></script>
    ?>
");
  var review = document.getElementById("product_reviews_write").review.value;
  if (review.length < <?php 
    echo REVIEW_TEXT_MIN_LENGTH;
    ?>
) {
    error_message = error_message + unescape("<?php 
    echo xtc_js_lang(JS_REVIEW_TEXT);
    ?>
");
    error = 1;
  }
  if (!((document.getElementById("product_reviews_write").rating[0].checked) || (document.getElementById("product_reviews_write").rating[1].checked) || (document.getElementById("product_reviews_write").rating[2].checked) || (document.getElementById("product_reviews_write").rating[3].checked) || (document.getElementById("product_reviews_write").rating[4].checked))) {
    error_message = error_message + unescape("<?php 
    echo xtc_js_lang(JS_REVIEW_RATING);
    ?>
");
    error = 1;
  }
  if (error == 1) {
    alert(error_message);
    return false;
  } else {
    return true;
  }
}
//--></script>
<?php 
}
if (strstr($PHP_SELF, FILENAME_POPUP_IMAGE)) {
 function javascript_validation()
 {
     $js = '';
     if (is_array($this->modules)) {
         $js = '<script type="text/javascript"><!-- ' . "\n" . 'function check_form() {' . "\n" . '  var error = 0;' . "\n" . '  var error_message = unescape("' . xtc_js_lang(JS_ERROR) . '");' . "\n" . '  var payment_value = null;' . "\n" . '  if (document.getElementById("checkout_payment").payment.length) {' . "\n" . '    for (var i=0; i<document.getElementById("checkout_payment").payment.length; i++) {' . "\n" . '      if (document.getElementById("checkout_payment").payment[i].checked) {' . "\n" . '        payment_value = document.getElementById("checkout_payment").payment[i].value;' . "\n" . '      }' . "\n" . '    }' . "\n" . '  } else if (document.getElementById("checkout_payment").payment.checked) {' . "\n" . '    payment_value = document.getElementById("checkout_payment").payment.value;' . "\n" . '  } else if (document.getElementById("checkout_payment").payment.value) {' . "\n" . '    payment_value = document.getElementById("checkout_payment").payment.value;' . "\n" . '  }' . "\n\n";
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             if (isset($GLOBALS[$class]) && $GLOBALS[$class]->enabled) {
                 $js .= $GLOBALS[$class]->javascript_validation();
             }
         }
         if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
             $js .= "\n" . '  if (!document.getElementById("checkout_payment").conditions.checked) {' . "\n" . '    error_message = error_message + unescape("' . xtc_js_lang(ERROR_CONDITIONS_NOT_ACCEPTED) . '");' . "\n" . '    error = 1;' . "\n" . '  }' . "\n\n";
         }
         $js .= "\n" . '  if (payment_value == null) {' . "\n" . '    error_message = error_message + unescape("' . xtc_js_lang(JS_ERROR_NO_PAYMENT_MODULE_SELECTED) . '");' . "\n" . '    error = 1;' . "\n" . '  }' . "\n\n" . '  if (error == 1 && submitter != 1) {' . "\n" . '    alert(error_message);' . "\n" . '    return false;' . "\n" . '  } else {' . "\n" . '    return true;' . "\n" . '  }' . "\n" . '}' . "\n" . '//--></script>' . "\n";
     }
     return $js;
 }