var ajax_request = function(){
	this.method = 'POST';
	this.url = 'index.php';
	this.async = true;
	this.call_back = '';
	this.file_path = '';
	this.class_name = '';
	this.method_name = '';
	this.arguments = '';
	this.attributes = null;
	
	this.register_argument = function(name, value){
		this.arguments += '&arguments[' + name + ']=' + value;
	}

	this.send = function(){
		var xml_http;

		try{ // Firefox, Opera 8.0+, Safari
			xml_http = new XMLHttpRequest(); 
			xml_http.overrideMimeType('text/xml');
		}

		catch (e){// Internet Explorer
			try{
				xml_http = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e){
				try{
					xml_http = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e){
					alert("AJAX not possible!");
					return false;
				}
			}

		}
		
		var url = this.url + "?ajax=1";
		this.arguments += "&file_path=" + this.file_path + "&class_name=" + this.class_name + "&method_name=" + this.method_name;
		var call_back = this.call_back;
		var attributes = this.attributes;
		
		if(typeof(this.attributes) != "undefined"){
			var attributes = this.attributes;
		}
		
		xml_http.onreadystatechange = function(){
			if (xml_http.readyState==4){
				if (xml_http.status == 200) {
					eval(call_back + "(xml_http, attributes);");
				}
			}
		}
		
		xml_http.open(this.method, url, this.async);
		xml_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xml_http.setRequestHeader("Content-length", this.arguments.length);
		xml_http.setRequestHeader("Connection", "close");
		xml_http.send(this.arguments);

		return xml_http;
	}
}