function ajax(method, async)
{
	this.xmlhttp = this.get_xmlhttp();
	this.method = typeof(method) != 'undefined' ? method : 'GET';
	this.async = typeof(async) != 'undefined' ? async : true;
}
ajax.prototype.xmlhttp = null;
ajax.prototype.response = null;
ajax.prototype.get_xmlhttp = function()
{
	var xmlhttp;
	try
	{
		// Mozilla / Safari / IE7
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		// IE
		var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0',
			'MSXML2.XMLHTTP.4.0',
			'MSXML2.XMLHTTP.3.0',
			'MSXML2.XMLHTTP',
			'Microsoft.XMLHTTP' );
		var success = false;
		for (var i=0;i < XMLHTTP_IDS.length && !success; i++)
		{
			try
			{
				xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
				success = true;
			} catch (e) {}
		}
		if (!success)
		{
			throw new Error('Unable to create XMLHttpRequest.');
		}
	}
	return xmlhttp;
}
ajax.prototype.do_call = function(action, vars, callback)
{
	var args = arguments;
	var timestamp = new Date().getTime();
	var callback = typeof(callback) != 'undefined' ? callback : null;
	var vars_string = this.to_string(vars);
	//alert(vars.toString());
	//alert(action + '?time=' +  timestamp + '&' + vars_string);
	if( vars_string == null || this.method == 'POST' )
		this.xmlhttp.open(this.method, action + '?time=' +  timestamp, this.async);
	else
		this.xmlhttp.open(this.method, action + '?time=' +  timestamp + '&' + vars_string, this.async);
	if( callback != null )
	{
		this.xmlhttp.onreadystatechange = function()
		{
			if( this.readyState == 4 && this.status == 200 && callback != null )
			{
				//alert(this.responseText);
				if( this.responseText == '' )
					var response = null;
				else
					eval('var response = ' + this.responseText + ';');
				var argument_string = '';
				if( args.length > 3 )
				{
					for( var i = 3; i < args.length; i++ )
					{
						argument_string += ', args[' + i + ']';
					}
				}
				
				if( typeof(callback) === 'function' )
				{
					eval('callback(response' + argument_string + ');');
				} else {
					eval(callback + '(response' + argument_string + ');');
				}
			}
		}
	}
	
	if( this.method == 'POST' )
	{
		this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		this.xmlhttp.send(vars_string);
	} else {
		this.xmlhttp.send(null);
	}
}
ajax.prototype.to_string = function( vars )
{
	var vars_strings = new Array();
	for( name in vars )
	{
		if( typeof(vars[name]) == 'array' || typeof(vars[name]) == 'object' )
			vars_strings.push(this.to_string(vars[name]));
		else
			vars_strings.push(name + '=' + vars[name]);
	}
	return ( vars_strings.length == 0 )? null: vars_strings.join('&');
}
