function valida(){
	
	Form = document.contato;
	
	if(Form.sexo.value == ""){
		alert("Campo Sexo Obrigatório!");
		Form.sexo.focus();
		return false;
	}
	if(Form.nome.value == ""){
		alert("Campo Nome Obrigatório!");
		Form.nome.focus();
		return false;
	}
	if(Form.cpf.value == ""){
		alert("Campo CPF Obrigatório!");
		Form.cpf.focus();
		return false;
	}
	
	if(Form.dia.value == ""){
		alert("Campo Nascimento Obrigatório!");
		Form.dia.focus();
		return false;
	}
	if(Form.mes.value == ""){
		alert("Campo Nascimento Obrigatório!");
		Form.mes.focus();
		return false;
	}
	if(Form.ano.value == ""){
		alert("Campo Nascimento Obrigatório!");
		Form.ano.focus();
		return false;
	}
	
	if(Form.est_civil.value == ""){
		alert("Campo Estado Civil Obrigatório!");
		Form.est_civil.focus();
		return false;
	}
	if(Form.endereco.value == ""){
		alert("Campo Endereço Obrigatório!");
		Form.endereco.focus();
		return false;
	}
	if(Form.bairro.value == ""){
		alert("Campo Bairro Obrigatório!");
		Form.bairro.focus();
		return false;
	}
	if(Form.cidade.value == ""){
		alert("Campo Cidade Obrigatório!");
		Form.cidade.focus();
		return false;
	}
	if(Form.estado.value == ""){
		alert("Campo Estado Obrigatório!");
		Form.estado.focus();
		return false;
	}
	if(Form.pais.value == ""){
		alert("Campo Pais Obrigatório!");
		Form.pais.focus();
		return false;
	}
	if(Form.telefone_re.value == "" && Form.telefone_com.value == "" && Form.celular.value == ""){

			alert("Você não informou nenhum número de telefone para contato. \n Informe ao menos 1 telefone para contato.");	
			Form.telefone_re.focus();
			return false;

		/*if(confirm("Você não informou nenhum numero de telefone para contato. \n Isso pode dificultar o processo de seleção, gostaria de informar algum numero de telefone?")){
			if(document.getElementById('telefone_re').value == ""){
				document.getElementById('telefone_re').focus();
				return false;
			}
			if(document.getElementById('telefone_com').value == ""){
				document.getElementById('telefone_com').focus();
				return false;
			}
			if(document.getElementById('celular').value == ""){
				document.getElementById('celular').focus();
				return false;
			}
		}*/
	}	
	invalidCharsList = " /:,;~#";

	if ( Form.email.value.indexOf('@',0)==-1 || Form.email.value.indexOf('@',0)== 0 || Form.email.value.indexOf('.',0)==-1) {
			 alert("O endereço de e-mail parece ser inválido!");
			 Form.email.select();
			 Form.email.focus();
			 return (false);
	}
	for (i = 0; i < invalidCharsList.length; i++) {
	  errorChar = invalidCharsList.charAt(i);
	  if (Form.email.value.indexOf(errorChar,0) != -1) {
		Form.email.select();
		Form.email.focus();
		return (false);
	  }
   }
}
function numerosCpf(){
	if (event.keyCode < 48 || event.keyCode > 57){
		return false;
	}
}
function zer(){
	alert("ERRO. CPF inválido. Digite Novamente. Sem pontos");
	document.contato.cpf.focus();
	return false;
}
function check_cpf(numcpf){
	if(document.contato.cpf.value.length < 11){
		return zer();
	}
	if((numcpf == "00000000000") || (numcpf == "11111111111") ||
   	   (numcpf == "22222222222") || (numcpf == "33333333333") ||
   	   (numcpf == "44444444444") || (numcpf == "55555555555") ||
	   (numcpf == "66666666666") || (numcpf == "77777777777") ||
	   (numcpf == "88888888888") || (numcpf == "99999999999") ) {
		return zer();
	}
	x = 0;
	soma = 0;
	dig1 = 0;
	dig2 = 0;
	texto = "";
	numcpf1="";
	len = numcpf.length; x = len -1;
	
	for (var i=0; i <= len - 3; i++) {
	y = numcpf.substring(i,i+1);
	soma = soma + ( y * x);
	x = x - 1;
	texto = texto + y;
	
	}
	
	// % retorna o resto da divisão por 11
	dig1 = 11 - (soma % 11);
	
	if (dig1 == 10) dig1=0 ;
	if (dig1 == 11) dig1=0 ;
	
	numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	
	for (var i=0; i <= len - 2; i++) {
	soma = soma + (numcpf1.substring(i,i+1) * x);
	x = x - 1;
	}
	dig2= 11 - (soma % 11);
	
	if (dig2 == 10) dig2=0;
	if (dig2 == 11) dig2=0;
	
	if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
		return true;
	}else{
		return zer();
	}
}

function formtQQ(e,src,mask) {
	if(window.event) { _TXT = e.keyCode; } 
	else if(e.which) { _TXT = e.which; }
		if(_TXT > 47 && _TXT < 58) { 
			var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
			if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); } 
				return true; } else { if (_TXT != 8) { return false; } 
		else { return true; }
	}
}
function formataMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){

	//máscara de moeda 0.000.000,00
	SeparadorMilesimo='.';

    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;    
    // 13=enter, 8=backspace as demais retornam 0(zero)
    // whichCode==0 faz com que seja possivel usar todas as teclas como delete, setas, etc    
    if ((whichCode == 13) || (whichCode == 0) || (whichCode == 8))
    	return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave 
 
    if (strCheck.indexOf(key) == -1) 
    	return false; // Chave inválida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) 
        	break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) 
        	aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) 
    	objTextBox.value = '';
    if (len == 1) 
    	objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) 
    	objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        	objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}