var req;

function loadXMLDocOfertas(url,valor)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChangeOfertas;
        req.open("GET", url+'?of='+valor, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChangeOfertas;
            req.open("GET", url+'?of='+valor, true);
            req.send();
        }
    }
}

function processReqChangeOfertas()
{
    if (req.readyState == 4) {
        if (req.status == 200) {
            document.getElementById('ofertas').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}

function jsOfertas(valor)
{
	document.getElementById('topof1').style.background = "#FFFFFF";
	document.getElementById('topof2').style.background = "#FFFFFF";
	document.getElementById('topof3').style.background = "#FFFFFF";
	document.getElementById('topof'+valor).style.background = "#000033";
    loadXMLDocOfertas("js_ofertas.php",valor);
}