﻿


function abresub1(cont) {
    //alert('Abre sub1-' + cont);
    document.getElementById('menusubseq' + cont).style.display = '';
    document.getElementById('+abresub1' + cont).style.display = 'none';
    document.getElementById('-abresub1' + cont).style.display = '';
}



function fechasub1(cont) {
    //alert('Fecha sub1-' + cont);
    document.getElementById('menusubseq' + cont).style.display = 'none';
    document.getElementById('+abresub1' + cont).style.display = '';
    document.getElementById('-abresub1' + cont).style.display = 'none';
}



function abresub2(cont,cont1) {
    //alert('Abre sub2-' + cont + '-' + cont1);
    document.getElementById('menusubseq' + cont+'-'+cont1).style.display = '';
    document.getElementById('+abresub1' + cont + '-' + cont1).style.display = 'none';
    document.getElementById('-abresub1' + cont + '-' + cont1).style.display = '';
}


function fechasub2(cont, cont1) {
    //alert('Abre sub2-' + cont + '-' + cont1);
    document.getElementById('menusubseq' + cont + '-' + cont1).style.display = 'none';
    document.getElementById('+abresub1' + cont + '-' + cont1).style.display = '';
    document.getElementById('-abresub1' + cont + '-' + cont1).style.display = 'none';
}


var detect = navigator.userAgent.toLowerCase();
var OS, browser, version, total, thestring;

//  alert(detect);


if (checkIt('konqueror')) {
    browser = "Konqueror";
    OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "IE"
else if (!checkIt('compatible')) {
    browser = "Firefox"
    version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS) {
    if (checkIt('linux')) OS = "Linux";
    else if (checkIt('x11')) OS = "Unix";
    else if (checkIt('mac')) OS = "Mac"
    else if (checkIt('win')) OS = "Windows"
    else OS = "an unknown operating system";
}

function checkIt(string) {
    place = detect.indexOf(string) + 1;
    thestring = string;
    return place;
}


//alert(browser+"-"+version);

if (browser == "IE" && version == "6") {

    alert("Por favor, atualise seu navegador para estes site funcionar corretamente");

}



function getPosicaoElemento(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 &&
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return { left: offsetLeft, top: offsetTop };
}




function getWidth() {
    return window.innerWidth ? window.innerWidth : /* For non-IE */
             document.documentElement ? document.documentElement.clientWidth : /* IE 6+ (Standards Compilant Mode) */
             document.body ? document.body.clientWidth : /* IE 4 Compatible */
             window.screen.width; /* Others (It is not browser window size, but screen size) */
}





function moveRelogio() {

    init();
  

    momentoAtual = new Date()
    hora = momentoAtual.getHours()
    minuto = momentoAtual.getMinutes()
    segundo = momentoAtual.getSeconds()

    horaImprimivel = hora + " : " + minuto + " : " + segundo


    if (segundo == 0 || segundo == 10 || segundo == 20 || segundo == 30 || segundo == 40 || segundo == 50) {

        if (segundo == 0) {
            segundo = 30;
        }

        if (segundo == 50) {
            segundo = 10;
        }

        abreimg(segundo / 10);

        mostraposicao(1);

        mostraposicao(2);

        mostraposicao(3);


        var valida = document.getElementById('validapg').value;

        if (valida == "home") {

            mostralateral(1);

            mostralateral(2);

            mostrabannertop();

        }
              

    }

    setTimeout("moveRelogio()", 1000)
}



function playvideo(obj) {

    tot = document.getElementById('totvideos').value;
    cont = 0;

    while (cont < tot) {
        cont = cont + 1;
        document.getElementById('playvideo' + cont).style.display = 'none';
        document.getElementById('resumodestaque' + cont).style.display = 'none';
        document.getElementById('datadestaque' + cont).style.display = 'none';
    }

    document.getElementById('resumodestaque' + obj).style.display = '';
    document.getElementById('imgplayvideo').style.display = 'none';
    document.getElementById('playvideo' + obj).style.display = '';
    document.getElementById('datadestaque' + obj).style.display = '';


}

        

function mostrabannertop() {

    var totaldestpos1 = document.getElementById('totbannertop').value;
    var destpos1 = document.getElementById('bannertopatu').value;

    cont = 1;
    while (cont <= parseInt(totaldestpos1)) {

        document.getElementById('bannertop' + cont).style.display = 'none';
        cont++;
    }

    var destposatu1 = parseInt(destpos1) + 1;

    if (destposatu1 > parseInt(totaldestpos1)) {
        destposatu1 = 1;
    }

    document.getElementById('bannertop' + destposatu1).style.display = '';
    document.getElementById('bannertopatu' ).value = destposatu1;
}


function mostraposicao(posicao) {

    var totaldestpos1 = document.getElementById('totdestlatp'+posicao).value;
    var destpos1 = document.getElementById('destlatp' + posicao).value;

    cont = 1;
    while (cont <= parseInt(totaldestpos1)) {

        document.getElementById('destlatpos'+posicao+'-' + cont).style.display = 'none';
        cont++;
    }

    var destposatu1 = parseInt(destpos1) + 1;

    if (destposatu1 > parseInt(totaldestpos1)) {
        destposatu1 = 1;
    }

    document.getElementById('destlatpos' + posicao + '-' + destposatu1).style.display = '';
    document.getElementById('destlatp' + posicao + '').value = destposatu1;
}



function mostralateral(posicao) {

    //alert('entrou');

    var totaldestpos1 = document.getElementById('totlateral' + posicao).value;
    var destpos1 = document.getElementById('lateralatu' + posicao).value;

    cont = 1;
    while (cont <= parseInt(totaldestpos1)) {

        document.getElementById('lateralpos' + posicao + '-' + cont).style.display = 'none';
        cont++;
    }

    var destposatu1 = parseInt(destpos1) + 1;

    if (destposatu1 > parseInt(totaldestpos1)) {
        destposatu1 = 1;
    }

    document.getElementById('lateralpos' + posicao + '-' + destposatu1).style.display = '';
    document.getElementById('lateralatu' + posicao + '').value = destposatu1;
}


function abreobra() {
    document.getElementById('conteudobra').style.display = '';
    document.getElementById('setaobbx').style.display = '';
    document.getElementById('setaobld').style.display = 'none';
}



function fechaobra() {
    document.getElementById('conteudobra').style.display = 'none';
    document.getElementById('setaobbx').style.display = 'none';
    document.getElementById('setaobld').style.display = '';
}



function abrecid() {
    document.getElementById('conteudocid').style.display = '';
    document.getElementById('setacidbx').style.display = '';
    document.getElementById('setacidld').style.display = 'none';
}



function fechacid() {
    document.getElementById('conteudocid').style.display = 'none';
    document.getElementById('setacidbx').style.display = 'none';
    document.getElementById('setacidld').style.display = '';
}






function abreservcid() {
    document.getElementById('conteudoservcid').style.display = '';
    document.getElementById('setaservcidbx').style.display = '';
    document.getElementById('setaservcidld').style.display = 'none';
}



function fechaservcid() {
    document.getElementById('conteudoservcid').style.display = 'none';
    document.getElementById('setaservcidbx').style.display = 'none';
    document.getElementById('setaservcidld').style.display = '';
}




function abreservemp() {
    document.getElementById('conteudoservemp').style.display = '';
    document.getElementById('setaservempbx').style.display = '';
    document.getElementById('setaservempld').style.display = 'none';
}



function fechaservemp() {
    document.getElementById('conteudoservemp').style.display = 'none';
    document.getElementById('setaservempbx').style.display = 'none';
    document.getElementById('setaservempld').style.display = '';
}



function fechasec() {
    document.getElementById('conteudosec').style.display = 'none';
    document.getElementById('setabx').style.display = 'none';
    document.getElementById('setald').style.display = '';
}



function abresec() {
    document.getElementById('conteudosec').style.display = '';
    document.getElementById('setabx').style.display = '';
    document.getElementById('setald').style.display = 'none';
}


function abreimg(obj) {

    cont = 0;

    var maximo = document.getElementById("numpainel").value;

   // alert(maximo);


    while (cont < parseInt(maximo)) {
        cont = cont + 1;
        document.getElementById("divfundo" + cont).style.marginLeft = '20px';
        document.getElementById('divfundo' + cont).style.background = 'url(imagens/barras_banner_topo%201.png)';
        document.getElementById("divfundo" + cont).style.width = '252px';
        document.getElementById("divmarg" + cont).style.marginLeft = '20px';
        document.getElementById('imgbannertopo' + cont).style.display = 'none';
    }

    // alert('vai mudar');

    document.getElementById('imgbannertopo' + obj).style.display = '';
    document.getElementById("divfundo" + obj).style.width = '270px';
    document.getElementById("divfundo" + obj).style.marginLeft = '1px';
    document.getElementById('divfundo' + obj).style.background = 'url(imagens/barras_banner_topo.png)';
    document.getElementById("divmarg" + obj).style.marginLeft = '41px';


}

var newwindow;

function imprimirnot(idnot) {
    newwindow = window.open('imprimirnot.aspx?idnot=' + idnot, 'Impressão', 'toolbar=no,location=no,status=no,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}


function imprimircidade(idnot) {
    newwindow = window.open('imprimircidade.aspx?idnot=' + idnot, 'Impressão', 'toolbar=no,location=no,status=no,scrollbars=1,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}


function imprimirlistaagenda(idnot) {
    newwindow = window.open('imprimiragenda.aspx?idnot=' + idnot, 'Impressão', 'toolbar=no,location=no,status=no,scrollbars=1,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}

function imprimirconteudoagenda(idnot) {
    newwindow = window.open('imprimircagenda.aspx?idnot=' + idnot, 'Impressão', 'toolbar=no,location=no,status=no,scrollbars=1,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}


function imprimirlistanot(idnot) {
    newwindow = window.open('imprimirlistanot.aspx?idnot=' + idnot, 'Impressão', 'toolbar=no,location=no,status=no,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}

function imprimirlistanotsec(idsec) {
    newwindow = window.open('imprimirlistanotsec.aspx?idsec=' + idsec, 'Impressão', 'toolbar=no,location=no,status=no,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}


function imprimirimprensa() {
    newwindow = window.open('imprimirimprensa.aspx?' , 'Impressão', 'toolbar=no,location=no,status=no,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}


function imprimirlegislacao() {
    newwindow = window.open('imprimirlegislacao.aspx?' , 'Impressão', 'toolbar=no,location=no,status=no,menubar=no,width=600,height=800');
    if (window.focus) { newwindow.focus() }
}



function enviarnot(idnot) {

    document.getElementById('divenvemail').style.display = '';
   // alert('Preencha as informações para o envio do email');

}


function almnot(idnot) {

  //  alert('clicou almentar notícia id=' + idnot);
    document.getElementById('resumonotid').style.fontSize = '24px';

}


function dimnot(idnot) {

   //  alert('clicou diminuir notícia id=' + idnot);
    document.getElementById('resumonotid').style.fontSize = '10px';

}




function almlista(idnot) {

    //alert('clicou almentar notícia id=' + idnot);

        cont = 0;

        while (cont < 9) {

            cont++;

            document.getElementById('titulonotid'+cont).style.fontSize = '18px';
            document.getElementById('resumonotid'+cont).style.fontSize = '16px';

        }

    }



    function almagenda() {

     //   alert('clicou almentar notícia id=');

        cont = 0;
          while (cont < 9) {

            cont++;


            document.getElementById('tituloag' + cont).style.fontSize = '18px';
            document.getElementById('localag' + cont).style.fontSize = '16px';
            document.getElementById('dataag' + cont).style.fontSize = '16px';
            document.getElementById('resumoag' + cont).style.fontSize = '16px';

         //   document.getElementById('resumonotid' + cont).style.fontSize = '16px';

        }

    }


    function dimagenda() {

       // alert('clicou almentar notícia id=');

        cont = 0;
        while (cont < 9) {

            cont++;


            document.getElementById('tituloag' + cont).style.fontSize = '14px';
            document.getElementById('localag' + cont).style.fontSize = '12px';
            document.getElementById('dataag' + cont).style.fontSize = '12px';
            document.getElementById('resumoag' + cont).style.fontSize = '12px';

            //   document.getElementById('resumonotid' + cont).style.fontSize = '16px';

        }

    }



    function almCagenda() {

        //   alert('clicou almentar notícia id=');

        cont = 0;
        while (cont < 9) {

            cont++;


            document.getElementById('tituloag' + cont).style.fontSize = '24px';
            document.getElementById('localag' + cont).style.fontSize = '22px';
            document.getElementById('dataag' + cont).style.fontSize = '20px';
            document.getElementById('resumoag' + cont).style.fontSize = '18px';



        }

    }


    function dimCagenda() {

        // alert('clicou almentar notícia id=');

        cont = 0;
        while (cont < 9) {

            cont++;


            document.getElementById('tituloag' + cont).style.fontSize = '16px';
            document.getElementById('localag' + cont).style.fontSize = '12px';
            document.getElementById('dataag' + cont).style.fontSize = '12px';
            document.getElementById('resumoag' + cont).style.fontSize = '12px';

            //   document.getElementById('resumonotid' + cont).style.fontSize = '16px';

        }

    }


function dimlista(idnot) {

    // alert('clicou diminuir notícia id=' + idnot);

        cont = 0;

        while (cont < 9) {
            cont++;

            document.getElementById('titulonotid' + cont).style.fontSize = '18px';
            document.getElementById('resumonotid' + cont).style.fontSize = '10px';

        }

}
