function AJAX(url, callback) {

	var req = init();
	req.onreadystatechange = processRequest;

	function init() {

		var A;
		var msxmlhttp = new Array(
		'Msxml2.XMLHTTP.5.0',
		'Msxml2.XMLHTTP.4.0',
		'Msxml2.XMLHTTP.3.0',
		'Msxml2.XMLHTTP',
		'Microsoft.XMLHTTP');
		for (var i = 0; i < msxmlhttp.length; i++) {
			try {
				A = new ActiveXObject(msxmlhttp[i]);
			} catch (e) {
				A = null;
			}
		}

		if(!A && typeof XMLHttpRequest != "undefined")
		A = new XMLHttpRequest();
		return A;

		/*
		var reqObj = null;
		try {
		reqObj = new XMLHttpRequest();
		} catch(e) {
		try {
		reqObj = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
		try {
		reqObj = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) { }
		}
		}
		return reqObj;
		*/
	}

	function processRequest () {
		if (req.readyState == 4 && Math.floor(req.status / 100) == 2 && callback) {
			if (req.responseXML != null && req.responseXML.childNodes != null && req.responseXML.childNodes.length > 0)
			callback(req.responseXML);
			else
			callback(req.responseText);
		}
	}

	this.doGet = function() {
		var time = new Date();
		req.open("GET", url + (url.indexOf("?") < 0 ? "?" : "&") + "__t=" + Math.floor(time.getTime() / 100), true);
		req.send(null);
	}

	this.doPost = function(params) {
		req.open("POST", url, true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		var body = "";
		if (typeof(params) == "string" || params instanceof String) {
			body = params;
		} else {
			for (var key in params) {
				if (body != "")
				body += "&";
				body += key + "=" + escape(params[key]).replace(/\+/, "%2B");
			}
		}
		req.send(body);
	}

    this.doSyncPost = function(params) {
        req.open("POST", url, false);
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        var body = "";
        if (typeof(params) == "string" || params instanceof String) {
            body = params;
        } else {
            for (var key in params) {
                if (body != "")
                body += "&";
                body += key + "=" + escape(params[key]).replace(/\+/, "%2B");
            }
        }
        req.send(body);
    }

}

