function ajax()
{
	this.xmlhttp = null;		// the object itself
	this.callBackFunc = null;	// call back function on success
	this.errorFunc = null;		// function to call on error
	this.method = "POST";		// method to make request with; "GET" | "POST"
	this.postData = null;		// & separated list of variable = data pairs
	this.responseXml = null;	// response xml 
	this.responseText = null;	// response text
	this.url = null;		// url used in ajax request
	this.async = true;		// set to false for debugging
	this.callBackFunc = null;	// callback function
	this.errorFunc = null;		// error function
	
	var req=this;	
	this.callBackFunc = function () { alert(req.responseText); };
	this.errorFunc = function () { alert("error "+req.xmlhttp.status+":\nan error has occured"); }
				
	this.loadXMLDoc = function (url)
	{
		this.url = url;
	
		if (window.XMLHttpRequest) 
			this.xmlhttp=new XMLHttpRequest();
		else if (window.ActiveXObject) 
			this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

		if (this.xmlhttp)
		{
			this.xmlhttp.onreadystatechange=function ()
			{
				if(req.xmlhttp.readyState==4)
				{
					if(req.xmlhttp.status==200)
					{
						req.responseText = req.xmlhttp.responseText;
						if(req.xmlhttp.responseXml)
							req.responseXml = req.xmlhttp.responseXml;
						else req.responseXml = req.xmlhttp.responseXML;
						if(req.callBackFunc)
							req.callBackFunc();
					}
					else
					{
						if(req.errorFunc)
							req.errorFunc();
					}
		       		}
			};
			this.xmlhttp.open(this.method,url,this.async);
			if(this.postData)
			{
				    this.xmlhttp.setRequestHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8");
				    this.xmlhttp.send(this.postData);
			} else this.xmlhttp.send(null);
			return true;
		} else return false;
	};
}

