//================================== AJAX =========================================
// global flag
var isIE = false;

// global request and XML document objects
var req;

var tipo;

function loadXMLDoc(url) {
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		isIE = true;
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChange() {
	// only if req shows "loaded"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			 switch (tipo) {
			   case "mudaPagina": mudaPagina(); break;
			   case "listaProdutos": listaProdutos(); break;
			   case "listaTiposDownload": listaTiposDownload(); break;
			   case "mudaPaginaProd": mudaPaginaProd(); break;
			 }
		} else {
			alert("There was a problem retrieving the XML data:\n" +		req.statusText);
		}
	}
}
//===========================================================================
