<?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) { ?>
	<p><?php echo $text_payment_method; ?></p>
	<div class="radio">
		<?php foreach ($payment_methods as $payment_method) { ?>
			<div class="highlight" id="MethodCard">
				<?php if ($payment_method['code']) { ?>
					<div class="campos"> 
						<input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" id="<?php echo $payment_method['code']; ?>" checked="checked" />
					</div>  
					<?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'  ){ ?>
							<span style="margin-left:20px; position: relative; "><?php echo $payment_method['title']; ?></span>
						<?php } ?> 	
						
				
					
			    <?php } ?>
		
			</div>
	    <?php } ?>
	</div>
	<div class="MethodCard-coment" >
	  <b><?php echo $text_comments; ?></b>
	  <textarea name="comment" id="campo" rows="8" onkeyup="mostrarResultado(this.value,500,'spcontando');contarCaracteres(this.value,500,'sprestante')" style="width: 98%;"><?php echo $comment; ?></textarea>
	  <br />
		<span id="spcontando" style="font-family:Open Sans',Arial, Helvetica, sans-serif;">Ainda não temos nada digitado..</span><br />
		<span id="sprestante" style="font-family:Open Sans',Arial, Helvetica, sans-serif;"></span>	  
	</div>
<script language="javascript">
    
$( document ).ready(function() {
    mostrarResultado($('#campo').val(), 500, 'spcontando');
    contarCaracteres($('#campo').val(), 500, 'sprestante');
});

function mostrarResultado(box,num_max,campospan){
	var contagem_carac = box.length;
	if (contagem_carac != 0){
		document.getElementById(campospan).innerHTML = contagem_carac + " caracteres digitados";
		if (contagem_carac == 1){
			document.getElementById(campospan).innerHTML = contagem_carac + " caracter digitado";
		}
		if (contagem_carac >= num_max){
			document.getElementById(campospan).innerHTML = "Limite de caracteres excedido!";
		}
	}else{
		document.getElementById(campospan).innerHTML = "Ainda não temos nada digitado..";
	}
}

function contarCaracteres(box,valor,campospan){
	var conta = valor - box.length;
	document.getElementById(campospan).innerHTML = "Você ainda pode digitar " + conta + " caracteres";
	if(box.length >= valor){
		document.getElementById(campospan).innerHTML = "Você não pode mais digitar..";
		document.getElementById("campo").value = document.getElementById("campo").value.substr(0,valor);
	}	
}

</script>	
	
	<br />
<?php } ?>
<br />
<?php if ($text_agree) { ?>
	<div class="buttons">
		<div class="right"><?php echo $text_agree; ?>
			<?php if ($agree) { ?>
			<input type="checkbox" name="agree" value="1" checked="checked" />
			<?php } else { ?>
			<input type="checkbox" name="agree" value="1" />
			<?php } ?>
			<input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
	    </div>
    </div>
<?php } else { ?>
	<div class="buttons">
		<div class="right">
			<input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
	    </div>
	</div>
<?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> 