function confirmar(url,evento){
	if(confirm('Confirma '+evento)){
		window.location=url;
	}
}

function loadXMLDoc(url,dado,valor)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url+"?"+dado+"="+valor, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET",url+"?"+dado+"="+valor, true);
            req.send();
        }
    }
}


function processReqChange()
{
    // apenas quando o estado for "completado"
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // procura pela div id="atualiza" e insere o conteudo
            // retornado nela, como texto HTML
//			alert(_div);
            document.getElementById(_div).innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }

}

function atualiza(valor,dado,div,url)
{
    _div = div;

    loadXMLDoc(url,dado,valor);
}


function loadXMLDoc2(url,dado,valor)
{
    req2 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req2 = new XMLHttpRequest();
        req2.onreadystatechange = processReqChange2;
        req2.open("GET", url+"?"+dado+"="+valor, true);
        req2.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req2) {
            req2.onreadystatechange = processReqChange2;
            req2.open("GET",url+"?"+dado+"="+valor, true);
            req2.send();
        }
    }
}


function processReqChange2()
{
    // apenas quando o estado for "completado"
    if (req2.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req2.status == 200) {
            // procura pela div id="atualiza" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById(_div2).innerHTML = req2.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req2.statusText);
        }
    }

}

function atualiza2(valor,dado,div,url,tempo)
{
  wait(tempo);  
}

function refresh()
{
    window.location='index.php';
}


