// Funções Globais

function menu_over(id,sub,msg)
{
    var tid = 'menu_'+id;
    var did = 'divisor_'+id;
    var sid = 'divisor_'+sub;
    document.getElementById(tid).style.backgroundImage = 'url(imagens/00000001_r2_c9.jpg)';
    document.getElementById(tid).className = 'fontblack';
    document.getElementById(did).innerHTML = "<img border='0' src='imagens/00000001_r2_c8.jpg' width='7' height='38'>";
    document.getElementById(sid).innerHTML = "<img border='0' src='imagens/00000001_r2_c12.jpg' width='7' height='38'>";
    document.getElementById('menu_aviso').innerHTML = "&nbsp;»&nbsp;"+msg+"<br>";
}

function menu_out(id,sub)
{
    var tid = 'menu_'+id;
    var did = 'divisor_'+id;
    var sid = 'divisor_'+sub;
    document.getElementById(tid).style.backgroundImage = 'url(imagens/00000001_r2_c19.jpg)';
    document.getElementById(tid).className = 'fontwhite';
    document.getElementById(did).innerHTML = "<img border='0' src='imagens/00000001_r2_c18.jpg' width='3' height='23'>";
    document.getElementById(sid).innerHTML = "<img border='0' src='imagens/00000001_r2_c18.jpg' width='3' height='23'>";
    document.getElementById('menu_aviso').innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>";
}

function conteudo_leiloes_over(id)
{
    document.getElementById('conteudo_leiloes_t_'+id).className = 't2';
    document.getElementById('conteudo_leiloes_b_'+id).className = 'b2';
    document.getElementById('conteudo_leiloes_l_'+id).className = 'l2';
    document.getElementById('conteudo_leiloes_r_'+id).className = 'r2';
    document.getElementById('conteudo_leiloes_bl_'+id).className = 'bl2';
    document.getElementById('conteudo_leiloes_br_'+id).className = 'br2';
    document.getElementById('conteudo_leiloes_tl_'+id).className = 'tl2';
    document.getElementById('conteudo_leiloes_tr_'+id).className = 'tr2';
}

function conteudo_leiloes_out(id)
{
    document.getElementById('conteudo_leiloes_t_'+id).className = 't';
    document.getElementById('conteudo_leiloes_b_'+id).className = 'b';
    document.getElementById('conteudo_leiloes_l_'+id).className = 'l';
    document.getElementById('conteudo_leiloes_r_'+id).className = 'r';
    document.getElementById('conteudo_leiloes_bl_'+id).className = 'bl';
    document.getElementById('conteudo_leiloes_br_'+id).className = 'br';
    document.getElementById('conteudo_leiloes_tl_'+id).className = 'tl';
    document.getElementById('conteudo_leiloes_tr_'+id).className = 'tr';
}

// Funções Ajax
function ajax() {};

ajax.prototype.iniciar = function() {

    try{
        this.xmlhttp = new XMLHttpRequest();
    }catch(ee){
        try{
            this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(E){
                this.xmlhttp = false;
            }
        }
    }
    return true;
}

ajax.prototype.ocupado = function() {
    estadoAtual = this.xmlhttp.readyState;
    return (estadoAtual && (estadoAtual < 4));
}

ajax.prototype.processa = function() {
    if (this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200) {
        return true;
    }
}

ajax.prototype.enviar = function(url, metodo, modo, iddiv) {
    if (!this.xmlhttp) {
        this.iniciar();
    }

    if (!this.ocupado()) {
        if(metodo == "GET") {
            this.xmlhttp.open("GET", url, modo);
            this.xmlhttp.send(null);
        } else {
            this.xmlhttp.open("POST", url, modo);
            this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            this.xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
            this.xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
            this.xmlhttp.setRequestHeader("Pragma", "no-cache");
            this.xmlhttp.send(url);
        }

		if (iddiv == "alert") {
			alert(this.xmlhttp.responseText);
		} else if (iddiv == "eval") {
			eval(this.xmlhttp.responseText);
		} else {
			document.getElementById(iddiv).innerHTML = this.xmlhttp.responseText;
		}

        if (this.processa) {
            return unescape(this.xmlhttp.responseText.replace(/\+/g," "));
        }
    }

    return false;
}