AjaxRequestShowLoader = null;
function AjaxRequest (url,func,asinc,send) {
    if (AjaxRequestShowLoader) {
        AjaxRequestShowLoader(true);
    }
	var xmlObj = null
	if(window.XMLHttpRequest)
		xmlObj = new XMLHttpRequest()
	else if(window.ActiveXObject)
		xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
		
	send = send || null;
	method = send ? 'POST' : 'GET';
	asinc  = asinc ? true : false;
	xmlObj.open (method,url,asinc)

	if (asinc) {		
		xmlObj.onreadystatechange = function() {
			if (xmlObj.readyState == 4) {
				if (xmlObj.status == 200 && func) {
				    if (AjaxRequestShowLoader) {
				        AjaxRequestShowLoader(false);
	                    AjaxRequestShowLoader = false;
				    }
					func(xmlObj.responseXML,xmlObj.responseText);
				}
			}
		}
	}
	if (method=='POST')
		xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded;")
	xmlObj.send(send);
	if (asinc)
		return true;
	if (xmlObj.status == 200 && func) {
	    if (AjaxRequestShowLoader) {
	        AjaxRequestShowLoader(false);
                  AjaxRequestShowLoader = false;
	    }
		func(xmlObj.responseXML,xmlObj.responseText);
	}
}

showLoader = function(show) {
    var el = document.getElementById('ajaxLoader');
    el.style.display = show?'block':'none';
}