rendered paste body{* $Id: check_zipcode_js.tpl,v 1.2.2.3 2005/03/09 12:20:29 max Exp $ *}<SCRIPT type="text/javascript" language="JavaScript 1.2">{literal}function check_zip_code_field(cnt, zip){var alert_str = '';var c_code; if(!zip) return true; if(zip.value == "") return true; c_code = cnt ? cnt.options[cnt.selectedIndex].value : "{/literal}{$config.General.default_country}{literal}"; if (c_code == "US") { if (zip.value.length!=5 || zip.value.search(/\D/) != -1) alert_str = '{/literal}{$lng.txt_error_us_zip_code|replace:"'":"\'"}{literal}'; } else if (c_code == "CA") { if (zip.value.length!=6 && zip.value.length!=7) alert_str = '{/literal}{$lng.txt_error_ca_zip_code|replace:"'":"\'"}{literal}'; } if(alert_str.length > 0) { alert(alert_str); zip.focus(); return false; } return true}function check_zip_code(){ return check_zip_code_field(document.forms["registerform"].b_country, document.forms["registerform"].b_zipcode) && check_zip_code_field(document.forms["registerform"].s_country, document.forms["registerform"].s_zipcode); }{/literal}</SCRIPT>