var req;

function loadXMLDoc(url,valor,variavel,div)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function(){
						if (req.readyState == 4) {
							 document.getElementById(div).innerHTML = "Carregando";
							if (req.status == 200) {
								document.getElementById(div).innerHTML = req.responseText;
							} else {
								alert("Houve um problema ao obter os dados:\n" + req.statusText);
							}
						}
					}
		
        req.open("GET", url+'?'+variavel+'='+valor, true);
        req.send(null);
		
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function(){
					if (req.readyState == 4) {
						 document.getElementById(div).innerHTML = "Carregando";
						if (req.status == 200) {
							alert('div: '+div);
							document.getElementById(div).innerHTML = req.responseText;
						} else {
							alert("Houve um problema ao obter os dados:\n" + req.statusText);
						}
					}
				}
            req.open("GET", url+'?'+variavel+'='+valor, true);
            req.send();
        }
    }
	
}

function Atualiza(valor,url,variavel,div)
{
   
   loadXMLDoc(url,valor,variavel,div);
}


var req2;

function loadXMLDoc2(url,valor,variavel,variavel2,valor2,div)
{
    req2 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req2 = new XMLHttpRequest();
        req2.onreadystatechange = function(){
						if (req2.readyState == 4) {
							 document.getElementById(div).innerHTML = "Carregando";
							if (req2.status == 200) {
								document.getElementById(div).innerHTML = req2.responseText;
							} else {
								alert("Houve um problema ao obter os dados:\n" + req2.statusText);
							}
						}
					}
		
        req2.open("GET", url+'?'+variavel+'='+valor+'&'+variavel2+'='+valor2, true);
        req2.send(null);
		
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req2) {
            req2.onreadystatechange = function(){
					if (req2.readyState == 4) {
						 document.getElementById(div).innerHTML = "Carregando";
						if (req2.status == 200) {
							alert('div: '+div);
							document.getElementById(div).innerHTML = req2.responseText;
						} else {
							alert("Houve um problema ao obter os dados:\n" + req2.statusText);
						}
					}
				}
            req2.open("GET", url+'?'+variavel+'='+valor+'&'+variavel2+'='+valor2, true);
            req2.send();
        }
    }
	
}

function Atualiza2(valor,url,variavel,variavel2,valor2,div)
{
   
   loadXMLDoc2(url,valor,variavel,variavel2,valor2,div);
}



