<script>

function CheckForCCDisplay(selObj){

var inarray=0;
autopayment = selObj.substr(0,1);
selObj = selObj.substr(2);
<!-- echo list the possible plugins that require cc information -->
validpluginsforcc = new Array({VALIDPLUGINSFORCC})
{STRAVAILABLECCARRAY}
<!-- for loop to take a look and see if the selected plugin accepts cc information -->
for (x=0;x<{ARRAYCOUNT};x++){
    if (selObj==validpluginsforcc[x]) inarray=1;
}
visabit=0;mcbit=0;amexbit=0;discoverbit=0;
<!-- if inarray is 1 then we need to show credit card information -->
if (inarray==1) {
    if (pluginsforcc[selObj][{CCREDITVISA}]==1){
        visabit=1;
        $('visa_logo').style.display="";
    } else {
        $('visa_logo').style.display="none";
    }
    if (pluginsforcc[selObj][{CCREDITMC}]==1){
        mcbit=1;
        $('mastercard_logo').style.display="";
    } else {
        $('mastercard_logo').style.display="none";
    }
    if (pluginsforcc[selObj][{CCREDITAMEX}]==1){
        amexbit=1;
        $('americanexpress_logo').style.display="";
    } else {
        $('americanexpress_logo').style.display="none";
    }
    if (pluginsforcc[selObj][{CCREDITDISC}  ]==1){
        discoverbit=1;
        $('discover_logo').style.display="";
    } else {
        $('discover_logo').style.display="none";
    }
    document.forms['accountinfo'].elements['c_ccnumber'].value='[lj]Invalid Credit Card Number[/lj]';
    $('creditcardinfo').style.display="";
    document.forms['accountinfo'].elements['r_ccnumber'].value='[lj]Credit Card is Required[/lj]';
    if (pluginsforcvv[selObj] == 1) {
        $('cvv2info').style.display = '';
        document.forms['accountinfo'].elements['r_cvv2'].value='[lj]CVV2 number is required[/lj]';
    } else {
        $('cvv2').value = '';
        document.forms['accountinfo'].elements['r_cvv2'].value='';
        $('cvv2info').style.display = 'none';
    }
} else {
    document.forms['accountinfo'].elements['c_ccnumber'].value='';
    document.forms['accountinfo'].elements['r_ccnumber'].value='';
    document.forms['accountinfo'].elements['r_cvv2'].value='';
    $('cvv2').value='';
    $('creditcardinfo').style.display="none";
}
document.forms['accountinfo'].elements['validcc'].value=""+visabit+mcbit+amexbit+discoverbit+"";
document.forms['accountinfo'].elements['autopayment'].value=autopayment;
}

</script>


<div class="block">
    <div class="block_title">
        <h3>[l]Billing Information[/l]</h3>
    </div>
    <ul>
        <li>
                    
            <!-- BEGIN DYNAMIC BLOCK: billingerror -->
            <p class="order_override">
                <font class="red"><b>[l]Credit Card Authorization Failed[/l]<br></font>{THEBILLINGERROR}</b>
            </p>
            <!-- END DYNAMIC BLOCK: billingerror -->
            
            <div id="billingblock" style="display:{BILLINGBLOCKSTYLE}">
                <p class="order_override">
                    <label>[l]Payment Method[/l]:</label>
                    <select name="paymenttype" class="dropdown" onChange="SwitchRecurringVisibility(this); CheckForCCDisplay(this.options[this.selectedIndex].value);">
                        <!-- BEGIN DYNAMIC BLOCK: plugin_names -->
                        <option value='{GATEWAYVALUE}' {GATEWAYSELECTED}>{GATEWAYTSIGNUPNAME}&nbsp;&nbsp;&nbsp;</option>
                        <!-- END DYNAMIC BLOCK: plugin_names -->
                    </select>
                </p>
                <p class="order_override">
                    <label></label>
                    <span id="recurringField" style="display:{RECURRINGVISIBILITY}">
                        <!-- BEGIN DYNAMIC BLOCK: not_price_included -->
                        <input type="hidden" id="use_paypal_subscriptions" name="use_paypal_subscriptions" value="0"/>
                        <!-- END DYNAMIC BLOCK: not_price_included -->
                        <!-- BEGIN DYNAMIC BLOCK: plugin_paypal_force -->
                        [l]Use subscription[/l]: <input type="checkbox" id="use_paypal_subscriptions" name="use_paypal_subscriptions" value="1" {CHECKED} /> {USERECURRINGSUBSCRIPTIONNOTE}
                        <!-- END DYNAMIC BLOCK: plugin_paypal_force -->
                        <!-- BEGIN DYNAMIC BLOCK: use_paypal_subscriptions -->
                        <input type="hidden" id="use_paypal_subscriptions" name="use_paypal_subscriptions" value="1"/>
                        <!-- END DYNAMIC BLOCK: use_paypal_subscriptions -->
                    </span>
                </p>
                <!-- credit card information if the select plugin accepts it -->
                <div id="creditcardinfo" style="display:{DISPLAYCC}">
                    <input type="hidden" name="autopayment" value="{AUTOPAYMENT}">
                    <p class="order_override">
                        <label>[l]Credit Card Number[/l]:</label>
                        <input type="text" class="txtbox" name="ccnumber" value="{CCNUMBER}" size="30" class="required" onkeypress="return noenter(event)">
                        <input type="hidden" name="c_ccnumber" value="{INVALIDCC}">
                        <input type="hidden" name="r_ccnumber" value="{REQUIREDCC}">
                        <input type="hidden" name="r_cvv2" value="{REQUIREDCVV2}">
                    </p>
                    <p class="order_override">
                        <label>[l]Expiration Month[/l]:&nbsp;&nbsp;</label>
                        <select type="text" class="dropdown" name="ccmonth">
                            <!-- BEGIN DYNAMIC BLOCK: monthoption -->
                            <option value="{MONTHVALUE}"{MONTHSELECTED}>{MONTHNUMBER} - {MONTHNAME}</option>
                            <!-- END DYNAMIC BLOCK: monthoption -->
                        </select>
                    </p>
                    <p class="order_override">
                        <label>[l]Expiration Year[/l]:&nbsp;&nbsp;</label>
                        <select class="dropdown" type="text" name="ccyear">
                            <!-- BEGIN DYNAMIC BLOCK: yearoption -->
                            <option value="{CCYEAR}" {YEARSELECTED}>{CCYEAR}</option>
                            <!-- END DYNAMIC BLOCK: yearoption -->
                        </select>
                    </p>
                    <p class="order_override" id='cvv2info' style="display:{DISPLAYCVV2}">
                        <label>[l]CVV2[/l]:&nbsp;&nbsp;</label>
                        <input type="text" class="txtbox" size="4" maxlength="4" name="cvv2" id="cvv2" value="{CVV2}"/>&nbsp;&nbsp;{CVV2HELP}
                    </p>
                    <p class="order_override">
                        <label>[l]Accepting[/l]:</label>
                        <img src="images/visa_logo.gif" style="display:{VISASTYLE}" id="visa_logo">
                        <img src="images/mastercard_logo.gif" style="display:{MASTERCARDSTYLE}" id="mastercard_logo">
                        <img src="images/americanexpress_logo.gif" style="display:{AMEXSTYLE}" id="americanexpress_logo">
                        <img src="images/discover_logo.gif" style="display:{DISCSTYLE}" id="discover_logo">
                        <input type="hidden" name="validcc" value="{BITVALIDCC}">
                    </p>
                </div>
            </div>
            <p id="billingblockmember" style="display:{BILLINGBLOCKMEMBER}">
                [l]Your existing billing method will be used[/l]
            </p>
            <!-- BEGIN DYNAMIC BLOCK: coupons -->
            <p class="order_override">
                <label>[l]Coupon Code[/l]:</label>
                <input type="text" class="txtbox" id="coupon_code" name="coupon_code" value="{couponCode}" />
                <input type="button" class="button_medium" value="[lh]validate[/lh]" onclick="validateCoupon(this.form)" />
            </p>
            <p class="order_override">
                <span id="invalid_code" style="display:none">[l]Invalid Code[/l]</span>
                <span id="coupon_name" class="bold"></span>
                <span id="coupon_description"></span>
            </p>
            <!-- END DYNAMIC BLOCK: coupons -->
        </li>
    </ul>
</div>
