
// Get an XMLHttpRequest object in a portable way.
function newXMLHttpRequest()
{
	var req;
	req = false;
	// For Safari, Firefox, and other non-MS browsers
	if (window.XMLHttpRequest)
	{
		try
		{
			req = new XMLHttpRequest();
		}
		catch (e)
		{
			req = false;
		}
	}
	else if (window.ActiveXObject)
	{
		// For Internet Explorer on Windows
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				req = false;
			}
		}
	}
	return req;
}

function sendScreenResolution()
{
	var req;
	
	req = newXMLHttpRequest();
	
	if (req)
	{
		var intWidth;
		var intHeight;
		var strIP;
		
		intWidth = screen.width;
		intHeight = screen.height;
		try
		{
			req.open("POST", "/Survey/Tool/Reports/ScreenRes/UpdateResolution.asp", true);
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			
			var encoded = '';
			encoded = 'width=' + intWidth + '&height=' + intHeight;
			req.send(encoded);
		}
		catch (e) {}
		
	}
}

function sendAJAXRequest(strURL,strParameters,strReturn)
{
	var req;
	
	req = newXMLHttpRequest();
	
	if (req)
	{
		try
		{
			req.open("POST", strURL, true);
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			
			if (strReturn != null)
			{
				req.onreadystatechange = eval(strReturn);
			}
			
			req.send(strParameters);
		}
		catch (e) {}
		
	}
	return req;
}
