/// XMLHttpRequest factory. This function creates an XMLHttpRequest,
/// depends on the browser the user used.
/// When no HttpRequest can be found, it will throw an error.
function FactoryXMLHttpRequest() 
{
	if (window.XMLHttpRequest) 
	{
		return new XMLHttpRequest();
	} else
	{
		if (window.ActiveXObject)
		{
			// create a list of possible objects
			var msxmls = new Array('Mxml2.XMLHTTP.5.0', 'Mxml2.XMLHTTP.4.0','Mxml2.XMLHTTP.3.0',
				'Mxml2.XMLHTTP','Microsoft.XMLHTTP');
				
			// iterate through all possible classes
			for (var i = 0; i<msxmls.length; i++) 
			{
				try
				{
					return new ActiveXObject(msxmls[i]);					
				}
				catch (e)
				{
					// do nothing
				}
			} // for
		} // if
	} // else
	
	throw new Error("Could not instantiate XMLHttpRequest");
}
