function criaAJAX(){
	var xmlhttp=false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
		xmlhttp = false;
		}
	}
	if (!xmlhttp) xmlhttp = new XMLHttpRequest();
	return xmlhttp;
}

function XMLParser (){
	var xmlDoc,ie;

	this.create = function (){
		var pser = null;
		if (window.ActiveXObject){
			pser = new ActiveXObject("Microsoft.XMLDOM");
			pser.async = false;
			this.ie = true;
		}else if (document.implementation && document.implementation.createDocument){
			pser = document.implementation.createDocument("","",null);
			this.ie = false;
		}
		return pser;
	}
	
	this.load = function (file){
		this.xmlDoc.load (file);
		if (this.ie)
			this.callback ();
		else
			this.xmlDoc.onload = this.callback;
	}
	
	this.xmlDoc = this.create ();
	
	this.callback = function (){
		alert("Funçao de callback não definida");
	};
}

//COMO RETORNAR O EVENT HANDLER???
function basicAJAX(page,data){
	var i,retorno,data_qtt=0;
	if(data!=undefined && data.length>0){
		data_qtt++;
		for(i=0;i<data.length;i++) if(data.substr(i,1)=='&') data_qtt++;
	}
	ajax.open("POST",page,true);
	ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajax.setRequestHeader("Content-length", data_qtt);
	ajax.onreadystatechange=function(){if(ajax.readyState==4)return(ajax.responseText);}
	ajax.send(data);
}

