function Return() {
	this.nCode = 0;
	this.getCode = function () {
		return this.nCode;
	};
	this.setCode = function (a) {
		this.nCode = a;
	};
	this.strText = "";
	this.getText = function () {
		return this.strText;
	};
	this.setText = function (a) {
		this.strText = a;
	};
	this.strInfo = "";
	this.getInfo = function () {
		return this.strInfo;
	};
	this.setInfo = function (a) {
		this.strInfo = a;
	};
}
function HttpClient(c) {
	this.strServletURL = c;
	this.SERVICENAME_KEY = "strServiceName";
	this.TRANSNAME_KEY = "strTransName";
	this.getServletURL = function () {
		return this.strServletURL;
	};
	var d = function (a) {
		var b = a.responseXML;
		return b.documentElement;
	}, e = this, a = function (a, e, b) {
		if (e.test(a.name) == false) {
			throw "Invalid component's name";
			return -1;
		}
		var d = a.cdodatatype;
		if (typeof d == "undefined") {
			return -1;
		}
		var c = a.cdodataregex;
		if (typeof c != "undefined") {
			if (c.test(a.value) == false) {
				if (onVerifyFailed != null) {
					onVerifyFailed(a);
					return -1;
				}
			}
		}
		switch (d.toLowerCase()) {
		  case "byte":
			b.setByteValue(a.name, a.value);
			break;
		  case "short":
			b.setShortValue(a.name, a.value);
			break;
		  case "integer":
			b.setIntegerValue(a.name, a.value);
			break;
		  case "long":
			b.setLongValue(a.name, a.value);
			break;
		  case "float":
			b.setFloatValue(a.name, a.value);
			break;
		  case "double":
			b.setDoubleValue(a.name, a.value);
			break;
		  case "string":
			b.setStringValue(a.name, a.value);
			break;
		  case "date":
			b.setDateValue(a.name, a.value);
			break;
		  case "time":
			b.setTimeValue(a.name, a.value);
			break;
		  case "datetime":
			b.setDateTimeValue(a.name, a.value);
		}
		return 0;
	}, b = function (g, e) {
		for (var c = g.elements, f = /([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*/, b = 0; b < c.length; b = b + 1) {
			var d = c[b].tagName.toLowerCase();
			if (d == "input") {
				switch (c[b].type) {
				  case "checkbox":
				  case "radio":
					if (c[b].checked == true) {
						if (a(c[b], f, e) == -1) {
							return -1;
						}
					}
					break;
				  case "hidden":
				  case "password":
				  case "text":
					if (a(c[b], f, e) == -1) {
						return -1;
					}
				}
				continue;
			} else {
				if (d == "button" || d == "select" || d == "textarea") {
					if (a(c[b], f, e) == -1) {
						return -1;
					}
				}
			}
		}
		return 0;
	};
	this.submit = function (l, m, o, n, h) {
		var c = new CDO;
		if (b(o, c) != 0) {
			return null;
		}
		var a = null;
		if (window.XMLHttpRequest) {
			a = new XMLHttpRequest;
		} else {
			if (window.ActiveXObject) {
				a = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		var l = c.getStringValue("strServiceName"), m = c.getStringValue("strTransName"), f = "strServiceName=" + l + "&strTransName=" + m;
		try {
			var g = c.toXML(), i = encodeURI(this.strServletURL + "?" + f) + "&$$CDORequest$$=" + encodeURIComponent(g);
			if (i.getLength() > 1024 || !(h == true)) {
				a.open("POST", encodeURI(this.strServletURL + "?" + f), false);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				a.send("$$CDORequest$$=" + encodeURIComponent(g));
			} else {
				a.open("GET", i, false);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				!(h == true) && a.setRequestHeader("If-Modified-Since", "0");
				a.send(null);
			}
		}
		catch (k) {
			return null;
		}
		try {
			var j = a.responseXML.documentElement.childNodes, d = new CDO;
			d.fromXML(j[0].childNodes[0]);
			n.fromXML(j[1].childNodes[0]);
			var e = new Return;
			e.nCode = d.getIntegerValue("nCode");
			e.strInfo = d.getStringValue("strInfo");
			e.strText = d.getStringValue("strText");
		}
		catch (k) {
			return null;
		}
		return e;
	};
	this.loadXML = function (e, c) {
		var a = null;
		if (window.XMLHttpRequest) {
			a = new XMLHttpRequest;
		} else {
			if (window.ActiveXObject) {
				a = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		try {
			a.open("GET", e, false);
			a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
			!(c == true) && a.setRequestHeader("If-Modified-Since", "0");
			a.send(null);
		}
		catch (g) {
			return null;
		}
		var b = null;
		if (a.status == 200) {
			var f = d(a);
			b = new CDO;
			b.fromXML(f);
		}
		return b;
	};
	this.loadText = function (d, c) {
		var a = null;
		if (window.XMLHttpRequest) {
			a = new XMLHttpRequest;
		} else {
			if (window.ActiveXObject) {
				a = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		try {
			a.open("GET", d, false);
			a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
			!(c == true) && a.setRequestHeader("If-Modified-Since", "0");
			a.send(null);
		}
		catch (e) {
			return null;
		}
		var b = "";
		if (a.status == 200) {
			b = a.responseText;
		}
		return b;
	};
	this.handleTrans = function (d, m, g) {
		var a = null;
		if (window.XMLHttpRequest) {
			a = new XMLHttpRequest;
		} else {
			if (window.ActiveXObject) {
				a = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		var k = d.getStringValue("strServiceName"), l = d.getStringValue("strTransName"), e = "strServiceName=" + k + "&strTransName=" + l;
		try {
			var f = d.toXML(), h = encodeURI(this.strServletURL + "?" + e) + "&$$CDORequest$$=" + encodeURIComponent(f);
			if (h.getLength() > 1024 || !(g == true)) {
				a.open("POST", encodeURI(this.strServletURL + "?" + e), false);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				a.send("$$CDORequest$$=" + encodeURIComponent(f));
			} else {
				a.open("GET", h, false);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				!(g == true) && a.setRequestHeader("If-Modified-Since", "0");
				a.send(null);
			}
		}
		catch (j) {
			return null;
		}
		try {
			var i = a.responseXML.documentElement.childNodes, b = new CDO;
			b.fromXML(i[0].childNodes[0]);
			m.fromXML(i[1].childNodes[0]);
			var c = new Return;
			c.nCode = b.getIntegerValue("nCode");
			c.strInfo = b.getStringValue("strInfo");
			c.strText = b.getStringValue("strText");
		}
		catch (j) {
			return null;
		}
		return c;
	};
	this.throwTrans = function (b, e) {
		var a = null;
		if (window.XMLHttpRequest) {
			a = new XMLHttpRequest;
		} else {
			if (window.ActiveXObject) {
				a = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		var g = b.getStringValue("strServiceName"), h = b.getStringValue("strTransName"), c = "strServiceName=" + g + "&strTransName=" + h;
		try {
			var d = b.toXML(), f = encodeURI(this.strServletURL + "?" + c) + "&$$CDORequest$$=" + encodeURIComponent(d);
			if (f.getLength() > 1024 || !(e == true)) {
				a.open("POST", encodeURI(this.strServletURL + "?" + c), false);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				a.send("$$CDORequest$$=" + encodeURIComponent(d));
			} else {
				a.open("GET", f, true);
				a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
				!(e == true) && a.setRequestHeader("If-Modified-Since", "0");
				a.send(null);
			}
		}
		catch (i) {
		}
	};
	this.onVerifyFailed = null;
}


