function microAjax(url, callbackFunction)
{
	var loaded = false;

	this.startLoading = function() {
    	loaded = false;
		window.setTimeout('showLoadingImage()', 1000);
  	}
	
	this.showLoadingImage = function() {
		var el = document.getElementById("loading");
		if (el && !loaded) {
			//el.innerHTML = '<img src="../images/ajax-loader-trans.gif">';
			el.innerHTML = '<img src="../images/ajax-loader.gif">';
			el.style.display = 'block';	
		}
	}
	
	 this.stopLoading = function() {
		document.getElementById("loading").style.display = 'none';
    	loaded = true;
  	}

	this.bindFunction = function (caller, object) {
        return function() {
            return caller.apply(object, new Array(object));
        }
    }

    this.stateChange = function (object) {
        if (this.request.readyState==4) {
            this.callbackFunction(this.request);
			this.stopLoading();
        }
    }

    this.getRequest = function() {
        if (window.ActiveXObject)
            return new ActiveXObject('Microsoft.XMLHTTP');
        else if (window.XMLHttpRequest)
            return new XMLHttpRequest();
        else
            return false;
    }
	
    if (arguments[2]) {
        this.postBody = arguments[2];
	} else { 
        this.postBody="";
	}
	
	this.startLoading();
    this.callbackFunction=callbackFunction;
    this.url=url;   
    this.request = this.getRequest();

    if(this.request) {
        this.request.onreadystatechange = this.bindFunction(this.stateChange, this);		

        if (this.postBody != "") {
			this.request.open("POST", url, true);
            this.request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
            this.request.setRequestHeader('Connection', 'close');
        } else {
			this.request.open("GET", url, true);
        }
		
        this.request.send(this.postBody);
    }
}