var HttpRequest = false;

// Submit XML
function AjaxHTTPInit()
{
    HttpRequest = false;
	/* Create a new XMLHttpRequest object to talk to the Web server */
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
		HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			HttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e2) {
			HttpRequest = false;
		}
	}
	@end @*/

    if (!HttpRequest && typeof XMLHttpRequest != 'undefined') {
		HttpRequest = new XMLHttpRequest();
	}

	if (!HttpRequest) {
        alert("Failed to Initializing XMLHttpRequest!");
		return false;
	}

	return true;
}

function AjaxHTTPPost(url, param, CallBackHandler)
{
	// Open an HTTP POST connection to the shopping cart servlet.
	// Third parameter specifies request is asynchronous.
	HttpRequest.open("POST", url, true);

	HttpRequest.onreadystatechange = CallBackHandler;

	// Specify that the body of the request contains form data
	HttpRequest.setRequestHeader("Content-Type", 
								 "application/x-www-form-urlencoded");

	// Send form encoded data stating that I want to add the 
	// specified item to the cart.
	HttpRequest.send(param);
}

function AjaxHTTPGet(url, CallBackHandler)
{
	// Open a connection to the server
	HttpRequest.open("GET", url, true);

	// Setup a function for the server to run when it's done
	HttpRequest.onreadystatechange = CallBackHandler;

	// Send the request
	HttpRequest.send(null);
}

