/**
 */

function estados()
{
	var estado = $('#estado').val();
	
	if(estado != '')
	{
		$.post("../includes/webservice/ajax/cidades.php", {
            estado: estado
        }, function(data)
		{
			$('#cidades_cb').html(data);
        });
	}
}

function pagSeguro()
{
	$('#fIdentificacao').submit();
}

/**
 * Funcao inicial
 */
function init(){
	$('#estado').change(estados);
	
	$('#cpf').mask('999.999.999-99');
	$('#ddd').mask('99');
	$('#celular').mask('9999-9999');
	$('#cep').mask('99999-999');
	
	$('#link_pagseguro').click(pagSeguro);
	
	if($('.check').is(':checked'))
	{
		$('.check').click();
	}
	
	$(".check").click(function(){
		if ($(this).attr("checked") == true) {
			$(".normal").css('display', 'none');
			$("#descricaoAva").html('<label class="margem">Se você já possui cadastro no Portal AVA, confirme abaixo seu e-mail e senha para se cadastrar.</label>');
			$('#confirmaAva').val(1);
		}
		else {
			$(".normal").css('display', 'block');
			$("#descricaoAva").html('');
			$('#confirmaAva').val(0);
		}
	});

	//Bloqueia o caracter @ no input nome
	$(function() {
	    $('#nome').keypress(function(event) {
	        var tecla = (window.event) ? event.keyCode : event.which;
	     
		    if (tecla == 64) return false;
	        
	    });
	});
	
	//impede que seja colado algo no campo
	$('#nome').bind('paste', function(e){
		return false;
	});

}

// Jquery / Quando a pagina carregar dispara a chamada da init.
$(document).ready(init);

