HttpProcessor.prototype.xmlHttpObj = null;
HttpProcessor.prototype.httpMethod = null;
HttpProcessor.prototype.targetUrl = null;
HttpProcessor.prototype.responseText = null;
HttpProcessor.prototype.responseXML = null;
HttpProcessor.prototype.onSuccessCallBack = null;
HttpProcessor.prototype.asyncMode = true;

function HttpProcessor() {
}

HttpProcessor.prototype.setMethod = function(method) {
	this.httpMethod = method;
}

HttpProcessor.prototype.setUrl = function(url) {
	this.targetUrl = url;
}

HttpProcessor.prototype.getResponseText = function() {
	alert(this.responseText);
	return this.responseText;
}

HttpProcessor.prototype.getResponseXML = function() {
	return this.responseXML;
}

HttpProcessor.prototype.setOnSuccessCallBack = function(funcName) {
	this.onSuccessCallBack = funcName;
}

HttpProcessor.prototype.setAsyncMode = function(mode) {
	this.asyncMode = mode;
}

HttpProcessor.prototype.sendRequest = function() {
	// Use the request object of MooTools
	this.xmlHttpObj = new Request({method: this.httpMethod, url: this.targetUrl, async: this.asyncMode});
	if (this.onSuccessCallBack != null)
		this.xmlHttpObj.addEvent("onSuccess", this.onSuccessCallBack);
	this.xmlHttpObj.send();

	if (!this.asyncMode) {
		this.responseText = this.xmlHttpObj.response.text;
		this.responseXML = this.xmlHttpObj.response.xml;
	}
}
