if( typeof ajax_wrap == "undefined" )
	var ajax_wrap =
	{
		bind: function( args )
		{
			with( this )
			{
				if( _xhr && _xhr.readyState != 4 )
				{
					_queue.push( args );
					return;
				} else
				{
					if( !_xhr )
						_xhr = _getXhr();
					if( !args.method )
						args.method = "GET";
					_xhr.open( args.method, args.url, true );
					_xhr.onreadystatechange =
						function()
						{
							if( _xhr.readyState == 4 )
							{
								if( !_xhr.status || _xhr.status == 200 )
								{
									if( args.mimetype == "text/json" ) // FIXME: cheap hack
									{
										var tmp = null;
										try
										{
											tmp = eval("(" +  _xhr.responseText + ")");
										} catch( e )
										{
											args.error( null, "ERROR - Please reload and try again" ); //XmlHttpRequest error: response is not of type text/json
										} finally
										{
											args.load( null, tmp, null );
										}
									} else
									{
										args.load( null, _xhr.responseText, null );
									}
								} else
								{
									if( args.error )
										args.error( null, "HTTP error " + _xhr.status );
								}
								delete _xhr.onreadystatechange;
								delete args;
								_inFlight = false;
								if( _queue.length )
									bind( _queue.shift() );
							}
						};
					_xhr.send( null );
					_inFlight = true;
				}
			}
		},

		_getXhr: function()
		{
			if( window.XMLHttpRequest )
				return new XMLHttpRequest();
			else if( window.ActiveXObject )
				return new ActiveXObject( "Microsoft.XMLHTTP" );
			else
				throw "Unable to instantiate XHR object";
		},

		_xhr: null,
		
		_queue: [],
		
		_inFlight: false
	};