function janelaTextoCurriculum(status){
  var modulo = document.getElementById("textoCurriculum");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}
function janelaTextoCurriculum2(status){
  var modulo = document.getElementById("textoCurriculum2");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}
function janelaTextoCurriculum3(status){
  var modulo = document.getElementById("textoCurriculum3");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}

// FUNCAO AJAX
function retornaRequest() {
  var req;
  if ( window.ActiveXObject ) // IE
    req = new ActiveXObject( "Microsoft.XMLHTTP" );
  else if ( window.XMLHttpRequest ) // não IE
    req = new XMLHttpRequest();
  
  return req;
}

// ================================== FUNCAO PARA EXIBIR AS AREAS DOS CURSOS ==================================
function exibirCursosAreas(pagina) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "cursosAreas" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var texto = document.getElementById( "cursosAreas" );
      texto.innerHTML = req.responseText;
    }
  }

  req.open( "POST", pagina, true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send('');
}

// ================================== FUNCAO PARA EXIBIR AS SUB AREAS DOS CURSOS ==================================
function exibirCursoSubAreas(tpocurso, pagina) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "cursoSubAreas" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var texto = document.getElementById( "cursoSubAreas" );
      texto.innerHTML = req.responseText;
    }
  }

  req.open( "POST", pagina, true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send('tpocurso='+tpocurso);
}

// ================================== FUNCAO PARA EXIBIR OS CURSOS ==================================
function exibirCursos(codtpocurso, pagina) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "cursos" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var texto = document.getElementById( "cursos" );
      texto.innerHTML = req.responseText;
    }
  }

  req.open( "POST", pagina, true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send('codtpocurso='+codtpocurso);
}

// ================================== FUNCAO PARA EXIBIR OS DETALHES DO CURSO ==================================
function exibirCursoDescricao(idcurso, pagina) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "cursoDescricao" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var texto = document.getElementById( "cursoDescricao" );
      texto.innerHTML = req.responseText;
    }
  }

  req.open( "POST", pagina, true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send('idcurso='+idcurso);
}

function exibirTexto(i, pagina) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "texto" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var texto = document.getElementById( "texto" );
      texto.innerHTML = req.responseText;
    }
  }

  req.open( "POST", "pages/tntprincipal/jsp/"+pagina, true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send( 'texto='+i );
}

// FUNCAO AJAX
function exibirImagemTNTFormsReports(i) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "imagemFormsReports" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var imagem = document.getElementById( "imagemFormsReports" );
      imagem.innerHTML = req.responseText;
    }
  }

  req.open( "POST", "pages/tntprincipal/jsp/imagemFormsReports.jsp", true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send( 'imagem='+i );
  janelaImagemFormsReports('Exibir');
}

function exibirModulosGE(i) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "textoModulosGE" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var modulo = document.getElementById( "textoModulosGE" );
      modulo.innerHTML = req.responseText;
    }
  }

  req.open( "POST", "pages/tntprincipal/jsp/textoModulosGE.jsp", true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send( 'modulo='+i );
  janelaTextoModulosGE('Exibir');
}

function exibirModulosGI(i) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "textoModulosGI" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var modulo = document.getElementById( "textoModulosGI" );
      modulo.innerHTML = req.responseText;
    }
  }

  req.open( "POST", "pages/tntprincipal/jsp/textoModulosGI.jsp", true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send( 'modulo='+i );
  janelaTextoModulosGI('Exibir');
}

function exibirInfoGeraisGI(i) {
  var req = retornaRequest();

  req.onreadystatechange = function() {
    document.getElementById( "textoInfoGeraisGI" ).innerHTML = "Carregando...";
    if ( req.readyState == 4 ) {
      var modulo = document.getElementById( "textoInfoGeraisGI" );
      modulo.innerHTML = req.responseText;
    }
  }

  req.open( "POST", "pages/tntprincipal/jsp/textoInfoGeraisGI.jsp", true );
  req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
  req.send( 'modulo='+i );
  janelaTextoInfoGeraisGI('Exibir');
}

function mudarPagina() {
  var valor = eval('document.segmento.opcao.value');
  location.href='clientes.do?valor='+valor;
}

function abrir(URL, width, height, resizable) {
  var left = 150;
  var top  = 130;
  window.open(URL, 'TNT', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, resizable='+resizable+'');
}

function janelaTextoModulosGE(status){
  var modulo = document.getElementById("textoModulosGE");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}

function janelaTextoModulosGI(status){
  var modulo = document.getElementById("textoModulosGI");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}

function janelaTextoInfoGeraisGI(status){
  var modulo = document.getElementById("textoInfoGeraisGI");
  if (status=="Exibir") modulo.style.visibility = "visible";
  else modulo.style.visibility = "hidden";
}

function janelaImagemFormsReports(status){
  var imagem = document.getElementById("imagemFormsReports");
  if (status=="Exibir") imagem.style.visibility = "visible";
  else                  imagem.style.visibility = "hidden";
}

function janelaBanner(status){
  var banner = document.getElementById("tntFormsReports");
  if (status=="Exibir") banner.style.visibility = "visible";
  else                  banner.style.visibility = "hidden";
}

// BANNER POS
function janelaBannerEventos( status ){
  var banner = document.getElementById("banner");

  if (status == "exibir") banner.style.visibility = "visible";
  else                    banner.style.visibility = "hidden";
}


// função para evento de rolover das imagens
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// função para exibir os layer do menu
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

