function HTTPRequest()
{
	this.oHTTP = false;
	this.cache = [];

	/*@cc_on
	@if (@_jscript_version >= 5)
      	try 
	{
      		this.oHTTP = new ActiveXObject("Msxml2.XMLHTTP")
      	}
      	catch (e)
	{
         		try 
		{
         			this.oHTTP = new ActiveXObject("Microsoft.XMLHTTP")
         		}
         		catch (e2)
		{
         			this.oHTTP = false
         		}
      	}
   	@end
	@*/

	if (!this.oHTTP && typeof XMLHttpRequest != 'undefined')
		this.oHTTP = new XMLHttpRequest()
}

HTTPRequest.prototype.get = function(sURL,callback)
{
	var t = this;
	var o = this.oHTTP;

	if(this.cache[escape(sURL)])
	{
		callback();
	}
	else
	{
		this.oHTTP.open("GET", sURL,true);
 		this.oHTTP.onreadystatechange=
		function()
		{	
			if (o.readyState == 4) 
			{
				if(o.responseText)
				{	
					var obj;
					try
					{
						eval("obj = " + o.responseText);
						t.cache[escape(sURL)] = obj;
						callback();
					}
					catch(e){};
				}
			}
		};
		this.oHTTP.send(null);
	}
}

HTTPRequest.prototype.post = function(sURL,sPayload,callback)
{
	var t = this;
	var o = this.oHTTP;

	this.oHTTP.open("POST", sURL,true);
	this.oHTTP.onreadystatechange=
	function()
	{	
		if (o.readyState == 4) 
		{
			if(o.responseText)
			{	
				var obj;
				eval("obj = " + o.responseText);
				t.cache[escape(sURL)] = obj;
				callback();
			}
		}
	};
 	this.oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	this.oHTTP.send(sPayload);
}

HTTPRequest.prototype.showCache = function(sURL)
{
	alert(this.cache[escape(sURL)]);
}



