function personagem(){
	var d = new Date();
	d = d.getSeconds();
	if (d%2 == 0){
		document.getElementById("ph").style.display = "block";
	}else
		document.getElementById("pm").style.display = "block";
}

function validarCPF(campoCPF){
	   var cpf = document.getElementById(campoCPF).value;
	    
	   if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" ||
	   cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" ||
	   cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" ||
	   cpf == "88888888888" || cpf == "99999999999"){
	   document.getElementById("error").innerHTML = "CPF inválido. Tente novamente.";
	   return false;
	   }

	   soma = 0;
	   for(i = 0; i < 9; i++)
	     soma += parseInt(cpf.charAt(i)) * (10 - i);
	   resto = 11 - (soma % 11);
	   if(resto == 10 || resto == 11)
	  resto = 0;
	   if(resto != parseInt(cpf.charAt(9))){
	  document.getElementById("error").innerHTML = "CPF inválido. Tente novamente.";
	  return false;
	   }
	   soma = 0;
	   for(i = 0; i < 10; i ++)
	  soma += parseInt(cpf.charAt(i)) * (11 - i);
	   resto = 11 - (soma % 11);
	   if(resto == 10 || resto == 11)
	  resto = 0;
	   if(resto != parseInt(cpf.charAt(10))){
	  document.getElementById("error").innerHTML = "CPF inválido. Tente novamente.";
	  return false;
	   }
	   document.getElementById("error").innerHTML = " ";
	   return true;
	 }

function abrejanela(cHtml, cTitulo) {
    var janela;
    var janela = "toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=no,width=780,height=500";
    var win = window.open(cHtml, cTitulo, janela);
    if (win == null) {
        alert('Um mecanismo bloquador de \'pop-ups\' em seu computador, impediu que uma nova janela fosse aberta.\nPor favor, configure esse mecanismo para aceitar pop-ups dessa página!');
    }
}
function formCartaoCredito(numpedido,total){
	$('#NUMPEDIDO').val(numpedido);
	$('#TOTAL').val(total);
	$('#formcartaocredito').submit();	
}
function carregaBoleto (){
	$('#boleto').html('');
	$("#boletoCarregando").show();
	var curso = $("#curso").val();
	var ra = $("#ra").val();
	  $.ajax({
		   url: path+'/boleto/ra/'+ra+'/curso/'+curso+'/listar',
		   success: function(data){
		   	$('#boleto').html(data);
		   },
		   complete: function(){
		    	$("#boletoCarregando").hide();
		   }
	  });
}

