var Ajax = function(){
	XHR = null; 
	var browserUtente = navigator.userAgent.toUpperCase();
	if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
  		var XHR = new XMLHttpRequest();
	else if(window.ActiveXObject &&browserUtente.indexOf("MSIE 4") < 0){
 		if(browserUtente.indexOf("MSIE 5") < 0)
   			XHR = new ActiveXObject("Msxml2.XMLHTTP");
		else
   			XHR = new ActiveXObject("Microsoft.XMLHTTP");
   	}
   	this._connection = XHR; 
   	this._link = ""; 
   	this._xmlresponse= "";
};
 
Ajax.prototype = {
	getResult : function(){
		return 
		}, 
	setFunction : function(f){
		this._connection.onreadystatechange = f ; 
		}, 

	appendParamRequest : function(key,values){
		this._link += key + "=" + escape(values) + "&";
	},
	mysql : function(query){
		this.appendParamRequest("QUERY",query); 
		this.processa("Root/JavaScript/Ajax/ajaxdb.php");  
	}, 
	processa : function(functionpage){
		this._xmlresponse = ""; 
		var usaLink = false; 
		if(this._connection) {
    			usaLink = true;
    			//this._connection.onreadystatechange = this.getFunction(this);
		
			this._connection.open("POST", functionpage, true);
			this._connection.setRequestHeader("content-type", "application/x-www-form-urlencoded");
			this._connection.setRequestHeader("Content-length", this._link.length);
			this._connection.setRequestHeader("connection", "close");
			this._connection.send(this._link); 
		
		 


		/*	var queryString = "QUERY=SELECT * FROM  `administrators` LIMIT 0 , 5";
			var queryString = "?";
			this._connection.open("GET", "ajaxdb.php" + queryString, true);
			this._connection.send(null); 
		*/}
  		return usaLink;
	}
};

