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";
}
this.Ficha = null;

function AtualizarCadastro(Ficha){
  Contexto = ObterContexto();
  if(this.Ficha != null){
    document.getElementById(this.Ficha).style.display = 'none';
  };
  this.Ficha = Ficha;
  if(eval(this.Servico)){
    document.getElementById(this.Servico).style.display = 'none';
  }
  document.getElementById('AtualizacaoCadastro').style.display = 'block';
  document.getElementById(this.Ficha).style.display = 'block';
  document.getElementById('Sindicalizacao').style.display = 'none';
  if(Contexto == 'index'){
    document.getElementById('NoticiaPrincipalTeste').style.display = 'none';
    //document.getElementById('NoticiaSec').style.display = 'none';
    //document.getElementById('BannerBottom').style.display = 'block';
  }
  else if((Contexto == 'imprensa') || (Contexto == 'juridico') || (Contexto == 'links') || (Contexto == 'valorizese') || (Contexto == 'galeria') || (Contexto == 'videos')){
    document.getElementById('ConteudoPrincipal').style.display = 'none';
  }
}


function DiretoriasAnteriores(Id) {
  if(Id != '0'){
    Link = 'diretoriasanteriores/' + Id;
    PopUp(Link);
  }
}

function escondeDiv(){
  var objDiv = document.getElementById("EventoSindMedico");
  if(objDiv != null){
    objDiv.style.display = "none";
  }
}

function FechaDiretoriaPainel(){
  document.getElementById('Diretoriapainel').style.display = 'none';
  document.getElementById(this.Id).style.display = 'none';
  this.Id = 0;
  return true;
}

function FechaServico(){
  if(this.Contexto == 'index'){
    document.getElementById('NoticiaPrincipalTeste').style.display = 'block';
    //document.getElementById('NoticiaSec').style.display = 'block';
    //document.getElementById('BannerBottom').style.display = 'block';
  }
  else if(this.Contexto == 'diretoria'){
    document.getElementById('Diretoria').style.display = 'block';
    document.getElementById('Trienio').style.display = 'block';
  }
  else if((this.Contexto == 'imprensa') || (this.Contexto == 'juridico') || (this.Contexto == 'links') || (this.Contexto == 'valorizese') || (this.Contexto == 'galeria') || (Contexto == 'videos')){
    document.getElementById('ConteudoPrincipal').style.display = 'block';
  }
  document.getElementById(this.Servico).style.display = 'none';
  return true;
}


function MostraDiretoriaPainel(DiretorId) {
  if (this.Id > 0){
    FechaDiretoriaPainel();
  }
  this.Id = DiretorId;
  document.getElementById(Id).style.display = 'block';
  document.getElementById('Diretoriapainel').style.display = 'block';
  return true;
}

function MenuDireito(){
  var objeDiv = document.getElementById('apoio');
  objeDiv.style.display = 'block';
  objeDiv.innerHTML = '';
  if(this.Nav == "IE"){
    objeDiv.innerHTML = ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuApoio.xsl");
  }
  else{
   objeDiv.appendChild(ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuApoio.xsl"));
  }
}

function MenuBannerBottom(){
  var objeDiv = document.getElementById('BannerBottom');
  objeDiv.innerHTML = '';
  if(this.Nav == "IE"){
    objeDiv.innerHTML = ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuBanners.xsl");
  }
  else{
    objeDiv.appendChild(ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuBanners.xsl"));
  }
}

function MenuBannerEsquerdo(){
  var objeDivLeft = document.getElementById('BannerEsquerdo');
  if(this.Nav == "IE"){
    objeDivLeft.innerHTML = ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuBannerEsquerdo.xsl");
  }
  else{
    objeDivLeft.appendChild(ObterXML("DadosXML/MenuApoio.xml", "Estilos/MenuBannerEsquerdo.xsl"));
  }
}


function MenuHorizontal(){
  var objeDiv = document.getElementById('MenuHoriz');
  objeDiv.style.display = 'block';
  objeDiv.innerHTML = '';
  if(this.Nav == "IE"){
    objeDiv.innerHTML = ObterXML("DadosXML/MenuHorizontal.xml", "Estilos/MenuHorizontal.xsl");
  }
  else{
    objeDiv.appendChild(ObterXML("DadosXML/MenuHorizontal.xml", "Estilos/MenuHorizontal.xsl"));
  }

}

function MenuVertical(){
  var objeDiv = document.getElementById('menuVert');
  objeDiv.style.display = 'block';
  if(this.Nav == "IE"){
    objeDiv.innerHTML = ObterXML("DadosXML/MenuServico.xml", "Estilos/MenuServico.xsl");
  }
  else{
    objeDiv.appendChild(ObterXML("DadosXML/MenuServico.xml", "Estilos/MenuServico.xsl"));
  }
}

function MontarFicha(Ficha){
  document.getElementById(Ficha).style.display = 'block';
  document.getElementById(this.Ficha).style.display = 'none';
  this.Ficha = Ficha;
}



function PainelDiretoria(){
  var objeDiv = document.getElementById('Diretoriapainel');
  objeDiv.innerHTML = '';
  if(this.Nav == "IE"){
    objeDiv.innerHTML = ObterXML("DadosXML/PainelDiretoria.xml", "Estilos/PainelDiretoria.xsl");
  }
  else{
    objeDiv.appendChild(ObterXML("DadosXML/PainelDiretoria.xml", "Estilos/PainelDiretoria.xsl"));
  }

}

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 TrocaCorDiv(Obj ,Trocar) {
  Contexto = ObterContexto();
  if(Contexto == 'index') {
    if(Trocar){
      Obj.style.background = '#E1F2E0';
      Obj.style.border = 'solid 1px #95BC92';
    }
    else {
      Obj.style.background = '#FFFFFF';
      Obj.style.border = 'none';
      Obj.style.borderBottom = 'solid 2px #95BC92';
    }
  }
  if(Contexto == 'diretoria') {
    if(Trocar){
      Obj.style.background = '#D8DEE2';
      Obj.style.border = 'solid 1px #9BB9CA';
    }
    else {
      Obj.style.background = '#FFFFFF';
      Obj.style.border = 'none';
      Obj.style.borderBottom = 'solid 2px #9BB9CA';
    }
  }
    else if(Contexto == 'videos') {
    if(Trocar){
      Obj.style.background = '#EFEFEF';
      Obj.style.border = 'solid 1px #E0E0E0';
    }
    else {
      Obj.style.background = '#FFFFFF';
      Obj.style.border = 'none';
      Obj.style.borderBottom = 'solid 2px #E0E0E0';
    }
  }
}
