/* JS***** Functions made by Daniel von Paraski */
/* ©2006 Daniel von Paraski */
/* http://vonparaski.com */


		/* -----
	 FUNÇÃO PARA O MENU:  MOSTRA QUANDO CLICADO UMA VEZ, OCULTA QUANDO CLICADO A SEGUNDA VEZ
	--------- */

function JSMostraeOculta(id_objeto,id_objeto_tmp){
       if (id_objeto.style.display == ''){
           id_objeto.style.display = 'none';
            if (id_objeto_tmp)
                id_objeto_tmp.style.display = '';
       }
       else{
           id_objeto.style.display = '';
            if (id_objeto_tmp)
                id_objeto_tmp.style.display = 'none';
       }
}

/* -----
	 FUNÇÃO PARA abrir janela para visualizar as imagens
	--------- */
function abre_janela(url)
{
	 var janela = window.open(url, "foto", "menubar=0,resizable=1,width=350,height=250");
	 janela.focus();
}
		/* -----
	 FUNÇÃO PARA O MENU:  MOSTRA QUANDO CLICADO UMA VEZ, OCULTA QUANDO CLICADO A SEGUNDA VEZ
	--------- */

function JSMostraeOcultaNovo(id_objeto)
{
	if (document.getElementById(id_objeto).style.display == ''){
		document.getElementById(id_objeto).style.display = 'none';
	}
	else{
		document.getElementById(id_objeto).style.display = '';
	}
}

   
   

		/* -----
	FUNÇÃO QUE FAZ A TROCA (VISUAL) DE UM OBJETO NA TELA
	CASO ID_STATUS SEJA UM, O OBJETO ANTERIOR NÃO SERÁ RETIRADO DA TELA
	--------- */
var tblAcao;
function JSSwapObject(id_tbl,id_status)
{
	//alert(id_tbl.id);
	if (tblAcao && id_status != 1)
		tblAcao.style.display = 'none';
	id_tbl.style.display = '';
	tblAcao = id_tbl;
}
    
    
    
    
		/* -----
	 FUNÇÃO PARA ABRIR UM LINK DE OBJETO - POR DENTRO DO PORTAL (OBJETO,NECESSARIAMENTE)
	--------- */

function JSJanelaAncoraObjeto(id_objeto,w,h,scroll,popup)
{
	if (popup) 	
		window.open("/index.php/content/view/"+id_objeto+".html","JanelaAncoraObjeto","menubar=no,width="+w+",heigth="+h+",statuds=no,scrollbars="+scroll);
	else
		window.open("/index.php/content/view/"+id_objeto+".html","JanelaAncoraObjeto");
	window.focus;
}

	
	
	
		/* -----
	FUNCÃO PARA ABRIR JANELAS DE LINKS EXTERNOS (i.e: http://google.com)
	--------- */

function JSJanelaAncoraURL(url,w,h,scroll,popup)
{
	if (popup)
			window.open(url,"JanelaAncoraURL","menubar=no,width="+w+",heigth="+h+",statuds=no,scrollbars="+scroll);
		else
			window.open(url,"JanelaAncora");
}

    
		/* -----
	innerHTML: ESCREVE QUALQUER TEXTO EM QUALQUER OBJETO
	i.e: JSWriteOnObject(id do objeto,'conteúdo de texto entre aspas',staus);
	status: define se o texto anterior será mantido ou sobreposto (1 - sobreposto, 0 - mantido)
	--------- */

function JSWriteOnObject(id_object,hol_text,tynSelect)
{	
	if (tynSelect)
		id_object.innerHTML = hol_text;
	else
		id_object.innerHTML += hol_text;
}
    

    
/* -----
Função para mudança de página dentro de uma mesma janela do Browser.
--------- */

function JSChangePage(CURL,AURL)
{	
	if (AURL)
		top.window.location.href = CURL+'?'+AURL;
	else
		top.window.location.href = CURL;
}
	
	

/* -----
Funcoes que trocam menu e banner
--------- */
/*
function JsTrocaMenu(menu)
{
	if(menu == 'pa')
	{
		document.getElementById('menuPlanoAcao').style.display = '';
		document.getElementById('menuAreasAtuacao').style.display = 'none';
		document.getElementById('abaBgEsq').className = 'titmenuFundoSelecionado titMenuVerticalContra bg_mercurio2';
		document.getElementById('abaBgDir').className = 'titmenuFundo puto';
	}
	else if(menu == 'aa')
	{
		document.getElementById('menuPlanoAcao').style.display = 'none';
		document.getElementById('menuAreasAtuacao').style.display = '';
		document.getElementById('abaBgEsq').className = 'titmenuFundo puto';
		document.getElementById('abaBgDir').className = 'titmenuFundoSelecionado titMenuVerticalContra bg_mercurio2';
	}

        url = "/html/objects/gravaSessaoMenu.php?navSess="+menu;
        rs = pegaConteudoGETSemRetorno(url);
}
*/
function JsTrocaMenu(menu)
{

        if(menu == 'pa')
                {
                        document.getElementById('menuPlanoAcao').style.display = '';
                        document.getElementById('menuAreasAtuacao').style.display = 'none';
                        document.getElementById('abaCantoEsq').className = 'abaCantoEsqAtivo';
                        document.getElementById('abaBgEsq').className = 'abaBgAtivo';
                        document.getElementById('abaDivisoria').className = 'abaDivisoriaDirEsqMenu';
                        document.getElementById('abaBgDir').className = 'abaBgDesab';
                        document.getElementById('abaCantoDir').className = 'abaCantoDirDesb';
                }
                else if(menu == 'aa')
                {
                        document.getElementById('menuPlanoAcao').style.display = 'none';
                        document.getElementById('menuAreasAtuacao').style.display = '';
                        document.getElementById('abaCantoEsq').className = 'abaCantoEsqDesb';
                        document.getElementById('abaBgEsq').className = 'abaBgDesab';
                        document.getElementById('abaDivisoria').className = 'abaDivisoriaEsqDirMenu';
                        document.getElementById('abaBgDir').className = 'abaBgAtivo';
                        document.getElementById('abaCantoDir').className = 'abaCantoDirAtivo';
                }

                url = "/html/objects/gravaSessaoMenu.php?navSess="+menu;
                rs = pegaConteudoGETSemRetorno(url);
}

function JsTrocaBanner(banner)
{
	if(banner == 'pe')
	{
		document.getElementById('emDestaques').style.display = '';
		document.getElementById('editais').style.display = 'none';
		document.getElementById('abaEsqDestaques').className = 'titmenuFundoSelecionado titMenuVerticalContra titBannerSeta bg_mercurio2';
		document.getElementById('abaDirDestaques').className = 'fundoTitBanner titBannerMais puto';
	}
	else if(banner == 'ee')
	{
		document.getElementById('emDestaques').style.display = 'none';
		document.getElementById('editais').style.display = '';
		document.getElementById('abaEsqDestaques').className = 'fundoTitBanner titBannerMais puto';
		document.getElementById('abaDirDestaques').className = 'titmenuFundoSelecionado titMenuVerticalContra titBannerSeta bg_mercurio2';
	}
}

function JsTrocaBannerB(banner)
{
	if(banner == 'pe')
	{
		document.getElementById('emDestaques').style.display = '';
		document.getElementById('editais').style.display = 'none';
		document.getElementById('fndct').style.display = 'none';
		document.getElementById('abaEsqDestaques').className = 'fundoAbaSelecionada titMenuVerticalContra titBannerSeta bg_mercurio2';
		document.getElementById('abaCenDestaques').className = 'fundoTitBanner titBannerMais puto';
		document.getElementById('abaDirDestaques').className = 'fundoTitBanner titBannerMais puto';
	}
	else if(banner == 'ee')
	{
		document.getElementById('editais').style.display = '';
		document.getElementById('emDestaques').style.display = 'none';
		document.getElementById('fndct').style.display = 'none';
		document.getElementById('abaCenDestaques').className = 'fundoAbaSelecionada titMenuVerticalContra titBannerSeta bg_mercurio2';
		document.getElementById('abaEsqDestaques').className = 'fundoTitBanner titBannerMais puto';
		document.getElementById('abaDirDestaques').className = 'fundoTitBanner titBannerMais puto';
	}
	else if(banner == 'fn')
	{
		document.getElementById('fndct').style.display = '';
		document.getElementById('editais').style.display = 'none';
		document.getElementById('emDestaques').style.display = 'none';
		document.getElementById('abaDirDestaques').className = 'fundoAbaSelecionada titMenuVerticalContra titBannerSeta bg_mercurio2';
		document.getElementById('abaEsqDestaques').className = 'fundoTitBanner titBannerMais puto';
		document.getElementById('abaCenDestaques').className = 'fundoTitBanner titBannerMais puto';
	}
}

function JsMostraOcultaMenu(acao)
{
	if(acao == "m")
	{
		document.getElementById('menuPlanoAcao2').style.display = '';
		document.getElementById('btnMostraOcultaMenu').innerHTML = '<span style="cursor:pointer;"><img src="/html/imagens/icn_ocultamenu.gif" alt="Ocultar menu" border="0" title="Ocultar menu" onclick="JsMostraOcultaMenu(\'o\');></span>';
	}
	else if(acao == "o")
	{
		document.getElementById('menuPlanoAcao2').style.display = 'none';
		document.getElementById('btnMostraOcultaMenu').innerHTML = '<span style="cursor:pointer;"><img src="/html/imagens/icn_mostramenu.gif" alt="Mostrar menu" border="0" title="Mostrar menu" onclick="JsMostraOcultaMenu(\'m\');"></span>';
	}		
}

	
/* FORM CHECK - CSS & REGEX & JAVACSCRIPT */
/* ©2006 Daniel von Paraski */
/* http://vonparaski.com */
/* Based on 'script form validation script' 
   available on http://www.htmlgoodies.com/ (C)
   on  February 2006  by Alf Magne Kalleland */

