<script type="text/javascript" src="admin/view/javascript/jquery/tabs.js"></script>
<script type="text/javascript" src="app/komerci_form/futura.js"></script>

<style>
   .cartao{
       margin: 0 auto 20px auto;
       text-align: center;
	   min-height: 30px;
    }

    .cartao li{
    	list-style: none;
    	float: left;
    }

    .pagamento{
       margin: 0 auto;
       text-align: center;
       display:none;
    }
</style>

<div class="buttons">
	<div id="tab-parcelado" class="cartao">
        	<ul>
                <?php if($ativa_visa=='1'){?>
                <li><a href="javascript:void(0);" onclick="Parcelado('visa')"><img src="app/komerci_form/images/visa.gif" border="0"></a></li>
                <?php }?>
                <?php if($ativa_mastercard=='1'){?>
                <li><a href="javascript:void(0);" onclick="Parcelado('mastercard')"><img src="app/komerci_form/images/mastercard.gif" border="0"></a></li>
                <?php }?>
                <?php if($ativa_diners=='1'){?>
                <li><a href="javascript:void(0);" onclick="Parcelado('diners')"><img src="app/komerci_form/images/diners.gif" border="0"></a></li>
                <?php }?>
                <?php if($ativa_hiper=='1'){?>
                <li><a href="javascript:void(0);" onclick="Parcelado('hiper')"><img src="app/komerci_form/images/hiper.gif" border="0"></a></li>
                <?php }?>
                <?php if($ativa_hipercard=='1'){?>
                <li><a href="javascript:void(0);" onclick="Parcelado('hipercard')"><img src="app/komerci_form/images/hipercard.gif" border="0"></a></li>
                <?php }?>
        	</ul>
</div>

	<div id="pagamento_parcelado" class="pagamento">

            <table class="table table-action">
            	<thead>
            		<th class="t-medium"><b>Bandeira:</b></th>
            		<th class="t-medium"><b>Valor:</b></th>
            		<th class="t-medium"></th>
            	</thead>

            	 <tbody>
            	    <td class="info_responsive"><b>Bandeira</b></td>
            	 	<td><span id="meio_parcelado_titulo"></span></td>
            	 	<td class="info_responsive"><b>Valor:</b></td>
            	 	<td><select style="width:250px;" id="lista_parcelas_parcelado"></select></td>
            	 	<td>
                  <button class="btn-default btn-large" onclick="PagarParcelado()" id="button-confirm">
                    <span>Pagamento Seguro!</span>
                  </button>
                </td>
            	 </tbody>
            </table>

	</div>



<script type="text/javascript">
window.waitEvent('scripts_document', function(){

function ConfirmarRede(i){
location.href='<?php echo $redir;?>&i='+i;
}

function PagarParcelado(){
var parcela = $("#lista_parcelas_parcelado").val();
if(parcela==''){
alert("Selecione o valor desejado!");
return false;
}
var linha_pg = <?php echo $documento; ?>+"|"+<?php echo $telefone; ?>+"|"+parcela;
window.open("app/komerci_form/gtw.php?i="+linha_pg+"&pedido=<?php echo $pedido['order_id'];?>&hash=<?php echo md5($pedido['order_id']);?>&tipo=p","gateway","height=600,width=800,status=no,toolbar=no,menubar=no,location=no");
}

//aplica as tabs
$('#tabs a').tabs();

function Parcelado(meio){

//jQuery(".cpf").mask("99999999999",{completed:function(){ValidarCPF(this.val());}});
//jQuery(".telefone").mask("(99)99999999?9");

//mostra o form
$("#pagamento_parcelado").show();
$("#meio_parcelado_titulo").html('<img src="app/komerci_form/images/'+meio+'.gif" border="0">');
//pupula a lista de parcelas
$.getJSON('app/komerci_form/get.parcelas.parcelado.php?id='+meio+'&total=<?php echo $pedido['total'];?>&hash=<?php echo md5($pedido['total']);?>', function(data) {
  var items = '';
  $.each(data, function(key, val) {
    items += '<option value="' + key + '">' + val + '</option>';
  });
  $('#lista_parcelas_parcelado').html(items);
});
}
});
</script>
</div>
