<p>
  Please enter your credit card and billing information in the fields below.  Fields marked with <span class="errormessage">*</span> are required.
</p>

<%if payment_declined%>
<p class="errormessage">Your payment was declined: <%payment_errmsg%></p>
<%~elsif payment_erred%>
<p class="errormessage">An error occured while processing your payment: <%payment_errmsg%></p>
<%~endif%>

<form action="<%db_cgi_url_https%>/<%if modify%>modify<%else%>add<%endif%>.cgi" method="post">
  <input type="hidden" name="process_payment" value="1" />
  <input type="hidden" name="do" value="payment_direct" />
  <input type="hidden" name="last_step" value="form" />
  <input type="hidden" name="last_page" value="payment_form" />
  <input type="hidden" name="cat_id" value="<%escape_html cat_id%>" />
  <input type="hidden" name="link_id" value="<%escape_html link_id%>" />
  <input type="hidden" name="payment_term" value="<%escape_html payment_term%>" />
  <input type="hidden" name="payment_method" value="<%escape_html payment_method%>" />
  <input type="hidden" name="payment_method_type" value="<%escape_html payment_method_type%>" />
  <%if modify%><input type="hidden" name="modify" value="1" /><%endif%>

  <div class="row<%unless no_cc_brand%> required<%endunless%><%if credit_card_brand_error%> invalid<%endif%> clear">
    <label for="credit_card_brand" class="name"><%if no_cc_brand%>Cards Accepted:<%else%>Card Type: <span>*</span><%endif%></label>
    <div class="value<%if no_cc_brand%> wrappedtext<%endif%>">
    <%if no_cc_brand%>
      <%loop payment_types%><%name%><%unless last%>, <%endunless%><%endloop%>
    <%else%>
      <select id="credit_card_brand" name="credit_card_brand">
        <option value="">---</option><%loop payment_types%><option value="<%escape_html code%>"<%if credit_card_brand eq $code%> selected="selected"<%endif%>><%name%></option><%endloop%>
      </select>
    <%endif%>
    </div>
  </div>
  <div class="row required<%if credit_card_number_error%> invalid<%endif%> clear">
    <label for="credit_card_number" class="name">Card Number: <span>*</span></label>
    <div class="value">
      <input type="text" id="credit_card_number" name="credit_card_number" value="<%if credit_card_number%><%escape_html credit_card_number%><%endif%>" class="text" autocomplete="off" />
    </div>
  </div>
  <div class="row required<%if credit_card_expiry_error%> invalid<%endif%> clear">
    <label for="credit_card_expiry_month" class="name">Expiry: <span>*</span></label>
    <div class="value">
      <select id="credit_card_expiry_month" name="credit_card_expiry_month">
        <option value="">Month</option>
        <option value="01"<%if credit_card_expiry_month eq '01'%> selected="selected"<%endif%>>Jan (01)</option>
        <option value="02"<%if credit_card_expiry_month eq '02'%> selected="selected"<%endif%>>Feb (02)</option>
        <option value="03"<%if credit_card_expiry_month eq '03'%> selected="selected"<%endif%>>Mar (03)</option>
        <option value="04"<%if credit_card_expiry_month eq '04'%> selected="selected"<%endif%>>Apr (04)</option>
        <option value="05"<%if credit_card_expiry_month eq '05'%> selected="selected"<%endif%>>May (05)</option>
        <option value="06"<%if credit_card_expiry_month eq '06'%> selected="selected"<%endif%>>Jun (06)</option>
        <option value="07"<%if credit_card_expiry_month eq '07'%> selected="selected"<%endif%>>Jul (07)</option>
        <option value="08"<%if credit_card_expiry_month eq '08'%> selected="selected"<%endif%>>Aug (08)</option>
        <option value="09"<%if credit_card_expiry_month eq '09'%> selected="selected"<%endif%>>Sep (09)</option>
        <option value="10"<%if credit_card_expiry_month eq '10'%> selected="selected"<%endif%>>Oct (10)</option>
        <option value="11"<%if credit_card_expiry_month eq '11'%> selected="selected"<%endif%>>Nov (11)</option>
        <option value="12"<%if credit_card_expiry_month eq '12'%> selected="selected"<%endif%>>Dec (12)</option>
      </select> /
      <%Links::Payment::next_years(10)%><%-- Show the next 10 years --%>
      <select id="credit_card_expiry_year" name="credit_card_expiry_year">
        <option value="">Year</option>
        <%loop next_years%><option<%if credit_card_expiry_year eq $loop_value%> selected="selected"<%endif%>><%loop_value%></option><%endloop%>
      </select>
    </div>
  </div>
  <div class="row required<%if billing_fname_error%> invalid<%endif%> clear">
    <label for="billing_fname" class="name">First Name: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_fname" name="billing_fname" value="<%if billing_fname%><%escape_html billing_fname%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_lname_error%> invalid<%endif%> clear">
    <label for="billing_lname" class="name">Last Name: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_lname" name="billing_lname" value="<%if billing_lname%><%escape_html billing_lname%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_address_1_error%> invalid<%endif%> clear">
    <label for="billing_address_1" class="name">Address Line 1: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_address_1" name="billing_address_1" value="<%if billing_address_1%><%escape_html billing_address_1%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row<%if billing_address_2_error%> invalid<%endif%> clear">
    <label for="billing_address_2" class="name">Address Line 2:</label>
    <div class="value">
      <input type="text" id="billing_address_2" name="billing_address_2" value="<%if billing_address_2%><%escape_html billing_address_2%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_city_error%> invalid<%endif%> clear">
    <label for="billing_city" class="name">City: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_city" name="billing_city" value="<%if billing_city%><%billing_city%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_state_error%> invalid<%endif%> clear">
    <label for="billing_state" class="name">State/Province: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_state" name="billing_state" value="<%if billing_state%><%billing_state%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_country_error%> invalid<%endif%> clear">
    <label for="billing_country" class="name">Country: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_country" name="billing_country" value="<%if billing_country%><%billing_country%><%endif%>" class="text" />
    </div>
  </div>
  <div class="row required<%if billing_postal_code_error%> invalid<%endif%> clear">
    <label for="billing_postal_code" class="name">ZIP/Postal Code: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_postal_code" name="billing_postal_code" value="<%if billing_postal_code%><%billing_postal_code%><%endif%>" class="text shorttext" />
    </div>
  </div>
<%~if billing_phone_required%>
  <div class="row required<%if billing_phone_error%> invalid<%endif%> clear">
    <label for="billing_phone" class="name">Phone: <span>*</span></label>
    <div class="value">
      <input type="text" id="billing_phone" name="billing_phone" value="<%if billing_phone%><%billing_phone%><%endif%>" class="text" />
    </div>
  </div>
<%~endif%>
  <div class="formsubmit">
    <input type="submit" value="Make Payment" class="submit" onclick="this.style.color = 'red'; this.value='Please wait...'" />
  </div>
</form>
