// JavaScript Document
function Ajax() {
  this.url="";
  this.method="GET";
  this.onSuccess=null;
  this.onError=function (msg) {
    alert(msg);
  }
}

Ajax.prototype.doRequest = function () {
  var xmlHttpRequest=getXMLHttpRequest();
  var _this=this;
  
  xmlHttpRequest.open ("GET", this.url, true);
  xmlHttpRequest.onreadystatechange=readyStateHandler;
  xmlHttpRequest.send(null);
  
  function readyStateHandler () {
	//wenn Uebertragung beendet und Server bereit
    _this.onSuccess (xmlHttpRequest.responseText, xmlHttpRequest.responseXML);
  }
}

function getXMLHttpRequest () {
  if (window.XMLHttpRequest) {
	return new XMLHttpRequest();
  } 
  else {
	if (windows.ActiveXObject) {
	  try {
        return new ActiveXObject("Msxml2.XMLHTTP");
	  }
	  catch (e) {
		  try {
            return new ActiveXObject("Microsoft.XMLHTTP");
		  }
          catch (e) {
            return null;
		  }
	  }
	}
	return null;
  }
}
