var http_request = false;


function makeRequestResult(xmlhttp, callback) {
	alert(http_request.readyState);
	alert(http_request.status);
	alert(http_request.responseText);
	alert(http_request.responseXML);

	callback(xmlhttp);
}

function makeRequest(url, parameters, callback, callbackParam, async) {
	var xmlhttp = false;
	async = async || true;
	
/*
  Provide the XMLHttpRequest constructor for Internet Explorer 5.x-6.x:
  Other browsers (including Internet Explorer 7.x-9.x) do not redefine
  XMLHttpRequest if it already exists.
*/
	if (typeof XMLHttpRequest == "undefined") {
		XMLHttpRequest = function () {
			try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
			catch (e) {}
			try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
			catch (e) {}
			try { return new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (e) {}
			//Microsoft.XMLHTTP points to Msxml2.XMLHTTP and is redundant
			alert("This browser does not support XMLHttpRequest.");  
			throw new Error("This browser does not support XMLHttpRequest.");
		};
	}
	xmlhttp = new XMLHttpRequest();
	if (xmlhttp.overrideMimeType) {
		//http_request.overrideMimeType('text/xml');
		xmlhttp.overrideMimeType('text/html');
	}
 
	if (async) {
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				http_request = xmlhttp;
				callback(xmlhttp, callbackParam);
			}
		};
	}

	xmlhttp.open('POST', url, async);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//	http_request.setRequestHeader("Content-length", parameters.length);
//	http_request.setRequestHeader("Connection", "close");
	xmlhttp.send(parameters);
	
	if (!async) {
		http_request = xmlhttp;
		callback(xmlhttp, callbackParam);
	}
}
