/*****************************  XmlHttpRequest  *****************************

Author:	        Luke Breuer, labreuer+xmlhttprequest@gmail.com
Created:        4/19/05
Documentation:  http://luke.breuer.com/xmlhttprequest.aspx

If you use this code without significantly modifying it, I require that you
maintain a link to http://luke.breuer.com/xmlhttprequest.aspx in this
file and that you include my name and contact information in this file.
*/

var callbackFunction = null
var http;

function handleHttpResponse(element)
{
	if (http.readyState == 4 && callbackFunction != null)
		callbackFunction(http.responseText);   
}
function sendQuerystring(querystringOrUrl) 
{
	http.abort();

	http.onreadystatechange = handleHttpResponse; 
		
	http.open("GET", (querystringOrUrl.indexOf('?') < 0 ? '?' : '') + querystringOrUrl, true); 
	http.send(null);
}
function getXmlHttpObject() 
{
	var xmlhttp;

	/*@cc_on
	@if (@_jscript_version >= 5)
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	@else
	xmlhttp = false;
	@end @*/
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	
	return xmlhttp;
}
function initXmlHttpRequest(callback)
{
	callbackFunction = callback;
	http = getXmlHttpObject();
	

	return http != null;
}