function tabiXmlHttp(url) {
        this.READY_STATE_UNINITIALIZED = 0;
        this.READY_STATE_LOADING = 1;
        this.READY_STATE_INTERACTIVE = 3;
		this.READY_STATE_COMPLETE = 4;
		this.req = null;
		this.url = url;
		this.method = (arguments[1]) ? arguments[1] : "POST";
		this.params = (arguments[2]) ? arguments[2] : null;
		this.onLoad = (arguments[3]) ? arguments[3] : this.defaultLoad;
		this.onError = (arguments[4]) ? arguments[4] : this.defaultError;
}

tabiXmlHttp.prototype.loadXMLDoc = function() {
	if (window.XMLHttpRequest) {
		this.req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		this.req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (this.req) {
		try {
			var loader = this;
			this.req.onreadystatechange = function() {
						loader.onReadyState.call(loader);
										}
			this.req.open(this.method,this.url, true);
            this.req.setRequestHeader("If-Modified-Since","Wed, 15 Nov 1995 00:00:00 GMT");
    	    this.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			this.req.send(this.params);
        } catch (err) {
            this.onError.call(this);
        }
	}
};

tabiXmlHttp.prototype.onReadyState = function() {
        if (this.req.readyState == this.READY_STATE_COMPLETE) {
                if (this.req.status == 200 || !this.req.status) {
                        this.onLoad.call(this);
                }
                else {
                        this.onError.call(this);
                }
        }
};

tabiXmlHttp.prototype.defaultLoad = function() {
};

tabiXmlHttp.prototype.defaultError = function() {
};

tabiXmlHttp.prototype.XML2JS = function(containerTag) {
        var xmlDoc = this.req.responseXML;
        var output = new Array();
        var rawData = xmlDoc.getElementsByTagName(containerTag)[0];
        var i, j, oneRecord, oneObject;

        if (rawData) {
                if (xmlDoc) {
                        for (i = 0; i < rawData.childNodes.length; i ++) {
                                if (rawData.childNodes[i].nodeType == 1) {
                                        oneRecord = rawData.childNodes[i];
                                        oneObject = output[output.length] = new Object();
       
                                        for (j = 0; j < oneRecord.childNodes.length; j ++) {
                                                if (oneRecord.childNodes[j].nodeType == 1 && oneRecord.childNodes[j].firstChild) {
                                                        oneObject[oneRecord.childNodes[j].tagName] = oneRecord.childNodes[j].firstChild.nodeValue;
                                                }
                                        }
                                }
                        }
                }
        }

        return output;
};

