function Ajax()
{
	this.xhr = null;
	this.createAjax = function(){
			if(window.XMLHttpRequest) // Firefox et autres
				   this.xhr = new XMLHttpRequest(); 
			else if(window.ActiveXObject)
			{ // Internet Explorer 
				try {
			      	 this.xhr = new ActiveXObject("Msxml2.XMLHTTP");
			   	 } catch (e) {
			      	this.xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    }
			}
			else { // XMLHttpRequest non supporté par le navigateur 
				   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
				   this.xhr = false; 
				} 
			}	
	
	this.request = 	function (url,methode,data){
				if(this.xhr){
					var self = this;
				// On défini ce qu'on va faire quand on aura la réponse
				this.xhr.onreadystatechange = function()
				{
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					switch (self.xhr.readyState) 
					{
						case 1:
							self.onLoading();
							break;
						case 4:
							self.repText = self.xhr.responseText;
							self.repXML = self.xhr.responseXML;
							self.onsuccess(self.xhr);
					
					}
				}
				this.xhr.open(methode,url,true);
				if(methode == "GET")
					this.xhr.send(null);
				else{
					this.xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					this.xhr.send(data);
				}
		}
	}
	
		
	this.resetfunction = function() {
		this.onLoading = function() {};
		this.onsuccess = function() {};
  	}
				
	this.createAjax();
	this.resetfunction();
	
}