<?php
/**
 * Avalanche for Magento 1.8+
 * Designed by Fast Division (http://fastdivision.com)
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://fastdivision.com/legal/license.txt
 *
 * @author     Fast Division
 * @version    1.5.0
 * @copyright  Copyright 2013 Fast Division
 * @license    http://fastdivision.com/legal/license.txt
 */
?>
<?php $_code=$this->getMethodCode() ?>
<ul class="form-list checkout-form cc-form" id="payment_form_<?php echo $_code ?>" style="display:none;">
    <li class="field">
        <label for="<?php echo $_code ?>_cc_owner" class="required"><?php echo $this->__('Name on Card') ?><em>*</em></label>
        <div class="input-box">
            <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
        </div>
    </li>
    <li class="field">
        <label for="<?php echo $_code ?>_cc_type" class="required"><?php echo $this->__('Credit Card Type') ?><em>*</em></label>
        <div class="input-box">
            <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-cc-type-select">
                <option value=""><?php echo $this->__('- Select -') ?></option>
            <?php $_ccType = $this->getInfoData('cc_type') ?>
            <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
                <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
            <?php endforeach ?>
            </select>
        </div>
    </li>
    <li class="field">
        <label for="<?php echo $_code ?>_cc_number" class="required"><?php echo $this->__('Credit Card Number') ?><em>*</em></label>
        <div class="input-box">
            <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
        </div>
    </li>
    <li class="field">
        <label for="<?php echo $_code ?>_expiration" class="required"><?php echo $this->__('Expiration Date') ?><em>*</em></label>
        <div class="input-box">
            <div class="v-fix">
                <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
                <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
                <?php foreach ($this->getCcMonths() as $k=>$v): ?>
                    <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                <?php endforeach ?>
                </select>
				&nbsp;&nbsp;
                <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
                <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
                <?php foreach ($this->getCcYears() as $k=>$v): ?>
                    <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                <?php endforeach ?>
                </select>
            </div>
        </div>
    </li>
    <?php echo $this->getChildHtml() ?>
    <?php if($this->hasVerification()): ?>
    <li class="field">
        <label for="<?php echo $_code ?>_cc_cid" class="required"><?php echo $this->__('Card Verification Number') ?><em>*</em><br><a href="#" class="cvv-what-is-this small"><?php echo $this->__('What is this?') ?></a></label>
        <div class="input-box">
            <div class="v-fix">
                <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
            </div>
        </div>
    </li>
    <?php endif; ?>
    <?php if ($this->hasSsCardType()): ?>
    <li class="field" id="<?php echo $_code ?>_cc_type_ss_div">
        <ul class="inner-form">
            <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
            <li class="field">
                <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
                <span class="input-box">
                    <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
                </span>
            </li>

            <li class="field">
                <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
                <div class="input-box">
                    <div class="v-fix">
                        <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
                        <?php foreach ($this->getCcMonths() as $k=>$v): ?>
                            <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                        <?php endforeach ?>
                        </select>
                    </div>
                    <div class="v-fix">
                        <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
                        <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
                            <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
                        <?php endforeach ?>
                        </select>
                    </div>
                </div>
            </li>
            <li class="adv-container">&nbsp;</li>
        </ul>
        <script type="text/javascript">
        //<![CDATA[
        var SSChecked<?php echo $_code ?> = function() {
            var elm = $('<?php echo $_code ?>_cc_type');
            if (['SS','SM','SO'].indexOf(elm.value) != -1) {
                $('<?php echo $_code ?>_cc_type_ss_div').show();
            } else {
                $('<?php echo $_code ?>_cc_type_ss_div').hide();
            }
        };

        Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
        SSChecked<?php echo $_code ?>();
        //]]>
        </script>
    </li>
    <?php endif; ?>
</ul>
