function GetXmlHttpObject()
{
	var XMLHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		XMLHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		var aryXmlHttp = new Array(
								  "MSXML2.XMLHTTP.6.0",
								  "MSXML2.XMLHTTP.5.0",
								  "MSXML2.XMLHTTP.4.0",
								  "MSXML2.XMLHTTP.3.0",
								  "MSXML2.XMLHTTP",
								  "Microsoft.XMLHTTP"
								  );
		for (var i=0; i<aryXmlHttp.length && !XMLHttp; i++)
		{
			try
			{
				XMLHttp = new ActiveXObject(aryXmlHttp[i]);
			} 
			catch (e) {}
		}
	}
	if (!XMLHttp)
	{
		alert("Error: failed to create the XMLHttpRequest object.");
	}
	else 
	{
		return XMLHttp;
	}
}

function AjRequest()
{
	var _xmlobj = this;
	this.xmlhttp = GetXmlHttpObject();
	this.method = '';
	this.url = '';
	this.postdata = '';
	this.div = '';

	this.getResponse = function(url, method, postdata, div)
	{
		HtmlDiv = document.getElementById(div);
		_xmlobj.method = method;
		_xmlobj.url = url;
		_xmlobj.postdata = postdata;
		_xmlobj.div = div;

		if (_xmlobj.xmlhttp)
		{
			_xmlobj.xmlhttp.open(_xmlobj.method, _xmlobj.url, true);
			_xmlobj.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			_xmlobj.xmlhttp.onreadystatechange = function()
			{
				try
				{
					switch(_xmlobj.xmlhttp.readyState)
					{
						case 4:
							if(_xmlobj.xmlhttp.status == 200)
							{
								 HtmlDiv.innerHTML = _xmlobj.xmlhttp.responseText;
							}
					}
				}
				catch(e)
				{
					alert(e.toString());
				}
			}
			_xmlobj.xmlhttp.send(_xmlobj.postdata);
		}
	}	
}