<script language="javascript" type="text/javascript"><!--hide it---
    function CheckForCCDisplay(selObj){
        var inarray = 0;

        // possible plugins that require cc information
        validpluginsforcc = new Array({pluginsList});
        {availableCCArray}

        //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;
        
        laserbit    = 0;
        dinersbit   = 0;
        switchbit   = 0;

        //if inarray is 1 then we need to show credit card information
        if (inarray == 1) {
            if (pluginsforcc[selObj][{cCREDITVISA}] == 1) {
                visabit = 1;
                document.getElementById('visa_logo').style.display = "";
            } else {
                document.getElementById('visa_logo').style.display = "none";
            }

            if (pluginsforcc[selObj][{cCREDITMC}] == 1) {
                mcbit = 1;
                document.getElementById('mastercard_logo').style.display = "";
            } else {
                document.getElementById('mastercard_logo').style.display = "none";
            }

            if (pluginsforcc[selObj][{cCREDITAMEX}] == 1) {
                amexbit = 1;
                document.getElementById('americanexpress_logo').style.display = "";
            } else {
                document.getElementById('americanexpress_logo').style.display = "none";
            }

            if (pluginsforcc[selObj][{cCREDITDISC}] == 1) {
                discoverbit = 1;
                document.getElementById('discover_logo').style.display = "";
            } else {
                document.getElementById('discover_logo').style.display = "none";
            }


            if (pluginsforcc[selObj][{cCREDITLASER}] == 1) {
                laserbit = 1;
                document.getElementById('lasercard_logo').style.display = "";
            } else {
                document.getElementById('lasercard_logo').style.display = "none";
            }

            if (pluginsforcc[selObj][{cCREDITDINERS}] == 1) {
                dinersbit = 1;
                document.getElementById('dinersclub_logo').style.display = "";
            } else {
                document.getElementById('dinersclub_logo').style.display = "none";
            }

            if (pluginsforcc[selObj][{cCREDITSWITCH}] == 1) {
                switchbit = 1;
                document.getElementById('switch_logo').style.display = "";
            } else {
                document.getElementById('switch_logo').style.display = "none";
            }

            //   document.forms['customerdata'].elements['c_ccnumber'].value = 'Invalid Credit Card Number';

            <!-- BEGIN DYNAMIC BLOCK: forceCCRequirement -->
            if (document.forms['customerdata'].elements['r_ccnumber'] != null) {
                document.forms['customerdata'].elements['r_ccnumber'].value = lang('Credit Card Required');
            }
            <!-- END DYNAMIC BLOCK: forceCCRequirement -->

            document.getElementById('creditcardinfo').style.display = "";
            //document.getElementById('nocreditcardinfo').style.display = "none";
        } else {
            if (document.forms['customerdata'].elements['c_ccnumber'] != null) {
                document.forms['customerdata'].elements['c_ccnumber'].value = '';
            }

            if (document.forms['customerdata'].elements['r_ccnumber'] != null) {
                document.forms['customerdata'].elements['r_ccnumber'].value = '';
            }

            document.getElementById('creditcardinfo').style.display = "none";
            //document.getElementById('nocreditcardinfo').style.display = "";
        }
        document.forms['customerdata'].elements['validcc'].value = "" + visabit + mcbit + amexbit + discoverbit + laserbit + dinersbit + switchbit + "";
    }



    function replaceString(oldS,newS,fullS) {
      for (var i=0; i<fullS.length; i++) {
         if (fullS.substring(i,i+oldS.length) == oldS) {
            fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length);
         }
      }
      return fullS;
    }

    function fixaddress(myfield) {
      myfield.value =  replaceString(" ","",myfield.value);
      myfield.value = myfield.value.toLowerCase();
    }

    function checkCreditBalance(form){
        if (form.balance.value !=""){
            if (isNaN(form.balance.value) || form.balance.value < 0){
                alert(lang("Your credit balance has a wrong format or is not valid"));
                return (false);
            }
        }
        return (true);
    }

    function showHideRecurring(value) {
        usingRecurring = document.getElementById('use_recurring');
        if (value == 'paypal') {
            usingRecurring.style.display = 'block';
        } else {
            usingRecurring.style.display = 'none';
        }
    }

    function showHideVaultPaymentInformation(value) {
        if (value == 'quantumvault') {
            document.getElementById('vaultpaymentinformation').style.display = 'block';
            document.getElementById('vaultpaymentiframe').src = "index.php?fuse=admin&view=ViewPluginUrl&plugintoshow=quantumvault";
        } else {
            document.getElementById('vaultpaymentinformation').style.display = 'none';
            document.getElementById('vaultpaymentiframe').src = '';
        }
    }

    if (document.images) {
        pic1= new Image(167,14);
        pic1.src="{RELATIVE_PATH}images/loading.gif";
    }
//-->
</script>
<div style="border-top:1px solid #D4D4D4;padding-bottom: 17px;"></div>
<form method='post' name='customerdata' action="index.php?fuse=clients&action=Admin_UpdateProfileBilling">
            <dl class="form">
                <!-- BEGIN DYNAMIC BLOCK: billing -->
                    <!-- BEGIN DYNAMIC BLOCK: billingAdminOnly -->

                <!--  ADDED FOR: ACCOUNT_CREDIT - Credit Balance  -->
                        <!-- BEGIN DYNAMIC BLOCK: billingEditCredit -->
                <dt style="border-top:0px;"><label>[l]Credit Balance[/l]</label></dt>
                <dd style="border-top:0px;">
                    <input class="x-form-text x-form-field"  type='text' name='balance' size='15' autocomplete="off" value="{balance}">
                    {creditCurrencySymbol}
                </dd>
                        <!-- END DYNAMIC BLOCK: billingEditCredit -->

                        <!-- BEGIN DYNAMIC BLOCK: billingSeeCredit -->
                <dt><label>[l]Credit Balance[/l]</label></dt>
                <dd>
                    {creditBalance}
                </dd>
                        <!-- END DYNAMIC BLOCK: billingSeeCredit -->
                <!--  ADDED FOR: ACCOUNT_CREDIT - Credit Balance  -->

                <dt><label>[l]Taxable[/l]</label></dt>
                <dd>
                    <select name='taxable'>
                        <option value='1' {taxableYesSelected} >[l]Yes[/l]</option>
                        <option value='0' {taxableNoSelected} >[l]No[/l]</option>
                    </select>
                </dd>

                <dt><label>[l]Currency[/l]</label></dt>
                <dd>
                    {currencyDropdown}&nbsp;&nbsp;{currencySymbol}
                </dd>

                <dt><label>[l]Payment Type[/l]</label></dt>
                <dd>
                    <select name='paymenttype' onChange="CheckForCCDisplay(this.options[this.selectedIndex].value); showHideRecurring(this.options[this.selectedIndex].value); showHideVaultPaymentInformation(this.options[this.selectedIndex].value);">
                        <!-- BEGIN DYNAMIC BLOCK: paymentTypeOption -->
                        <option value="{paymentTypeOptionValue}" {paymentTypeOptionSelected} >{paymentTypeOptionLabel}</option>
                        <!-- END DYNAMIC BLOCK: paymentTypeOption -->
                    </select>&nbsp;&nbsp;<img id="paymenttypetip" class="tip-target" src="../templates/admin/images/information-button.png"/>
                </dd>

                <div id="use_recurring" style="display:{displayRecurring}">
                    <dt><label>[l]Use Subscription[/l]</label></dt>
                    <dd>
                        <input type="radio" name="recurring_paypal" value="0" {recurringPaypalNo} />&nbsp;[l]No[/l]&nbsp;&nbsp;
                        <input type="radio" name="recurring_paypal" value="1" {recurringPaypalYes} />&nbsp;[l]Yes[/l]
                        &nbsp;&nbsp;<img id="subscriptiontip" class="tip-target" src="../templates/admin/images/information-button.png"/>
                    </dd>
                </div>
                    <!-- END DYNAMIC BLOCK: billingAdminOnly -->

                <div id='creditcardinfo' style="display:{displayCC}">
                    <dt><label>[l]Credit Card Number[/l]</label></dt>

                    <!-- BEGIN DYNAMIC BLOCK: CCSection -->
                    <dd>
                        <!-- BEGIN DYNAMIC BLOCK: isPassphrased -->
                            <!-- BEGIN DYNAMIC BLOCK: ccIsThere -->
                                <!-- BEGIN DYNAMIC BLOCK: canEditCC -->
                                <div id="ccbuttons" style="width:230px;">
                                    <a href="javascript:ShowCC();">xxxxxxxxxxxxx {lastFour}</a>&nbsp;&nbsp;&nbsp;
                                    <!-- BEGIN DYNAMIC BLOCK: deleteCC -->
                                    <div id="deleteccbtn" style="float:right;"></div>
                                    <!-- END DYNAMIC BLOCK: deleteCC -->
                                </div>
                                <!-- END DYNAMIC BLOCK: canEditCC -->

                            {cantEditCC}
                            <!-- END DYNAMIC BLOCK: ccIsThere -->

                            <!-- BEGIN DYNAMIC BLOCK: ccIsNotThere -->
                            <input class="x-form-text x-form-field"  type=text name=ccnumber size=25>
                            <input type='hidden' name='c_ccnumber' value="{requiredMsg}" />
                            <input type='hidden' name='r_ccnumber' value="{ccRequiredMsg}" />
                            <!-- END DYNAMIC BLOCK: ccIsNotThere -->
                        <!-- END DYNAMIC BLOCK: isPassphrased -->

                        <!-- BEGIN DYNAMIC BLOCK: isNotPassphrased -->
                            <!-- BEGIN DYNAMIC BLOCK: thereIsCC -->
                                <!-- BEGIN DYNAMIC BLOCK: CCEditable -->
                                    <!-- BEGIN DYNAMIC BLOCK: passphraseable -->
                                    <a href="{someHelpURL}" title="{someHelpPopupText}" class="red">{someHelp}</a>
                                    <!-- END DYNAMIC BLOCK: passphraseable -->

                                    <!-- BEGIN DYNAMIC BLOCK: awaitingValidation -->
                                    <font color='red'>[l]Awaiting Validation[/l]</font>
                                    <!-- END DYNAMIC BLOCK: awaitingValidation -->

                                    <!-- BEGIN DYNAMIC BLOCK: deleteCC2 -->
                                    <div id="ccbuttons" style="width:178px;">
                                        <div id="validateccbtn" style="float:left"></div>
                                        <div id="deleteccbtn" style="float:right"></div>
                                    </div>
                                    <!-- END DYNAMIC BLOCK: deleteCC2 -->
                                <!-- END DYNAMIC BLOCK: CCEditable -->

                                <!-- BEGIN DYNAMIC BLOCK: awaitingValidation2 -->
                                <font color='red'>[l]Awaiting Validation[/l]</font>
                                <!-- END DYNAMIC BLOCK: awaitingValidation2 -->
                            <!-- END DYNAMIC BLOCK: thereIsCC -->

                            <!-- BEGIN DYNAMIC BLOCK: thereIsNoCC -->
                            <input class="x-form-text x-form-field" type='text' name='ccnumber' size='25'>
                            <input type='hidden' name='c_ccnumber' value="{requiredMsg}" />
                            <input type='hidden' name='r_ccnumber' value="{ccRequiredMsg}" />
                            <!-- END DYNAMIC BLOCK: thereIsNoCC -->
                        <!-- END DYNAMIC BLOCK: isNotPassphrased -->
                    </dd>

                        <!-- BEGIN DYNAMIC BLOCK: changeCC -->
                    <dt><label style="width:147px;">[l]New Credit Card Number[/l]</label></dt>
                    <dd>
                        <input class="x-form-text x-form-field" type='text' name='newccnumber' size='25'>
                        <input type='hidden' name='c_newccnumber' value="{requiredMsg}" />
                        <input type='hidden' name='r_newccnumber' value="">&nbsp;&nbsp;<img id="newcctip" class="tip-target" src="../templates/admin/images/information-button.png"/>
                    </dd>
                        <!-- END DYNAMIC BLOCK: changeCC -->
                    <!-- END DYNAMIC BLOCK: CCSection -->

                    <!-- BEGIN DYNAMIC BLOCK: emptyCCSection -->
                    <dd>
                        <input class="x-form-text x-form-field" type='text' name='ccnumber' size='25' value='{ccnumber}'>
                        <input type='hidden' name='c_ccnumber' value="{requiredMsg}" />
                        <input type='hidden' name='r_ccnumber' value="{ccRequiredMsg}">
                    </dd>
                    <!-- END DYNAMIC BLOCK: emptyCCSection -->

                    <dt><label>[l]Expiration Month[/l]</label></dt>
                    <dd>
                        <select type='text' name='ccmonth'>
                    <!-- BEGIN DYNAMIC BLOCK: monthOptions -->
                            <option value="{monthOptionsValue}" {monthOptionsSelected} >{monthOptionsLabel}</option>
                    <!-- END DYNAMIC BLOCK: monthOptions -->
                        </select>
                    </dd>

                    <dt><label>[l]Expiration Year[/l]</label></dt>
                    <dd>
                        <select type='text' name='ccyear'>
                    <!-- BEGIN DYNAMIC BLOCK: yearOptions -->
                            <option value="{yearOptionsValue}" {yearOptionsSelected} >{yearOptionsLabel}</option>
                    <!-- END DYNAMIC BLOCK: yearOptions -->
                        </select>
                    </dd>

                    <dt><label>[l]Accepting[/l]</label></dt>
                    <dd>
                        <img alt="visa" src="../images/creditcards/visa.gif" style="display:{visaStyle}" id='visa_logo'>
                        <img alt="mastercard" src="../images/creditcards/mc.gif" style="display:{mastercardStyle}" id='mastercard_logo'>
                        <img alt="americanexpress" src="../images/creditcards/amex1.gif" style="display:{americanexpressStyle}" id='americanexpress_logo'>
                        <img alt="discover" src="../images/creditcards/discover.gif" style="display:{discoverStyle}" id='discover_logo'>
                        
                        <img alt="lasercard" src="../images/creditcards/laser.gif" style="display:{lasercardStyle}" id='lasercard_logo'>
                        <img alt="dinersclub" src="../images/creditcards/diners.gif" style="display:{dinersclubStyle}" id='dinersclub_logo'>
                        <img alt="switch" src="../images/creditcards/switch.gif" style="display:{switchStyle}" id='switch_logo'>
                        <input type='hidden' name='validcc' value='{visabit}{mcbit}{amexbit}{discbit}{laserbit}{dinersbit}{switchbit}' />
                    </dd>
                </div>

                <div id='vaultpaymentinformation' style="display:{displayEditVaultPaymentInformation}">
                    <iframe
                        id=vaultpaymentiframe
                        src ="{vaultPaymentIframeSrc}"
                        width="100%"
                        height="300"
                        scrolling="auto"
                        frameborder="0"
                    >
                        <p>
                            [l]Your browser does not support iframes.[/l]
                        </p>
                    </iframe>
                </div>
                <!-- END DYNAMIC BLOCK: billing -->
            </dl>


            <input type='hidden' name='removeArray' value='{queryString1}'>
                <input type='submit' class='button' value='[l]update[/l]' onclick='if (checkCreditBalance(form)) {check(form,form.elements.length);} return false;' class=body>
            
        
</form>