
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").innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}



function atualiza(valor){
loadXMLDoc("ajax/subcats.php?ID="+valor);
}

// muda marca

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

if (window.XMLHttpRequest) {
 req2 = new XMLHttpRequest();
 req2.onreadystatechange = processReqChange2;
 req2.open("GET", url, 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", url, true);
 req2.send();
}
}
}


function processReqChange2(){

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

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


function mudamarca(valor){
loadXMLDoc2("ajax/marca.php?ID="+valor);
}

// seleciona modelo

function enviabusca(){
enviaofrm();
}
