003632a6a684f1099b2b9797162306e12ad5b5a0
[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 <%= if ( $terms_of_service =~ /\S/ ) { # enable overlib
9   $OUT .= qq!<SCRIPT type="text/javascript" src="$_.js"></SCRIPT>\n!
10     foreach (qw(overlibmws overlibmws_iframe overlibmws_draggable 
11                 overlibmws_crossframe iframecontentmws ));
12 }
13 %>
14 <script type="text/javascript">
15   var mywindow = -1;
16   function myopen(filename,windowname,properties) {
17     myclose();
18     mywindow = window.open(filename,windowname,properties);
19   }
20   function myclose() {
21     if ( mywindow != -1 )
22       mywindow.close();
23     mywindow = -1
24   }
25 </script>
26
27 <%= $OUT .= $body_header
28       || '<FONT SIZE=7>'.
29          ( $agent || ( $signup_service eq 'svc_phone' ? 'ITSP' : 'ISP' ) ).
30          ' Signup form</FONT><BR><BR>';
31 %>
32
33 <FONT SIZE="+1" COLOR="#ff0000"><%= encode_entities($error) %></FONT>
34
35 <FORM NAME="OneTrueForm" ACTION="<%= $self_url %>" METHOD=POST onSubmit="document.OneTrueForm.signup.disabled=true">
36 <INPUT TYPE="hidden" NAME="prepaid_shortform" VALUE="<%= encode_entities($prepaid_shortform) %>">
37 <INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
38 <INPUT TYPE="hidden" NAME="action" VALUE="process_signup">
39 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>">
40 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<%= $referral_custnum %>">
41 <INPUT TYPE="hidden" NAME="ss" VALUE="">
42 <input type="hidden" name="payby">
43 <%=
44   $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);
45 %>
46
47 <%=
48   $OUT = join("\n", map { qq|<input type="hidden" name="$_" />| } qw / promo_code reg_code pkgpart username _password _password2 sec_phrase popnum domsvc mac_addr countrycode phonenum sip_password pin / );
49 %>
50
51 <%=
52   if ($override_ban_warn) {
53     $OUT .= 'Are you sure you want to sign up again? <SELECT NAME="override_ban_warn"><OPTION VALUE="0">No<OPTION VALUE="1">Yes</SELECT><BR><BR>';
54   } else {
55     $OUT .= '';
56   }
57 %>
58
59 Where did you hear about our service? <SELECT NAME="refnum">
60 <%=
61   $OUT .= '<OPTION VALUE="">' unless $refnum;
62   foreach my $part_referral ( @part_referral ) {
63     $OUT .= '<OPTION VALUE="'. $part_referral->{'refnum'}. '"';
64     $OUT .= ' SELECTED' if $part_referral->{'refnum'} == $refnum;
65     $OUT .= '>'. $part_referral->{'referral'};
66   }
67 %>
68 </SELECT><BR><BR>
69
70 <%= unless ( $prepaid_template_custnum && $prepaid_shortform  ) {
71
72 my $bgcolor = $box_bgcolor || '#c0c0c0';
73 $OUT .= qq!
74 Contact Information
75 <TABLE BGCOLOR="$bgcolor" BORDER=0 CELLSPACING=0 WIDTH="100%">
76 <TR>
77   <TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
78   <TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="$last">,
79                 <INPUT TYPE="text" NAME="first" VALUE="$first"></TD>
80 </TR>
81 <TR>
82   <TD ALIGN="right">Company</TD>
83   <TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="$company"></TD>
84 </TR>
85 <TR>
86   <TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
87   <TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="$address1"></TD>
88 </TR>
89 <TR>
90   <TD ALIGN="right">&nbsp;</TD>
91   <TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="$address2"></TD>
92 </TR>
93 <TR>
94   <TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
95   <TD><INPUT TYPE="text" NAME="city" VALUE="$city"></TD> !;
96
97         my ($county_html, $state_html, $country_html) =
98           regionselector( {
99             selected_county  => $county,
100             selected_state   => $state,
101             selected_country => $country,
102             default_state    => $statedefault,
103             default_country  => $countrydefault,
104             locales          => \@cust_main_county,
105           } );
106  
107 $county_out = ($county_html =~ /SELECT/) ? 'County/State' : 'State';
108 $OUT .= qq!<TH ALIGN="right"><font color="#ff0000">*</font> $county_out </TH>
109   <TD>
110     $county_html $state_html
111   </TD>
112   <TH><font color="#ff0000">*</font>Zip</TH>
113   <TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="$zip"></TD>
114 </TR>
115 <TR>
116   <TH ALIGN="right"><font color="#ff0000">*</font>Country</TH>
117   <TD>$country_html</TD>
118 <TR>
119   <TD ALIGN="right">Day Phone</TD>
120   <TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="$daytime" SIZE=18></TD>
121 </TR>
122 <TR>
123   <TD ALIGN="right">Night Phone</TD>
124   <TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="$night" SIZE=18></TD>
125 </TR>
126 <TR>
127   <TD ALIGN="right">Fax</TD>
128   <TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="$fax" SIZE=12></TD>
129 </TR>
130 !;
131   if ( $stateid_enabled ) {
132     my ($county_html, $state_html, $country_html) =
133       regionselector( {
134         prefix           => 'stateid_',
135         default_state    => $statedefault,
136         default_country  => $countrydefault,
137         locales          => \@cust_main_county,
138       } );
139     $OUT .= qq!<TR><TD ALIGN="right">!. $label{stateid}.'</TD>';
140     $OUT .= qq!<TD><INPUT TYPE="text" NAME="stateid" VALUE="$stateid" SIZE=12></TD>!;
141     $OUT .= qq!<TD ALIGN="right">!. $label{stateid_state} .'</TD>';
142     $OUT .="<TD COLSPAN=3>$county_html $state_html</TD></TR>";
143   }
144 $OUT .= qq!
145 </TABLE><font color="#ff0000">*</font> required fields<BR>
146 !;
147
148 }
149 else {
150     @payby = ('PREPAY');
151 }
152 '';
153 %>
154
155 <BR>Billing information<TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=0 WIDTH="100%">
156 <TR><TD>
157
158   <%=
159     $OUT ='';
160     unless ( $emailinvoiceonly ) { 
161     $OUT .= '<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"';
162     my @invoicing_list = split(', ', $invoicing_list );
163     $OUT .= ' CHECKED'
164       if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
165     $OUT .= '>   Postal mail invoice'; } 
166   %>
167
168
169 </TD></TR>
170 <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 ) ) %>">
171 </TD></TR>
172 <%= ( scalar(@payby) > 1 or 1 ) ? '<TR><TD>Billing type ' : '' %>
173 <!--</TABLE>
174 <TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
175 <TR>-->
176
177   <%=
178
179     my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
180     foreach ( keys %card_types ) {
181       $selected = $CARD_type eq $card_types{$_} ? 'SELECTED' : '';
182       $cardselect .= qq!<OPTION $selected VALUE="$card_types{$_}">$_</OPTION>!;
183     }
184     $cardselect .= '</SELECT>';
185   
186     my %payby = (
187       '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="">!,
188       '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="">!,
189       '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="">!,
190       '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="">!,
191       '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="">!,
192       '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">!,
193       '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"),
194       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="" MAXLENGTH=80>!,
195     );
196
197     if ( $cvv_enabled ) {
198       foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
199         my $cvv_r = $require_cvv ? '<font color="#ff0000">*</font> ' : '';
200         $payby{$payby} .= qq!<TR><TD ALIGN="right">${cvv_r}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>!;
201       }
202     }
203     if ( $paystate_enabled ) {
204       foreach my $payby ( grep { exists $payby{$_} } qw(CHEK DCHK) ) { 
205         my ($county_html, $state_html, $country_html) =
206           regionselector( {
207             prefix           => "${payby}_pay",
208             default_state    => $statedefault,
209             default_country  => $countrydefault,
210             locales          => \@cust_main_county,
211           } );
212         $payby{$payby} .= "<BR>${r}Bank state $county_html $state_html";
213       }
214     }
215
216     my( $account, $aba ) = split('@', $payinfo);
217     my %paybychecked = (
218       '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> Expiration</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>!,
219       '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">!,
220       '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">!,
221       '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="">!,
222       '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="">!,
223       '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">!,
224       '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),
225       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="$payinfo" MAXLENGTH=80>!,
226     );
227
228     if ( $cvv_enabled ) {
229       foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
230         my $cvv_r = $require_cvv ? '<font color="#ff0000">*</font> ' : '';
231         $paybychecked{$payby} .= qq!<TR><TD ALIGN="right">${cvv_r}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>!;
232       }
233     }
234     if ( $paystate_enabled ) {
235       foreach my $payby ( grep { exists $payby{$_} } qw(CHEK DCHK) ) { 
236         my ($county_html, $state_html, $country_html) =
237           regionselector( {
238             prefix           => "${payby}_pay",
239             selected_county  => $county,
240             selected_state   => $state,
241             selected_country => $country,
242             default_state    => $statedefault,
243             default_country  => $countrydefault,
244             locales          => \@cust_main_county,
245           } );
246         $paybychecked{$payby} .= "<BR>${r}Bank state $county_html $state_html";
247       }
248     }
249
250   my %payby_index = ( 'CARD'   => qq/Credit Card/,
251                       'DCRD'   => qq/Credit Card/,
252                       'CHEK'   => qq/Check/,
253                       'DCHK'   => qq/Check/,
254                       'LECB'   => qq/Phone Bill Billing/,
255                       'BILL'   => qq/Billing/,
256                       'COMP'   => qq/Complimentary/,
257                       'PREPAY' => qq/Prepaid Card/,
258                     );
259   
260
261 tie my %options, 'Tie::IxHash', ();
262
263 foreach my $payby_option ( @payby ) {
264   $options{$payby_option} = $payby_index{$payby_option};
265 }
266
267 my $selected_layer = ( grep { $_ eq 'CARD' } @payby ) ? 'CARD' : $payby[0];
268
269 HTML::Widgets::SelectLayers->new(
270   options => \%options,
271   selected_layer => $selected_layer,
272   form_name => 'dummy',
273   html_between => '</td></tr></table>',
274   form_action => 'dummy.cgi',
275   layer_callback => sub { my $layer = shift; return ( shift @hide_payment_fields ? '' : $paybychecked{$layer} ) . '</TABLE>'; },
276 )->html;
277
278
279   %>
280
281 </TR></TABLE><font color="#ff0000">*</font> required fields
282 <FORM name="signup_form" action="<%= $self_url %>" METHOD="POST" onsubmit="return fixup_form();"><BR><BR>First package
283 <INPUT TYPE="hidden" NAME="promo_code" VALUE="<%= $promo_code %>">
284 <INPUT TYPE="hidden" NAME="reg_code" VALUE="<%= $reg_code %>">
285 <TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=0 WIDTH="100%">
286 <TR>
287   <TD COLSPAN=2><SELECT NAME="pkgpart">
288
289   <%=
290     $OUT .= '<OPTION VALUE="">(none)'
291       unless scalar(@part_pkg) == 1 or $default_pkgpart;
292     foreach my $part_pkg ( @part_pkg ) {
293       $OUT .= '<OPTION VALUE="'. $part_pkg->{'pkgpart'}. '"';
294       $OUT .= ' SELECTED' if $pkgpart && $part_pkg->{'pkgpart'} == $pkgpart;
295       $OUT .= '>'. $part_pkg->{'pkg'};
296     }
297   %>
298
299   </SELECT></TD>
300 </TR>
301 <%=
302   if ( $signup_service eq 'svc_phone' ) {
303
304     $OUT .= '<TR><TD ALIGN="right">Phone number</TD><TD>'.
305             didselector( 'field'   => 'phonenum',
306                          'svcpart' => $default_svcpart,
307                        ).
308             '</TD></TR>';
309
310     $OUT .= <<ENDOUT;
311 <TR>
312   <TD ALIGN="right">Voicemail PIN</TD>
313   <TD><INPUT TYPE="pin" NAME="pin" VALUE="$pin"></TD>
314 </TR>
315 ENDOUT
316
317   } else {
318
319     $OUT .= <<ENDOUT;
320 <TR>
321   <TD ALIGN="right">Username</TD>
322   <TD><INPUT TYPE="text" NAME="username" VALUE="$username"></TD>
323 </TR>
324 ENDOUT
325
326   $OUT .= domainselector( svcpart=>$default_svcpart, domsvc=>$default_domsvc )
327     if $default_svcpart;
328
329     $OUT .= <<ENDOUT;
330 <TR>
331   <TD ALIGN="right">Password</TD>
332   <TD><INPUT TYPE="password" NAME="_password" VALUE="$_password"></TD>
333 </TR>
334 <TR>
335   <TD ALIGN="right">Re-enter Password</TD>
336   <TD><INPUT TYPE="password" NAME="_password2" VALUE="$_password2"></TD>
337 </TR>
338 ENDOUT
339
340     if ( $security_phrase ) {
341       $OUT .= <<SECPHRASE;
342 <TR>
343   <TD ALIGN="right">Security Phrase</TD>
344   <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
345   </TD>
346 </TR>
347 SECPHRASE
348     } else {
349       $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
350     }
351
352     if ( $nomadix ) {
353
354       warn $mac_addr;
355       $mac_addr ||= $MA;
356       warn $mac_addr;
357
358       $OUT .= <<NOMADIX;
359         <INPUT TYPE="hidden" NAME="mac_addr" VALUE="$mac_addr">
360 NOMADIX
361
362     }
363
364   }
365
366   if ( @svc_acct_pop ) {
367     $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
368             popselector( 'popnum'        => $popnum,
369                          'pops'          => \@svc_acct_pop,
370                          'init_popstate' => $init_popstate,
371                          'popac'         => $popac,
372                          'acstate'       => $acstate,
373                        ).
374             '</TD></TR>';
375   } else {
376     $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop);
377   }
378
379 %>
380
381 </TABLE>
382
383 <%= 
384 if ( @optional_packages ) { 
385   my @html;
386   foreach my $ii ( 0 .. $#optional_packages) {
387   my $friendly_index = $ii + 1; 
388   if ($optional_packages[$ii]) {
389     push @html, qq|<BR>Optional Package #$friendly_index <br />|,'<table bgcolor="#c0c0c0"><tr><td>';
390
391     push @html, qq|<select name="optional_package${ii}">|;
392     push @html, qq|<option value="none"></option>|;
393     push @html, map { qq|<option value="$_->{pkgpart}">$_->{pkg}</option>| } @{$optional_packages[$ii]};
394     push @html, q|</select>|;
395     
396     push @html, '</td></tr></table>';
397     }
398     $OUT = join("\n", @html);
399   }  
400 } else {
401 $OUT = ''
402 }
403 %>
404 <%=
405   if ( $terms_of_service =~ /\S/ ) {
406     my $title = 'Terms of Service'; #config?
407     my $onclick = qq[overlib( terms_content, CAPTION, "$title", STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, CLOSETEXT, "Close" );];
408     # Container for $terms_of_service to avoid nasty escaping.
409     $OUT .= qq[
410 <BR>
411 <DIV id="div_terms" style="display:none">$terms_of_service</DIV>
412 <SCRIPT type="text/javascript">
413 function agree_to_terms (val) {
414   document.getElementById("signup").disabled = !val;
415 }
416 function show_terms () {
417   overlib( document.getElementById('div_terms').innerHTML,
418     CAPTION, '$title', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE,
419     CLOSECLICK, CLOSETEXT, 'Close' );
420 }
421 </SCRIPT>
422 <INPUT TYPE="checkbox" onchange="agree_to_terms(this.checked)">&nbsp;
423 I agree to the <a href="javascript:void(0);" onclick="show_terms();">Terms of Service</a>.
424 ];
425   }
426 %>
427 <BR><INPUT TYPE="submit" ID="signup" NAME="signup" VALUE="Signup">
428 <script language="javascript">
429 <%= length($terms_of_service) ? 'agree_to_terms(false)' : '' %>
430
431 function fixup_form() {
432     
433     // copy payment method data up to OneTrueForm
434     
435     var payment_method_elements = new Array( 'payinfo', 'payinfo1', 'payinfo2', 'payname', 'paycvv' , 'paystate', 'paytype', 'month', 'year','type' );
436     var payment_method_form_name = document.OneTrueForm.select.options[document.OneTrueForm.select.selectedIndex].value;
437     document.OneTrueForm.elements['payby'].value = payment_method_form_name;
438     var payment_method_form = document.forms[payment_method_form_name];
439
440     for ( ii = 0 ; ii < payment_method_elements.length ; ii++ ) {
441         var true_element_name = payment_method_form_name + '_' + payment_method_elements[ii];
442         copyelement ( payment_method_form.elements[true_element_name],
443                       document.OneTrueForm.elements[true_element_name] );
444     }
445     
446     // Copy signup details to OneTrueForm
447     
448     var signup_elements = new Array (
449       'promo_code', 'reg_code', 'pkgpart',
450       'username', '_password', '_password2', 'sec_phrase', 'popnum', 'domsvc',
451       'mac_addr',
452       'countrycode', 'phonenum', 'sip_password', 'pin'
453     );
454
455     for ( ii = 0 ; ii < signup_elements.length ; ii ++ ) {
456         copyelement ( document.signup_form.elements[signup_elements[ii]],
457                       document.OneTrueForm.elements[signup_elements[ii]]);
458     }
459
460     document.OneTrueForm.submit();
461     return false;
462 }
463
464 function copyelement(from, to) {
465 //    alert ( from + ' ' + to );
466     
467     if ( from == undefined ) {
468         to.value = '';
469     } else { 
470         if ( from.type == 'select-one' ) {
471             to.value = from.options[from.selectedIndex].value;
472         } else if ( from.type == 'checkbox' ) {
473             if ( from.checked ) {
474                 to.value = from.value;
475             } else {
476                 to.value = '';
477             }
478         } else {
479             if ( from.value == undefined ) {
480                 to.value = '';
481             } else {
482                 to.value = from.value;
483             }
484         }
485 //      alert(from.name + " (" + from.type + "): " + to.name + " => " + to.value);
486     }
487 }
488
489 </script>
490 </FORM>
491 <%= $OUT .= $body_footer %>
492 </BODY>
493 </HTML>