function SendPost(Method, Webpage, QueryString, Synchronous, Callback)
{
	ajaxRequest(Webpage, Method, QueryString, Callback, Callback, !Synchronous);
}

function ajaxRequest(url, method, param, onSuccess, onFailure, async){
	var self = this;

	if (window.XMLHttpRequest) self.xmlHttpRequest = new XMLHttpRequest();
	else if (window.ActiveXObject) self.xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");

	var xmlHttpRequest = self.xmlHttpRequest;

	if(async){
		xmlHttpRequest.onreadystatechange=function()
		{
			ExecuteCallback(xmlHttpRequest, onSuccess, onFailure);
		};
		xmlHttpRequest.open(method, url, async);
		if (method=='POST') xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		try { xmlHttpRequest.send(param); }
		catch(ex) {}
	}
	else{
		xmlHttpRequest.open(method, url, async);
		if (method=='POST') xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		try { xmlHttpRequest.send(param); }
		catch(ex) {}
		ExecuteCallback(xmlHttpRequest, onSuccess, onFailure);
	}
}
function ExecuteCallback(xmlHttpRequest, onSuccess, onFailure){
	if (xmlHttpRequest.readyState==4 && xmlHttpRequest.status==200) {
		if(typeof(onSuccess)=="function") {
			onSuccess(xmlHttpRequest);
		}
	}
	else if (xmlHttpRequest.readyState==4 && xmlHttpRequest.status !=200) {
		if(typeof(onFailure)=="function") {
			onFailure(xmlHttpRequest);
		}
	}
}

