/* Função responsável pela criação e abertura de janelas instantâneas. */
function Janela(url,lar,alt,rol)
{
  window.open(url,"","location=no,directories=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars="+rol+",width="+lar+",height="+alt);
}

/* Valida os dados digitados no livro de visitas. */
function ValidaDados1()
{
  if (document.Livro.Nome.value.length < 5)
  {
    window.alert("É necesário preencher o campo Nome.");
    return false;
  }
  if (document.Livro.Email.value == "" || document.Livro.Email.value.indexOf('@', 0) == -1 || document.Livro.Email.value.indexOf('.',0) == -1 || document.Livro.Email.value.indexOf(' ',0) != -1)
  {
    window.alert("E-mail inválido!");
    return false;
  }
  if (document.Livro.Comentario.value.length < 5)
  {
    window.alert("É necessário preencher o campo Comentário.");
    return false;
  }
  return true;
}

/* Valida os dados digitados no cadastro de usuários. */
function ValidaDados2()
{
  if (document.Cadastro.Nome.value.length < 5)
  {
    window.alert("É necesário preencher o campo Nome.");
    return false;
  }
  if (document.Cadastro.Pseudonimo.value.length < 3)
  {
    window.alert("Nome de usuário inválido!.");
    return false;
  }
  if (document.Cadastro.Email.value == "" || document.Cadastro.Email.value.indexOf('@', 0) == -1 || document.Cadastro.Email.value.indexOf('.',0) == -1 || document.Cadastro.Email.value.indexOf(' ',0) != -1)
  {
    window.alert("E-mail inválido!");
    return false;
  }
  if (document.Cadastro.Senha.value.length < 4)
  {
    window.alert("É necessário preencher o campo Senha. Mínimo de 4 e máximo de 8 caracteres.");
    return false;
  }
  if (document.Cadastro.Senha.value != document.Cadastro.SenhaAux.value)
  {
    window.alert("As senhas não combinam!");
    return false;
  }
  return true;
}
