function zjx(file)
{
	this.zjxBError = "Yeehhh!!! Browser Sux!!! Change It!\n";
	this.rFile = file;
	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = false;
	this.execute = false;
	this.loading_fired = 0;
	this.LoadingMes = "";
	this.Loading = true;
	this.otherClass = "";
	this.otherId = "";
  //      this.xmlhttp = false;
	this.element = "";
	this.onLoading = function() {
//		if(this.Loading)
//			document.getElementById('loading-layer').style.display="block";
//		else
//			document.getElementById(this.otherId).className = this.otherClass + "_s";
	};
	this.onLoaded = function() {
/*
		if(this.Loading)
		{
			document.getElementById('loading-layer').style.display="none";
		}
		else
			document.getElementById(this.otherId).className = this.otherClass + "_h";
*/
	};
	this.onInteractive = function() { };
	this.onCompletion = function() { 
//		if(this.Loading)
//		{
//			document.getElementById('loading-layer').style.display="none";
//		}
//		else
//			document.getElementById(this.otherId).className = this.otherClass + "_h";
	};
	this.onError = function() { };
	this.onFail = function() { };

//		if ( LoadingMes )
//		{
//			document.getElementById( 'loading-layer-text' ).innerHTML = message;
//		}


	this.createZJX = function() 
	{
		var req = null;
	        if (window.XMLHttpRequest) 
		{
			req = new XMLHttpRequest();
			if (req.overrideMimeType)
			{
				req.overrideMimeType('text/xml');
			}
		} 
		else if (window.ActiveXObject) 
		{
			try 
			{
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) 
			{
                		try 
				{
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch (err) 
				{
					req = null;
				}
			}
		}
	        if (!req) 
		{
			alert(this.zjxBError);
			return false;
	        }
		return req;

	};
	
	this.setVar = function(name, value)
	{
		if (this.URLString.length < 3)
		{
			this.URLString = name + "=" + value;
		} 
		else 
		{
			this.URLString += "&" + name + "=" + value;
		}
	}
	
	this.encVar = function(name, value)
	{
		var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
		return varString;
	}
	
	this.encodeURLString = function(string)
	{
		varArray = string.split('&');
		for (i = 0; i < varArray.length; i++)
		{
			urlVars = varArray[i].split('=');
			if (urlVars[0].indexOf('amp;') != -1)
			{
				urlVars[0] = urlVars[0].substring(4);
			}
			varArray[i] = this.encVar(urlVars[0],urlVars[1]);
		}
		return varArray.join('&');
	}

	this.encodeVAR = function(url)
	{
		url = url.toString();
		var regcheck = url.match(/[\x90-\xFF]/g);
	
		if ( regcheck )
		{
			for (var i = 0; i < i.length; i++)
			{
				url = url.replace(regcheck[i], '%u00' + (regcheck[i].charCodeAt(0) & 0xFF).toString(16).toUpperCase());
			}
		}

		return escape(url).replace(/\+/g, "%2B");
	}
	
	this.runResponse = function()
	{
		eval(this.response);
	}


	this.runZJX = function()
	{
		var xmlhttp;
		xmlhttp = this.createZJX();

		this.responseStatus = new Array(2);
		if(!xmlhttp && this.zjxBError)
		{ 
			alert(this.zjxBError); 
		} 
		else 
		{
			if (this.encodeURIString)
			{
				var timeval = new Date().getTime(); 
				this.URLString = this.encodeURLString(this.URLString);
				this.setVar("rndval", timeval);
			}
			if (this.element) 
			{ 
				this.elementObj = document.getElementById(this.element); 
			}
			if (xmlhttp) 
			{
				var self = this;
				xmlhttp.onreadystatechange = function() 
				{ 

					switch (xmlhttp.readyState)
					{
						case 1:
							self.onLoading();
						break;
						case 2:
							self.onLoaded();
						break;
						case 3:
							self.onInteractive();
						break;
						case 4:
							self.response = xmlhttp.responseText;
							self.responseXML = xmlhttp.responseXML;
//							self.responseStatus[1] = zmlhttp.statusText;
							self.onCompletion();
							if(self.execute)
							{
								self.runResponse(); 
							}
							if (self.elementObj) 
							{
								var elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea")
								{
									if (xmlhttp.status != '200') 
									{
										alert('Access Error'); 
									}
									else
									{
										self.elementObj.value = self.response;
									}
								} 
								else 
								{
									if (xmlhttp.status != '200') 
									{
										alert('Access Error'); 
									} 
									else 
									{
										self.elementObj.innerHTML = self.response;
									}
								}
							}
							self.URLString = "";
						break;
					}
				}

//				xmlhttp.onreadystatechange = function() { this.statechangeZJX(xmlhttp,self); };
				if (this.method == "GET") 
				{
					var totalurlstring = this.rFile + "?" + this.URLString;
					xmlhttp.open(this.method, totalurlstring, true);
					xmlhttp.setRequestHeader('Accept-Charset', 'utf-8');
					xmlhttp.send(null);

				} 
				else if (this.method == "POST")
				{
					xmlhttp.open(this.method, this.rFile, true);
  					try 
					{
						xmlhttp.setRequestHeader("Method", "POST " + this.rFile + " HTTP/1.1");
						xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
						xmlhttp.setRequestHeader('Cache-Control','no-store, no-cache, must-revalidate');
						xmlhttp.setRequestHeader('Cache-Control','post-check=0, pre-check=0');
						xmlhttp.setRequestHeader('Pragma','no-cache');
//						xmlhttp.setRequestHeader("Content-type", "multipart/form-data; \ boundary=\"capitano\"");
						xmlhttp.setRequestHeader('Accept-Charset', 'utf-8');
					} 
					catch (e) {}
					xmlhttp.send(this.URLString);
				}
			}
		}
	};
}