function Ajax() {

	this.failed = false;
	this.xmlhttp = null;
	this.method = 'GET';

	this.resetFunction = function() {
		this.onLoading = function() {};
		this.onsuccess = function() {};
  	}
	
	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	}

	this.request = function(file, options) {
		//this.onsuccess = options.onsuccess || this.onsuccess;
		this.method = options.method || 'GET';
		
		if (this.failed) {
			alert('Erreur de navigateur');
		} else {
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					this.xmlhttp.open(this.method, file, true);
				} else {
					this.xmlhttp.open(this.method, file, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 4:
							self.responseText = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.onsuccess(self.xmlhttp);
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}

	}

	this.createAJAX();
	this.resetFunction();
}