// JScript source code

// JavaScript Document

function Http(){
	
	try{this.xmlhttp = new XMLHttpRequest();}
	catch(trymicrosoft){
		try
		{this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
		catch(othermicrosoft){
			try{this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
			catch(failed){this.xmlhttp = null;}
		}
	}
}

function mostraIntercambio()
{
    var url = "m_conteudoinformativo/ConteudoInformativo.php?idmenuitem=6";
	var div = document.getElementById('ma_intercambioIntroducaoTexto');
	
	httpConteudoInformativo = null;
	var httpConteudoInformativo = new Http();
	httpConteudoInformativo.xmlhttp.open("GET", url,true);
	httpConteudoInformativo.xmlhttp.onreadystatechange = function(){
		                            div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpConteudoInformativo.xmlhttp.readyState == 4){
										if(httpConteudoInformativo.xmlhttp.status == 200){
		                                    div.innerHTML = httpConteudoInformativo.xmlhttp.responseText;
                                            menu_intercambio(1);
										 }
									 }
								  };
	httpConteudoInformativo.xmlhttp.send(null);
}

function menu_intercambio(id)
{
  /* Recupera Valor para Controle Menus */
  document.getElementById('valorFlash').value = id;
  /*Fim*/
  
  escondeFrameIntercambio('iintercambiocentro');
  mostraTextoMenuIntroducao('intercambioTextoMenuIntroducao','1');
  
  if (id==1)
    mostraCategoriaDica('descricaosub',4);
  else
	if (id==2)
      mostraCategoriaDica('descricaosub',13);
    else
	  if (id==3)
        mostraCategoriaDica('descricaosub',14);
      else
	    if (id==4)
          mostraCategoriaDica('descricaosub',15);
        else
          if (id==5)
            mostraCategoriaDica('descricaosub',3);
          else
		    if (id==6)
              mostraFrameIntercambio('iintercambiocentro','ma_intercambio/PesqInstituicaoCurso.php?s_idnivel=9');
		    else
		      {
		        var divcategorias = document.getElementById('categorias');
			    divcategorias.innerHTML='';
		  	    var divdescricaosub = document.getElementById('descricaosub');
			    divdescricaosub.innerHTML='';
			    var divdicas = document.getElementById('dicas');
			    divdicas.innerHTML='';
			    var divdescricao = document.getElementById('descricao');
			    divdescricao.innerHTML='';
		      }
}

function mostraTextoMenuIntroducao(iddiv,op){
  
    switch (op) {
	  case '1': var url = "ma_intercambio/IntercambioOquee.html?"; break;
	  case '2': var url = "ma_intercambio/IntercambioBeneficios.html?"; break;
	  case '3': var url = "ma_intercambio/IntercambioPorqueir.html?"; break;
	  default:  var url = "ma_intercambio/IntercambioOquee.html?";
    }
	
	var div = document.getElementById(iddiv);
	
	httpTextoMenuIntroducao = null;
	var httpTextoMenuIntroducao = new Http();
	httpTextoMenuIntroducao.xmlhttp.open("GET", url + "time=" + new Date(), true);
	httpTextoMenuIntroducao.xmlhttp.onreadystatechange = 
	                  function() {
									if(httpTextoMenuIntroducao.xmlhttp.readyState == 4){
										if(httpTextoMenuIntroducao.xmlhttp.status == 200){
											div.innerHTML = httpTextoMenuIntroducao.xmlhttp.responseText;
                                        }
									}
								 };
	httpTextoMenuIntroducao.xmlhttp.send(null);
   
}

function mostraFrameIntercambio(frame,url)
{
  // esconde a div
  var div = document.getElementById('categorias');
  div.style.display = "none";
  var divc = document.getElementById('conteudo');
  divc.style.display = "none";

  // mostra frame
  var auxframe = document.getElementById(frame);
  auxframe.src=url;
  auxframe.style.display = "";
}
function escondeFrameIntercambio(frame)
{
  //esconde frame
  var auxframe = document.getElementById(frame);
  auxframe.style.display = "none";

  //mostra div
  var div = document.getElementById('categorias');
  div.style.display = "";
  var divc = document.getElementById('conteudo');
  divc.style.display = "";
}
