
function ImagensThumbsCarregaImagem(imagem, legenda) {
    var posicaoScroll;

    if (navigator.appName == "Microsoft Internet Explorer")
        posicaoScroll = document.documentElement.scrollTop;
    else
        posicaoScroll = window.pageYOffset;

    imagem = "<img onload=\"window.scrollTo(0, " + posicaoScroll + ");\" src=" + imagem + " />" + legenda;
    document.getElementById('ImagensThumbsDivImagens').innerHTML = imagem;
}

function ImagensThumbs2ColunasCarregaImagem(imagem, legenda, posicao) {
    var posicaoScroll;

    if (navigator.appName == "Microsoft Internet Explorer")
        posicaoScroll = document.documentElement.scrollTop;
    else
        posicaoScroll = window.pageYOffset;

    imagem = "<img onload=\"window.scrollTo(0, " + posicaoScroll + ");\" src=" + imagem + " />" + legenda;
    document.getElementById('ImagensThumbs2ColunasDivImagens').innerHTML = imagem;
}

function CarregarBannerFlash(w, h, banners, admin) {
    if (admin == "admin") 
        dir = "../";
    else 
        dir = "";
    
    AC_FL_RunContent("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0",
					  "width", w, "height", h,
					  "src",
					  dir + "Imagens/Banners?Banners=" + banners,
					  "quality", "high", "pluginspage", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash",
					  "wmode", "transparent",
					  "movie",
					  dir + "Imagens/Banners?Banners=" + banners);
}

function CarregarFlash(url, w, h) {
    AC_FL_RunContent("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0",
					  "width", w, "height", h,
					  "src",
					  url,
					  "quality", "high", "pluginspage", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash",
					  "wmode", "transparent",
					  "movie",
					  url);
}

function CentralizarDiv(div) {
    var ps = new PageSize();
    w = ps.windowWidth;
    h = ps.windowHeight;

    if (navigator.appName == "Microsoft Internet Explorer")
        scrollTop = document.documentElement.scrollTop;
    else
        scrollTop = window.pageYOffset;

    divW = document.getElementById(div).offsetWidth;
    divH = document.getElementById(div).offsetHeight;

    document.getElementById(div).style.left = ((w / 2) - (divW / 2)) + "px";
    document.getElementById(div).style.top = (((h / 2) - (divH / 2)) + scrollTop) + "px";
}


function AbrirDivAlert(texto) {
    var ps = new PageSize();

    document.getElementById("divAlertModal").style.display = "block";
    document.getElementById("divAlertModal").style.width = "100%";
    document.getElementById("divAlertModal").style.height = ps.pageHeight + 10 + "px";
    document.getElementById("divAlertTexto").innerHTML = texto;
    document.getElementById("divAlert").style.display = "block";
    CentralizarDiv("divAlert");
    setTimeout("document.getElementById('divAlertOkLink').focus()", 300);
}

function FecharDivAlert() {
    document.getElementById("divAlertModal").style.display = "none";
    document.getElementById("divAlert").style.display = "none";
}

function FecharDivAlertKey(e, e2) {
    var key = (e) ? e : e2; 
    if (key.keyCode == 27) {
        document.getElementById("divAlertModal").style.display = "none";
        document.getElementById("divAlert").style.display = "none";
    }
}

function PageSize() {
    this.windowWidth = 0;
    this.windowHeight = 0;
    this.xScroll = 0;
    this.yScroll = 0;
    this.pageHeight = 0;

    if (window.innerHeight && window.scrollMaxY) {

        this.yScroll = window.innerHeight + window.scrollMaxY;
    }
    else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        this.xScroll = document.body.scrollWidth;
        this.yScroll = document.body.scrollHeight;
    }
    else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        this.xScroll = document.body.offsetWidth;
        this.yScroll = document.body.offsetHeight;
    }

    if (self.innerHeight) {	// all except Explorer
        this.windowWidth = self.innerWidth;
        this.windowHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        this.windowWidth = document.documentElement.clientWidth;
        this.windowHeight = document.documentElement.clientHeight;
    }
    else if (document.body) { // other Explorers
        this.windowWidth = document.body.clientWidth;
        this.windowHeight = document.body.clientHeight;
    }
    // for small pages with total height less then height of the viewport
    if (this.yScroll < this.windowHeight) {
        this.pageHeight = this.windowHeight;
    }
    else {
        this.pageHeight = this.yScroll;
    }
}

function SubmitWebmail(e) {
    var key = (e) ? e : window.event;
    if (key.keyCode == 13) {
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$main$ucHome1$WebmailImagem", "", false, "", "http://webmail.cisnnet.com.br/src/redirect.php", false, true));
        key.cancelBubble = true;
        alert("Redirecionamento para o site do WebMail");
    }
}

function SubmitLoginCliente(e) {
    var key = (e) ? e : window.event;
    if (key.keyCode == 13) {
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$main$ucHome1$btnEntrarEnviar", "", false, "", "http://www.cisnet.com.br/LoginCliente.php?novo=s", false, true));
        key.cancelBubble = true;
        key.keyCode = 0;
    }
}
