function AjaxRequest(not_cached)
{
	this.req = null;
	this.not_cached = not_cached;
}
AjaxRequest.prototype =
{
	sendRequest : function(url, callback, post_data, custom_data)
	{
		this._createXMLHTTPObject();

		if (!this.req)
			return;

		var method = (post_data) ? "POST" : "GET";

		try	{
			if (!this.not_cached) {
				if (url.indexOf("?") == -1)
					url += "?" + Math.random();
				else
					url += "&" + Math.random();
			}

			this.req.open(method, url, true);
		}catch(e) {
			return;
		}

		this.req.setRequestHeader("User-Agent", "XMLHTTP/1.0");

		if (post_data)
			this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		if (typeof custom_data != "undefined")
			this.req.custom_data = custom_data;

		this.req.onreadystatechange = function()
		{
			if (this.readyState != 4)
				return;

			if (this.status != 200 && this.status != 304)
				return;

			callback(this);
		}

		if (this.req.readyState == 4)
			return;

		try	{
			this.req.send(null);
		}catch (e) {
			return;
		}
	},

	_createXMLHTTPObject : function()
	{
		var factories = [
			function() {return new XMLHttpRequest()},
			function() {return new ActiveXObject("Msxml2.XMLHTTP")},
			function() {return new ActiveXObject("Msxml3.XMLHTTP")},
			function() {return new ActiveXObject("Microsoft.XMLHTTP")}
		];

		for (var i=0; i<factories.length; i++) {
			try	{
				this.req = factories[i]();
			}catch (e) {
				continue;
			}

			break;
		}
	}
}
