
/*

	general js script for communicating with servers via the HTTP protocol

*/

function HTTP()
{
	this.func = null;
	this.request = null;
}

HTTP.funcs = [
	       function() { return new XMLHttpRequest(); },
	       function() { return new ActiveXObject("Msxm12.XMLHTTP"); },
	       function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
];


HTTP.prototype.newRequest = function()
{
	if ( HTTP.func != null ) { this.request = HTTP.func(); return this.request; }

	for (var i = 0; i < HTTP.funcs.length; i++)
	{
		try {
		    var f = HTTP.funcs[i]
		    var r = f();
		    if ( r != null )
		    {
			HTTP.func = f;
			return r;
		    }
		}
		catch (e) {
		continue;
		}
	}

	HTTP.func = function()
	{
		throw new Error("XMLHttpRequest not supported");
	}
	HTTP.func();
}


HTTP.prototype.GET = function(url, async, user, password)
{
	if (!sync) { async = true; }
	if (user && password)
	{
		this.request.open("GET", url, async, user, password);
	}
	else
	{
		this.request.open("GET", url, async);
	}
}


HTTP.prototype.POST = function()
{
}


HTTP.prototype.send = function()
{
}
