function AbreDica(numero) {
  dicas=window.open("dicas/"+numero+".htm","dica","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=650,height=400,top=100,left=100");
}

function fLink(txtMsg) {
  window.status = txtMsg;
}

function abreJanela(txtObjeto,txtURL,txtNI,numW,numH,numTop,numLeft) {
  comando = txtObjeto + "=window.open('" + txtURL + "','" + txtNI + "','width=" + numW + ",height=" + numH + ",top=" + numTop + ",left=" + numLeft + "');";
  eval(comando);
}

function devTrim(t) {
  tam = t.length;
  txt = "";
   for (i=0;i<tam;i++)
    if (t.charAt(i) != " ")
       {
       txt = t.substring(i,t.length);
      break;
      }
  return txt;
}

function stringVazia(t) {
  if (devTrim(t).length == 0)
    return true;
  else
    return false;
}

function emailOk(t) {
  if (t.indexOf("@") == -1 || t.indexOf(".") == -1)
    return false;
  else
    return true;
}

function validaInscricao() {
  if (!emailOk(document.forms[0].endereco.value)) {
    window.alert("O endereço de e-mail deve ser preenchido corretamente");
    document.forms[0].endereco.focus();
  }
else
  document.forms[0].submit();
}

function validaOpiniao(fo) {
  if (stringVazia(fo.txtNome.value)) {
    window.alert("O nome deve ser preenchido");
    fo.txtNome.value = "";
    fo.txtNome.focus();
  }
  else if (! emailOk(fo.txtEmail.value)) {
    window.alert("O email deve ser preenchido corretamente");
    fo.txtEmail.focus();
  }
  else if (fo.txtMensagem.value.length > 300) {
    window.alert("Tente limitar sua mensagem a 300 caracteres");
    fo.txtMensagem.focus();
  }
  else {
    fo.txtNome.value = devTrim(fo.txtNome.value);
    fo.submit();
  }
}

function pedeOpiniao(a,p) {
  document.write("<table width='300' border='1' cellspacing='0' cellpadding='5'><tr><td><div class='pequeno'>D&ecirc; sua opini&atilde;o, preenchendo o formul&aacute;rio a seguir. (o preenchimento dos campos em vermelho &eacute; obrigat&oacute;rio)</div><br><form action='../asp/opiniaoartigo.asp' method='post'><span class='pequeno' style='color:Red'>Nome:</span> <input type='text' name='txtNome' size='30' maxlength='40' class='pequeno'><br><br><span class='pequeno' style='color:Red'>email:</span> <input type='text' name='txtEmail' size='30' maxlength='40' class='pequeno'><br><br><span class='pequeno'>Conceito sobre o artigo:</span><br><input type='radio' name='txtConceito' value='excelente'><span class='pequeno'>Excelente</span><input type='radio' name='txtConceito' value='bom'><span class='pequeno'>Bom</span><input type='radio' name='txtConceito' value='ruim'><span class='pequeno'>Ruim</span><input type='radio' name='txtConceito' value='péssimo'><span class='pequeno'>P&eacute;ssimo</span><br><br><span class='pequeno'>mensagem:</span><br><textarea name='txtMensagem' cols='30' rows='5' class='pequeno'></textarea><br><input type='hidden' name='txtAssunto' value='" + a + "'><input type='hidden' name='txtPara' value='" + p + "'><input type='button' value='Envia' class='pequeno' onclick='validaOpiniao(this.form)'></form></td></tr></table>");
}

function rodapeArtigo() {
  document.write("<p class='corpo' align='center'><b><a href='javascript:history.back();'>voltar</a></b> | <b><a href='index.html'>&iacute;ndice de artigos</a></b> | <b><a href='index.html#topo'>in&iacute;cio</a></b></p>");
}

function Noticias(f) {
  idx = f.selPeriodo.selectedIndex;
  if (idx != 0)
    self.location = f.selPeriodo.options[idx].value
}

function Janela(variavel,url,nomeinterno,caracteristicas) {
  comando = variavel + " = window.open('" + url + "','" + nomeinterno + "','" + caracteristicas + "');";
  eval(comando);
}

function Enquete(quadro) {
  maximo = quadro.enq.length;
  escolheu = false;
  for (i=0;i<maximo;i++) {
    if (quadro.enq[i].checked) {
      escolheu = true;
      break;
    }
  }
  if (escolheu)
    quadro.submit();
  else
    alert ("É necessário escolher uma opção para votar.");
}

function Verifica_email(fendereco) {
  if ((!Preenchido(fendereco)) || (!Tem(fendereco,"@")) || (!Tem(fendereco,".")))
    return false;
  else
    return true;
}

function Tem(fdado,fcaractere) {
  return (fdado.indexOf(fcaractere) != -1);
}

function Preenchido(fdado) {
  return (fdado != "");
}

function Verifica_mensagem(fmensagem,ftamanho) {
  return (fmensagem.length <= ftamanho);
}

function Atualiza(quadro) {
  if (!Verifica_email(quadro.email.value)) {
    alert("É necessário informar o endereço de e-mail.");
    quadro.email.focus();
  }
  else
    quadro.submit();
}

function Vagas(quadro) {
  if (!Preenchido(quadro.empresa.value)) {
    alert("Preencha o campo EMPRESA.");
    quadro.empresa.focus();
  }
  else if (!Preenchido(quadro.realname.value)) {
    alert("Preencha o campo NOME.");
    quadro.realname.focus();
  }
  else if (!Verifica_email(quadro.email.value)) {
    alert("O e-mail não foi preenchido corretamente.");
    quadro.email.focus();
  }
  else if (quadro.descricao.value.length > 500) {
    alert("A descrição da vaga pode ter até 500 caracteres. Revise-a.");
    quadro.descricao.focus();
  }
  else {
    if (quadro.empresa.value.toUpperCase() == "CONFIDENCIAL") quadro.empresa.value == "CONFIDENCIAL";
    if (quadro.realname.value.toUpperCase() == "CONFIDENCIAL") quadro.realname.value == "CONFIDENCIAL";
    if (quadro.cidade.value == "") quadro.cidade.value = "Não informada";
    if (quadro.cargo.value == "") quadro.cargo.value = "Não informado";
    if (quadro.descricao.value == "") quadro.descricao.value = "Maiores informações sobre a vaga não foram fornecidas pelo anunciante";
    quadro.submit();
  }
}

function Cadastro(quadro) {
  if (!Preenchido(quadro.nome.value)) {
    alert("O nome precisa ser preenchido.");
    quadro.nome.focus(); 
  }
  else if (!Tem(quadro.nome.value," ")) {
    alert("Digite seu nome completo.");
    quadro.nome.focus(); 
  }
  else if (!Verifica_email(quadro.endereco.value)) {
    alert("O e-mail não foi preenchido corretamente.");
    quadro.endereco.focus(); 
  }
  else if (!Preenchido(quadro.pw.value)) {
    alert("É necessário informar uma senha.");
    quadro.pw.focus(); 
  }
  else if (quadro.pw.value != quadro.cfpw.value) {
    alert("A senha informada não foi confirmada.");
    quadro.cfpw.value = "";
    quadro.cfpw.focus(); 
  }
  else {
    if (quadro.atualiza.value == "s")
      top.esquerda.temporario.campo.value = quadro.endereco.value;
    quadro.submit(); 
  }
}

function Forum(quadro) {
  if (!Verifica_email(quadro.email.value)) {
    alert("É necessário informar o endereço de e-mail corretamente.");
    quadro.email.focus();
  }
  else
    quadro.submit();
}

function Contato(quadro) {
  if (!Preenchido(quadro.realname.value)) {
    alert("O nome precisa ser preenchido.");
    quadro.realname.focus();
  }
  else if (!Tem(quadro.realname.value," ")) {
    alert("Digite seu nome completo.");
    quadro.realname.focus();
  }
  else if (!Verifica_email(quadro.email.value)) {
    alert("O e-mail não foi preenchido corretamente.");
    quadro.email.focus();
  }
  else if (!Verifica_mensagem(quadro.mensagem.value,500)) {
    alert("Sua mensagem deve ter até 500 caracteres. Por favor, revise o texto e tente enviá-lo novamente.");
    quadro.mensagem.focus();
  }
  else
    quadro.submit();
}

function Valida(banco) {
  if (!Preenchido(banco.realname.value)) {
    alert("É necessário preencher o nome.");
    banco.realname.focus();
  }
  else if (!Verifica_email(banco.email.value)) {
    alert("O endereço de e-mail aparentemente não é válido ou não foi preenchido. Por favor, revise-o.");
    banco.email.focus();
  }
  else if (!Verifica_mensagem(banco.observacoes.value,500)) {
    alert ("O campo de Conhecimentos / Trabalhos Desenvolvidos tem um limite de 500 caracteres. Por favor, revise o que digitou.");
    banco.observacoes.focus();
  }
  else
    banco.submit();
}

function Politica() {
  window.open("private.html","privacidade","width=300,height=250,top=10,left=10");
}

function Pula(linhas) {
  for (i=1;i<=linhas;i++)
    document.write("<br>");
}

function Rollover(local,arquivo) {
  comando = "document." + local + ".src = '" + arquivo + "';";
  eval(comando);
}

function Fecha(tempo) {
  setTimeout("close()",tempo*1000);
}

function Grafico(numero,cor,titulo) {
  document.write("<tr><td class='pequeno'>" + titulo + "&nbsp;&nbsp;&nbsp;</td>");
  for (i=1;i<=numero;i++)
    document.write("<td bgcolor='" + cor + "'>&nbsp;</td>");
  document.write("<td class='pequeno'>&nbsp;" + numero + "</td></tr>");
}

function Codigo(linha,texto) {
  document.write("<tr><td class='texto'>" + linha + ":</td><td class='codigo'>" + texto + "</td></tr>");
}

function OpiniaoColuna(fo) {
  if (fo.msg.value.length > 500) {
    alert("A mensagem está limitada a 500 caracteres. Corrija-a.");
    fo.msg.focus();
  }
  else
    fo.submit();
}

function AddDeveloper(vnome,vemail,vcidade,vestado,vcv,vdata) {
  tatual = nome.length;
  nome[tatual] = vnome;
  email[tatual] = vemail;
  cidade[tatual] = vcidade;
  estado[tatual] = vestado;
  cv[tatual] = vcv;
  data[tatual] = vdata;
}

function AddNews(vdata,vfonte,vtitulo,vlink) {
  tatual = newsdata.length;
  newsdata[tatual] = vdata;
  newsfonte[tatual] = vfonte;
  newstitulo[tatual] = vtitulo;
  newslink[tatual] = vlink;
}

function verificaResolucaoBarra() {
  if (screen.width > 800)
    document.getElementById("anunciosdireita").style.visibility = "visible";
}
