var receiveReq = getXmlHttpRequestObject();		
//Get our browser specific XmlHttpRequest object.
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		//Display your error message here. 
		//and inform the user they might want to upgrade
		//their browser.
		alert("Your browser doesn't support the XmlHttpRequest object.  Better upgrade to Firefox.");
	}
}

function callAjax(urlApp, controller, action, parameters){
	//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
	if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
		//Setup the connection as a GET call to SayHello.html.
		//True explicity sets the request to asyncronous (default).
		receiveReq.open("GET", urlApp+'?rt='+controller+'/'+action+'&'+parameters, true);
		//Set the function that will be called when the XmlHttpRequest objects state changes.
		receiveReq.onreadystatechange = handleUpdateResponse; 
		//Make the actual request.
		receiveReq.send(null);
	}			
}
function handleUpdateResponse(){
	//Check to see if the XmlHttpRequests state is finished.
	if (receiveReq.readyState == 4) {
		//Set the contents of our span element to the result of the asyncronous call.
		document.getElementById('content').innerHTML = receiveReq.responseText;
	}			
}
function startCallback() {
	// make something useful before submit (onStart)
	return true;
}

function completeCallback(response) {
	// make something useful after (onComplete)
	document.getElementById('nr').innerHTML = parseInt(document.getElementById('nr').innerHTML) + 1;
	document.getElementById('r').innerHTML = response;
}