﻿var url;
var xmlHttp = null;

function showPag(str) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Desculpe. Seu navegador não suporta AJAX!");
        return;
    }

    if (str == "") str = "inicial.htm";
    window.location.hash = str;
    url = "pages/" + str;

    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
    if (xmlHttp.readyState == 1) {
        document.getElementById("conteudo").innerHTML = "<img src='loading.gif'>";
    }
    return url;
}

function stateChanged() {
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            pageTracker._trackPageview(url); //relatório de visitas por página
            document.getElementById("conteudo").innerHTML = xmlHttp.responseText;
        }
    }
}

function GetXmlHttpObject() {
    if (window.XMLHttpRequest) {
        a = new XMLHttpRequest();
    } //Objeto nativo (FF/Safari/Opera7.6+)
    else {
        try {
            a = new ActiveXObject("Msxml2.XMLHTTP"); //activeX (IE5.5+/MSXML2+)
        }
        catch (e) {
            try {
                a = new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)
            }
            catch (e) { /* O navegador não tem suporte */
                a = false;
            }
        }
    }
    return a;
}

function efeitoBotaoSupIn(botao) {
    document.getElementById(botao).className = "btnSup2";
}

function efeitoBotaoSupOut(botao) {
    document.getElementById(botao).className = "btnSup1";
}

function efeitoLinkIn(link) {
    document.getElementById(link).className = "comSublinhado";
}

function efeitoLinkOut(link) {
    document.getElementById(link).className = "semSublinhado";
}
