﻿
idDoc = "";

function abreLight() {
    document.getElementById('light').style.display = 'block';
    document.getElementById('fade').style.display = 'block';


    var fundo1 = document.getElementById("fade");
    fundo1.style.top = "0px";
    fundo1.style.left = "0px";
    fundo1.style.width = document.body.clientWidth;
    fundo1.style.height = document.body.clientHeight;
    fundo1.style.display = "block";


    LeftPosition = (screen.width) ? (screen.width - 500) / 2 : 0;
    TopPosition = (screen.height) ? (screen.height - 550) / 2 : 0;


    var fundo2 = document.getElementById("light");
    fundo2.style.top = TopPosition + "px";
    fundo2.style.left = LeftPosition + "px";
    fundo2.style.visibility = "visible";


}

function fechaLight() {
    document.getElementById('light').style.display = 'none';
    document.getElementById('fade').style.display = 'none';
}



//xml = "";


//Função utilizada pelo repositório de arquivos
function link(id) {

    void(0);


}

function abreLinkCalendario(item) {

        //Para o calendário cenofisco
      id = item.innerHTML;

 
    //limpa("ucHomeBoxNewsletterMeio");
    //carregando("boxNoticiasLista");

    var oHTTPRequest = createXMLHTTP();
    var el = document.getElementById("lightConteudo");
    var pagina = Array(1);

    pagina[1] = "Links/Documento/ExibeDocumento.ashx?idDoc=" + idDoc + "&seqLink=" + id;

    oHTTPRequest.open("get", pagina[1], true);
    oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    if (oHTTPRequest.readyState != 4) {
        void (0);
    }

    oHTTPRequest.onreadystatechange = function () {
        if (oHTTPRequest.readyState == 4) {
            // limpa("ucHomeBoxNewsletterMeio");
            try {
                boxNoticiasResultado = oHTTPRequest.responseText;

                if (boxNoticiasResultado.indexOf("<html>") < 0) {
                    el.innerHTML = boxNoticiasResultado;
                    abreLight();
                } else {
                    el.innerHTML = "Tente novamente mais tarde!";
                    abreLight();
                }
            } catch (ex) { //limpa("ucHomeBoxNewsletterMeio"); 
                alert("erro");
            }
        }
    }
    oHTTPRequest.send("");

   
}
