// 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 mostraProfissao()
{
    var url = "m_conteudoinformativo/ConteudoInformativo.php?idmenuitem=2";
	var div = document.getElementById('ma_profissoesIntroducaoTexto');
	
	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;
                                            mostraProfissaoArea('ma_profissoesSubmenu',4);
										 }
									 }
								  };
	httpConteudoInformativo.xmlhttp.send(null);
}

function mostraProfissaoArea(iddiv,area){
    var url = "ma_profissoes/PesqProfissaoArea.php?=";

	if (iddiv=='')
	  {iddiv = 'ma_profissoesSubmenu';}

	var div = document.getElementById(iddiv);

	httpProfissaoArea = null;
	var httpProfissaoArea = new Http();
	httpProfissaoArea.xmlhttp.open("GET", url + "&idgrandearea=" + escape(area) + "&time=" + new Date() + "&grandearea_profissao_profPageSize=100", true);
	httpProfissaoArea.xmlhttp.onreadystatechange = function(){
									div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpProfissaoArea.xmlhttp.readyState == 4){
										if(httpProfissaoArea.xmlhttp.status == 200){
		                                    div.innerHTML = httpProfissaoArea.xmlhttp.responseText;
                                            
											if(document.getElementById("grandearea_profissao_profidsel")!=null){
											   var aux= document.getElementById("grandearea_profissao_profidsel").value;
											   if(escape(aux)!="")
											   {
												  menu_onclick('grandearea_profissao_profprofissao_nome_1','clear_menu');
											      mostraDetalhesProfissao('ma_profissoesConteudoTexto',aux,area);
                                               }
											   else
											   {
											     var divprof = document.getElementById('profissao');
												 divprof.innerHTML='';
												 var divcursos = document.getElementById('cursos');
												 divcursos.innerHTML='';
												 var divmapa = document.getElementById('mapa');
												 divmapa.innerHTML='';
												 var divinstituicoes = document.getElementById('instituicoes');
												 divinstituicoes.innerHTML='';
                                               }
											}
										 }
									 }
								  };
	httpProfissaoArea.xmlhttp.send(null);

}

function mostraDetalhesProfissao(iddiv,profissao,area){

    var url = "ma_profissoes/PesqProfissaoDetalhe.php?=";
	
	if (iddiv=='')
	  {iddiv = 'ma_profissoesConteudoTexto';}
	
	var div = document.getElementById(iddiv);
	
	
	httpDetalhesProfissao = null;
	var httpDetalhesProfissao = new Http();
	httpDetalhesProfissao.xmlhttp.open("GET", url + "&idprofissao=" + escape(profissao)+ "&idgrandearea="+escape(area) + "&time=" + new Date(),true);
	httpDetalhesProfissao.xmlhttp.onreadystatechange = function(){
		                            div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpDetalhesProfissao.xmlhttp.readyState == 4){
										if(httpDetalhesProfissao.xmlhttp.status == 200){
		                                    div.innerHTML = httpDetalhesProfissao.xmlhttp.responseText;
											if(document.getElementById('tituloDetalhe')!=null)
											  alteraCorDetalhes();
											  mostraCursosProfissao('ma_profissoesConteudoCursos',profissao);
										 }
									 }
								  };
	httpDetalhesProfissao.xmlhttp.send(null);
}


function mostraCursosProfissao(iddiv,profissao){
	var url = "ma_profissoes/PesqCursoProfissao.php?=";
	
	if (iddiv==''){div = 'ma_profissoesConteudoCursos';}
    else{div = iddiv;}
	
	var div = document.getElementById(iddiv);
	
	httpCursoProfissao = null;
	var httpCursoProfissao = new Http();
	httpCursoProfissao.xmlhttp.open("GET", url + "&idprofissao=" + escape(profissao) + "&time=" + new Date(),true);
	httpCursoProfissao.xmlhttp.onreadystatechange = function(){
		                            div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpCursoProfissao.xmlhttp.readyState == 4){
										if(httpCursoProfissao.xmlhttp.status == 200){
		                                    div.innerHTML = httpCursoProfissao.xmlhttp.responseText;
											if(document.getElementById("curso_cursoprofissaoidsel")!=null){
                                               
											   var aux= document.getElementById("curso_cursoprofissaoidsel").value;
											   if(escape(aux)!="")
											   {
                                                 mostraInstituicoesCursoAacademico('ma_profissoesConteudoCursosInstituicoes',aux,"","");
												 menu_onclick('curso_cursoprofissaonome_1','clear_menu_cursoprofissao');
											   }
											   else
											   {
											     mostraInstituicoesCursoAacademico('ma_profissoesConteudoCursosInstituicoes',0,"","");   
											     //var divmapa = document.getElementById('mapa');
												 //divmapa.innerHTML="";
												 //var divinstituicoes = document.getElementById('instituicoes');
												 //divinstituicoes.innerHTML="";
											   }
											     
											}
											
										 }
									 }
								  };
	httpCursoProfissao.xmlhttp.send(null);
	
}


function mostraInstituicoesCursoAacademico(iddiv,curso,urldir,idregiao)
{
	var url = "ma_profissoes/PesqInstituicaoCurso.php?";
	url = url + "s_idcurso="+curso;
	
	if (iddiv=='')
	  {iddiv = 'ma_profissoesConteudoCursosInstituicoes';}

	var div = document.getElementById(iddiv);
    div.src=url;	
 
}

function showHide (ID) {
    if (document.getElementById(ID).style.display == "none") {
               document.getElementById(ID).style.display= "";
    }
    else {
               document.getElementById(ID).style.display = "none";
    }
}

function show_hint(e,iddiv,idtexto)
{
	var hint   = document.getElementById(iddiv);
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	
	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	hint.innerHTML = document.getElementById(idtexto).innerHTML;
	hint.style.top = posy + "px";
	hint.style.left = posx + 30 + "px";
	hint.style.display = 'block';					
}

function hide_hint(iddiv)
{
	var hint   = document.getElementById(iddiv);
	hint.style.top = 0 + "px";
	hint.style.left = 0 + "px";
	hint.style.display = 'none';
}


function getHTTPObject()
{
	var xmlhttp;
	if(window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
	} else {
		if (window.ActiveXObject)
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			if (!xmlhttp)
			{ 
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		}
	}
	return xmlhttp;
}

/*
---------------------------------------------------------------------------------
  Mostra/Oculta Div -> Saiba Mais
---------------------------------------------------------------------------------
*/
function showHide (ID) {
    if (document.getElementById(ID).style.display == "none") {
               document.getElementById(ID).style.display= "";
    }
    else {
               document.getElementById(ID).style.display = "none";
    }
}


/*
---------------------------------------------------------------------------------
  Mostra barra Menu Profissoes
---------------------------------------------------------------------------------
*/
function menu_onclick(id,var_menu){
	
	var aux="menu_"+id;
	
	if(document.getElementById(var_menu).value==""){
		 
		 document.getElementById(var_menu).value=aux;
	     document.getElementById(document.getElementById(var_menu).value).src=imgProfissoes(document.getElementById('grandearea_profissao_profidgrandearea').value);
		 document.getElementById(document.getElementById(var_menu).value).style.display="";
		 
		}
	else{
		
		document.getElementById(document.getElementById(var_menu).value).style.display="none";
		document.getElementById(var_menu).value=aux;
	    document.getElementById(document.getElementById(var_menu).value).src=imgProfissoes(document.getElementById('grandearea_profissao_profidgrandearea').value);
		document.getElementById(document.getElementById(var_menu).value).style.display="";
		
		}
}



/*
---------------------------------------------------------------------------------
  Define Cor Conforme Area
---------------------------------------------------------------------------------
*/
function corArea(profissaoArea){
	
	var cor = "";
	
	switch (profissaoArea) {
		case '1': cor='#E8661B'; break;
		case '2': cor='#AB257C'; break;
		case '3': cor='#D52D2D'; break;
		case '4': cor='#25BF77'; break;
		case '5': cor='#B0F741'; break;
		case '6': cor='#E6BA23'; break;
		case '7': cor='#E0E34A'; break;
		case '8': cor='#7B337F'; break;
		case '9': cor='#3C4D92'; break;
		default:;
    }
	
	return cor;
	
}

/*
---------------------------------------------------------------------------------
  Atera Cor imagem Menu Profissoes
---------------------------------------------------------------------------------
*/
function imgProfissoes(profissaoArea){
	
	var img = "";
	
	switch (profissaoArea) {
		case '1': img='ma_profissoes/img/exatas_ponto.png'; break;
		case '2': img='ma_profissoes/img/engenharias_ponto.png'; break;
		case '3': img='ma_profissoes/img/biologicas_ponto.png'; break;
		case '4': img='ma_profissoes/img/saude_ponto.png'; break;
		case '5': img='ma_profissoes/img/agrarias_ponto.png'; break;
		case '6': img='ma_profissoes/img/humanas_ponto.png'; break;
		case '7': img='ma_profissoes/img/sociais_ponto.png'; break;
		case '8': img='ma_profissoes/img/linguistica_ponto.png'; break;
		case '9': img='ma_profissoes/img/multidisciplinar_ponto.png'; break;
		default: img = "";
    }
	
	return img;
	
}

/*
---------------------------------------------------------------------------------
  Altera Cor Profissões Detalhe
---------------------------------------------------------------------------------
*/
function alteraCorDetalhes(){
	
	/* Botões
	 -------------------
	  saude            4
      agrarias         5
      sociais          7
      humanas          6
      exatas           1
      biologicas       3
      engenharias      2
      linguistica      8
      multidisciplinar 9
     */
   
    /*Altera cor do Titulo*/
	var idgrandearea=document.getElementById('grandearea_profissao_profidgrandearea');
	if (idgrandearea==null)
	  idgrandearea=4;

    document.getElementById('tituloDetalhe').style.color = corArea(idgrandearea.value);
	
	/*Altera cor e Font do Saiba Mais*/
	document.getElementById('profissaosaiba_mais').style.color = corArea(idgrandearea.value);
	document.getElementById('profissaosaiba_mais').style.fontSize = "12px";
	document.getElementById('profissaosaiba_mais').style.fontWeight="bold";	

	document.getElementById('profissaosaiba_mais2').style.color = corArea(idgrandearea.value);
	document.getElementById('profissaosaiba_mais2').style.fontSize = "12px";
	document.getElementById('profissaosaiba_mais2').style.fontWeight="bold";	
	
	/*Altera cor da Duração e Valor*/
	document.getElementById('profissaoDuracaoTexto').style.color = corArea(idgrandearea.value);
	document.getElementById('profissaoSalarioTexto').style.color = corArea(idgrandearea.value);
	
	/*Altera imagem Duração e Valor*/
	switch (idgrandearea.value) {
		case '1': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio EXATAS.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ EXATAS.png';
				  break;
		case '2': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio ENGENHARIA.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ ENGENHARIA.png';
				  break;
		case '3': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio BIOLOGICAS.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ BIOLOGICAS.png';
				  break;
		case '4': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio SAUDE.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ SAUDE.png';
				  break;
		case '5': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio AGRARIAS.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ AGRARIAS.png';
				  break;
		case '6': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio HUMANAS.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ HUMANAS.png';
				  break;
		case '7': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio SOCIAIS.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ SOCIAIS.png';
				  break;
		case '8': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio LINGUISTICA.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ LINGUISTICA.png';
				  break;
		case '9': document.getElementById('profissaoDuracaoImage').src = 'ma_profissoes/img/relogio MULTI.png';
				  document.getElementById('profissaoSalarioImage').src = 'ma_profissoes/img/$ MULTI.png';
				  break;
		default:;
	}
}



