function validarCPF(objCPF) {

  if (objCPF.value == ""){
     alert("Digite um valor para o campo \"CPF\".");
     return 'false';
  }
  else if (objCPF.value.length  != 11){
     alert("O campo do \"CPF\" deve ser preenchido com 11 dígitos.");
     return 'false';
  }
  else {
    cpf = objCPF.value;
    somaux = (cpf.charAt(0) * 10);
    somaux = somaux + (cpf.charAt(1) * 9);
    somaux = somaux + (cpf.charAt(2) * 8);
    somaux = somaux + (cpf.charAt(3) * 7);
    somaux = somaux + (cpf.charAt(4) * 6);
    somaux = somaux + (cpf.charAt(5) * 5);
    somaux = somaux + (cpf.charAt(6) * 4);
    somaux = somaux + (cpf.charAt(7) * 3);
    somaux = somaux + (cpf.charAt(8) * 2);
 
    if (somaux == 0) {
       alert("CPF inválido. Favor redigitar.");
       return 'false';
    }
 
    resto = (somaux % 11);
    div = somaux - resto;
    soma = (11 - (somaux - div));
    
    if (soma > 9){ soma = 0; }
    
    if (soma != (cpf.charAt(9))){
       alert("CPF inválido. Favor redigitar.");
       return 'false';
    }
    
    somaux = (cpf.charAt(0) * 11);
    somaux = somaux + (cpf.charAt(1) * 10);
    somaux = somaux + (cpf.charAt(2) * 9);
    somaux = somaux + (cpf.charAt(3) * 8);
    somaux = somaux + (cpf.charAt(4) * 7);
    somaux = somaux + (cpf.charAt(5) * 6);
    somaux = somaux + (cpf.charAt(6) * 5);
    somaux = somaux + (cpf.charAt(7) * 4);
    somaux = somaux + (cpf.charAt(8) * 3);
    somaux = somaux + (cpf.charAt(9) * 2);
    
    resto = (somaux % 11);
    div = (somaux - resto);
    soma = (11 - (somaux - div));
    
    if (soma > 9) { soma = 0; }
    
    if (soma != cpf.charAt(10)){
       alert("CPF inválido. Favor redigitar.");
       return 'false';
    }
  }
  return 'true';
}