function SomenteNumeros()
 {
  if (((event.keyCode >= 48) && (event.keyCode <= 57)) || (event.keyCode == 13))
   {
    return true;
   }
  else
   {
    if (event.keyCode != 8)
     {
      alert("                Erro!\n Valor de entrada inválido!\nCampo deve ser numérico!");
      event.keyCode = 0
      return false;
     }
   }
 }


function isMail(obj)
 { 
  arroba = "@";
  mail = obj.value;
  if (mail == "")
    return false;
     
  A1 = mail.indexOf(arroba);
  if (A1 < 0)
    return false;  
     
  cliente = mail.substring(0,A1);
  provedor = mail.substring(A1+1,mail.length);
  ponto = ".";
  P1 = provedor.indexOf(ponto);
         
  if (P1 < 0)
    return false;
  
  return true;
 }


function checkForm()
 {
  if (document.f.UF_Registro.selectedIndex <= 0)
   {
    alert("Escolha a UF do número de registro!");
    f.UF_Registro.focus();
    return false;
   }
  if (document.f.Num_Registro.value.length != 6)
   {
    alert("Preencha o número de registro com 6 (seis) dígitos!\n\nEx.: Registro n.º 1 originário do CRCBA.\nO preenchimento deverá ser: BA-000001/O");
    f.Num_Registro.focus();
    return false;
   }
  if (document.f.Tipo_Registro.selectedIndex <= 0)
   {
    alert("Escolha o tipo do registro!");
    f.Tipo_Registro.focus();
    return false;
   }
  if (document.f.Remetente.value.length < 10)
   {
    alert("Preencha o campo 'Nome' com pelo menos 10 caracteres/espaços!");
    f.Remetente.focus();
    return false;
   }
  val_email = isMail(f.emailremetente);
  if (val_email == false)
   {
    alert("Formato de E-mail inválido!\nFormato válido: conta@provedor.tipo\nEx: usuário@provedor.com.br");
    f.emailremetente.focus();
    return false;
   }
  if (document.f.Cidade_res.value.length == "")
   {
    alert("Preencha o campo 'Cidade de Residência'!");
    f.Cidade_res.focus();
    return false;
   }
  if (document.f.UF_res.value.length == "")
   {
    alert("Preencha o campo 'UF de Residência'!");
    f.UF_res.focus();
    return false;
   } 
  
  alert("Confira os dados informados abaixo: \n\nCRC: "+document.f.UF_Registro.value+"-"+document.f.Num_Registro.value+"/"+document.f.Tipo_Registro.value+"\n\nNome: " +document.f.Remetente.value+ "\n\nE-mail: " +document.f.emailremetente.value+ "\n\nTelefone: (" +document.f.DDD_Tel_res.value+ ") " +document.f.Tel_res.value+ "\n\nResidência: " +document.f.Cidade_res.value+ "-" +document.f.UF_res.value+ "\n\n");
  
  if(confirm("Deseja enviar a solicitação de Senha?"))
   {
    alert("                     Obrigado!!\n\nEntraremos em contato em até dois dias úteis!!")
    return true
   }
  else
   {
    alert("Envio de dados cancelado!!")
    return false
   }

 }

