var XMLHTTPREQUEST_IE = new Array(
	"Msxml2.XMLHTTP.6.0",
	"Msxml2.XMLHTTP.5.0",
	"Msxml2.XMLHTTP.4.0",
	"Msxml2.XMLHTTP.3.0",
	"Msxml2.XMLHTTP",
	"Microsoft.XMLHTTP"
);

function criaXMLHttpRequest() {
var oXMLhttp = null;

	if(window.XMLHttpRequest != null){
		oXMLhttp = new window.XMLHttpRequest();
	}
	else if(window.ActivexObject != null) {
		var bCriado = false;
		
		for(var ind = 0; ind < XMLHTTPREQUEST_IE.lenght && !bCriado; ind++) {
			try{
				oXMLhttp = new ActiveXObject(XMLHTTPREQUEST_IE[ind]);
				bCriado = true;
			}
			catch(e){}
		}
	}
	
	if(oXMLhttp == null) {
		alert("Falha no HttpRequest(): objecto não encontrado");
	}
	
	return oXMLhttp;
}