/**
 * This is a AJAX Object
 * @author Marten Koedam <marten@basesoft.com>
 * @copyright Copyright 2005, BaseSoft b.v.
 * @package I-Ware
 * @subpackage Includes
 * @since 22 july 2005
 * @version $Id$
 */
/**
 * 
 */
function AjaxObject()
{
	
}
/**
 * @stolen Google.com
 */
AjaxObject.prototype.getXMLHTTP = function()
{
	var rv = null;
	try
	{
		rv = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			rv = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			rv = null;
		}
	}
  	if(!rv && typeof XMLHttpRequest != "undefined")
		rv = new XMLHttpRequest();
	return rv;
}
/**
 * @stolen Google.com
 */
AjaxObject.prototype.callPage = function(queryString,method)
{
	if(_xmlHttp && _xmlHttp.readyState!=0 )
		_xmlHttp.abort();

	method = method?method:'GET';
	
	if(_xmlHttp=this.getXMLHTTP())
	{
		_xmlHttp.open(method,queryString,true);

		_xmlHttp.onreadystatechange = function()
		{
			if(_xmlHttp.readyState == 4 && _xmlHttp.responseText )
			{
				if(_xmlHttp.responseText.charAt(0) == "<" )
					_timeoutAdjustment--;
				else // The response text gets executed as javascript... 
				{
					try
					{
						eval( _xmlHttp.responseText )
					}
					catch(er)
					{
						if(el = document.getElementById('debug_log'))
							el.innerHTML += _xmlHttp.responseText+'<br /><br />';
					}
				}		
			}
				
      	};
		_xmlHttp.send( null );
	}
}
_xmlHttp = null;
_timeoutAdjustment = 0;