var AJAX = {
	onError 	: null,
	onInitialize: null,
	onSend		: null,
	onProcess 	: null,
	onComplete 	: null,
	parser		: null,
	
	METHOD 		: 'GET',
	URL 		: '',
	PARAMS 		: '',
	XMLHTTP		: null,
	_START_		: function () {
		if(!isNull(this.XMLHTTP)){
			this.XMLHTTP.abort();
			this.XMLHTTP = null;
		}
		try{ this.XMLHTTP = new XMLHttpRequest(); }
		catch (e) {
			try { this.XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (er) {
				try { this.XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (err) { alert ("Your browser does not support XML-HTTP Request"); return false; }
			}
		}
	},
	EXECUTE		: function () {
		this._START_();
		var obj = this;
		this.XMLHTTP.onreadystatechange = function(){
			switch(obj.XMLHTTP.readyState){
				case 0: eval(obj.onError); 		break;
				case 1: eval(obj.onInitialize); break;
				case 2: eval(obj.onSend);		break;
				case 3: eval(obj.onProcess); 	break;
				case 4:
					eval(obj.onComplete);
					if(!isNull(obj.parser))	obj.parser(obj.XMLHTTP);
					break;
			}
		}
		if(this.METHOD=='GET' && !isNull(this.PARAMS))
			this.URL = (this.PARAMS.substr(0,1)=='?')?this.URL+this.PARAMS:this.URL+'?'+this.PARAMS;
		this.XMLHTTP.open(this.METHOD, this.URL, true);
		if(this.METHOD=='POST')
			this.XMLHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		this.XMLHTTP.send(this.PARAMS);
	},
	GET 		: function (url, params) {
		this.METHOD 	= 'GET';
		this.URL 		= url;
		this.PARAMS		= params;
		this.EXECUTE();
	},
	POST 		: function (url, params) {
		this.METHOD 	= 'POST';
		this.URL 		= url;
		this.PARAMS		= params;
		this.EXECUTE();
	}
};