function checa_cpf(CPF) {
 if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
  CPF == "22222222222" || CPF == "33333333333" || CPF == "44444444444" ||
  CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
  CPF == "88888888888" || CPF == "99999999999")
  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)))
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)))
  return false;
 return true;
 }
//Função que checa o preencimento dos campos
function checareq(form){
if(!checa_cpf(form.cpfcnpj.value)){
alert("CPF Inválido. Preencha novamente!");
form.cpfcnpj.focus();
return (false);
}
}

