// Submit XML
function AjaxHTTPInit()
{
    var HttpReq = null;
	/* Create a new XMLHttpRequest object to talk to the Web server */
	/*@cc_on @*/
	try {
		HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e2) {
			HttpReq = null;
		}
	}
	
    if (!HttpReq && typeof XMLHttpRequest != 'undefined') {
		HttpReq = new XMLHttpRequest();
	}

	if (!HttpReq) {
		alert("Your browser does not support AJAX!");
		return null;
	}
	
	return HttpReq;
}

function AjaxSendRequest(url, param, on_handler){
    var ajax_req = AjaxHTTPInit();

	ajax_req.open("POST", url, true);
	ajax_req.onreadystatechange = function(){ on_handler(ajax_req); };
	ajax_req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	ajax_req.send(param);
}
