var divAuxJustNum = "";

//Funções de máscaras
function mascaraCPF(campo,evt){    // Esta eh a function que formata o cpf.
	
	campo = pegarE(campo);
	
	if (!isNum(evt))
		return false;
	
	var tecla =(window.event)?evt.keyCode:evt.which;
	if (isCaractereEspecial(tecla))
		return true;
	
	tecla = String.fromCharCode(tecla);
	
	var valor = campo.value;
	
	if (valor.length == 2){
		valor += tecla + ".";
		campo.value = valor;
		return false;
	}else if (valor.length == 6){
		valor += tecla + ".";
		campo.value = valor;
		return false;
	}else if (valor.length == 10){
		valor += tecla + "-";
		campo.value = valor;
		return false;
	}
	
	return true;
	
} 

function retirarMascaraCPF(cpf){
	
	cpf = cpf.replace(".","");
	cpf = cpf.replace(".","");
	cpf = cpf.replace("-","");
	
	return cpf;
	
}
function mascaraCNPJ(campo,evt){    // Esta eh a function que formata o cnpj.
	
	campo = pegarE(campo);
	
	if (!isNum(evt))
		return false;
	
	var tecla =(window.event)?evt.keyCode:evt.which;
	if (isCaractereEspecial(tecla))
		return true;
	
	tecla = String.fromCharCode(tecla);
	
	var valor = campo.value;
	
	if (valor.length == 1){
		valor += tecla + ".";
		campo.value = valor;
		return false;
	}else if (valor.length == 5){
		valor += tecla + ".";
		campo.value = valor;
		return false;
	}else if (valor.length == 9){
		valor += tecla + "/";
		campo.value = valor;
		return false;
	}else if (valor.length == 14){
		valor += tecla + "-";
		campo.value = valor;
		return false;
	}
	
	return true;
	
} 

function retirarMascaraCNPJ(cnpj){

	cnpj = cnpj.replace(".","");
	cnpj = cnpj.replace(".","");
	cnpj = cnpj.replace("/","");
	cnpj = cnpj.replace("-","");
	
	return cnpj;
	
}

function mascaraCep(campo,evt){
	campo = pegarE(campo);
	
	if (!isNum(evt))
		return false;
		
	var tecla =(window.event)?evt.keyCode:evt.which;
	if (isCaractereEspecial(tecla))
		return true;
	
	var mycep = '';
	mycep += campo.value;
	if (mycep.length == 2)
		mycep += '.';
	
	if (mycep.length == 6)
		mycep += '-';
	
	campo.value = mycep;
}
function retirarMascaraCep(cep){
	
	cep = cep.replace(".","");
	cep = cep.replace("-","");
	
	return cep;
	
}

function mascaraTel(campo,evt){
	
	campo = pegarE(campo);
	
	if (!isNum(evt))
		return false;
			
	var tecla =(window.event)?evt.keyCode:evt.which;
	if (isCaractereEspecial(tecla))
		return true;
	
	tecla = String.fromCharCode(tecla);
	
	var valor = campo.value;
	
	if (valor.length == 3){
		valor += tecla + "-";
		campo.value = valor;
		return false;
	}
	
	return true;
}

function retirarMascaraTel(tel){

	tel = tel.replace("(","");
	tel = tel.replace(")","");
	tel = tel.replace("-","");
	
	return tel;

}

function mascaraData(nomeCampo,evt){
	var campo = pegarE(nomeCampo);
	
	if (!isNum(evt))
		return false;
	
	var tecla =(window.event)?evt.keyCode:evt.which;
	if (isCaractereEspecial(tecla))
		return true;
	
	tecla = String.fromCharCode(tecla);
	
	var valor = campo.value;
	if (valor.length == 1 || valor.length == 4){
		valor += tecla + "/";
		campo.value=valor;
		return false;
	}
	
	return true;
}

function retirarMascaraData(data){

	data = data.replace("/","");
	data = data.replace("/","");
	
	return data;

}

//--------------------------------

//Verificações

function isNum( evt ){

	var tecla =(window.event)?evt.keyCode:evt.which;
	var caractere = String.fromCharCode(tecla);
	 
    if (isCaractereEspecial(tecla))
    	return true;
	
     var strValidos = "0123456789";
     if (strValidos.indexOf(caractere) == -1 )
         return false;
     return true;
} 

function isLetra(evt){

	var tecla =(window.event)?evt.keyCode:evt.which;
	var caractere = String.fromCharCode(tecla);
	
	if (isCaractereEspecial(tecla))
    	return true;
    	
    var strValidos = "abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVWXYZ";    
	if (strValidos.indexOf(caractere) == -1 )
         return false;
     return true;

}

function isLetraOuNumero(evt){

	var tecla =(window.event)?evt.keyCode:evt.which;
	var caractere = String.fromCharCode(tecla);
	
	var strValidos = "abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";    
	if (strValidos.indexOf(caractere) == -1 )
         return false;
     return true;
}


function isCaractereEspecial(tecla){
	
	if (tecla == 0 || tecla == 8)
		return true
			
	return false;
	
}


function isVazio(campo){
	campo = pegarE(campo);
	
	if (campo.value == null || campo.value == "")
		return true;
		
	return false;	
	
}

//--------------------------------

//Funções de ajuda

function pegarE(campo){
	return document.getElementById(campo);
}

function limparSelect(campo){
	campo = pegarE(campo);
	campo.options.length = 0;
}

function mostrarOcultarDiv(nomeDiv){
	var div = pegarE(nomeDiv);
	if (div.style.visibility == "hidden")
		showDiv(nomeDiv);
	else
		ocultarDiv(nomeDiv);	
}

function ocultarDiv(nomeDiv){
	var div = pegarE(nomeDiv);
	div.style.position = "absolute";
	div.style.visibility = "hidden";
}

function showDiv(nomeDiv){
	var div = pegarE(nomeDiv);
	div.style.position = "static";
	div.style.visibility = "visible";
}

function retirarNaoNumericos(valor){

	return valor.replace(/[^0-9]/gi, '');
	
}

function formataValor(campo) {
    campo.value = filtraCampo(campo);
    vr = campo.value;
    tam = vr.length;
     
    if (isNaN(vr)){
    	campo.value = retirarNaoNumericos(vr);
    	formataValor(campo);
    	return;
    }
   
    if (tam == 1) {
        campo.value = "0,0" + vr;
    }
    if (tam == 2) {
        campo.value = "0," + vr;
    }
    if (tam > 2 && tam <= 5) {
        campo.value = vr.substr(0, tam - 2) + "," + vr.substr(tam - 2, tam);
    }
    if (tam >= 6 && tam <= 8) {
        campo.value = vr.substr(0, tam - 5) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
    }
    if (tam >= 9 && tam <= 11) {
        campo.value = vr.substr(0, tam - 8) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
    }
    if (tam >= 12 && tam <= 14) {
        campo.value = vr.substr(0, tam - 11) + "." + vr.substr(tam - 11, 3) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
    }
    if (tam >= 15 && tam <= 18) {
        campo.value = vr.substr(0, tam - 14) + "." + vr.substr(tam - 14, 3) + "." + vr.substr(tam - 11, 3) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
    }
}

// limpa todos os caracteres especiais do campo solicitado
function filtraCampo(campo) {
    var s = "";
    var cp = "";
    vr = campo.value;
    
    if (vr.substr(0,2) == "0,")
    	vr = vr.substr(2);
    
    while (vr.substr(0,1) == "0")
    	vr = vr.substr(1);
    
    tam = vr.length;
    for (i = 0; i < tam; i++) {
        if (vr.substring(i, i + 1) != "/" &&
            vr.substring(i, i + 1) != "-" &&
            vr.substring(i, i + 1) != "." && vr.substring(i, i + 1) != ",") {
            s = s + vr.substring(i, i + 1);
        }
    }
    campo.value = s;
    return cp = campo.value;
}

function retirarMascaraMoeda(valor){

	valor = valor.replace(".","");
	valor = valor.replace(".","");
	valor = valor.replace(".","");
	valor = valor.replace(",","");
	
	return valor;
}

function Preload() {
	var args = arguments;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++) {
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
}

// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

function isEnter(event,botao){
	
	var tecla =(window.event)?event.keyCode:event.which;
	tecla == 13 ? pegarE(botao).onclick() : "";
	
}

var ultimo_campo_com_erro = "";
var ultima_secao_erro = "divAviso";
function tratarMensagemDeErro(entrada,divAvisoUsuario){

	if (pegarE(ultima_secao_erro)){
		pegarE(ultima_secao_erro).innerHTML = "";
        pegarE(ultima_secao_erro).style.display = "none";
    }
    
	var divAviso = "";
	
	if (divAvisoUsuario != undefined) //Se for explicitado a secao no codigo
		divAviso = pegarE(divAvisoUsuario);
	
	if (entrada[2] != undefined && entrada[2] != '') //Se vier a secao da classe erro
		divAviso = pegarE(entrada[2])
	
    divAviso.style.display = "";
    
	divAviso.innerHTML = entrada[0];
	ultima_secao_erro = divAviso.id;
	
	var campo_com_erro = "";
	if (pegarE(entrada[1])){
		campo_com_erro = pegarE(entrada[1]);
		campo_com_erro.style.backgroundColor = "lightblue";
		campo_com_erro.focus();
		ultimo_campo_com_erro = entrada[1];
		return;
	}
	
	if (entrada[1] == "sessao_expirou"){
		openZoomComObj(pegarE('secaoLoginUsuario'),150,350,"Sessão expirada!");
        pegarE('secaoLoginUsuario').style.display = "block";
        pegarE('iframeLoginUsuario').src = pegarE('iframeLoginUsuario').name;
	}

}

function getCidadesHTML(sigla_uf){

	limparSelect("id_cidade");
	var o = new Option("Recuperando...","");
	try{
    	pegarE("id_cidade").add(o,null); // standards compliant
    }catch(ex){
	    pegarE("id_cidade").add(o); // IE only
    }
	
	x_getCidadesHTML("id_cidade","","","",sigla_uf,tratarGetCidadesHTML);

}

function tratarGetCidadesHTML(entrada){

	if (typeof(entrada) == "string"){
		pegarE("regiaoCidades").innerHTML = entrada;
	}else{
		tratarMensagemDeErro(entrada,"divAviso");
	}
}


function addEvent(obj, evType, fn)
{
    if (obj.addEventListener)
    {
       obj.addEventListener(evType, fn, false);
       return true;
    }
    else if (obj.attachEvent)
    {
       var r = obj.attachEvent("on"+evType, fn);
       return r;
    } 
    else
    {
       return false;
    }
}

function adicionaEventoFoco(obj,novaAcao){

	var eventosAtuais = "" + obj.onfocus;
	
	var primeiraChave = eventosAtuais.indexOf("{");
	var segundaChave = eventosAtuais.lastIndexOf("}");

	var conteudoAtual = eventosAtuais.substr(primeiraChave +1,(segundaChave-primeiraChave)-1);
	var novoConteudo = conteudoAtual + novaAcao;

	obj.onfocus = function(){
	
		eval(novoConteudo);
	
	}
	
}

function adicionaEventoBlur(obj,novaAcao){

	var eventosAtuais = "" + obj.onblur;
	
	var primeiraChave = eventosAtuais.indexOf("{");
	var segundaChave = eventosAtuais.lastIndexOf("}");

	var conteudoAtual = eventosAtuais.substr(primeiraChave +1,(segundaChave-primeiraChave)-1);
	var novoConteudo = conteudoAtual + novaAcao;
		
	obj.onblur = function(){
		eval(novoConteudo);
	}
}

function ativarEfeitoInputs(){
	var objInputs = document.getElementsByTagName("input");
	for (i=0;i< objInputs.length;i++){
		
		var obj = objInputs[i];
		
		if (obj.type == 'text' || obj.type == 'password'){
			
			if (obj.className != "DatePicker"){
				
				
				adicionaEventoFoco(obj,"this.className='InputComFoco';");
				adicionaEventoBlur(obj,"this.className='Input';");
					
			}
		}
	}
}

function getStringComValoresDosCampos(campos){
	
	var tam_campos = campos.length;
	var camposString = "";
	
	for (i=0;i< tam_campos;i++)
		camposString += campos[i].value + ", SEPARADOR ,";
	
	camposString = camposString.substr(0,camposString.length - (", SEPARADOR ,".length));
	
	return camposString;

}

function mostrarCombosEscondidas(){

	//Mostra as combos escondidas
	var combos = document.getElementsByTagName("select");
	for (i=0;i< combos.length;i++)
		if (combos[i].name != "nao_desaparece")
			combos[i].style.visibility = "visible";

}

function esconderCombos(){

//Esconde todas as combos para nao dar problema...
	var combos = document.getElementsByTagName("select");
	for (i=0;i< combos.length;i++){
		if (combos[i].name != "nao_desaparece")
			combos[i].style.visibility="hidden";
	}
}

function limitarCaracteres(campo,idObjAlvo,maxQnt){

	var objAlvo = pegarE(idObjAlvo);
	var tamCampo = campo.value.length;
	
	if (tamCampo <= maxQnt){
		objAlvo.innerHTML = maxQnt - tamCampo;
		return true;
	}else{
		campo.value = campo.value.substr(0,maxQnt);	
	}
	
	return false;

}

function adicionarOptionNoSelect(id_select,texto_option){

	var o = new Option(texto_option,"");
	try{
    	pegarE(id_select).add(o,null); // standards compliant
    }catch(ex){
	    pegarE(id_select).add(o); // IE only
    }
}

//TRIM JAVASCRIPT

String.prototype.trim = function()
{
return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function getCampoSelecionadoPeloNome(nome_campo){

	var campos = document.getElementsByName(nome_campo);
	var tam = campos.length;
	
	for (var i=0;i < tam;i++){
		if (campos[i].checked){
			return campos[i].value;
		}
	}
	return "";
}

function isIE(){

	return (navigator.appName.indexOf("Netscape")>=0) ? false : true;

}

function strpos( haystack, needle, offset){
 
    var i = haystack.indexOf( needle, offset ); // retorna -1
    return i >= 0 ? i : false;
    
}

function substr( f_string, f_start, f_length ) {
 
    if(f_start < 0) {
        f_start += f_string.length;
    }
 
    if(f_length == undefined) {
        f_length = f_string.length;
    } else if(f_length < 0){
        f_length += f_string.length;
    } else {
        f_length += f_start;
    }
 
    if(f_length < f_start) {
        f_length = f_start;
    }
 
    return f_string.substring(f_start, f_length);
}

function upperCase(event) {
   var keynum;

   // IE
   if (window.event) {
      keynum = event.keyCode;
   }
   // Netscape/Firefox/Opera
   else if (event.which) {
      keynum = event.which;
   }

   if ((keynum >= 97 && keynum <= 122) || (keynum >= 224 && keynum <= 255)) {
      // converte de acordo com o valor decimal da tecla na tabela ascii   
      keynum = keynum - 32;
      
      // IE
      if (window.event) {
         window.event.keyCode = keynum;
      }
      // firefox e outros que usam o Gecko
      else if (event.which) {
         var newEvent = document.createEvent("KeyEvents");
         newEvent.initKeyEvent("keypress", true, true, document.defaultView,
                  event.ctrlKey, event.altKey, event.shiftKey,
                  event.metaKey, 0, keynum);
         event.preventDefault();
         event.target.dispatchEvent(newEvent);
      }
   }
   
   return true;
}

function lower(ustr)
{

	var str=ustr.value;
	ustr.value=str.toLowerCase();
}



function sair() {

    document.location.href= 'index.php';

}

function mostraEsconde(idObjeto){
	objeto = document.getElementById(idObjeto); 
	if(objeto.style.display == '')
		objeto.style.display = 'none';
	else
		objeto.style.display = '';
		
}

function avisoRapidoGeral(secao,valor){

    if (valor != "")
        pegarE(secao).style.display = "";        
    else
        pegarE(secao).style.display = "none";
    
    pegarE(secao).innerHTML = valor;

}

function mostrarDivDetalheClasse(tr,linkEstilo){
	
	document.getElementById('secaoDetalhamentoClasse').style.display = 'none';
	document.getElementById('secaoJusticaAbertaClasse').style.display = 'none';
	document.getElementById('secaoJusticaNumerosClasse').style.display = 'none';
	document.getElementById('secaoTemporariedadeClasse').style.display = 'none';
	
	document.getElementById(tr).style.display = 'block';
	
	document.getElementById('linkDetalheClasse').className  = '';
	document.getElementById('linkJustAbertaClasse').className  = '';
	document.getElementById('linkJustNumeroClasse').className  = '';
	document.getElementById('linkTempClasse').className  = '';
	
	document.getElementById(linkEstilo).className  = 'ativo';

	/*
	var arvore = getInstanciaArvoreById('arvoreInterna');
    var seqItem = arvore.elementoSelecionado;
	
    if(seqItem != ""){
    	
    	document.getElementById(tr+'Item').innerHTML = "<span class='alerta1'>Carregando... <img src='imagens/loading2.gif'></span>";
    	
    	
	    switch (tr) {
			case "secaoJusticaAbertaClasse":
				x_getJustAbertaItem(seqItem, tipoItem,
									tratarCarregarJustAberta);
				break
			case "secaoJusticaNumerosClasse":
				x_getJustNumeroItem(seqItem, tipoItem,
								    tratarCarregarJustNumero);
				break
			case "secaoTemporariedadeClasse":
				x_getJustAbertaItem(seqItem, tipoItem,
								    tratarCarregarJustAberta)
				break
			default:
				return false
	    }
    }
    */	
    

}

function mostrarDivDetalheAssunto(tr,linkEstilo){
	
	document.getElementById('secaoDetalhamentoAssunto').style.display = 'none';
	document.getElementById('secaoJusticaAbertaAssunto').style.display = 'none';
	document.getElementById('secaoTemporariedadeAssunto').style.display = 'none';
	
	document.getElementById(tr).style.display = 'block';
	
	document.getElementById('linkDetalheAssunto').className  = '';
	document.getElementById('linkJustAbertaAssunto').className  = '';
	document.getElementById('linkTempAssunto').className  = '';
	
	document.getElementById(linkEstilo).className  = 'ativo';

}

function mostrarDivDetalheMovimento(tr,linkEstilo){
	
	document.getElementById('secaoDetalhamentoMovimento').style.display = 'none';
	document.getElementById('secaoJusticaAbertaMovimento').style.display = 'none';
	document.getElementById('secaoJustNumerosMovimento').style.display = 'none';
	document.getElementById('secaoTemporariedadeMovimento').style.display = 'none';
	
	document.getElementById(tr).style.display = 'block';
	
	document.getElementById('linkDetalheMovimento').className  = '';
	document.getElementById('linkJustAbertaMovimento').className  = '';
	document.getElementById('linkJustNumeroMovimento').className  = '';
	document.getElementById('linkTempMovimento').className  = '';
	
	document.getElementById(linkEstilo).className  = 'ativo';

}

function abrirRelatorioTemp(){

	document.location.href = 'geradorExcel/gerar_xls_temporariedade.php';
}

function selecionarDivJustNumeros(div,paridade){
	
	document.getElementById('secaoNumJustEstadual'+paridade).style.display = 'none';
	document.getElementById('secaoNumJustFederal'+paridade).style.display = 'none';
	document.getElementById('secaoNumJustSuperior'+paridade).style.display = 'none';
	document.getElementById('secaoNumJustTrabalho'+paridade).style.display = 'none';
	
	document.getElementById(div).style.display = 'block';
	
}

function selecionarDivJustNumerosAbas(valor){
	
	var campo = document.getElementById(valor).style.display;
	
	if(campo == 'block')
		document.getElementById(valor).style.display = 'none';
	else
		document.getElementById(valor).style.display = 'block';
}

function verificarSelecionados(tipoJustica,valor){
	
	if(tipoJustica == "1"){
		
		for (i=1;i<=10;i++){
			
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else if(tipoJustica == "2"){
		
		for (i=11;i<=20;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
	
	}else if(tipoJustica == "3"){
		
		for (i=21;i<=30;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else if(tipoJustica == "4"){
		
		for (i=31;i<=40;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else if(tipoJustica == "5"){
		
		for (i=41;i<=50;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else if(tipoJustica == "6"){
		
		for (i=51;i<=60;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else if(tipoJustica == "7"){
		
		for (i=61;i<=70;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}else{
		
		for (i=71;i<=80;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
		pegarE("valor_temp_"+valor).checked = true;
		
	}
	
}

function desmarcarTemp(tipoJustica){
	
	if(tipoJustica == "1"){
		
		for (i=1;i<=10;i++){
			
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else if(tipoJustica == "2"){
		
		for (i=11;i<=20;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
	
	}else if(tipoJustica == "3"){
		
		for (i=21;i<=30;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else if(tipoJustica == "4"){
		
		for (i=31;i<=40;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else if(tipoJustica == "5"){
		
		for (i=41;i<=50;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else if(tipoJustica == "6"){
		
		for (i=51;i<=60;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else if(tipoJustica == "7"){
		
		for (i=61;i<=70;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}else{
		
		for (i=71;i<=80;i++){
			pegarE("valor_temp_"+i).checked = false;
		}
		
	}
}

function abrirVisualizarParametrizacao(seqPergunta){
	
	pegarE('parametrizacaoSgt').value = '';
	
	openZoomComObj(pegarE("divVisualizarParametrizacao"),150,400,"Informações da parametrização com as Tabelas Unificadas");
    pegarE("divVisualizarParametrizacao").style.display = "block";
	
	x_buscarParametrizaocaoSgt(seqPergunta,
					    	   tratarBuscarParametrizaocaoSgt);
	
}

function tratarBuscarParametrizaocaoSgt(entrada){
	
	pegarE('parametrizacaoSgt').value = entrada;
}

function verificarMarcacaoJustNum(seq, paridade, periodo){
	
	var campo = periodo+paridade+seq;
	
	var opcao = pegarE(campo).checked;
	
	if(periodo == 'DU')
		var periodoComparar = 'AN';
	else
		var periodoComparar = 'DU';
	
	var campoComparar = periodoComparar+paridade+seq;
	var opcaoComparar = pegarE(campoComparar).checked;
	
	if(opcaoComparar == true)
		pegarE(campoComparar).checked = false;
	
}

function getPerguntasJustNumero(alterar,paridade,modulo,aba,div){
	
	if(getInstanciaArvoreById('arvoreInterna')){
	
		var arvore = getInstanciaArvoreById('arvoreInterna');
		var seqItem = arvore.elementoSelecionado;
	}else{
		
		var seqItem = null;
		
	}
	
	x_getPerguntasJustNumero(alterar,paridade,modulo,aba,seqItem,
							 tratarGetPerguntasJustNumero);
	
	divAuxJustNum = div;
	
}

function tratarGetPerguntasJustNumero(entrada){
	
	$("#conteudoPergutas").remove("#conteudoPergutas");
	
	$("#"+divAuxJustNum).append("<div id='conteudoPergutas'></div>");
	$("#conteudoPergutas").html(entrada);
	
}

function selecionarDivJustAbertaAbas(valor,valor2){
	
	document.getElementById("secaoJusticaAbertaClasseItem").style.display = 'none';
	document.getElementById("secaoJusticaAberta2ClasseItem").style.display = 'none';
	
	document.getElementById("btnJustAberta1").className = 'botao';
	document.getElementById("btnJustAberta2").className = 'botao';

	document.getElementById(valor).style.display = 'block';
	document.getElementById(valor2).className = 'botaoAtivo';
}

function selecionarDivJustAbertaAbasFlg(valor, valor2){
	
	document.getElementById("tabelaJustAbertaMag").style.display = 'none';
	document.getElementById("tabelaJustAbertaSer").style.display = 'none';
	
	document.getElementById("btnJustAbertaMag1").className = 'botao';
	document.getElementById("btnJustAbertaSer1").className = 'botao';

	document.getElementById(valor).style.display = 'block';
	document.getElementById(valor2).className = 'botaoAtivo';
	
}
