/******************************************************
 *
 * This script was written for
 * http://other.lookstrike.com
 *
 * If you plan to use it for your own, you can but you
 * MUST leave this whole comment intact in each file.
 *
 * Copyright		: (C) Jean-Sébastien Goupil - 2006-2008
 * Website		: http://other.lookstrike.com
 *
 ******************************************************/

var staticXMLRequest;

function XMLRequest() {
	this.init();
}

XMLRequest.prototype = {
	init: function() {
		this.mixId = null;
		this.callbackClass = null;

		if (window.XMLHttpRequest) { // Firefox
			this.obj = new XMLHttpRequest();
		} else if (window.ActiveXObject) { // Internet Explorer
			this.obj = new ActiveXObject('Microsoft.XMLHTTP');
		} else { // XMLHttpRequest not supported by your browser
			throw "Your browser doesn't support XMLHTTPRequest objects...";
		}
	},

	Connect: function(strMethod, strWebsite, bAsync) {
		if(bAsync == null)
			bAsync = true;
		return this.obj.open(strMethod, strWebsite, bAsync);
	},

	SetCallback: function(callbackClass) {
		staticXMLRequest = this;
		this.callbackClass = callbackClass;
		this.obj.onreadystatechange = this.requestCallback;
	},

	Send: function(szData) {
		this.obj.send(szData);
	},

	requestCallback: function() {
		staticXMLRequest.callbackClass(staticXMLRequest);
	},

	GetState: function() {
		return this.obj.readyState;
	},

	GetXML: function() {
		return this.obj.responseXML;
	},

	GetText: function() {
		return this.obj.responseText;
	},

	SetId: function(mixId) {
		this.mixId = mixId;
	},

	GetId: function() {
		return this.mixId;
	}
}