<?php
    if ($this->config->get('config_pixel_facebook_status')=='enable'){
        if (!$this->config->get('config_pixel_facebook')==''){
            echo html_entity_decode("<script> fbq('track', 'AddPaymentInfo'); </script>", ENT_QUOTES, 'UTF-8');
        }
    }
?>

<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php if ($payment_methods) { ?>
	<div class="radio">
		<?php foreach ($payment_methods as $payment_method) { ?>
			<div class="highlight" id="MethodCard">
				<?php if ($payment_method['code']) { ?>
					<input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" id="<?php echo $payment_method['code']; ?>" class="card-controll" checked="checked">
					<?php if($payment_method['code'] == 'cielo'){ ?>
						<div class="pm" >
							<img src="image/cielo/elo.jpg" width="70px" height="50px" class="imgc"/><br />
						</div>  
						<div class="pm" >
							<img src="image/cielo/amex.jpg" width="70px" height="50px" class="imgc" /><br />
						</div> 	
						</br>			
					<?php } elseif ($payment_method['code'] == 'erede'){ ?>
						<div class="pm">
							<img src="image/erede/visa.png"  class="imgc"/>
						</div>  
						<div class="pm">
							<img src="image/erede/master-card.png"  class="imgc"/>
						</div>  
						<div class="pm">
							<img src="image/erede/diners.png"  class="imgc"/>
						</div>  
						<div class="pm">
							<img src="image/erede/Hipercard.png"  class="imgc"/>
						</div>  
						</br>					
						<?php } elseif ($payment_method['code']!='cielo' && $payment_method['code'] != 'erede') { ?>
              <label for="<?php echo $payment_method['code']; ?>" class="card-label ft-rounded-medium campos">
                <span><?php echo $payment_method['title']; ?></span>
              </label>
						<?php } ?> 	
			    <?php } ?>
			</div>
	    <?php } ?>
	</div>
	<div class="MethodCard-coment">
	  <b><?php echo $text_comments; ?></b>
    <div class="ft-pull-right" style="margin-right: 25px;">
      <span id="spcontando" style="font-family:Open Sans',Arial, Helvetica, sans-serif;">0</span><span> de 500 caracteres</span>	  
    </div>
	  <textarea name="comment" id="campo" placeholder="Limite de 500 caracteres" rows="8" onkeyup="mostrarResultado(this.value,500,'spcontando');contarCaracteres(this.value,500,'sprestante')" style="width: 98%;"><?php echo $comment; ?></textarea>
	  <br />
	</div>
<script language="javascript">    
$( document ).ready(function() {
    mostrarResultado($('#campo').val(), 500, 'spcontando');
});

function mostrarResultado(box,num_max,campospan){
	var contagem_carac = box.length;
	document.getElementById(campospan).innerHTML = contagem_carac;
}
</script>	
	
	<br />
<?php } ?>
<br />
<?php if ($text_agree) { ?>
	<?php if ($agree) { ?>
  	<input type="checkbox" name="agree" value="1" checked="checked">
	<?php } else { ?>
  	<input type="checkbox" name="agree" value="1">
	<?php } ?>
  <?php echo $text_agree; ?>
	<button type="submit" id="button-payment-method" class="ft-btn-default ft-btn-medium ft-btn-success ft-top-margin-large ft-visible-block"><?php echo $button_continue ?></button>
<?php } else { ?>
	<button type="submit" id="button-payment-method" class="ft-btn-default ft-btn-medium ft-btn-success ft-top-margin-large ft-visible-block"><?php echo $button_continue ?></button>
<?php } ?>

<script type="text/javascript"><!--
$(document).ready(function() {
	  $('.politica').live('click',function(){
		var url= '<?php echo $agree_Politica_privacidade; ?>';
    
		$.ajax({    
			url : url ,
			dataType: 'HTML',
			success : function(html){
			    $.fancybox({
				    maxheigh    : '90%',
					maxWidth    : '90%',
					height      : '50%',
					width       : '50%',
					opacity     : 0.5,
					fitToView   : false,
					autoSize    : true,
					closeClick  : false,
					openEffect  : 'none',
					closeEffect : 'none',
					href		: false,
					loop		: false,
					scrolling   : true,
					content     : html
				});  
			},
            error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
            }			
	    });	
    });
});
//--></script> 