navegador = navigator.appName;
if (navegador == "Microsoft Internet Explorer"){
  //document.write("<link href='estilos/IE.css' rel='stylesheet' type='text/css'/>");
  this.Nav = "IE";
}
else{
  //document.write("<link href='estilos/Open.css' rel='stylesheet' type='text/css'/>");
  this.Nav = "OS";
  }


function escondeDiv(){
  var objDiv = document.getElementById("DivEvento");
  objDiv.style.display = "none"; 
}

function escondeMenu() {
  if(document.getElementById('menuVertical').style.display == ''){
    document.getElementById('menuVertical').style.display = 'none';
    document.getElementById('lerconteudo').style.width = '684px';
    document.getElementById('ModoImp').src = 'images/setaRight.jpg';
  }
  else {
    document.getElementById('menuVertical').style.display = '';
    document.getElementById('lerconteudo').style.width = '574px';
    document.getElementById('ModoImp').src = 'images/setaLeft.jpg';
  }
}

function exibeDescricaoArquivo(Objeto, Mostra){
  if(Mostra){
    document.getElementById(Objeto).style.display = 'block';
  }
  else{
    document.getElementById(Objeto).style.display = 'none';
  }
}

function imprimeData(){
  DataToda = new Date();
  DiaHoje = DataToda.getDay();
  MesHoje = DataToda.getMonth();

  NomeDia = new Array(7)
  NomeDia[0] = "Dom";
  NomeDia[1] = "Seg";
  NomeDia[2] = "Ter" ;
  NomeDia[3] = "Qua";
  NomeDia[4] = "Qui";
  NomeDia[5] = "Sex";
  NomeDia[6] = "Sáb";
  
  NomeMes = new Array(12)
  NomeMes[0] = "Janeiro";
  NomeMes[1] = "Fevereiro";
  NomeMes[2] = "Março";
  NomeMes[3] = "Abril";
  NomeMes[4] = "Maio";
  NomeMes[5] = "Junho";
  NomeMes[6] = "Julho";
  NomeMes[7] = "Agosto";
  NomeMes[8] = "Setembro";
  NomeMes[9] = "Outubro";
  NomeMes[10] = "Novembro";
  NomeMes[11] = "Dezembro";
  document.write (NomeDia[DiaHoje] + ', ' + DataToda.getDate() + ' de ' + NomeMes[MesHoje] + ' de ' + DataToda.getYear());
}

function imprimeRodaPe(){
  document.write ('APUA BRASIL - SEPES 713/913 - Lote E - Edifício AMBR - APUA - 40 - Brasília - Distrito Federal - CEP:70390 - 135 <br/>E-mail:apuabrasil@apuabrasil.org.br.desenvolvido por m3informaticaltda@gmail.com')
}

function jsSubmit(Action,Valor){
  document.Restrito.action=Action;
  document.Restrito.grupo.value = Valor;
  document.Restrito.method='POST';
  document.Restrito.submit();
  return true;
}

function JSubmitFormGrupo(Estado,Id){
  if(Estado == "Listar"){
    return location.href = 'index.php';
  };
  Form = document.FormAplicacao;
  Form.Estado.value = Estado;
  Form.id.value = Id;
  Form.method = "POST";
  return Form.submit();
}

function lerConteudo(ConteudoId){
  location.href = 'lerConteudo.php?Id=' + ConteudoId;
}

function obterContexto(){
  //Calcula o Contexto
  Url = location.href;
  Arquivo = Url.substring(Url.lastIndexOf("/") + 1,Url.length);
  Replace =  Arquivo.replace(".php","");
  return Replace.toLowerCase();
}

function pesquisar(ConteudoTxt){
  location.href = 'pesquisar.php?Parametro=' + ConteudoTxt;
}

function popUp(sArquivo,w,h){
  if(!eval(w)){
    var w = 740;
  }
  if(!eval(h)){
    var h = 460;
  }
  var left = (screen.width - w) / 2;
  var top = (screen.height - h) / 2;
  Opcoes = 'width='+w+',height='+h+',top='+top+',left='+left+',toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1'
  win = window.open(sArquivo,'PopUp',Opcoes);
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function replace(str,find,repla){
  var newStr = ""
  for(i=0;i<=str.length-1;i++){
    strValue = str.substring(i,i+1)
    if (strValue == find){
      newStr += repla;
    }
    else{
      newStr += str.substring(i,i+1);
    }
  }
  return newStr
}

function enviarForm(Formulario, ScriptPHP, w, h){
  popUp('',w,h);
  Formulario.method = 'POST';
  Formulario.target = 'PopUp';
  Formulario.action = ScriptPHP;
  Formulario.submit();
  return true;
}

function trocaCorDiv(Obj ,Trocar) {
  if(Trocar){
    Obj.style.background = '#F1ECDE';
    Obj.style.border = 'solid 1px #F0DB98';
  }
  else {
    Obj.style.background = 'none';
    Obj.style.border = '1px solid #a6120a';
  }
}
