function localAjax() {
	var self = this;
	var xmldoc;
	var param;
	var attr;
	var url;
	var method;
	var data;
	var async;

	this.CreateHttpRequestObject = function(param) {
		if (!param) { param = 'text/xml'; }
		var http_request=false;
		if (window.XMLHttpRequest) {
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) { http_request.overrideMimeType(param); }
		}
		else if (window.ActiveXObject) {
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {}
			}
		}
		return http_request;
	}
	this.lajax_ejs = function(param) {
		eval(param);
	}
	this.lajax_art = function(param) {
		 alert(param);
	}
	this.lajax_fwd = function(param) {
		document.location.href=param;
	}
	this.makeRequest = function(url,method,data,async) {
		var httpRequest=self.CreateHttpRequestObject();
		httpRequest.onreadystatechange = function() {
			if (httpRequest.readyState == 4) {
				if (httpRequest.status == 200) {
					var xmltmp = httpRequest.responseXML;
					if(xmltmp) {
						if(httpRequest.responseText=='') {
							return;
						}
						try {
							if(xmltmp.documentElement.tagName!='najax') {
								return 0;
							}
						}
						catch (e) {
							return 0;
						}
						self.ajaxResponse(xmltmp);
					}
				}
				else {
					if(httpRequest.status!=404) {
						setTimeout("lAjax.makeRequest('"+url+"','"+method+"','"+data+"','"+async+"')",5000);
					}
				}
			}
		};
		httpRequest.open(method, url, async);
		if(method=='POST') {
			httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		}
		httpRequest.send(data);
	}
	this.ajaxResponse = function(xmldoc) {
		var root = xmldoc.getElementsByTagName('najax')[0];
		for(var i=0;i<root.childNodes.length;i++) {
			switch(root.childNodes[i].getAttribute("act")) {
				case 'ejs':
				self.lajax_ejs(root.childNodes[i].childNodes[0].nodeValue);
				break
				case 'art':
				self.lajax_art(root.childNodes[i].childNodes[0].nodeValue);
				break
				case 'fwd':
				self.lajax_fwd(root.childNodes[i].childNodes[0].nodeValue);
				break
			}
		}
	}
}
var lAjax = new localAjax;
