Ajax = function(file, method) {
	if (!method)	method = "GET";
	this.object		= Ajax.requestObject();
	this.file		= file;
	this.include	= null;
	this.method		= (method == 'GET') ? method : 'POST';
	this.parameters	= '';
	this.loading	= function() { }
	this.finish		= function() { }
	this.error		= function() { alert('Data get Error!\r\nTry later.'); }
	this.post		= null;
}

Ajax.requestObject = function() {
	var oRequest = null;
	if ( typeof XMLHttpRequest != "undefined" ) oRequest = new XMLHttpRequest();
	if ( !oRequest && typeof ActiveXObject != "undefined" ) {
		try { oRequest = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) {
			try { oRequest = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (e2) {
				try { oRequest = new ActiveXObject("Msxml2.XMLHTTP.4.0"); }
				catch (e3) { req = null; }
			}
		}
	}
	if (!oRequest && window.createRequest) oRequest = window.createRequest();
	if (!oRequest) return null;
	return oRequest;
}

Ajax.prototype.onevent = function(name) {
	if (this.object) {
		this.object.open(this.method, this.file + this.parameters, true);
		if (this.method == 'POST') {
			try {
				this.object.setRequestHeader("Method", "POST " + this.file + this.parameters + " HTTP/1.1");
				this.object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			} catch(e) {}
		}
		this.object.onreadystatechange = new Function('if (' + name + '.object.readyState == 4) { if (' + name + '.object.status == 200) ' + name + '.finish(); else ' + name + '.error(); } else ' + name + '.loading();');
		this.object.send(this.post);
	}
}

Ajax.explodeXML = function(XMLtext, tag) {
	var oREG = new RegExp('<' + tag + '[^>]*>(.+?)</' + tag + '>', 'ig');
	var tags = XMLtext.match(oREG);
	var value = [];
	var temp;
	if (tags) {
		for (var i = 0; i < tags.length; i++) {
			temp = tags[i].replace(oREG, "$1");
			if (temp) value.push(temp);
		}
	}
	return value;
}

Ajax.removeCdata = function(text) {
	var oREG = new RegExp('<\\!\\[CDATA\\[(.+?)\\]\\]\>', 'ig');
	return text.replace(oREG, "$1");
}

Ajax.replaceNewlines = function(text) {
	var oREG = new RegExp('<nl\\s*\\/>', 'ig');
	return text.replace(oREG, '\r\n');
}

Ajax.nocash = function() {
	return Math.round(Math.random() * (new Date).valueOf());
}