+ }
+
+ invnum_search( invnum, search_invnum_update );
+
+ }
+
+ function <% $opt{prefix} %>search_custnum() {
+
+ this.style.color = '#000000'
+
+ var custnum_obj = this;
+ var searchrow = this.getAttribute('rownum');
+ var custnum = this.value;
+
+ if ( custnum == 'searching...' || custnum == 'Not found' || custnum == '' )
+ return;
+
+ if ( this.getAttribute('magic') == 'nosearch' ) {
+ this.setAttribute('magic', '');
+ return;
+ }
+
+ if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
+ <% $opt{prefix} %>addRow();
+ }
+
+ var customer_obj = document.getElementById('customer'+searchrow);
+ customer_obj.value = 'searching...';
+ customer_obj.disabled = true;
+ customer_obj.style.color = '#000000';
+ customer_obj.style.backgroundColor = '#dddddd';
+
+ var customer_select = document.getElementById('cust_select'+searchrow);
+
+ customer_obj.style.display = '';
+ customer_select.style.display = 'none';
+
+ var invnum = document.getElementById('invnum'+searchrow);
+ invnum.value = '';
+
+ update_balance_text(searchrow, '');
+ update_status_text( searchrow, '');
+ update_status_color(searchrow, '#000000');
+ update_num_open(searchrow, 0);
+
+ function search_custnum_update(customers) {
+
+ var customerArrayArray = eval('(' + customers + ')') || [];
+
+ if ( customerArrayArray.length == 0 ) {
+
+ update_customer(searchrow, []);
+
+ } else if ( customerArrayArray.length == 1 ) {
+
+ update_customer(searchrow, customerArrayArray[0]);
+% if ( $opt{custnum_update_callback} ) {
+ <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
+% }