var req;
function loadXMLDoc(url){
 req = null;

if (window.XMLHttpRequest) {
 req = new XMLHttpRequest();
 req.onreadystatechange = processReqChange;
 req.open("GET", url, true); 
 req.send(null);

} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
}
if (req) {
 req.onreadystatechange = processReqChange;
 req.open("GET", url, true);
 req.send();
}
}
}


function processReqChange(){

if (req.readyState == 4) {
if (req.status == 200) {

document.getElementById("atualiza_tipo").innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}

function atualiza_tipo(valor){
loadXMLDoc("tipo.php?ID="+valor);
}

var req2;
function loadXMLDoc2(url2){
 req2 = null;

if (window.XMLHttpRequest) {
 req2 = new XMLHttpRequest();
 req2.onreadystatechange = processReqChange2;
 req2.open("GET", url2, true); 
 req2.send(null);

} else if (window.ActiveXObject) {
try {
req2 = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req2 = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req2 = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req2 = false;
}
}
}
}
if (req2) {
 req2.onreadystatechange = processReqChange2;
 req2.open("GET", url2, true);
 req2.send();
}
}
}


function processReqChange2(){

if (req2.readyState == 4) {
if (req2.status == 200) {

document.getElementById("atualiza_cidade").innerHTML = req2.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req2.statusText);
}
}
}

function atualiza_cidade(valor){
loadXMLDoc2("cidade.php?ID="+valor);
}


var req3;
function loadXMLDoc3(url3){
 req3 = null;

if (window.XMLHttpRequest) {
 req3 = new XMLHttpRequest();
 req3.onreadystatechange = processReqChange3;
 req3.open("GET", url3, true); 
 req3.send(null);

} else if (window.ActiveXObject) {
try {
req3 = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req3 = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req3 = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req3 = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req3 = false;
}
}
}
}
if (req3) {
 req3.onreadystatechange = processReqChange3;
 req3.open("GET", url3, true);
 req3.send();
}
}
}


function processReqChange3(){

if (req3.readyState == 4) {
if (req3.status == 200) {

document.getElementById("atualiza_bairro").innerHTML = req3.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req3.statusText);
}
}
}

function atualiza_bairro(valor){
loadXMLDoc3("bairro.php?ID="+valor);
}


var req4;
function loadXMLDoc4(url4){
 req4 = null;

if (window.XMLHttpRequest) {
 req4 = new XMLHttpRequest();
 req4.onreadystatechange = processReqChange4;
 req4.open("GET", url4, true); 
 req4.send(null);

} else if (window.ActiveXObject) {
try {
req4 = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req4 = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req4 = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req4 = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req4 = false;
}
}
}
}
if (req4) {
 req4.onreadystatechange = processReqChange4;
 req4.open("GET", url4, true);
 req4.send();
}
}
}


function processReqChange4(){

if (req4.readyState == 4) {
if (req4.status == 200) {

document.getElementById("atualiza_dormitorio").innerHTML = req4.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req4.statusText);
}
}
}

function atualiza_dormitorio(valor){
loadXMLDoc4("../Arquivos/dormitorio.php?ID="+valor);
}