var Ajax = 
{
	_private_functions: 
	{
		_initAJAX: function()
		{
			if (window.XMLHttpRequest)
			{
				this._http=new XMLHttpRequest();
			}
			else
			{
				this._http=new ActiveXObject("Microsoft.XMLHTTP");
			}

			if (this._http == undefined)
			{
				alert("Error in creating XMLHttpRequest");
				return;
			}

			this._isopen = false;
	
			return this;
		},

		_changeReadyState: function(func)
		{
			if (typeof(func) == 'function')
			{
				var b = this;
				var f = function () { return func(b); };
				this._http.onreadystatechange = f;
				return;
			}

			alert("method not supported");
			return;
		},

		_open : function(method, url, async)
		{
			this._isopen = true;
			return this._http.open(method, url, async);
		},

		_send: function(string)
		{
			return this._http.send(string);
		},

		_setRequestHeader: function(header, value)
		{
			return this._http.setRequestHeader(header, value);
		},

		_setCustomVar: function(name, value)
		{
			this._custom_vars[name] = value;
		},

		_getCustomVar: function(name)
		{
			return this._custom_vars[name];
		}
	},

	inst: function()
	{

		this._initAJAX = Ajax._private_functions._initAJAX;
		this.changeReadyState = Ajax._private_functions._changeReadyState;
		this.fetchResponseText = function () { return this._http.responseText; };
		this.fetchResponseXML = function () { return this._http.responseXML; };
		this.fetchResponseState = function () { return this._http.readyState; };
		this.fetchResponseStatus = function () { try { return this._http.status; } catch(err) { return 500; } }; 
		this.open = Ajax._private_functions._open;
		this.send = Ajax._private_functions._send;
		this.setRequestHeader = Ajax._private_functions._setRequestHeader;
		this.setContentType = function (ct) { return this.setRequestHeader("Content-Type", ct); };

		this.setCustomVar = Ajax._private_functions._setCustomVar;
		this.getCustomVar = Ajax._private_functions._getCustomVar;
		this._custom_vars  = new Array();

		this._initAJAX();

		return this;
	},

	ignoreReadyState: function(ajax)
	{
		return;
	}


};

