+ //this part does USPS address correction
+
+ // XXX should this be first and should we update the form fields that are
+ // displayed???
+
+ //var state_el = document.bottomform.elements['state'];
+
+ //address_standardize(
+ var cust_main = new Array(
+ 'company', document.bottomform.elements['company'].value,
+ 'address1', document.bottomform.elements['address1'].value,
+ 'address2', document.bottomform.elements['address2'].value,
+ 'city', document.bottomform.elements['city'].value,
+ 'state', document.bottomform.elements['state'].value,
+ //'state', state_el.options[ state_el.selectedIndex ].value,
+ 'zip', document.bottomform.elements['zip'].value,
+
+ 'ship_company', document.bottomform.elements['company'].value,
+ 'ship_address1', document.bottomform.elements['address1'].value,
+ 'ship_address2', document.bottomform.elements['address2'].value,
+ 'ship_city', document.bottomform.elements['city'].value,
+ 'ship_state', document.bottomform.elements['state'].value,
+ //'ship_state', state_el.options[ state_el.selectedIndex ].value,
+ 'ship_zip', document.bottomform.elements['zip'].value
+ );
+
+ address_standardize( cust_main, update_address );
+
+}
+
+function update_address(arg) {
+
+ var argsHash = eval('(' + arg + ')');
+
+ var address1 = argsHash['address1'];
+ var zip = argsHash['zip'];
+ var changed = argsHash['address_standardized'];
+ var ship_changed = argsHash['ship_address_standardized'];
+
+ alert(address1);
+ alert(zip);
+ alert(changed);
+ alert(ship_changed);
+
+% if ( $conf->exists('cust_main-auto_standardize_address') ) {
+ // XXX this path not handled yet
+% } else {
+ // XXX well, this path not handled yet either. popup a confirmation popup
+% }
+
+ document.bottomform.submit();
+