function $(id){ return document.getElementById(id);}
function AjaxHandler (){
	this.loadingMsg;
	this.callback;
	if (window.XMLHttpRequest) {
		this.request = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		this.request = new ActiveXObject("Microsoft.XMLHTTP");
	}
}
AjaxHandler.prototype.post = function(params,url){
	//abre a requisição
	this.request.open("POST", url, true);
	//Define os headers
	this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=iso-8859-1");
	this.request.setRequestHeader("Content-length", params.length);
	this.request.setRequestHeader("Connection", "close");
	this.request.onreadystatechange = this.callback;
	if(this.request.readyState == 1 || this.request.readyState == 4){
		this.request.send(params);
	}	
}
AjaxHandler.prototype.get = function(url){
	this.request.open("GET", url, true);
	this.request.onreadystatechange = this.callback;
	if(this.request.readyState == 1 || this.request.readyState == 4){
		this.request.send(null);
	}
}
AjaxHandler.prototype.setCallback = function(cb){
	this.callback = cb;
}
AjaxHandler.prototype.setLoading = function(msg){
	this.loadingMsg = msg;
}

