[if value mv_order_profile eq credit_card]
[then]
<!--- credit card information --->
<table cellspacing=0 cellpadding="0" width="100%">
<tr>
  <td>
	<table border=0 cellspacing=0 cellpadding=4 width="100%">
	<tr class=contentbar1>
	  <td colspan="2" width="30%">
		<b>
		[error std_label="[L]Credit Card Information[/L]" name=mv_credit_card_valid]
		</b>
	  </td>
	  <td>
		[calc]
		  my $accepted = $Variable->{CREDIT_CARDS_ACCEPTED};
		  my (@out);
		  my (@cc);
		  my $out;
		  push @cc, 'visa' if $accepted =~ /visa/;
		  push @cc, 'mc' if $accepted =~ /mc/;
		  push @cc, 'disc' if $accepted =~ /discover/;
		  push @cc, 'amex' if $accepted =~ /amex/;
		  for (@cc) {
			push @out, qq{<img src="small$_.png">};
		  }
		  return join '&nbsp;&nbsp;', @out;
		[/calc]
	  </td>
	</tr>
	<tr>
	  <td align=right width="30%">
		<b>[L]Card Number[/L]: </b>
	  </td>
	  <td colspan=2>
		<b><input type=text name=mv_credit_card_number size=22></b>
	  </td>
	</tr>
	[if variable MV_DEMO_MODE]
	<tr>
	  <td>
	  &nbsp;
	  </td>
	  <td colspan=2>
		([L]test number[/L] <a href="javascript:void 0" onclick="checkout.mv_credit_card_number.value='4111 1111 1111 1111'; return false;">4111 1111 1111 1111</a>)
	  </td>
	</tr>
	[/if]
	[comment]
        Get the security code / cvv2
    [/comment]
    <script language="javascript">
    <!--
    var pop_window;
    function popWin(pop_url) {

        pop_window = open(pop_url, 'package_info',',width=500,height=450,scrollbars=no,resizable=no');
        
        
    }   
    //-->
    </script>
      <tr>
        <td align=right width="30%" valign=top class="contentbar1">
            [comment] <b>[L]Security Code[/L]: </b><br> [/comment]
            <b>[error std_label="[L]Security Code:[/L]" name=mv_credit_card_cvv2]</b><br>
            <a href="[area special/cvv_pop]" target="package_info" onclick="popWin('[area special/cvv_pop]'); return false;"><small>Where is it?</small></a>
        </td>
        <td valign=top class="contentbar1">
        <input type="text" name="mv_credit_card_cvv2" size="4" maxlength="4">
        </td>
        <td class="contentbar1">
         <small>The security code should be printed on the back of your card, 
usually on the signature strip, and consists of the three digits after 
the card number.  Please <b>do not</b> enter your card's PIN number here.</small>
        </td>
      </tr>
	<tr>
	  <td align=right>
		<b>[L]Expiration[/L]: </b>
	  </td>
	  <td colspan=2>

		  <select name=mv_credit_card_exp_month>
		  [loop
				  option=mv_credit_card_exp_month
				  acclist=1
				  list=|
1=01 - [L]January[/L],
2=02 - [L]February[/L],
3=03 - [L]March[/L],
4=04 - [L]April[/L],
5=05 - [L]May[/L],
6=06 - [L]June[/L],
7=07 - [L]July[/L],
8=08 - [L]August[/L],
9=09 - [L]September[/L],
10=10 - [L]October[/L],
11=11 - [L]November[/L],
12=12 - [L]December[/L]|]
		  <option value="[loop-code]"> [loop-param label]
		  [/loop]
		  </select>
  
		  <select name=mv_credit_card_exp_year>
		  [comment]
		  This should always return the current year as the first, then
		  7 more years.
		  [/comment]
		  [loop option=mv_credit_card_exp_year lr=1 list=`
		  my $year = $Tag->time( '', { format => '%Y' }, '%Y' );
		  my $out = '';
		  for ($year .. $year + 7) {
				  /\d\d(\d\d)/;
				  $last_two = $1;
				  $out .= "$last_two\t$_\n";
		  }
		  return $out;
		  `]

		  <option value="[loop-code]"> [loop-pos 1]
		  [/loop]
		  </select>
		</td>
	  </tr>
	  </table>
										  
	</td>
  </tr>
  </table>

[/then]
[elsif value mv_order_profile eq postal]
	  [L]We will wait for a check sent to us referencing the order number you receive on your receipt.[/L]
[/elsif]
[elsif value mv_order_profile eq cod]
	  [msg arg.0="[handling cod]"]There will be a %s charge added for COD.[/msg]
[/elsif]
[elsif value mv_order_profile eq online_check]
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr>
	  <td>
		<table border="0" cellspacing="0" cellpadding="0"  width="100%">
		<tr>
		  <td colspan="4" class=contentbar1>
			<b>&nbsp;&nbsp;[L]Check Information[/L]</b>
		  </td>
		  <td>&nbsp;</td>
		  <td>&nbsp;</td>
		</tr>
		<tr>
		  <td align="right">
			[error name=check_account std_label="[L]Account Number[/L]" required=1]
		  </td>
		  <td colspan="3 align="left">
			<b>
			<input type=text name=check_account size=22 value="[evalue check_account]">
			</b>
		  </td>
		</tr>
		<tr>
		  <td align="right">
			[error name=check_routing std_label="[L]Routing Number[/L]" required=1]
			
		  </td>
		  <td align="left" colspan="3">
			<b><input type=text name=check_routing size=22 value="[evalue check_routing]"></b>
		  </td>
		</tr>
		<tr>
		  <td align="right">
			[error name=check_number std_label="[L]Check Number[/L]" required=1]
		  </td>
		  <td align="left" colspan="3">
			<b>
			<input type=text name=check_number size=22 value="[evalue check_number]">
			</b>
		  </td>
			</tr>
		<tr>
		  <td align="right">
			[error name=check_bank_phone std_label="[L]Bank Phone[/L]" required=1]
			
		  </td>
		  <td align="left" colspan="3">
			<b>
			<input type=text name=check_bank_phone size=22 value="[evalue check_bank_phone]">
			</b>
		  </td>
			</tr>
		<tr>
			<td colspan=4>&nbsp;</td>
		</tr>
	  </table>
	</td>
  </tr>
</table>

[/elsif]
[elsif value mv_order_profile eq purchase_order]

<table cellspacing=0 cellpadding=0 width="100%">
<tr>
  <td>
	<table border=0 cellspacing=0 cellpadding=3 width="100%">
	<tr>
	  <td colspan="4" class=contentbar1>
		<b> [L]P.O. Information[/L] </b>
	  </td>
	</tr>
	<tr>
	  <td align=right width="30%">
		[error name=credit_limit_ok std_label="[L]PO Number[/L]" required=1] &nbsp; &nbsp;
	  </td>
	  <td align=left colspan=3>
		<b>
		<input name=po_number value="[evalue po_number]" size=14>
		</b>
	  </td>
	</tr>
	<tr>
		<td colspan=4>&nbsp;</td>
	</tr>

	[if type=data
		term="userdb::credit_limit::[data session username]"
		op=">"
		compare=0.01]

	<tr>
	  <td align=right valign=top>
		<b> [L]Available credit[/L] </b>&nbsp;&nbsp;&nbsp;
	  </td>
	  <td align=left colspan=3>
		[currency]
		[data table=userdb col=credit_limit key="[data session username]"]
		[/currency]
		
		[if type=data
				term="userdb::credit_limit::[data session username]"
				op=<
				compare="[total-cost noformat=1]"
		]
		<br>
		[msg arg.0="[total-cost]"]Order total %s exceeds credit limit, please call.[/msg]
		[/if]
		<br>
	  </td>
	</tr>

	[/if]
	<tr>
		<td colspan=4>&nbsp;</td>
	</tr>
	</table>
										
  </td>
</tr>
</table>

[/elsif]
[else]
	[L]No payment method selected.[/L]
[/else]
[/if]
