appAjax = {
	xml: null,
	
	xmlhttp: function() {
		var Ajax;
		try {
			Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros.
		} catch(ee) {
			try {
				Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
			} catch(e) {
				try {
					Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
				} catch(e) {
					Ajax = false;
				}
			}
		}
		return Ajax;
	},
	
	request: function(method, url, content, func, assync) {
		if (assync == null) {
			assync = true;
		}
		
		if (content == '') {
			content = null;
		}
		
		this.xml = this.xmlhttp();
		
		if (func != null) {
			this.xml.onreadystatechange = func;
		}
		
		this.xml.open(method, url, assync);
		this.xml.send(content);
	},
	
	check_status: function() {
		if(this.xml.readyState == 4){
			return this.xml.status;
		}
	},
	
	get_response: function() {
		if(this.xml.getResponseHeader('Content-Type').indexOf('xml') != -1){
			return this.xml.responseXML.documentElement;
		} else {
			return this.xml.responseText;
		}
	}
}
