function Ajax(){
	this.assincr = true;
	this.method = "GET";
	this.val = "";
	
	//carrega o conteudo de uma resposta ajax em uma div
	this.loadContent = function(url , div_name){
		if(xmlhttp) {
			xmlhttp.open(this.method, url , this.assincr);
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4){
					if(xmlhttp.status == 200) {
						if(div_name != ""){
							document.getElementById(div_name).innerHTML = xmlhttp.responseText;
						}
					} else {
						alert(xmlhttp.statusText);
					}
				}
			}
			xmlhttp.send(null);
		}
	}
	
	//carrega o conteudo de uma ajax em uma var
	this.loadResponse = function(url){
		if(xmlhttp) {
			xmlhttp.open(this.method, url , this.assincr);
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4) {
					if(xmlhttp.status == 200) {
						ajax.val = xmlhttp.responseText;
					} else {
						alert(xmlhttp.statusText);
					}
				}
			}
			xmlhttp.send(null);
		}
		return this.val;
	}
	
}

//retorna o objeto XMLHttp
function ajaxInit(){
	try {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e) {
		try {
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch(ex) {
			try {
				return new XMLHttpRequest();
			} catch(exc) {
				alert("Esse browser não tem recursos para uso do Ajax");
				return null;
			}
		}
	}
}
var xmlhttp = ajaxInit();
var ajax = new Ajax();