function Requester (async) {
	this.async = async ? true : false;
	this.request = null;
	this.action = null;
	this.XML = null;
	this.TXT = null;
	//this.initAJAX ();

	return true;
};

Requester.prototype.execAction = function () {
	if (this.request.readyState == 4) {
		try {
			if (this.request.status == 200) {
				this.XML = this.getXML ();
				this.TXT = this.getTXT ();
				this.action ();
			} else if (this.request.status != 0) {
				alert ("Error retrieving URL: " + this.request.statusText);
			}
		}
		catch (ex) {
			alert (ex);
		}
	}
	return true;
};

Requester.prototype.initAJAX = function () {

	var self = this;

	if (this.request != null && this.request.readyState != 0 && this.request.readyState != 4) {
		this.request.abort ();
	}

	try {
		this.request = new XMLHttpRequest();
	}
	catch (error) {
		try {
			this.request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (error) {
			this.request = null;
			return false;
		}
	}

	this.request.onreadystatechange = function () {
		self.execAction ();
		return true;
	};
	
	return true;
};

Requester.prototype.getTXT = function () {
	return this.request.responseText;
};

Requester.prototype.getXML = function () {
	return this.request.responseXML;
};

Requester.prototype.getData = function (url, m, d) {
	try {
		this.initAJAX ();
		this.request.open (m, url, this.async);
		this.request.send (d);
	}
	catch (ex) {
		alert("Error getting data");
		return false;
	}

	return true;
};

Requester.prototype.sendData = function (url, m, d) {
	try {
	    this.initAJAX ();
		this.request.open (m, url, this.async);
		this.request.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');
		this.request.send (d);
	}
	catch (ex) {
		alert("Error sending data");
		return false;
	}

	return true;
};

Requester.prototype.getPlugin = function () {
	writeToLayer ('plugindata', this.TXT, 1);
};

Requester.prototype.pageTitle = function () {
};

Requester.prototype.pageContent = function () {
};

Requester.prototype.gallery = function () {
};

Requester.prototype.galleryImage = function () {
};

Requester.prototype.category = function () {
};

Requester.prototype.getPinger = function () {
	writeToLayer ('div_pinger', this.TXT, 1);
};

Requester.prototype.comment = function () {
};

AJAX = new Requester(true);

