var req;
	if (window.XMLHttpRequest)
    {
        // browser has native support for XMLHttpRequest object
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        // try XMLHTTP ActiveX (Internet Explorer) version
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	document.write("<div id=\"pleasewait\"><p>Please Wait...</p></div>");


var nextfunct;

function ajaxPost(method, url, toSend, responseHandler)
{
    if(req)
    {
		showpleasewait();
		nextfunct = responseHandler
        req.onreadystatechange = postajax;
        req.open(method, url, true);
        req.setRequestHeader("content-type","application/x-www-form-urlencoded");
		req.setRequestHeader("Content-length", toSend.length);
		req.setRequestHeader("Connection", "close");
        req.send(toSend);
    }
    else
    {
        alert('Your browser does not seem to support XMLHttpRequest.');
    }
}

function postajax(){
	if (req.readyState == 4) {
		hidepleasewait();
		nextfunct();
	}
}

function showpleasewait(){
	document.getElementById("pleasewait").style.display = "block";
}

function hidepleasewait(){
	document.getElementById("pleasewait").style.display = "none";
}
