// "Factory Pattern" for creating the correct XMLHttpRequest object
// depending on the browser that calls it.
function FactoryXMLHttpRequest() {
	if (window.ActiveXObject) {
		var msxmls = ['Msxml2.XMLHTTP.5.0',
					  'Msxml2.XMLHTTP.4.0',
					  'Msxml2.XMLHTTP.3.0',
					  'Msxml2.XMLHTTP',
					  'Microsoft.XMLHTTP'];
		for (var i = 0; i < msxmls.length; i+=1) {
			try {
				return new ActiveXObject(msxmls[i]);
			} catch (e) { }
		}
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
	throw new Error("Could not instantiate XMLHttpRequest");
}
