{include file="header.tpl"}
<div class="col-12 col-md-9 fix-mt px-0" style="font-family: 'source sans pro'; padding-bottom: 60px; min-width: 83%;">
        <div class="floating-div-wrapper d-block d-sm-none" style="height: 120px;">
            <div class="floating-div-wrapper-overlay">
            </div>
        </div>

        <div class="container">
            <div class="row">
                <div class="col-md-6 col-12">
                    <div class="float-div shadow-sm pb-50 pt-4 px-4 border">
                        <h5 class="reduceH5 bold-text border-bottom pb-4 align-center">
                            Deposit Fund <br>
                            <small class="xsmall site-black">
                                Start Trading Instantly
                            </small>
                        </h5>
{if $fatal}

{if $fatal == 'one_per_month'}
You can deposit once a month only.
{/if}

{else}

{literal}
<script language="javascript"><!--
function openCalculator(id)
{

  w = 225; h = 400;
  t = (screen.height-h-30)/2;
  l = (screen.width-w-30)/2;
  window.open('?a=calendar&type=' + id, 'calculator' + id, "top="+t+",left="+l+",width="+w+",height="+h+",resizable=1,scrollbars=0");

{/literal}
  {if $qplans > 1}
{literal}
  for (i = 0; i < document.spendform.h_id.length; i++)
  {
    if (document.spendform.h_id[i].value == id)
    {
      document.spendform.h_id[i].checked = true;
    }
  }
{/literal}
  {/if}
{literal}

}

function updateCompound() {
  var id = 0;
  var tt = document.spendform.h_id.type;
  if (tt && tt.toLowerCase() == 'hidden') {
    id = document.spendform.h_id.value;
  } else {
    for (i = 0; i < document.spendform.h_id.length; i++) {
      if (document.spendform.h_id[i].checked) {
        id = document.spendform.h_id[i].value;
      }
    }
  }

  var cpObj = document.getElementById('compound_percents');
  if (cpObj) {
    while (cpObj.options.length != 0) {
      cpObj.options[0] = null;
    }
  }

  if (cps[id] && cps[id].length > 0) {
    document.getElementById('coumpond_block').style.display = '';

    for (i in cps[id]) {
      cpObj.options[cpObj.options.length] = new Option(cps[id][i]);
    }
  } else {
    document.getElementById('coumpond_block').style.display = 'none';
  }
}
var cps = {};
--></script>
{/literal}

{if $frm.say eq 'deposit_success'}
<h3>The deposit has been successfully saved.</h3>
<br><br>
{/if}

{if $frm.say eq 'deposit_saved'}
<h3>The deposit has been saved. It will become active when the administrator checks statistics.</h3><br><br>
{/if}

 
{if $errors}
{if $errors.less_min}
Sorry, you can deposit not less than {$currency_sign}{$errors.less_min} with selected processing<br><br>
{/if}
{if $errors.greater_max}
Sorry, you can deposit not greater than {$currency_sign}{$errors.greater_max} with selected processing<br><br>
{/if}
{if $errors.not_enough_funds}
You have no enough funds to complete the operation.<br><br>
{/if}
{if $errors.ec_forbidden}
Sorry, deposit with selected processing is temproary forbidden.<br><br>
{/if}
{if $errors.cannot_invest_this_plan_anymore}
Sorry, you cannot invest this plan anymore<br><br>
{/if}
{if $errors.no_ps}
Please, select funds source.
{/if}
{/if}

<form method=post name="spendform">
<input type=hidden name=a value=deposit>
<div class="mt-4">
<div class="form-group">
<label for="currency">Deposit Plan</label>
    <select name="h_id" class="form-control">
{foreach from=$plans item=plan name=fplans}
{if $plans|@count > 1}
    <option name="type" value="{$plan.id}" checked>{$plan.name|escape:html}</option>
{/if}
{/foreach}
    </select> 
</div>
<div class="form-group">
<label for="amount">Amount</label>
   <input type="number" name="amount" value='{$frm.amount|default:$min_deposit|amount_format}' class="form-control bold-text" placeholder="Enter Amount" required>
</div>
<div class="form-group">
<label>Pay with</label>
    <select name="type" class="form-control">
{section name=p loop=$ps}
   {if $ps[p].balance > 0 and $ps[p].status == 1}        
    <option value="account_{$ps[p].id}">Spend funds from the Account Balance {$ps[p].name}</option>
   {/if}
{/section}
{section name=p loop=$ps}
   {if $ps[p].status}    
    <option value="process_{$ps[p].id}">Spend funds from {$ps[p].name}</option>
   {/if}
{/section}
</select>
</div>
                                <div class="mt-3">
                                    <small>If your preferred deposit method is not listed, please contact support.</small>
                                </div>
                                <div class="mt-4">
                                    <button class="btn-outline" type="submit" value="Spend">
                                        Continue &nbsp; <i class="fi fi-rr-arrow-right fixIcon2"></i>
                                    </button>
                                </div>
                            </div>

</form>
{literal}
<script language=javascript>
/*
for (i = 0; i<document.spendform.type.length; i++) {
  if ((document.spendform.type[i].value.match(/^process_/))) {
    document.spendform.type[i].checked = true;
    break;
  }
}
*/
updateCompound();
</script>
{/literal}

{/if}
</div>
                </div>
            </div>
        </div>
    </div>
{include file="footer.tpl"}