/*
*	Id: ajaxRequest_simple.js v. 1.0.1
*	simple ajax object
*	created 2007-7-9 15:34 GMT
*	by Sergej Koppel
*/
ajaxRequest = function(url, handler, m, b, h, s)
{
	this.urlReq			= url;
	this.stateHandler	= handler	|| function() { };
	this.method			= m			|| "GET";
	this.body			= b			|| null;
	this.headers		= h			|| false;
	this.sync			= s			|| true;
	this.abortReq		= false;
	
	this.req =	(window.XMLHttpRequest)
				?
				new XMLHttpRequest()
				:
				((window.ActiveXObject)
				?
				new ActiveXObject("Microsoft.XMLHTTP")
				:
				false
				);
	
	this.doRequest = function()
	{
		this.req.open(this.method, this.urlReq, this.sync);
		if (this.headers)
		{
			for (var i=0; i<this.headers.length; i+=2)
			{
				this.req.setRequestHeader(this.headers[i], this.headers[i+1]);
			}
		}
		this.req.onreadystatechange = this.stateHandler;
		this.req.send(this.body);
	}
};
