function startSending(ajaxURL, ajaxParams, ajaxMethod, destinationContainer, callbackSuccess, callbackFail) {

	ajaxSend(ajaxURL, ajaxParams, ajaxMethod, destinationContainer, callbackSuccess, callbackFail);
	
}

function ajaxSend(ajaxURL, ajaxParams, ajaxMethod, destinationContainer, callbackSuccess, callbackFail) {

	var communication = new Ajax.Request(ajaxURL,
	  {

	    method: ajaxMethod,
	  	parameters: ajaxParams,
	
	    onSuccess: function(transport){
			displayHTML(transport.responseText, destinationContainer, callbackSuccess, callbackFail);
	    },
	
	    onFailure: function(){ alert('Sorry, the website is under heavy stress. Please try again later.'); }
	  });
		
}


function displayHTML(jsonResponse, destinationContainer, callbackSuccess, callbackFail) {

	var mainContent = $(destinationContainer);
	if (mainContent) {
		if (jsonResponse.isJSON()) {
		  	var response = jsonResponse.evalJSON(true);
		  	mainContent.innerHTML = response.content;
		  	runFunction(callbackSuccess);
		} else {
		  	mainContent.innerHTML = response.content;
		  	runFunction(callbackFail);
		}
	}
}

