function Ajax(){
this.assincr = true;
this.method = "GET";
this.val = "";
this.xmlhttp = null;

try{
this.xmlhttp =  new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
try{
this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(ex){
try{
this.xmlhttp = new XMLHttpRequest();
}catch(exc){
alert("Esse browser não tem recursos para uso do Ajax");
this.xmlhttp = null;
}
}
}

//carrega o conteudo de uma ajax em uma var
this.loadResult = function(url){
if(this.xmlhttp) {
this.xmlhttp.open(this.method, url , this.assincr);
//
if(this.method == "GET"){
this.xmlhttp.send(null);
}else if(this.method == "POST"){
this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
try{
this.xmlhttp.send(url.split("?")[1]);
}catch(e){}
}
//
if(this.assincr){
this.xmlhttp.onreadystatechange = function(){
if(ajax.xmlhttp.readyState == 4){
if(ajax.xmlhttp.status == 200){
ajax.val = ajax.xmlhttp.responseText;
}else{
alert(ajax.xmlhttp.statusText);
}
}
}
}else{
ajax.val = ajax.xmlhttp.responseText;
}
}
return this.val;
}

}
