
// Begin GetXMLHttpRequest.js
// Created by:  Steve Seaquist
//
// Instantiates and returns an XMLHttpRequest object in a cross-browser compatible way. 
//
// PROGRAMMING NOTE: In theory, the reason for resetting sReq to false in the catch clauses is that an error could be 
// caught after the base object type (Object) is instantiated but before it's fully mutated into an XMLHttpRequest object. 
// By resetting sReq to false, we are throwing away any partially instantiated object that may have made sReq non-null in 
// the try clause. Personally, I think this is a "PPP" (paranoid programming practice). The "new" operator shouldn't 
// return ANYTHING until after instantiation is fully complete, right? Moreover, it should return the fully instantiated 
// object to the equals sign ("="), which is itself an operator in all C-based languages. So sReq wouldn't get a new value 
// until 2 operators after the instantiation itself completes!! Oh well, anyway, it gives us something to do in the catch 
// clause, which looks nicer, even though it's totally unnecessary, in my opinion. 
//
// Steve Seaquist, 07/06/2006. 

function GetXMLHttpRequest	()
{
var	sReq					= false;
// Firefox, iCab, Internet Explorer 7, Konqueror, Netscape, Opera, Safari, http://www.w3.org/TR/XMLHttpRequest/ standard, etc: 
if	(window.XMLHttpRequest)
	{
	try	{
		sReq				= new XMLHttpRequest();
		}
	catch (e)
		{
		sReq				= false;
		}
	}
if	(sReq)
	return sReq;
// Internet Explorer 5 and 6: 
if	(window.ActiveXObject)
	{
	try	{
		sReq				= new ActiveXObject("Msxml2.XMLHTTP");
		}
	catch (e)
		{
		sReq				= false;
		}
	if	(sReq)
		return sReq;
	try	{
		sReq				= new ActiveXObject("Microsoft.XMLHTTP");
		}
	catch (e)
		{
		sReq				= false;
		}
	}
return sReq;
}
// End GetXMLHttpRequest.js


