
if (typeof(tora) == "undefined")
	tora = new Object;

if (typeof(tora.asio) == "undefined")
	tora.asio = new Object;

// namespace tora { namespace asio {

tora.asio.Loader = function() {
	this.httpObj_ = new tora.asio.XMLHttpRequest();
}

tora.asio.Loader.prototype = {

	disableForm : function() { },

	enableForm : function() { },

	doLoad : function() { },

	source : function() { },

	loadedItems : function(tagname) {
		return this.httpObj_.responseXML().getElementsByTagName(tagname);
	},

	load : function() {
		var asio = tora.asio;

		this.disableForm();
		this.httpObj_.open("GET", this.source());
		var outer = this;
		this.httpObj_.onReadyStateChange(function() {
			if (outer.httpObj_.readyState() == asio.XMLHttpRequest.ReadyStates.COMPLETE) {
				if (outer.httpObj_.status() == asio.XMLHttpRequest.Statuses.OK) {
					outer.doLoad();
					outer.enableForm();
				} else {
				//	alert(outer.httpObj_.status() + " : " + outer.httpObj_.statusText());
				}
			}
		});

		this.httpObj_.send();
	}

};

// } } // tora.asio

