<script language="javascript" type="text/javascript" src="templates/<?php echo $this->gTemplateName; ?>/views/clients/profile_billing.js" ></script>
<script language="javascript" type="text/javascript">
    // <![CDATA[
    //keep track of what customer's old value for paypal subscription
    //was so that we can show the proper warning when updating
    var old_subscriptionyes=false;
    var selectedplugin='<?php echo $this->selectedpluginname; ?>';
    var selectedpluginrealname='<?php echo $this->selectedpluginrealname; ?>';
    // ]]>
</script>

<ul class="tabs">
    <li><a href="index.php?fuse=clients&amp;view=ShowCustomerData"><?php echo $this->lang("Profile"); ?></a></li>
    <li><a href="index.php?fuse=clients&amp;view=Profile_AlternateEmails"><?php echo $this->lang("Alternate Emails"); ?></a></li>
    <li class="active"><a href="index.php?fuse=clients&amp;view=Profile_Billing"><?php echo $this->lang("Billing"); ?></a></li>
    <li><a href="index.php?fuse=clients&amp;view=Profile_Password"><?php echo $this->lang("Password"); ?></a></li>
    <li><a href="index.php?fuse=clients&amp;view=Profile_StaffNotes"><?php echo $this->lang("Notes"); ?></a></li>
    <div class="bottom clear"></div>
</ul>

<form method="post" id="billingform" name="billingform">

<table class="ts2" cellspacing="0">
	<!--  ADDED FOR: ACCOUNT_CREDIT - Credit Balance  -->
	<tr>
    	<td class="label"><?php echo $this->lang("Credit Balance"); ?>:</td>
        <td><?php echo $this->balance; ?></td>
    </tr>
	<!--  ADDED FOR: ACCOUNT_CREDIT - Credit Balance  -->
	<?php if ($this->canEditPaymentType) { ?>
    <tr>
    	<td class="label"><?php echo $this->lang("Payment Type"); ?>:</td>
        <td><select name="paymenttype" id="paymenttype" onchange="GetCCInformation(this.options[this.selectedIndex].value); return false;">
        <?php foreach ($this->paymentmethods as $paymentmethod) { ?>
            <option value="<?php echo $paymentmethod['paymentTypeOptionValue']; ?>" <?php echo $paymentmethod['paymentTypeOptionSelected']; ?> ><?php echo $paymentmethod['paymentTypeOptionLabel']; ?></option>
        <?php } //end foreach ?>
    </select></td>
    </tr>
    <?php } //if can edit ?>
    <?php if (!$this->canEditPaymentType) { ?>
    <tr>
    	<td class="label"><?php echo $this->lang("Payment Type"); ?>:</td>
        <td><?php echo $this->paymentTypeOptionLabel; ?></td>
    </tr>
    <?php } //if can edit ?>
</table>

    <div id="use_recurring" style="display:none;">
    <table class="ts2" cellspacing="0">
    	<tr>
        	<td class="label"><?php echo $this->lang("Use Subscription");?>:</td>
            <td><input type="radio" id="subscriptionno" name="recurring_paypal" value="0" checked="checked" /> <?php echo $this->lang("No"); ?>&nbsp;&nbsp;
            <input type="radio" id="subscriptionyes" name="recurring_paypal" value="1" /> <?php echo $this->lang("Yes"); ?>&nbsp;&nbsp;</td>
        </tr>
    </table>
    </div>

    <div id="vaultpaymentinformation" style="display:none;">
        <p align=center>
            <font color=red><?php echo $this->lang("We do not store credit card information<br>for your selected payment type"); ?></font><br><br>
        </p>
        <iframe id="vaultpaymentiframe" src ="" width="100%" height="300" scrolling="auto" frameborder="0">
            <p><?php echo $this->lang("Your browser does not support iframes"); ?></p>
        </iframe>
    </div>

    <div id="creditcardinfo" style="display:none;">
    <table class="ts2" cellspacing="0">
    	<?php if ($this->canEditCreditCard) { ?>
        <tr>
        	<td class="label"><?php echo $this->lang("Credit Card Number"); ?>:</td>	
        	<td><span id="lastfourspan">
            <span id="lastfour"></span>
        </span><span id="deleteccspan" style="padding-left:10px;">
            <input type="button" id="deleteccbutton" value="<?php echo $this->lang("Delete Credit Card");?>" onclick="DeleteCC();return false;" />
            <br />
        	</span><span id="ccnumberspan">
            <input type="text" style="height:20px;width:180px;padding:1px;"  id="ccnumber" name="ccnumber" size="30" />
            <br />
        	</span><span id="awaitingvalidationspan">
            <span id="awaitingvalidation"></span>
            <br />
        	</span></td>
        </tr>
        <tr id="newccspan">
        	<td class="label"><?php echo $this->lang("New Card Number"); ?>:</td>
            <td><input type="text" id="newccnumber" name="newccnumber" />&nbsp;&nbsp;<?php echo $this->helpCCChange; ?></td>
        </tr>
        <tr>
        	<td class="label"><?php echo $this->lang("Expires"); ?>:</td>
            <td><select id="ccmonth" name="ccmonth">
			<?php foreach ($this->months as $month) { ?>
                <option value="<?php echo $month['monthOptionsValue']; ?>" <?php echo $month['monthOptionsSelected']; ?> ><?php echo $month['monthOptionsLabel']; ?></option>
            <?php } ?>
            </select>
    
            <select id="ccyear" name="ccyear">
            <?php foreach ($this->years as $year) { ?>
                <option value="<?php echo $year['yearOptionsValue']; ?>" <?php echo $year['yearOptionsSelected']; ?> ><?php echo $year['yearOptionsLabel']; ?></option>
            <?php } //end years ?>
            </select></td>
        </tr>
        <tr>
        	<td class="label"><?php echo $this->lang("Accepting"); ?>:</td>
            <td><img src="images/creditcards/visa.gif" id="visa_logo" alt="" />
            <img src="images/creditcards/mc.gif" id="mastercard_logo" alt="" />
            <img src="images/creditcards/amex1.gif" id="americanexpress_logo" alt="" />
            <img src="images/creditcards/discover.gif" id="discover_logo" alt="" />
            
            <img src="images/creditcards/laser.gif" id="lasercard_logo" alt="" />
            <img src="images/creditcards/diners.gif" id="dinersclub_logo" alt="" />
            <img src="images/creditcards/switch.gif" id="switch_logo" alt="" />
            <input type="hidden" name="validcc" id="validccbits" value='' /></td>
        </tr>
		<?php } else { ?>
        <tr>
        	<td class="label"><?php echo $this->lang("Credit Card Number"); ?>:</td>
        	<td><span id="lastfourspan">
            <span id="lastfour"></span>
        </span><span id="ccnumberspan"><input type="text" style="height:20px;width:180px;padding:1px;"   id="ccnumber" name="ccnumber" size="30" /></span><span id="awaitingvalidationspan">
            <span id="awaitingvalidation"></span>
            <br />
        </span>
        <span id="newccspan">
        </span></td>
		</tr>
		<?php } //edit credit card ifs ?>
    </table>       
    </div>
    
    <button class="button body" onclick='SaveBillingInformation(); return false;'><?php echo $this->lang("Update"); ?></button>
</form>

<script type="">
    GetCCInformation(selectedplugin);
</script>