
var req;
var pos;
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(pos).innerHTML = req.responseText;
			document.all.carregando.style.visibility = 'hidden';
			parent.document.body.style.cursor='default';
		} else {
			alert("Houve um problema ao obter os dados:\n" + req.statusText);
		}
	}
}



function div_carro(id, categoria){
	document.all.carregando.style.visibility = 'visible';
	parent.document.body.style.cursor='wait';
	pos = "div_carro"+id;
	loadXMLDoc("exibir_car.php?id="+id+"&categoria="+categoria);
}
function div_carroEshop(id,cor,cliente){

	document.all.carregando.style.visibility = 'visible';

	pos = "div_carro"+id;
	loadXMLDoc("exibirshop_car.php?id="+id+"&cor_1="+cor+"&cliente="+cliente);
}

function mostra_carro(id){
document.all.carregando.style.visibility = 'visible';
pos = "div_carro";
loadXMLDoc("exibircarcentro.php?id="+id);
}
function mostrausado(id){
document.all.carregando.style.visibility = 'visible';
pos = "div_usado";
loadXMLDoc("divusado.php?id="+id);
}


function fecha_div_carro(id){
	document.all.carregando.style.visibility = 'visible';
	parent.document.body.style.cursor='wait';
	pos = "div_carro"+id;
	document.getElemntById(pos).style.display='hidden';
	loadXMLDoc("inc/empty.php");
}

