remove an inadvertant debugging call left in, allow an agentnum to be specfied for...
[freeside.git] / fs_selfservice / FS-SelfService / cgi / signup.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4   <TITLE><%= $agent || ( $signup_service eq 'svc_phone' ? 'ITSP' : 'ISP' ) %> Signup form</TITLE>
5   <%= $head %>
6 </HEAD>
7 <BODY BGCOLOR="<%= $body_bgcolor || '#e8e8e8' %>" onUnload="myclose()">
8
9 <script type="text/javascript">
10   var mywindow = -1;
11   function myopen(filename,windowname,properties) {
12     myclose();
13     mywindow = window.open(filename,windowname,properties);
14   }
15   function myclose() {
16     if ( mywindow != -1 )
17       mywindow.close();
18     mywindow = -1
19   }
20 </script>
21
22 <%= $OUT .= $body_header
23       || '<FONT SIZE=7>'.
24          ( $agent || ( $signup_service eq 'svc_phone' ? 'ITSP' : 'ISP' ) ).
25          ' Signup form</FONT><BR><BR>';
26 %>
27
28 <FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
29
30 <FORM NAME="OneTrueForm" ACTION="<%= $self_url %>" METHOD=POST onSubmit="document.OneTrueForm.signup.disabled=true">
31 <INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
32 <INPUT TYPE="hidden" NAME="action" VALUE="process_signup">
33 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>">
34 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<%= $referral_custnum %>">
35 <INPUT TYPE="hidden" NAME="ss" VALUE="">
36 <input type="hidden" name="payby">
37 <%=
38   $OUT = join("\n",map { my $method = $_ ; map { qq|<input type="hidden" name="${method}_$_" />| } qw / payinfo payinfo1 payinfo2 payname paystate paytype paycvv month year type  /  } @payby);
39 %>
40
41 <%=
42   $OUT = join("\n", map { qq|<input type="hidden" name="$_" />| } qw / promo_code reg_code pkgpart username _password _password2 sec_phrase popnum mac_addr countrycode phonenum sip_password pin / );
43 %>
44
45 Where did you hear about our service? <SELECT NAME="refnum">
46 <%=
47   $OUT .= '<OPTION VALUE="">' unless $refnum;
48   foreach my $part_referral ( @part_referral ) {
49     $OUT .= '<OPTION VALUE="'. $part_referral->{'refnum'}. '"';
50     $OUT .= ' SELECTED' if $part_referral->{'refnum'} == $refnum;
51     $OUT .= '>'. $part_referral->{'referral'};
52   }
53 %>
54 </SELECT><BR><BR>
55 Contact Information
56 <TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=0 WIDTH="100%">
57 <TR>
58   <TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
59   <TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="<%= $last %>">,
60                 <INPUT TYPE="text" NAME="first" VALUE="<%= $first %>"></TD>
61 </TR>
62 <TR>
63   <TD ALIGN="right">Company</TD>
64   <TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="<%= $company %>"></TD>
65 </TR>
66 <TR>
67   <TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
68   <TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="<%= $address1 %>"></TD>
69 </TR>
70 <TR>
71   <TD ALIGN="right">&nbsp;</TD>
72   <TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="<%= $address2 %>"></TD>
73 </TR>
74 <TR>
75   <TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
76   <TD><INPUT TYPE="text" NAME="city" VALUE="<%= $city %>"></TD>
77   <TH ALIGN="right"><font color="#ff0000">*</font>State/Country</TH>
78   <TD>
79     <%=
80         ($county_html, $state_html, $country_html) =
81           regionselector( {
82             selected_county  => $county,
83             selected_state   => $state,
84             selected_country => $country,
85             default_state    => $statedefault,
86             default_country  => $countrydefault,
87             locales          => \@cust_main_county,
88           } );
89  
90         "$county_html $state_html";
91     %>
92   </TD>
93   <TH><font color="#ff0000">*</font>Zip</TH>
94   <TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="<%= $zip %>"></TD>
95 </TR>
96 <TR>
97   <TH ALIGN="right"><font color="#ff0000">*</font>Country</TH>
98   <TD><%= $country_html %></TD>
99 <TR>
100   <TD ALIGN="right">Day Phone</TD>
101   <TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="<%= $daytime %>" SIZE=18></TD>
102 </TR>
103 <TR>
104   <TD ALIGN="right">Night Phone</TD>
105   <TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="<%= $night %>" SIZE=18></TD>
106 </TR>
107 <TR>
108   <TD ALIGN="right">Fax</TD>
109   <TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="<%= $fax %>" SIZE=12></TD>
110 </TR>
111 <%=
112   $OUT = '';
113   if ( $stateid_enabled ) {
114     my ($county_html, $state_html, $country_html) =
115       regionselector( {
116         prefix           => 'stateid_',
117         default_state    => $statedefault,
118         default_country  => $countrydefault,
119         locales          => \@cust_main_county,
120       } );
121     $OUT .= qq!<TR><TD ALIGN="right">!. $label{stateid}.'</TD>';
122     $OUT .= qq!<TD><INPUT TYPE="text" NAME="stateid" VALUE="$stateid" SIZE=12></TD>!;
123     $OUT .= qq!<TD ALIGN="right">!. $label{stateid_state} .'</TD>';
124     $OUT .="<TD COLSPAN=3>$county_html $state_html</TD></TR>";
125   }
126 %>
127 </TABLE><font color="#ff0000">*</font> required fields<BR>
128 <BR>Billing information<TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=0 WIDTH="100%">
129 <TR><TD>
130
131   <%=
132     $OUT ='';
133     unless ( $emailinvoiceonly ) { 
134     $OUT .= '<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"';
135     my @invoicing_list = split(', ', $invoicing_list );
136     $OUT .= ' CHECKED'
137       if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
138     $OUT .= '>   Postal mail invoice'; } 
139   %>
140
141
142 </TD></TR>
143 <TR><TD><%= $OUT = ( $emailinvoiceonly ? q|<font color="#ff0000">*</font>| : q|| ) %> Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ ne 'POST' } split(', ', $invoicing_list ) ) %>">
144 </TD></TR>
145 <%= ( scalar(@payby) > 1 or 1 ) ? '<TR><TD>Billing type ' : '' %>
146 <!--</TABLE>
147 <TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
148 <TR>-->
149
150   <%=
151
152     my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
153     foreach ( keys %card_types ) {
154       $selected = $CARD_type eq $card_types{$_} ? 'SELECTED' : '';
155       $cardselect .= qq!<OPTION $selected VALUE="$card_types{$_}">$_</OPTION>!;
156     }
157     $cardselect .= '</SELECT>';
158   
159     my %payby = (
160       'CARD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("CARD"). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!,
161       'DCRD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("DCRD"). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="">!,
162       'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="" MAXLENGTH=10><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9> Type <SELECT NAME="CHEK_paytype">!. join('', map {qq!<OPTION VALUE="$_">$_</OPTION>!} @paytypes). qq!</SELECT><BR>{$r}Bank State <INPUT TYPE="text" NAME="CHEK_paystate" VALUE="" SIZE=5 MAXLENGTH=4><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="">!,
163       'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="" MAXLENGTH=10> Type <SELECT NAME="DCHK_paytype">!. join('', map {qq!<OPTION VALUE="$_">$_</OPTION>!} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9><BR>{$r}Bank State <INPUT TYPE="text" NAME="DCHK_paystate" VALUE="" SIZE=5 MAXLENGTH=4><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
164       'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" NAME="LECB_payinfo" VALUE="" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
165       'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR><INPUT TYPE="hidden" NAME="BILL_month" VALUE="12"><INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">Attention<INPUT TYPE="text" NAME="BILL_payname" VALUE="Accounts Payable">!,
166       'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR><font color="#ff0000">*</font>Exp !. expselect("COMP"),
167       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="" MAXLENGTH=80>!,
168     );
169
170     if ( $cvv_enabled ) {
171       foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
172         $payby{$payby} .= qq!<TR><TD ALIGN="right">CVV2&nbsp;(<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)</TD><TD><INPUT TYPE="text" NAME=${payby}_paycvv VALUE="" SIZE=4 MAXLENGTH=4></TD></TR>!;
173       }
174     }
175     if ( $paystate_enabled ) {
176       foreach my $payby ( grep { exists $payby{$_} } qw(CHEK DCHK) ) { 
177         my ($county_html, $state_html, $country_html) =
178           regionselector( {
179             prefix           => "${payby}_pay",
180             default_state    => $statedefault,
181             default_country  => $countrydefault,
182             locales          => \@cust_main_county,
183           } );
184         $payby{$payby} .= "<BR>${r}Bank state $county_html $state_html";
185       }
186     }
187
188     my( $account, $aba ) = split('@', $payinfo);
189     my %paybychecked = (
190       'CARD' => '<TABLE BGCOLOR="'. ( $box_bgcolor || '#c0c0c0' ). qq!" BORDER=0 CELLSPACING=0 WIDTH="100%"><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card type</TD><TD>$cardselect</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Card number</TD><TD><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19></TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Expration</TD><TD>!. expselect("CARD", $paydate). qq!</TD></TR><TR><TD ALIGN="right"><font color="#ff0000">*</font> Name on card</TD><TD><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname"></TD></TR>!,
191       'DCRD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("DCRD", $paydate). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="$payname">!,
192       'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="CHEK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="$payname">!,
193       'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="$account" MAXLENGTH=10> Type <SELECT NAME="DCHK_paytype">!. join('', map {qq!<OPTION VALUE="$_"!.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>"} @paytypes). qq!</SELECT><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
194       'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="$payinfo" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
195       'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR><INPUT TYPE="hidden" NAME="BILL_month" VALUE="12"><INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">Attention<INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!,
196       'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("COMP", $paydate),
197       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="$payinfo" MAXLENGTH=80>!,
198     );
199
200     if ( $cvv_enabled ) {
201       foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
202         $paybychecked{$payby} .= qq!<TR><TD ALIGN="right">CVV2&nbsp;(<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)</TD><TD><INPUT TYPE="text" NAME=${payby}_paycvv VALUE="$paycvv" SIZE=4 MAXLENGTH=4></TD></TR>!;
203       }
204     }
205     if ( $paystate_enabled ) {
206       foreach my $payby ( grep { exists $payby{$_} } qw(CHEK DCHK) ) { 
207         my ($county_html, $state_html, $country_html) =
208           regionselector( {
209             prefix           => "${payby}_pay",
210             selected_county  => $county,
211             selected_state   => $state,
212             selected_country => $country,
213             default_state    => $statedefault,
214             default_country  => $countrydefault,
215             locales          => \@cust_main_county,
216           } );
217         $paybychecked{$payby} .= "<BR>${r}Bank state $county_html $state_html";
218       }
219     }
220
221   my %payby_index = ( 'CARD'   => qq/Credit Card/,
222                       'DCRD'   => qq/Credit Card/,
223                       'CHEK'   => qq/Check/,
224                       'DCHK'   => qq/Check/,
225                       'LECB'   => qq/Phone Bill Billing/,
226                       'BILL'   => qq/Billing/,
227                       'COMP'   => qq/Complimentary/,
228                       'PREPAY' => qq/Prepaid Card/,
229                     );
230   
231
232 tie my %options, 'Tie::IxHash', ();
233
234 foreach my $payby_option ( @payby ) {
235   $options{$payby_option} = $payby_index{$payby_option};
236 }
237
238 my $selected_layer = ( grep { $_ eq 'CARD' } @payby ) ? 'CARD' : $payby[0];
239
240 HTML::Widgets::SelectLayers->new(
241   options => \%options,
242   selected_layer => $selected_layer,
243   form_name => 'dummy',
244   html_between => '</td></tr></table>',
245   form_action => 'dummy.cgi',
246   layer_callback => sub { my $layer = shift; return ( shift @hide_payment_fields ? '' : $paybychecked{$layer} ) . '</TABLE>'; },
247 )->html;
248
249
250   %>
251
252 </TR></TABLE><font color="#ff0000">*</font> required fields
253 <FORM name="signup_form" action="<%= $self_url %>" METHOD="POST" onsubmit="return fixup_form();"><BR><BR>First package
254 <INPUT TYPE="hidden" NAME="promo_code" VALUE="<%= $promo_code %>">
255 <INPUT TYPE="hidden" NAME="reg_code" VALUE="<%= $reg_code %>">
256 <TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=0 WIDTH="100%">
257 <TR>
258   <TD COLSPAN=2><SELECT NAME="pkgpart">
259
260   <%=
261     $OUT .= '<OPTION VALUE="">(none)'
262       unless scalar(@part_pkg) == 1 or $default_pkgpart;
263     foreach my $part_pkg ( @part_pkg ) {
264       $OUT .= '<OPTION VALUE="'. $part_pkg->{'pkgpart'}. '"';
265       $OUT .= ' SELECTED' if $pkgpart && $part_pkg->{'pkgpart'} == $pkgpart;
266       $OUT .= '>'. $part_pkg->{'pkg'};
267     }
268   %>
269
270   </SELECT></TD>
271 </TR>
272 <%=
273   if ( $signup_service eq 'svc_phone' ) {
274
275     $OUT .= '<TR><TD ALIGN="right">Phone number</TD><TD>'.
276             didselector( 'field'   => 'phonenum',
277                          'svcpart' => $default_svcpart,
278                        ).
279             '</TD></TR>';
280
281     $OUT .= <<ENDOUT;
282 <TR>
283   <TD ALIGN="right">Voicemail PIN</TD>
284   <TD><INPUT TYPE="pin" NAME="pin" VALUE="$pin"></TD>
285 </TR>
286 ENDOUT
287
288   } else {
289
290     $OUT .= <<ENDOUT;
291 <TR>
292   <TD ALIGN="right">Username</TD>
293   <TD><INPUT TYPE="text" NAME="username" VALUE="$username"></TD>
294 </TR>
295 <TR>
296   <TD ALIGN="right">Password</TD>
297   <TD><INPUT TYPE="password" NAME="_password" VALUE="$_password"></TD>
298 </TR>
299 <TR>
300   <TD ALIGN="right">Re-enter Password</TD>
301   <TD><INPUT TYPE="password" NAME="_password2" VALUE="$_password2"></TD>
302 </TR>
303 ENDOUT
304
305     if ( $security_phrase ) {
306       $OUT .= <<SECPHRASE;
307 <TR>
308   <TD ALIGN="right">Security Phrase</TD>
309   <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
310   </TD>
311 </TR>
312 SECPHRASE
313     } else {
314       $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
315     }
316
317     if ( $nomadix ) {
318
319       warn $mac_addr;
320       $mac_addr ||= $MA;
321       warn $mac_addr;
322
323       $OUT .= <<NOMADIX;
324         <INPUT TYPE="hidden" NAME="mac_addr" VALUE="$mac_addr">
325 NOMADIX
326
327     }
328
329   }
330
331   if ( @svc_acct_pop ) {
332     $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
333             popselector( 'popnum'        => $popnum,
334                          'pops'          => \@svc_acct_pop,
335                          'init_popstate' => $init_popstate,
336                          'popac'         => $popac,
337                          'acstate'       => $acstate,
338                        ).
339             '</TD></TR>';
340   } else {
341     $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop);
342   }
343
344 %>
345
346 </TABLE>
347
348 <%= 
349 if ( @optional_packages ) { 
350   my @html;
351   foreach my $ii ( 0 .. $#optional_packages) {
352   my $friendly_index = $ii + 1; 
353   if ($optional_packages[$ii]) {
354     push @html, qq|<BR>Optional Package #$friendly_index <br />|,'<table bgcolor="#c0c0c0"><tr><td>';
355
356     push @html, qq|<select name="optional_package${ii}">|;
357     push @html, qq|<option value="none"></option>|;
358     push @html, map { qq|<option value="$_->{pkgpart}">$_->{pkg}</option>| } @{$optional_packages[$ii]};
359     push @html, q|</select>|;
360     
361     push @html, '</td></tr></table>';
362     }
363     $OUT = join("\n", @html);
364   }  
365 } else {
366 $OUT = ''
367 }
368 %>
369
370 <BR><INPUT TYPE="submit" NAME="signup" VALUE="Signup">
371 <script language="JavaScript">
372
373 function fixup_form() {
374     
375     // copy payment method data up to OneTrueForm
376     
377     var payment_method_elements = new Array( 'payinfo', 'payinfo1', 'payinfo2', 'payname', 'paycvv' , 'paystate', 'paytype', 'month', 'year','type' );
378     var payment_method_form_name = document.OneTrueForm.select.options[document.OneTrueForm.select.selectedIndex].value;
379     document.OneTrueForm.elements['payby'].value = payment_method_form_name;
380     var payment_method_form = document.forms[payment_method_form_name];
381
382     for ( ii = 0 ; ii < payment_method_elements.length ; ii++ ) {
383         var true_element_name = payment_method_form_name + '_' + payment_method_elements[ii];
384         copyelement ( payment_method_form.elements[true_element_name],
385                       document.OneTrueForm.elements[true_element_name] );
386     }
387     
388     // Copy signup details to OneTrueForm
389     
390     var signup_elements = new Array (
391       'promo_code', 'reg_code', 'pkgpart',
392       'username', '_password', '_password2', 'sec_phrase', 'popnum',
393       'mac_addr',
394       'countrycode', 'phonenum', 'sip_password', 'pin'
395     );
396
397     for ( ii = 0 ; ii < signup_elements.length ; ii ++ ) {
398         copyelement ( document.signup_form.elements[signup_elements[ii]],
399                       document.OneTrueForm.elements[signup_elements[ii]]);
400     }
401
402     document.OneTrueForm.submit();
403     return false;
404 }
405
406 function copyelement(from, to) {
407 //    alert ( from + ' ' + to );
408     
409     if ( from == undefined ) {
410         to.value = '';
411     } else { 
412         if ( from.type == 'select-one' ) {
413             to.value = from.options[from.selectedIndex].value;
414         } else if ( from.type == 'checkbox' ) {
415             if ( from.checked ) {
416                 to.value = from.value;
417             } else {
418                 to.value = '';
419             }
420         } else {
421             if ( from.value == undefined ) {
422                 to.value = '';
423             } else {
424                 to.value = from.value;
425             }
426         }
427 //      alert(from.name + " (" + from.type + "): " + to.name + " => " + to.value);
428     }
429 }
430
431 </script>
432 </FORM>
433 <%= $OUT .= $body_footer %>
434 </BODY>
435 </HTML>