$(document).ready(function(){
	// fix pros labels com erros da validação
	
	$("input").keydown(function() {
		$("label.error[style=block]").removeAttr("style");
	});
	
	// pega Cidades
	$("#uf").change(function(){
		$("#cidade > option").replaceWith("<option>Carregando cidades...</option>");									
		$("#cidade").load("../lib/getCidades.php", { uf: $(this).val() }, function() {
			var str = "";
			$("#cidade option:selected").each(function () {
				str += $(this).text() + " ";
			});
			$("#municipio").val(str);																																								 
		});
	});
	
	$("#cidade").change(function() {
		var str = "";
		$("#cidade option:selected").each(function () {
		  str += $(this).text() + " ";
	    });
		$("#municipio").val(str);														 
	});
	
	//Utilizado para habilitar/desabilitar o campo CRA
    $("input[name=tipo]").click(function() {
 		if ($("input[name=tipo][value=ADM-CFA]").is(":checked")) {
			$("input[name=cra]").removeAttr("disabled").focus().val("");
		} else{
			$("input[name=cra]").attr("disabled","disabled").val("nº CRA");
		}	  
    });
	
});