if (typeof window != "undefined" && typeof window.nhn == "undefined") {
	window.nhn = new Object
}
if (typeof window != "undefined") {
	window.jindo = {}
} else {
	jindo = {}
}
jindo.$Jindo = function () {
	var cl = arguments.callee;
	var cc = cl._cached;
	if (cc) {
		return cc
	}
	if (! (this instanceof cl)) {
		return new cl()
	}
	if (!cc) {
		cl._cached = this
	}
	this.version = "1.3.2"
};
jindo.$ = function (sID) {
	var ret = new Array;

	var reg = /^<([a-z]+|h[1-5])>$/i;
	var reg2 = /^<([a-z]+|h[1-5])(\s+[^>]+)?>/i;
	for (var i = 0; i < arguments.length; i++) {
		el = arguments[i];
		if (typeof el == "string") {
			if (reg.test(el)) {
				el = document.createElement(RegExp.$1)
			} else {
				if (reg2.test(el)) {
					var p = {
						thead: "table",
						tbody: "table",
						tr: "tbody",
						td: "tr",
						dt: "dl",
						dd: "dl",
						li: "ul",
						legend: "fieldset"
					};
					var tag = RegExp.$1.toLowerCase();
					var parents = [];
					for (var j = 0; tag = p[tag]; j++) {
						var o = document.createElement(tag);
						if (j) {
							o.appendChild(parents[j - 1])
						}
						parents.push(o)
					}
					if (!parents[0]) {
						parents[0] = document.createElement("div")
					}
					var first = parents[0];
					jindo.$Element(first).html(el);
					for (el = first.firstChild; el; el = el.nextSibling) {
						if (el.nodeType == 1) {
							ret[ret.length] = el
						}
					}
				} else {
					el = document.getElementById(el)
				}
			}
		}
		if (el) {
			ret[ret.length] = el
		}
	}
	return ret.length > 1 ? ret : (ret[0] || null)
};
jindo.$Class = function (oDef) {
	function typeClass() {
		var t = this;
		var a = [];
		while (typeof t.$super != "undefined") {
			t.$super.$this = this;
			if (typeof t.$super.$init == "function") {
				a[a.length] = t
			}
			t = t.$super
		}
		for (var i = a.length - 1; i > -1; i--) {
			a[i].$super.$init.apply(a[i].$super, arguments)
		}
		if (typeof this.$init == "function") {
			this.$init.apply(this, arguments)
		}
	}
	if (typeof oDef.$static != "undefined") {
		var i = 0,
			x;
		for (x in oDef) {
			x == "$static" || i++
		}
		for (x in oDef.$static) {
			typeClass[x] = oDef.$static[x]
		}
		if (!i) {
			return oDef.$static
		}
		delete oDef.$static
	}
	typeClass.prototype = oDef;
	typeClass.prototype.constructor = typeClass;
	typeClass.extend = jindo.$Class.extend;
	return typeClass
};
jindo.$Class.extend = function (superClass) {
	this.prototype.$super = new Object;
	var superFunc = function (m, superClass, func) {
		if (m != "constructor" && func.toString().indexOf("$super") > -1) {
			var funcArg = func.toString().replace(/function\s*\(([^\)]*)[\w\W]*/g, "$1").split(",");
			var funcStr = func.toString().replace(/function\s*\(.*\)\s*\{/, "").replace(/this\.\$super/g, "this.$super.$super");
			funcStr = funcStr.substr(0, funcStr.length - 1);
			func = superClass[m] = new Function(funcArg, funcStr)
		}
		return function () {
			var f = this.$this[m];
			var t = this.$this;
			var r = (t[m] = func).apply(t, arguments);
			t[m] = f;
			return r
		}
	};
	for (var x in superClass.prototype) {
		if (typeof this.prototype[x] == "undefined" && x != "$init") {
			this.prototype[x] = superClass.prototype[x]
		}
		if (typeof superClass.prototype[x] == "function") {
			this.prototype.$super[x] = superFunc(x, superClass, superClass.prototype[x])
		} else {
			this.prototype.$super[x] = superClass.prototype[x]
		}
	}
	for (var x in superClass) {
		if (x == "prototype") {
			continue
		}
		this[x] = superClass[x]
	}
	return this
};
jindo.$Agent = function () {
	var cl = arguments.callee;
	var cc = cl._cached;
	if (cc) {
		return cc
	}
	if (! (this instanceof cl)) {
		return new cl
	}
	if (!cc) {
		cl._cached = this
	}
};
jindo.$Agent.prototype.navigator = function () {
	var info = new Object;
	var ver = -1;
	var u = navigator.userAgent;
	var v = navigator.vendor || "";

	function f(s, h) {
		return ((h || "").indexOf(s) > -1)
	}
	info.getName = function () {
		var name = "";
		for (x in info) {
			if (typeof info[x] == "boolean" && info[x]) {
				name = x
			}
		}
		return name
	};
	info.opera = (typeof window.opera != "undefined") || f("Opera", u);
	info.ie = !info.opera && f("MSIE", u);
	info.chrome = f("Chrome", u);
	info.safari = !info.chrome && f("Apple", v);
	info.firefox = f("Firefox", u);
	info.mozilla = f("Gecko", u) && !info.safari && !info.chrome && !info.firefox;
	info.camino = f("Camino", v);
	info.netscape = f("Netscape", u);
	info.omniweb = f("OmniWeb", u);
	info.icab = f("iCab", v);
	info.konqueror = f("KDE", v);
	try {
		if (info.ie) {
			ver = u.match(/(?:MSIE) ([0-9.]+)/)[1]
		} else {
			if (info.firefox || info.opera || info.omniweb) {
				ver = u.match(/(?:Firefox|Opera|OmniWeb)\/([0-9.]+)/)[1]
			} else {
				if (info.mozilla) {
					ver = u.match(/rv:([0-9.]+)/)[1]
				} else {
					if (info.safari) {
						ver = parseFloat(u.match(/Safari\/([0-9.]+)/)[1]);
						if (ver == 100) {
							ver = 1.1
						} else {
							ver = [1, 1.2, -1, 1.3, 2, 3][Math.floor(ver / 100)]
						}
					} else {
						if (info.icab) {
							ver = u.match(/iCab[ \/]([0-9.]+)/)[1]
						} else {
							if (info.chrome) {
								ver = u.match(/Chrome[ \/]([0-9.]+)/)[1]
							}
						}
					}
				}
			}
		}
		info.version = parseFloat(ver);
		if (isNaN(info.version)) {
			info.version = -1
		}
	} catch(e) {
		info.version = -1
	}
	jindo.$Agent.prototype.navigator = function () {
		return info
	};
	return info
};
jindo.$Agent.prototype.os = function () {
	var info = new Object;
	var u = navigator.userAgent;
	var p = navigator.platform;
	var f = function (s, h) {
		return (h.indexOf(s) > -1)
	};
	info.getName = function () {
		var name = "";
		for (x in info) {
			if (typeof info[x] == "boolean" && info[x]) {
				name = x
			}
		}
		return name
	};
	info.win = f("Win", p);
	info.mac = f("Mac", p);
	info.linux = f("Linux", p);
	info.win2000 = info.win && (f("NT 5.0", p) || f("2000", p));
	info.winxp = info.win && (f("NT 5.1", p) || f("Win32", p));
	info.xpsp2 = info.winxp && (f("SV1", u) || f("MSIE 7", u));
	info.vista = f("NT 6.0", p);
	info.win7 = f("NT 6.1", p);
	jindo.$Agent.prototype.os = function () {
		return info
	};
	return info
};
jindo.$Agent.prototype.flash = function () {
	var info = new Object;
	var p = navigator.plugins;
	var m = navigator.mimeTypes;
	var f = null;
	info.installed = false;
	info.version = -1;
	if (typeof p != "undefined" && p.length) {
		f = p["Shockwave Flash"];
		if (f) {
			info.installed = true;
			if (f.description) {
				info.version = parseFloat(f.description.match(/[0-9.]+/)[0])
			}
		}
		if (p["Shockwave Flash 2.0"]) {
			info.installed = true;
			info.version = 2
		}
	} else {
		if (typeof m != "undefined" && m.length) {
			f = m["application/x-shockwave-flash"];
			info.installed = (f && f.enabledPlugin)
		} else {
			for (var i = 10; i > 1; i--) {
				try {
					f = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
					info.installed = true;
					info.version = i;
					break
				} catch(e) {}
			}
		}
	}
	jindo.$Agent.prototype.flash = function () {
		return info
	};
	jindo.$Agent.prototype.info = jindo.$Agent.prototype.flash;
	return info
};
jindo.$Agent.prototype.silverlight = function () {
	var info = new Object;
	var p = navigator.plugins;
	var s = null;
	info.installed = false;
	info.version = -1;
	if (typeof p != "undefined" && p.length) {
		s = p["Silverlight Plug-In"];
		if (s) {
			info.installed = true;
			info.version = parseInt(s.description.split(".")[0]);
			if (s.description == "1.0.30226.2") {
				info.version = 2
			}
		}
	} else {
		try {
			s = new ActiveXObject("AgControl.AgControl");
			info.installed = true;
			if (s.isVersionSupported("2.0")) {
				info.version = 2
			} else {
				if (s.isVersionSupported("1.0")) {
					info.version = 1
				}
			}
		} catch(e) {}
	}
	jindo.$Agent.prototype.silverlight = function () {
		return info
	};
	return info
};
jindo.$A = function (array) {
	var cl = arguments.callee;
	if (typeof array == "undefined") {
		array = []
	}
	if (array instanceof cl) {
		return array
	}
	if (! (this instanceof cl)) {
		return new cl(array)
	}
	this._array = [];
	for (var i = 0; i < array.length; i++) {
		this._array[this._array.length] = array[i]
	}
};
jindo.$A.prototype.toString = function () {
	return this._array.toString()
};
jindo.$A.prototype.length = function (len, elem) {
	if (typeof len == "number") {
		var l = this._array.length;
		this._array.length = len;
		if (typeof elem != "undefined") {
			for (var i = l; i < len; i++) {
				this._array[i] = elem
			}
		}
		return this
	} else {
		return this._array.length
	}
};
jindo.$A.prototype.has = function (any) {
	return (this.indexOf(any) > -1)
};
jindo.$A.prototype.indexOf = function (any) {
	if (typeof this._array.indexOf != "undefined") {
		return this._array.indexOf(any)
	}
	for (var i = 0; i < this._array.length; i++) {
		if (this._array[i] == any) {
			return i
		}
	}
	return -1
};
jindo.$A.prototype.$value = function () {
	return this._array
};
jindo.$A.prototype.push = function (element1) {
	return this._array.push.apply(this._array, jindo.$A(arguments).$value())
};
jindo.$A.prototype.pop = function () {
	return this._array.pop()
};
jindo.$A.prototype.shift = function () {
	return this._array.shift()
};
jindo.$A.prototype.unshift = function (element1) {
	this._array.unshift.apply(this._array, jindo.$A(arguments).$value());
	return this._array.length
};
jindo.$A.prototype.forEach = function (callback, thisObject) {
	var arr = this._array;
	var errBreak = this.constructor.Break;
	var errContinue = this.constructor.Continue;

	function f(v, i, a) {
		try {
			callback.call(thisObject, v, i, a)
		} catch(e) {
			if (! (e instanceof errContinue)) {
				throw e
			}
		}
	}
	if (typeof this._array.forEach == "function") {
		try {
			this._array.forEach(f)
		} catch(e) {
			if (! (e instanceof errBreak)) {
				throw e
			}
		}
		return this
	}
	for (var i = 0; i < arr.length; i++) {
		try {
			f(arr[i], i, arr)
		} catch(e) {
			if (e instanceof errBreak) {
				break
			}
			throw e
		}
	}
	return this
};
jindo.$A.prototype.map = function (callback, thisObject) {
	var arr = this._array;
	var errBreak = this.constructor.Break;
	var errContinue = this.constructor.Continue;

	function f(v, i, a) {
		try {
			return callback.call(thisObject, v, i, a)
		} catch(e) {
			if (e instanceof errContinue) {
				return v
			} else {
				throw e
			}
		}
	}
	if (typeof this._array.map == "function") {
		try {
			this._array = this._array.map(f)
		} catch(e) {
			if (! (e instanceof errBreak)) {
				throw e
			}
		}
		return this
	}
	for (var i = 0; i < this._array.length; i++) {
		try {
			arr[i] = f(arr[i], i, arr)
		} catch(e) {
			if (e instanceof errBreak) {
				break
			}
			throw e
		}
	}
	return this
};
jindo.$A.prototype.filter = function (callback, thisObject) {
	var ar = new Array;
	this.forEach(function (v, i, a) {
		if (callback.call(thisObject, v, i, a) === true) {
			ar[ar.length] = v
		}
	});
	return jindo.$A(ar)
};
jindo.$A.prototype.every = function (callback, thisObject) {
	if (typeof this._array.every != "undefined") {
		return this._array.every(callback, thisObject)
	}
	var result = true;
	this.forEach(function (v, i, a) {
		if (callback.call(thisObject, v, i, a) === false) {
			result = false;
			jindo.$A.Break()
		}
	});
	return result
};
jindo.$A.prototype.some = function (callback, thisObject) {
	if (typeof this._array.some != "undefined") {
		return this._array.some(callback, thisObject)
	}
	var result = false;
	this.forEach(function (v, i, a) {
		if (callback.call(thisObject, v, i, a) === true) {
			result = true;
			jindo.$A.Break()
		}
	});
	return result
};
jindo.$A.prototype.refuse = function (value) {
	var a = jindo.$A(arguments);
	return this.filter(function (v, i) {
		return !a.has(v)
	})
};
jindo.$A.prototype.slice = function (start, end) {
	var a = this._array.slice.call(this._array, start, end);
	return jindo.$A(a)
};
jindo.$A.prototype.splice = function (index, howMany) {
	var a = this._array.splice.apply(this._array, arguments);
	return jindo.$A(a)
};
jindo.$A.prototype.shuffle = function () {
	this._array.sort(function (a, b) {
		return Math.random() > Math.random() ? 1 : -1
	});
	return this
};
jindo.$A.prototype.unique = function () {
	var a = this._array,
		b = [],
		l = a.length;
	var i, j;
	for (i = 0; i < l; i++) {
		for (j = 0; j < b.length; j++) {
			if (a[i] == b[j]) {
				break
			}
		}
		if (j >= b.length) {
			b[j] = a[i]
		}
	}
	this._array = b;
	return this
};
jindo.$A.prototype.reverse = function () {
	this._array.reverse();
	return this
};
jindo.$A.prototype.empty = function () {
	return this.length(0)
};
jindo.$A.Break = function () {
	if (! (this instanceof arguments.callee)) {
		throw new arguments.callee
	}
};
jindo.$A.Continue = function () {
	if (! (this instanceof arguments.callee)) {
		throw new arguments.callee
	}
};
jindo.$Ajax = function (url, option) {
	var cl = arguments.callee;
	if (! (this instanceof cl)) {
		return new cl(url, option)
	}
	function _getXHR() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest()
		} else {
			if (ActiveXObject) {
				try {
					return new ActiveXObject("MSXML2.XMLHTTP")
				} catch(e) {
					return new ActiveXObject("Microsoft.XMLHTTP")
				}
				return null
			}
		}
	}
	var loc = location.toString();
	var domain = "";
	try {
		domain = loc.match(/^https?:\/\/([a-z0-9_\-\.]+)/i)[1]
	} catch(e) {}
	this._url = url;
	this._options = new Object;
	this._headers = new Object;
	this._options = {
		type: "xhr",
		method: "post",
		proxy: "",
		timeout: 0,
		onload: function (req) {},
		onerror: null,
		ontimeout: function (req) {},
		jsonp_charset: "utf-8",
		callbackid: ""
	};
	this.option(option);
	var _opt = this._options;
	_opt.type = _opt.type.toLowerCase();
	_opt.method = _opt.method.toLowerCase();
	if (typeof window.__jindo2_callback == "undefined") {
		window.__jindo2_callback = new Array()
	}
	switch (_opt.type) {
	case "get":
	case "post":
		_opt.method = _opt.type;
		_opt.type = "xhr";
	case "xhr":
		this._request = _getXHR();
		break;
	case "flash":
		this._request = new jindo.$Ajax.SWFRequest();
		break;
	case "jsonp":
		_opt.method = "get";
		this._request = new jindo.$Ajax.JSONPRequest();
		this._request.charset = _opt.jsonp_charset;
		this._request.callbackid = _opt.callbackid;
		break;
	case "iframe":
		this._request = new jindo.$Ajax.FrameRequest();
		this._request._proxy = _opt.proxy;
		break
	}
};
jindo.$Ajax.prototype._onload = function () {
	if (this._request.readyState == 4) {
		if (this._request.status != 200 && typeof this._options.onerror == "function") {
			this._options.onerror(jindo.$Ajax.Response(this._request))
		} else {
			this._options.onload(jindo.$Ajax.Response(this._request))
		}
	}
};
jindo.$Ajax.prototype.request = function (oData) {
	var t = this;
	var req = this._request;
	var opt = this._options;
	var data, v, a = [],
		data = "";
	var _timer = null;
	if (typeof oData == "undefined" || !oData) {
		data = null
	} else {
		for (var k in oData) {
			v = oData[k];
			if (typeof v == "function") {
				v = v()
			}
			a[a.length] = k + "=" + encodeURIComponent(v)
		}
		data = a.join("&")
	}
	req.open(opt.method.toUpperCase(), this._url, true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	req.setRequestHeader("charset", "utf-8");
	for (var x in this._headers) {
		if (typeof this._headers[x] == "function") {
			continue
		}
		req.setRequestHeader(x, String(this._headers[x]))
	}
	if (typeof req.onload != "undefined") {
		req.onload = function (rq) {
			clearTimeout(_timer);
			t._onload(rq)
		}
	} else {
		req.onreadystatechange = function (rq) {
			clearTimeout(_timer);
			t._onload(rq)
		}
	}
	if (opt.timeout > 0) {
		_timer = setTimeout(function () {
			try {
				req.abort()
			} catch(e) {}
			opt.ontimeout(req)
		},
		opt.timeout * 1000)
	}
	req.send(data);
	return this
};
jindo.$Ajax.prototype.abort = function () {
	this._request.abort();
	return this
};
jindo.$Ajax.prototype.option = function (name, value) {
	if (typeof name == "undefined") {
		return ""
	}
	if (typeof name == "string") {
		if (typeof value == "undefined") {
			return this._options[name]
		}
		this._options[name] = value;
		return this
	}
	try {
		for (var x in name) {
			this._options[x] = name[x]
		}
	} catch(e) {}
	return this
};
jindo.$Ajax.prototype.header = function (name, value) {
	if (typeof name == "undefined") {
		return ""
	}
	if (typeof name == "string") {
		if (typeof value == "undefined") {
			return this._headers[name]
		}
		this._headers[name] = value;
		return this
	}
	try {
		for (var x in name) {
			this._headers[x] = name[x]
		}
	} catch(e) {}
	return this
};
jindo.$Ajax.Response = function (req) {
	if (this === jindo.$Ajax) {
		return new jindo.$Ajax.Response(req)
	}
	this._response = req
};
jindo.$Ajax.Response.prototype.xml = function () {
	return this._response.responseXML
};
jindo.$Ajax.Response.prototype.text = function () {
	return this._response.responseText
};
jindo.$Ajax.Response.prototype.status = function () {
	return this._response.status
};
jindo.$Ajax.Response.prototype.readyState = function () {
	return this._response.readyState
};
jindo.$Ajax.Response.prototype.json = function () {
	if (this._response.responseJSON) {
		return this._response.responseJSON
	} else {
		if (this._response.responseText) {
			try {
				return eval("(" + this._response.responseText + ")")
			} catch(e) {
				return {}
			}
		}
	}
	return {}
};
jindo.$Ajax.Response.prototype.header = function (name) {
	if (typeof name == "string") {
		return this._response.getResponseHeader(name)
	}
	return this._response.getAllResponseHeaders()
};
jindo.$Ajax.RequestBase = jindo.$Class({
	_headers: {},
	_respHeaders: {},
	_respHeaderString: "",
	callbackid: "",
	responseXML: null,
	responseJSON: null,
	responseText: "",
	status: 404,
	readyState: 0,
	$init: function () {},
	onload: function () {},
	abort: function () {},
	open: function () {},
	send: function () {},
	setRequestHeader: function (sName, sValue) {
		this._headers[sName] = sValue
	},
	getResponseHeader: function (sName) {
		return this._respHeaders[sName] || ""
	},
	getAllResponseHeaders: function () {
		return this._respHeaderString
	},
	_getCallbackInfo: function () {
		var id = "";
		if (this.callbackid != "") {
			var idx = 0;
			do {
				id = "$" + this.callbackid + "_" + idx;
				idx++
			} while (window.__jindo2_callback[id])
		} else {
			do {
				id = "$" + Math.floor(Math.random() * 10000)
			} while (window.__jindo2_callback[id])
		}
		return {
			id: id,
			name: "window.__jindo2_callback." + id
		}
	}
});
jindo.$Ajax.JSONPRequest = jindo.$Class({
	charset: "utf-8",
	_script: null,
	_onerror: null,
	_callback: function (data) {
		if (this._onerror) {
			clearTimeout(this._onerror);
			this._onerror = null
		}
		var self = this;
		this.responseJSON = data;
		this.onload(this);
		setTimeout(function () {
			self.abort()
		},
		10)
	},
	abort: function () {
		if (this._script) {
			try {
				this._script.parentNode.removeChild(this._script)
			} catch(e) {}
		}
	},
	open: function (method, url) {
		this.responseJSON = null;
		this._url = url
	},
	send: function (data) {
		var t = this;
		var info = this._getCallbackInfo();
		var head = document.getElementsByTagName("head")[0];
		this._script = jindo.$("<script>");
		this._script.type = "text/javascript";
		this._script.charset = this.charset;
		if (head) {
			head.appendChild(this._script)
		} else {
			if (document.body) {
				document.body.appendChild(this._script)
			}
		}
		window.__jindo2_callback[info.id] = function (data) {
			try {
				t.readyState = 4;
				t.status = 200;
				t._callback(data)
			} finally {
				delete window.__jindo2_callback[info.id]
			}
		};
		var agent = jindo.$Agent();
		if (agent.navigator().ie || agent.navigator().opera) {
			this._script.onreadystatechange = function () {
				if (this.readyState == "loaded") {
					if (!t.responseJSON) {
						t.readyState = 4;
						t.status = 500;
						t._onerror = setTimeout(function () {
							t._callback(null)
						},
						200)
					}
					this.onreadystatechange = null
				}
			}
		} else {
			this._script.onload = function () {
				if (!t.responseJSON) {
					t.readyState = 4;
					t.status = 500;
					t._onerror = setTimeout(function () {
						t._callback(null)
					},
					200)
				}
				this.onload = null;
				this.onerror = null
			};
			this._script.onerror = function () {
				if (!t.responseJSON) {
					t.readyState = 4;
					t.status = 404;
					t._onerror = setTimeout(function () {
						t._callback(null)
					},
					200)
				}
				this.onerror = null;
				this.onload = null
			}
		}
		this._script.src = this._url + "?_callback=" + info.name + "&" + data
	}
}).extend(jindo.$Ajax.RequestBase);
jindo.$Ajax.SWFRequest = jindo.$Class({
	_callback: function (success, data) {
		this.readyState = 4;
		if (success) {
			if (typeof data == "string") {
				try {
					this.responseText = decodeURIComponent(data);
					this.status = 200
				} catch(e) {}
			}
			this.onload(this)
		}
	},
	open: function (method, url) {
		var re = /https?:\/\/([a-z0-9_\-\.]+)/i;
		this._url = url;
		this._method = method
	},
	send: function (data) {
		this.responseXML = false;
		this.responseText = "";
		var t = this;
		var dat = {};
		var info = this._getCallbackInfo();
		var swf = window.document[jindo.$Ajax.SWFRequest._tmpId];
		var header = [];

		function f(arg) {
			switch (typeof arg) {
			case "string":
				return '"' + arg.replace(/\"/g, '\\"') + '"';
				break;
			case "number":
				return arg;
				break;
			case "object":
				var ret = "",
					arr = [];
				if (arg instanceof Array) {
					for (var i = 0; i < arg.length; i++) {
						arr[i] = f(arg[i])
					}
					ret = "[" + arr.join(",") + "]"
				} else {
					for (var x in arg) {
						arr[arr.length] = f(x) + ":" + f(arg[x])
					}
					ret = "{" + arr.join(",") + "}"
				}
				return ret;
			default:
				return '""'
			}
		}
		data = (data || "").split("&");
		for (var i = 0; i < data.length; i++) {
			pos = data[i].indexOf("=");
			key = data[i].substring(0, pos);
			val = data[i].substring(pos + 1);
			dat[key] = decodeURIComponent(val)
		}
		window.__jindo2_callback[info.id] = function (success, data) {
			try {
				t._callback(success, data)
			} finally {
				delete window.__jindo2_callback[info.id]
			}
		};
		swf.requestViaFlash(f({
			url: this._url,
			type: this._method,
			data: dat,
			charset: "UTF-8",
			callback: info.name,
			headers_json: this._headers
		}))
	}
}).extend(jindo.$Ajax.RequestBase);
jindo.$Ajax.SWFRequest.write = function (swf_path) {
	if (typeof swf_path == "undefined") {
		swf_path = "./ajax.swf"
	}
	jindo.$Ajax.SWFRequest._tmpId = "tmpSwf" + (new Date).getMilliseconds() + Math.floor(Math.random() * 100000);
	document.write('<div style="position:absolute;top:-1000px;left:-1000px"><object id="' + jindo.$Ajax.SWFRequest._tmpId + '" width="1" height="1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="' + swf_path + '"><param name = "allowScriptAccess" value = "always" /><embed name="' + jindo.$Ajax.SWFRequest._tmpId + '" src="' + swf_path + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="1" height="1" allowScriptAccess="always" swLiveConnect="true"></embed></object></div>')
};
jindo.$Ajax.FrameRequest = jindo.$Class({
	_frame: null,
	_proxy: "",
	_domain: "",
	_callback: function (id, data, header) {
		var self = this;
		this.readyState = 4;
		this.status = 200;
		this.responseText = data;
		this._respHeaderString = header;
		header.replace(/^([\w\-]+)\s*:\s*(.+)$/m, function ($0, $1, $2) {
			self._respHeaders[$1] = $2
		});
		this.onload(this);
		setTimeout(function () {
			self.abort()
		},
		10)
	},
	abort: function () {
		if (this._frame) {
			try {
				this._frame.parentNode.removeChild(this._frame)
			} catch(e) {}
		}
	},
	open: function (method, url) {
		var re = /https?:\/\/([a-z0-9_\-\.]+)/i;
		var dom = document.location.toString().match(re);
		this._method = method;
		this._url = url;
		this._remote = String(url).match(/(https?:\/\/[a-z0-9_\-\.]+)(:[0-9]+)?/i)[0];
		this._frame = null;
		this._domain = (dom[1] != document.domain) ? document.domain : ""
	},
	send: function (data) {
		this.responseXML = "";
		this.responseText = "";
		var t = this;
		var re = /https?:\/\/([a-z0-9_\-\.]+)/i;
		var info = this._getCallbackInfo();
		var url = this._remote + "/ajax_remote_callback.html?method=" + this._method;
		var header = new Array;
		window.__jindo2_callback[info.id] = function (id, data, header) {
			try {
				t._callback(id, data, header)
			} finally {
				delete window.__jindo2_callback[info.id]
			}
		};
		for (var x in this._headers) {
			header[header.length] = "'" + x + "':'" + this._headers[x] + "'"
		}
		header = "{" + header.join(",") + "}";
		url += "&id=" + info.id;
		url += "&header=" + encodeURIComponent(header);
		url += "&proxy=" + encodeURIComponent(this._proxy);
		url += "&domain=" + this._domain;
		url += "&url=" + encodeURIComponent(this._url.replace(re, ""));
		url += "#" + encodeURIComponent(data);
		var fr = this._frame = jindo.$("<iframe>");
		fr.style.position = "absolute";
		fr.style.visibility = "hidden";
		fr.style.width = "1px";
		fr.style.height = "1px";
		var body = document.body || document.documentElement;
		if (body.firstChild) {
			body.insertBefore(fr, body.firstChild)
		} else {
			body.appendChild(fr)
		}
		fr.src = url
	}
}).extend(jindo.$Ajax.RequestBase);
jindo.$H = function (hashObject) {
	var cl = arguments.callee;
	if (typeof hashObject == "undefined") {
		hashObject = new Object
	}
	if (hashObject instanceof cl) {
		return hashObject
	}
	if (! (this instanceof cl)) {
		return new cl(hashObject)
	}
	this._table = {};
	for (var k in hashObject) {
		if (this._table[k] == hashObject[k]) {
			continue
		}
		this._table[k] = hashObject[k]
	}
};
jindo.$H.prototype.$value = function () {
	return this._table
};
jindo.$H.prototype.$ = function (key, value) {
	if (typeof value == "undefined") {
		return this._table[key]
	}
	this._table[key] = value;
	return this
};
jindo.$H.prototype.length = function () {
	var i = 0;
	for (var k in this._table) {
		if (typeof Object.prototype[k] != "undeifned" && Object.prototype[k] === this._table[k]) {
			continue
		}
		i++
	}
	return i
};
jindo.$H.prototype.forEach = function (callback, thisObject) {
	var t = this._table;
	var h = this.constructor;
	for (var k in t) {
		if (!t.propertyIsEnumerable(k)) {
			continue
		}
		try {
			callback.call(thisObject, t[k], k, t)
		} catch(e) {
			if (e instanceof h.Break) {
				break
			}
			if (e instanceof h.Continue) {
				continue
			}
		}
	}
	return this
};
jindo.$H.prototype.filter = function (callback, thisObject) {
	var h = jindo.$H();
	this.forEach(function (v, k, o) {
		if (callback.call(thisObject, v, k, o) === true) {
			h.add(k, v)
		}
	});
	return h
};
jindo.$H.prototype.map = function (callback, thisObject) {
	var t = this._table;
	this.forEach(function (v, k, o) {
		t[k] = callback.call(thisObject, v, k, o)
	});
	return this
};
jindo.$H.prototype.add = function (key, value) {
	if (this.hasKey(key)) {
		return null
	}
	this._table[key] = value;
	return this
};
jindo.$H.prototype.remove = function (key) {
	if (typeof this._table[key] == "undefined") {
		return null
	}
	var val = this._table[key];
	delete this._table[key];
	return val
};
jindo.$H.prototype.search = function (value) {
	var result = false;
	this.forEach(function (v, k, o) {
		if (v === value) {
			result = k;
			jindo.$H.Break()
		}
	});
	return result
};
jindo.$H.prototype.hasKey = function (key) {
	var result = false;
	return (typeof this._table[key] != "undefined")
};
jindo.$H.prototype.hasValue = function (value) {
	return (this.search(value) !== false)
};
jindo.$H.prototype.sort = function () {
	var o = new Object;
	var a = this.values();
	var k = false;
	a.sort();
	for (var i = 0; i < a.length; i++) {
		k = this.search(a[i]);
		o[k] = a[i];
		delete this._table[k]
	}
	this._table = o;
	return this
};
jindo.$H.prototype.ksort = function () {
	var o = new Object;
	var a = this.keys();
	a.sort();
	for (var i = 0; i < a.length; i++) {
		o[a[i]] = this._table[a[i]]
	}
	this._table = o;
	return this
};
jindo.$H.prototype.keys = function () {
	var keys = new Array;
	for (var k in this._table) {
		keys.push(k)
	}
	return keys
};
jindo.$H.prototype.values = function () {
	var values = [];
	for (var k in this._table) {
		values[values.length] = this._table[k]
	}
	return values
};
jindo.$H.prototype.toQueryString = function () {
	var buf = [],
		val = null,
		idx = 0;
	for (var k in this._table) {
		if (typeof(val = this._table[k]) == "object" && val.constructor == Array) {
			for (i = 0; i < val.length; i++) {
				buf[buf.length] = encodeURIComponent(k) + "[]=" + encodeURIComponent(val[i] + "")
			}
		} else {
			buf[buf.length] = encodeURIComponent(k) + "=" + encodeURIComponent(this._table[k] + "")
		}
	}
	return buf.join("&")
};
jindo.$H.prototype.empty = function () {
	var keys = this.keys();
	for (var i = 0; i < keys.length; i++) {
		delete this._table[keys[i]]
	}
	return this
};
jindo.$H.Break = function () {
	if (! (this instanceof arguments.callee)) {
		throw new arguments.callee
	}
};
jindo.$H.Continue = function () {
	if (! (this instanceof arguments.callee)) {
		throw new arguments.callee
	}
};
jindo.$Json = function (sObject) {
	var cl = arguments.callee;
	if (typeof sObject == "undefined") {
		sObject = new Object
	}
	if (sObject instanceof cl) {
		return sObject
	}
	if (! (this instanceof cl)) {
		return new cl(sObject)
	}
	if (typeof sObject == "string") {
		try {
			sObject = new Function("return " + sObject)()
		} catch(e) {
			sObject = new Object
		}
	}
	this._object = sObject
};
jindo.$Json.fromXML = function (sXML) {
	var o = new Object;
	var re = /\s*<(\/?[\w:\-]+)((?:\s+[\w:\-]+\s*=\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'))*)\s*((?:\/>)|(?:><\/\1>|\s*))|\s*<!\[CDATA\[([\w\W]*?)\]\]>\s*|\s*>?([^<]*)/ig;
	var re2 = /^[0-9]+(?:\.[0-9]+)?$/;
	var ec = {
		"&amp;": "&",
		"&nbsp;": " ",
		"&quot;": '"',
		"&lt;": "<",
		"&gt;": ">"
	};
	var fg = {
		tags: ["/"],
		stack: [o]
	};
	var es = function (s) {
		return s.replace(/&[a-z]+;/g, function (m) {
			return (typeof ec[m] == "string") ? ec[m] : m
		})
	};
	var at = function (s, c) {
		s.replace(/([\w\:\-]+)\s*=\s*(?:"((?:\\"|[^"])*)"|'((?:\\'|[^'])*)')/g, function ($0, $1, $2, $3) {
			c[$1] = es(($2 ? $2.replace(/\\"/g, '"') : undefined) || ($3 ? $3.replace(/\\'/g, "'") : undefined))
		})
	};
	var em = function (o) {
		for (var x in o) {
			if (Object.prototype[x]) {
				continue
			}
			return false
		}
		return true
	};
	var cb = function ($0, $1, $2, $3, $4, $5) {
		var cur, cdata = "";
		var idx = fg.stack.length - 1;
		if (typeof $1 == "string" && $1) {
			if ($1.substr(0, 1) != "/") {
				var has_attr = (typeof $2 == "string" && $2);
				var closed = (typeof $3 == "string" && $3);
				var newobj = (!has_attr && closed) ? "" : {};
				cur = fg.stack[idx];
				if (typeof cur[$1] == "undefined") {
					cur[$1] = newobj;
					cur = fg.stack[idx + 1] = cur[$1]
				} else {
					if (cur[$1] instanceof Array) {
						var len = cur[$1].length;
						cur[$1][len] = newobj;
						cur = fg.stack[idx + 1] = cur[$1][len]
					} else {
						cur[$1] = [cur[$1], newobj];
						cur = fg.stack[idx + 1] = cur[$1][1]
					}
				}
				if (has_attr) {
					at($2, cur)
				}
				fg.tags[idx + 1] = $1;
				if (closed) {
					fg.tags.length--;
					fg.stack.length--
				}
			} else {
				fg.tags.length--;
				fg.stack.length--
			}
		} else {
			if (typeof $4 == "string" && $4) {
				cdata = $4
			} else {
				if (typeof $5 == "string" && $5) {
					cdata = es($5)
				}
			}
		}
		if (cdata.length > 0) {
			var par = fg.stack[idx - 1];
			var tag = fg.tags[idx];
			if (re2.test(cdata)) {
				cdata = parseFloat(cdata)
			} else {
				if (cdata == "true" || cdata == "false") {
					cdata = new Boolean(cdata)
				}
			}
			if (par[tag] instanceof Array) {
				var o = par[tag];
				if (typeof o[o.length - 1] == "object" && !em(o[o.length - 1])) {
					o[o.length - 1].$cdata = cdata;
					o[o.length - 1].toString = function () {
						return cdata
					}
				} else {
					o[o.length - 1] = cdata
				}
			} else {
				if (typeof par[tag] == "object" && !em(par[tag])) {
					par[tag].$cdata = cdata;
					par[tag].toString = function () {
						return cdata
					}
				} else {
					par[tag] = cdata
				}
			}
		}
	};
	sXML = sXML.replace(/<(\?|\!-)[^>]*>/g, "");
	sXML.replace(re, cb);
	return jindo.$Json(o)
};
jindo.$Json.prototype.get = function (sPath) {
	var o = this._object;
	var p = sPath.split("/");
	var re = /^([\w:\-]+)\[([0-9]+)\]$/;
	var stack = [
		[o]
	],
		cur = stack[0];
	var len = p.length,
		c_len, idx, buf, j, e;
	for (var i = 0; i < len; i++) {
		if (p[i] == "." || p[i] == "") {
			continue
		}
		if (p[i] == "..") {
			stack.length--
		} else {
			buf = [];
			idx = -1;
			c_len = cur.length;
			if (c_len == 0) {
				return []
			}
			if (re.test(p[i])) {
				idx = +RegExp.$2
			}
			for (j = 0; j < c_len; j++) {
				e = cur[j][p[i]];
				if (typeof e == "undefined") {
					continue
				}
				if (e instanceof Array) {
					if (idx > -1) {
						if (idx < e.length) {
							buf[buf.length] = e[idx]
						}
					} else {
						buf = buf.concat(e)
					}
				} else {
					if (idx == -1) {
						buf[buf.length] = e
					}
				}
			}
			stack[stack.length] = buf
		}
		cur = stack[stack.length - 1]
	}
	return cur
};
jindo.$Json.prototype.toString = function () {
	var func = {
		$: function ($) {
			if (typeof $ == "undefined") {
				return '""'
			}
			if (typeof $ == "boolean") {
				return $ ? "true" : "false"
			}
			if (typeof $ == "string") {
				return this.s($)
			}
			if (typeof $ == "number") {
				return $
			}
			if ($ instanceof Array) {
				return this.a($)
			}
			if ($ instanceof Object) {
				return this.o($)
			}
		},
		s: function (s) {
			var e = {
				'"': '\\"',
				"\\": "\\\\",
				"\n": "\\n",
				"\r": "\\r",
				"\t": "\\t"
			};
			var c = function (m) {
				return (typeof e[m] != "undefined") ? e[m] : m
			};
			return '"' + s.replace(/[\\"'\n\r\t]/g, c) + '"'
		},
		a: function (a) {
			var s = "[",
				c = "",
				n = a.length;
			for (var i = 0; i < n; i++) {
				if (typeof a[i] == "function") {
					continue
				}
				s += c + this.$(a[i]);
				if (!c) {
					c = ","
				}
			}
			return s + "]"
		},
		o: function (o) {
			var s = "{",
				c = "";
			for (var x in o) {
				if (typeof o[x] == "function") {
					continue
				}
				s += c + this.s(x) + ":" + this.$(o[x]);
				if (!c) {
					c = ","
				}
			}
			return s + "}"
		}
	};
	return func.$(this._object)
};
jindo.$Json.prototype.toXML = function () {
	var f = function ($, tag) {
		var t = function (s, at) {
			return "<" + tag + (at || "") + ">" + s + "</" + tag + ">"
		};
		switch (typeof $) {
		case "undefined":
		case "null":
			return t("");
		case "number":
			return t($);
		case "string":
			if ($.indexOf("<") < 0) {
				return t($.replace(/&/g, "&amp;"))
			} else {
				return t("<![CDATA[" + $ + "]]>")
			}
		case "boolean":
			return t(String($));
		case "object":
			var ret = "";
			if ($ instanceof Array) {
				var len = $.length;
				for (var i = 0; i < len; i++) {
					ret += f($[i], tag)
				}
			} else {
				var at = "";
				for (var x in $) {
					if (x == "$cdata" || typeof $[x] == "function") {
						continue
					}
					ret += f($[x], x)
				}
				if (tag) {
					ret = t(ret, at)
				}
			}
			return ret
		}
	};
	return f(this._object, "")
};
jindo.$Json.prototype.toObject = function () {
	return this._object
};
jindo.$Json.prototype.$value = jindo.$Json.prototype.toObject;
jindo.$Cookie = function () {
	var cl = arguments.callee;
	var cached = cl._cached;
	if (cl._cached) {
		return cl._cached
	}
	if (! (this instanceof cl)) {
		return new cl
	}
	if (typeof cl._cached == "undefined") {
		cl._cached = this
	}
};
jindo.$Cookie.prototype.keys = function () {
	var ca = document.cookie.split(";");
	var re = /^\s+|\s+$/g;
	var a = new Array;
	for (var i = 0; i < ca.length; i++) {
		a[a.length] = ca[i].substr(0, ca[i].indexOf("=")).replace(re, "")
	}
	return a
};
jindo.$Cookie.prototype.get = function (sName) {
	var ca = document.cookie.split(/\s*;\s*/);
	var re = new RegExp("^(\\s*" + sName + "\\s*=)");
	for (var i = 0; i < ca.length; i++) {
		if (re.test(ca[i])) {
			return unescape(ca[i].substr(RegExp.$1.length))
		}
	}
	return null
};
jindo.$Cookie.prototype.set = function (sName, sValue, nDays, sDomain, sPath) {
	var sExpire = "";
	if (typeof nDays == "number") {
		sExpire = ";expires=" + (new Date((new Date()).getTime() + nDays * 1000 * 60 * 60 * 24)).toGMTString()
	}
	if (typeof sDomain == "undefined") {
		sDomain = ""
	}
	if (typeof sPath == "undefined") {
		sPath = "/"
	}
	document.cookie = sName + "=" + escape(sValue) + sExpire + "; path=" + sPath + (sDomain ? "; domain=" + sDomain : "");
	return this
};
jindo.$Cookie.prototype.remove = function (sName, sDomain, sPath) {
	if (this.get(sName) != null) {
		this.set(sName, "", -1, sDomain, sPath)
	}
	return this
};
jindo.$Element = function (el) {
	var cl = arguments.callee;
	if (el && el instanceof cl) {
		return el
	}
	if (!jindo.$(el)) {
		return null
	}
	if (! (this instanceof cl)) {
		return new cl(el)
	}
	this._element = jindo.$(el);
	this.tag = (typeof this._element.tagName != "undefined") ? this._element.tagName.toLowerCase() : "";
	this._queue = new Array
};
jindo.$Element.prototype.$value = function () {
	return this._element
};
jindo.$Element.prototype.visible = function (bVisible) {
	if (typeof bVisible != "undefined") {
		this[bVisible ? "show" : "hide"]();
		return this
	}
	return (this.css("display") != "none")
};
jindo.$Element.prototype.show = function () {
	var s = this._element.style;
	var b = "block";
	var c = {
		p: b,
		div: b,
		form: b,
		h1: b,
		h2: b,
		h3: b,
		h4: b,
		ol: b,
		ul: b,
		fieldset: b,
		td: "table-cell",
		th: "table-cell",
		li: "list-item",
		table: "table",
		thead: "table-header-group",
		tbody: "table-row-group",
		tfoot: "table-footer-group",
		tr: "table-row",
		col: "table-column",
		colgroup: "table-column-group",
		caption: "table-caption",
		dl: b,
		dt: b,
		dd: b
	};
	try {
		if (typeof c[this.tag] == "string") {
			s.display = c[this.tag]
		} else {
			s.display = "inline"
		}
	} catch(e) {
		s.display = "block"
	}
	return this
};
jindo.$Element.prototype.hide = function () {
	this._element.style.display = "none";
	return this
};
jindo.$Element.prototype.toggle = function () {
	this[this.visible() ? "hide" : "show"]();
	return this
};
jindo.$Element.prototype.opacity = function (value) {
	var v, e = this._element,
		b = this.visible();
	value = parseFloat(value);
	if (!isNaN(value)) {
		value = Math.max(Math.min(value, 1), 0);
		if (typeof e.filters != "undefined") {
			value = Math.ceil(value * 100);
			if (typeof e.filters.alpha != "undefined") {
				e.filters.alpha.opacity = value
			} else {
				e.style.filter = (e.style.filter + " alpha(opacity=" + value + ")")
			}
		} else {
			e.style.opacity = value
		}
		return value
	}
	if (typeof e.filters != "undefined") {
		v = (typeof e.filters.alpha == "undefined") ? (b ? 100 : 0) : e.filters.alpha.opacity;
		v = v / 100
	} else {
		v = parseFloat(e.style.opacity);
		if (isNaN(v)) {
			v = b ? 1 : 0
		}
	}
	return v
};
jindo.$Element.prototype.appear = function (duration, callback) {
	var self = this;
	var op = this.opacity();
	if (!this.visible()) {
		op = 0
	}
	if (op == 1) {
		return this
	}
	try {
		clearTimeout(this._fade_timer)
	} catch(e) {}
	callback = callback || new Function;
	var step = (1 - op) / ((duration || 0.3) * 100);
	var func = function () {
		op += step;
		self.opacity(op);
		if (op >= 1) {
			callback(self)
		} else {
			self._fade_timer = setTimeout(func, 10)
		}
	};
	this.show();
	func();
	return this
};
jindo.$Element.prototype.disappear = function (duration, callback) {
	var self = this;
	var op = this.opacity();
	if (op == 0) {
		return this
	}
	try {
		clearTimeout(this._fade_timer)
	} catch(e) {}
	callback = callback || new Function;
	var step = op / ((duration || 0.3) * 100);
	var func = function () {
		op -= step;
		self.opacity(op);
		if (op <= 0) {
			self.hide();
			self.opacity(1);
			callback(self)
		} else {
			self._fade_timer = setTimeout(func, 10)
		}
	};
	func();
	return this
};
jindo.$Element.prototype.css = function (sName, sValue) {
	var e = this._element;
	if (sName == "opacity") {
		return typeof sValue == "undefined" ? this.opacity() : this.opacity(sValue)
	}
	if (typeof sName == "string") {
		var view;
		if (typeof sValue == "string" || typeof sValue == "number") {
			var obj = new Object;
			obj[sName] = sValue;
			sName = obj
		} else {
			if (e.currentStyle) {
				if (sName == "cssFloat") {
					sName = "styleFloat"
				}
				return e.currentStyle[sName] || e.style[sName]
			} else {
				if (window.getComputedStyle) {
					if (sName == "cssFloat") {
						sName = "float"
					}
					var d = e.ownerDocument || e.document || document;
					return d.defaultView.getComputedStyle(e, null).getPropertyValue(sName.replace(/([A-Z])/g, "-$1").toLowerCase()) || e.style[sName]
				} else {
					if (sName == "cssFloat" && /MSIE/.test(window.navigator.userAgent)) {
						sName = "styleFloat"
					}
					return e.style[sName]
				}
			}
			return null
		}
	}
	if (typeof jindo.$H != "undefined" && sName instanceof jindo.$H) {
		sName = sName.$value()
	}
	if (typeof sName == "object") {
		var v, type;
		for (var k in sName) {
			v = sName[k];
			type = (typeof v);
			if (type != "string" && type != "number") {
				continue
			}
			if (k == "cssFloat" && navigator.userAgent.indexOf("MSIE") > -1) {
				k = "styleFloat"
			}
			try {
				e.style[k] = v
			} catch(err) {
				if (k == "cursor" && v == "pointer") {
					e.style.cursor = "hand"
				} else {
					if (("#top#left#right#bottom#").indexOf(k + "#") > 0 && (type == "number" || !isNaN(parseInt(v)))) {
						e.style[k] = parseInt(v) + "px"
					}
				}
			}
		}
	}
	return this
};
jindo.$Element.prototype.attr = function (sName, sValue) {
	var e = this._element;
	if (typeof sName == "string") {
		if (typeof sValue != "undefined") {
			var obj = new Object;
			obj[sName] = sValue;
			sName = obj
		} else {
			if (sName == "class" || sName == "className") {
				return e.className
			}
			return e.getAttribute(sName)
		}
	}
	if (typeof jindo.$H != "undefined" && sName instanceof jindo.$H) {
		sName = sName.$value()
	}
	if (typeof sName == "object") {
		for (var k in sName) {
			if (typeof(sValue) != "undefined" && sValue === null) {
				e.removeAttribute(k)
			} else {
				e.setAttribute(k, sName[k])
			}
		}
	}
	return this
};
jindo.$Element.prototype.offset = function (nTop, nLeft) {
	var oEl = this._element;
	var oPhantom = null;
	if (typeof nTop == "number" && typeof nLeft == "number") {
		if (isNaN(parseInt(this.css("top")))) {
			this.css("top", 0)
		}
		if (isNaN(parseInt(this.css("left")))) {
			this.css("left", 0)
		}
		var oPos = this.offset();
		var oGap = {
			top: nTop - oPos.top,
			left: nLeft - oPos.left
		};
		oEl.style.top = parseInt(this.css("top")) + oGap.top + "px";
		oEl.style.left = parseInt(this.css("left")) + oGap.left + "px";
		return this
	}
	var bSafari = /Safari/.test(navigator.userAgent);
	var bIE = /MSIE/.test(navigator.userAgent);
	var fpSafari = function (oEl) {
		var oPos = {
			left: 0,
			top: 0
		};
		for (var oParent = oEl, oOffsetParent = oParent.offsetParent; oParent = oParent.parentNode;) {
			if (oParent.offsetParent) {
				oPos.left -= oParent.scrollLeft;
				oPos.top -= oParent.scrollTop
			}
			if (oParent == oOffsetParent) {
				oPos.left += oEl.offsetLeft + oParent.clientLeft;
				oPos.top += oEl.offsetTop + oParent.clientTop;
				if (!oParent.offsetParent) {
					oPos.left += oParent.offsetLeft;
					oPos.top += oParent.offsetTop
				}
				oOffsetParent = oParent.offsetParent;
				oEl = oParent
			}
		}
		return oPos
	};
	var fpOthers = function (oEl) {
		var oPos = {
			left: 0,
			top: 0
		};
		var oDoc = oEl.ownerDocument || oEl.document || document;
		var oHtml = oDoc.documentElement;
		var oBody = oDoc.body;
		if (oEl.getBoundingClientRect) {
			if (!oPhantom) {
				if (bIE && window.external) {
					oPhantom = {
						left: 2,
						top: 2
					};
					oBase = null
				} else {
					oPhantom = {
						left: 0,
						top: 0
					}
				}
			}
			var box = oEl.getBoundingClientRect();
			if (oEl !== oHtml && oEl !== oBody) {
				oPos.left = box.left - oPhantom.left;
				oPos.top = box.top - oPhantom.top;
				oPos.left += oHtml.scrollLeft || oBody.scrollLeft;
				oPos.top += oHtml.scrollTop || oBody.scrollTop
			}
		} else {
			if (oDoc.getBoxObjectFor) {
				var box = oDoc.getBoxObjectFor(oEl);
				var vpBox = oDoc.getBoxObjectFor(oHtml || oBody);
				oPos.left = box.screenX - vpBox.screenX;
				oPos.top = box.screenY - vpBox.screenY
			} else {
				for (var o = oEl; o; o = o.offsetParent) {
					oPos.left += o.offsetLeft;
					oPos.top += o.offsetTop
				}
				for (var o = oEl.parentNode; o; o = o.parentNode) {
					if (o.tagName == "BODY") {
						break
					}
					if (o.tagName == "TR") {
						oPos.top += 2
					}
					oPos.left -= o.scrollLeft;
					oPos.top -= o.scrollTop
				}
			}
		}
		return oPos
	};
	return (bSafari ? fpSafari : fpOthers)(oEl)
};
jindo.$Element.prototype.width = function (width) {
	if (typeof width == "number") {
		var e = this._element;
		e.style.width = width + "px";
		if (e.offsetWidth != width) {
			e.style.width = (width * 2 - e.offsetWidth) + "px"
		}
		return this
	}
	return this._element.offsetWidth
};
jindo.$Element.prototype.height = function (height) {
	if (typeof height == "number") {
		var e = this._element;
		e.style.height = height + "px";
		if (e.offsetHeight != height) {
			e.style.height = (height * 2 - e.offsetHeight) + "px"
		}
		return this
	}
	return this._element.offsetHeight
};
jindo.$Element.prototype.className = function (sClass) {
	var e = this._element;
	if (typeof sClass == "undefined") {
		return e.className
	}
	e.className = sClass;
	return this
};
jindo.$Element.prototype.hasClass = function (sClass) {
	return (" " + this._element.className + " ").indexOf(" " + sClass + " ") > -1
};
jindo.$Element.prototype.addClass = function (sClass) {
	var e = this._element;
	if (this.hasClass(sClass)) {
		return this
	}
	e.className = (e.className + " " + sClass).replace(/^\s+/, "");
	return this
};
jindo.$Element.prototype.removeClass = function (sClass) {
	var e = this._element;
	e.className = (e.className + " ").replace(sClass + " ", "").replace(/\s+$/, "");
	return this
};
jindo.$Element.prototype.toggleClass = function (sClass, sClass2) {
	sClass2 = sClass2 || "";
	if (this.hasClass(sClass)) {
		this.removeClass(sClass);
		if (sClass2) {
			this.addClass(sClass2)
		}
	} else {
		this.addClass(sClass);
		if (sClass2) {
			this.removeClass(sClass2)
		}
	}
	return this
};
jindo.$Element.prototype.text = function (sText) {
	var prop = (typeof this._element.innerText != "undefined") ? "innerText" : "textContent";
	if (this.tag == "textarea" || this.tag == "input") {
		prop = "value"
	}
	if (typeof sText == "string") {
		try {
			this._element[prop] = sText
		} catch(e) {
			return this.html(sText.replace(/&/g, "&amp;").replace(/</g, "&lt;"))
		}
		return this
	}
	return this._element[prop]
};
jindo.$Element.prototype.html = function (sHTML) {
	if (typeof sHTML == "string") {
		var oEl = this._element;
		var bBugAgent = jindo.$Agent().navigator().ie || (jindo.$Agent().navigator().firefox && !oEl.parentNode);
		if (bBugAgent) {
			var sId = "R" + new Date().getTime() + parseInt(Math.random() * 100000);
			var oDoc = oEl.ownerDocument || oEl.document || document;
			var oDummy;
			var sTag = oEl.tagName.toLowerCase();
			switch (sTag) {
			case "select":
			case "table":
				oDummy = jindo.$("<div>");
				oDummy.innerHTML = "<" + sTag + ' class="' + sId + '">' + sHTML + "</" + sTag + ">";
				break;
			case "tr":
			case "thead":
			case "tbody":
				oDummy = jindo.$("<div>");
				oDummy.innerHTML = "<table><" + sTag + ' class="' + sId + '">' + sHTML + "</" + sTag + "></table>";
				break;
			default:
				oEl.innerHTML = sHTML;
				break
			}
			if (oDummy) {
				var oFound;
				for (oFound = oDummy.firstChild; oFound; oFound = oFound.firstChild) {
					if (oFound.className == sId) {
						break
					}
				}
				if (oFound) {
					for (var oChild; oChild = oEl.firstChild;) {
						oChild.removeNode(true)
					}
					for (var oChild = oFound.firstChild; oChild; oChild = oFound.firstChild) {
						oEl.appendChild(oChild)
					}
					oDummy.removeNode && oDummy.removeNode(true)
				}
				oDummy = null
			}
		} else {
			oEl.innerHTML = sHTML
		}
		return this
	}
	return this._element.innerHTML
};
jindo.$Element.prototype.evalScripts = function (sHTML) {
	var aJS = [];
	sHTML = sHTML.replace(new RegExp("<script(\\s[^>]+)*>(.*?)<\/script>", "gi"), function (_, _, sPart) {
		aJS.push(sPart);
		return ""
	});
	eval(aJS.join("\n"));
	return this
};
jindo.$Element.prototype.outerHTML = function () {
	var e = this._element;
	if (typeof e.outerHTML != "undefined") {
		return e.outerHTML
	}
	var div = jindo.$("<div>");
	var par = e.parentNode;
	if (!par) {
		return e.innerHTML
	}
	par.insertBefore(div, e);
	div.style.display = "none";
	div.appendChild(e);
	var s = div.innerHTML;
	par.insertBefore(e, div);
	par.removeChild(div);
	return s
};
jindo.$Element.prototype.toString = jindo.$Element.prototype.outerHTML;
jindo.$Element.prototype.append = function (oElement) {
	var o = jindo.$Element(oElement).$value();
	this._element.appendChild(o);
	return jindo.$Element(o)
};
jindo.$Element.prototype.prepend = function (oElement) {
	var e = this._element;
	var o = jindo.$Element(oElement).$value();
	if (e.childNodes.length > 0) {
		e.insertBefore(o, e.childNodes[0])
	} else {
		e.appendChild(o)
	}
	return jindo.$Element(o)
};
jindo.$Element.prototype.replace = function (oElement) {
	var e = this._element;
	var o = jindo.$Element(oElement).$value();
	e.parentNode.insertBefore(o, e);
	e.parentNode.removeChild(e);
	return jindo.$Element(o)
};
jindo.$Element.prototype.appendTo = function (oElement) {
	var o = jindo.$Element(oElement).$value();
	o.appendChild(this._element);
	return this
};
jindo.$Element.prototype.prependTo = function (oElement) {
	var o = jindo.$Element(oElement).$value();
	if (o.childNodes.length > 0) {
		o.insertBefore(this._element, o.childNodes[0])
	} else {
		o.appendChild(this._element)
	}
	return this
};
jindo.$Element.prototype.before = function (oElement) {
	var o = jindo.$Element(oElement).$value();
	this._element.parentNode.insertBefore(o, this._element);
	return jindo.$Element(o)
};
jindo.$Element.prototype.after = function (oElement) {
	var o = this.before(oElement);
	o.before(this);
	return o
};
jindo.$Element.prototype.parent = function (pFunc, limit) {
	var e = this._element;
	var a = [],
		p = null;
	if (typeof pFunc == "undefined") {
		return jindo.$Element(e.parentNode)
	}
	if (typeof limit == "undefined" || limit == 0) {
		limit = -1
	}
	while (e.parentNode && limit--!=0) {
		p = jindo.$Element(e.parentNode);
		if (e.parentNode == document.documentElement) {
			break
		}
		if (!pFunc || (pFunc && pFunc(p))) {
			a[a.length] = p
		}
		e = e.parentNode
	}
	return a
};
jindo.$Element.prototype.child = function (pFunc, limit) {
	var e = this._element;
	var a = [],
		c = null,
		f = null;
	if (typeof pFunc == "undefined") {
		return jindo.$A(e.childNodes).filter(function (v) {
			return v.nodeType == 1
		}).map(function (v) {
			return jindo.$Element(v)
		}).$value()
	}
	if (typeof limit == "undefined" || limit == 0) {
		limit = -1
	}(f = function (el, lim) {
		var ch = null,
			o = null;
		for (var i = 0; i < el.childNodes.length; i++) {
			ch = el.childNodes[i];
			if (ch.nodeType != 1) {
				continue
			}
			o = jindo.$Element(el.childNodes[i]);
			if (!pFunc || (pFunc && pFunc(o))) {
				a[a.length] = o
			}
			if (lim != 0) {
				f(el.childNodes[i], lim - 1)
			}
		}
	})(e, limit - 1);
	return a
};
jindo.$Element.prototype.prev = function (pFunc) {
	var e = this._element;
	var a = [];
	var b = (typeof pFunc == "undefined");
	if (!e) {
		return b ? jindo.$Element(null) : a
	}
	do {
		e = e.previousSibling;
		if (!e || e.nodeType != 1) {
			continue
		}
		if (b) {
			return jindo.$Element(e)
		}
		if (!pFunc || pFunc(e)) {
			a[a.length] = jindo.$Element(e)
		}
	} while (e);
	return b ? jindo.$Element(e) : a
};
jindo.$Element.prototype.next = function (pFunc) {
	var e = this._element;
	var a = [];
	var b = (typeof pFunc == "undefined");
	if (!e) {
		return b ? jindo.$Element(null) : a
	}
	do {
		e = e.nextSibling;
		if (!e || e.nodeType != 1) {
			continue
		}
		if (b) {
			return jindo.$Element(e)
		}
		if (!pFunc || pFunc(e)) {
			a[a.length] = jindo.$Element(e)
		}
	} while (e);
	return b ? jindo.$Element(e) : a
};
jindo.$Element.prototype.first = function () {
	var el = this._element.firstElementChild || this._element.firstChild;
	if (!el) {
		return null
	}
	while (el && el.nodeType != 1) {
		el = el.nextSibling
	}
	return el ? jindo.$Element(el) : null
};
jindo.$Element.prototype.last = function () {
	var el = this._element.lastElementChild || this._element.lastChild;
	if (!el) {
		return null
	}
	while (el && el.nodeType != 1) {
		el = el.previousSibling
	}
	return el ? jindo.$Element(el) : null
};
jindo.$Element.prototype.isChildOf = function (element) {
	var e = this._element;
	var el = jindo.$Element(element).$value();
	while (e && e.parentNode) {
		e = e.parentNode;
		if (e == el) {
			return true
		}
	}
	return false
};
jindo.$Element.prototype.isParentOf = function (element) {
	var el = jindo.$Element(element).$value();
	while (el && el.parentNode) {
		el = el.parentNode;
		if (this._element == el) {
			return true
		}
	}
	return false
};
jindo.$Element.prototype.isEqual = function (element) {
	try {
		return (this._element === jindo.$Element(element).$value())
	} catch(e) {
		return false
	}
};
jindo.$Element.prototype.fireEvent = function (sEvent) {
	function IE(sEvent) {
		sEvent = (sEvent + "").toLowerCase();
		this._element.fireEvent("on" + sEvent);
		return this
	}
	function DOM2(sEvent) {
		var sType = "HTMLEvents";
		sEvent = (sEvent + "").toLowerCase();
		if (sEvent == "click" || sEvent.indexOf("mouse") == 0) {
			sType = "MouseEvents";
			if (sEvent == "mousewheel") {
				sEvent = "dommousescroll"
			}
		} else {
			if (sEvent.indexOf("key") == 0) {
				sType = "KeyEvents"
			}
		}
		var evt = document.createEvent(sType);
		evt.initEvent(sEvent, true, true);
		this._element.dispatchEvent(evt);
		return this
	}
	jindo.$Element.prototype.fireEvent = (typeof this._element.dispatchEvent != "undefined") ? DOM2 : IE;
	return this.fireEvent(sEvent)
};
jindo.$Element.prototype.empty = function () {
	this.html("");
	return this
};
jindo.$Element.prototype.leave = function () {
	var e = this._element;
	if (e.parentNode) {
		e.parentNode.removeChild(e)
	}
	return this
};
jindo.$Element.prototype.wrap = function (wrapper) {
	var e = this._element;
	wrapper = jindo.$(wrapper);
	if (e.parentNode) {
		e.parentNode.insertBefore(wrapper, e)
	}
	wrapper.appendChild(e);
	return this
};
jindo.$Element.prototype.ellipsis = function (stringTail) {
	stringTail = stringTail || "...";
	var txt = this.text();
	var len = txt.length;
	var cur_h = this.height();
	var i = 0;
	var h = this.text("A").height();
	if (cur_h < h * 1.5) {
		return this.text(txt)
	}
	cur_h = h;
	while (cur_h < h * 1.5) {
		i += Math.max(Math.ceil((len - i) / 2), 1);
		cur_h = this.text(txt.substring(0, i) + stringTail).height()
	}
	while (cur_h > h * 1.5) {
		i--;
		cur_h = this.text(txt.substring(0, i) + stringTail).height()
	}
};
jindo.$Element.prototype.indexOf = function (element) {
	try {
		var e = jindo.$Element(element).$value();
		var n = this._element.childNodes;
		var c = 0;
		var l = n.length;
		for (var i = 0; i < l; i++) {
			if (n[i].nodeType != 1) {
				continue
			}
			if (n[i] === e) {
				return c
			}
			c++
		}
	} catch(e) {}
	return -1
};
jindo.$Fn = function (func, thisObject) {
	var cl = arguments.callee;
	if (func instanceof cl) {
		return func
	}
	if (! (this instanceof cl)) {
		return new cl(func, thisObject)
	}
	this._events = [];
	this._tmpElm = null;
	this._key = null;
	if (typeof func == "function") {
		this._func = func;
		this._this = thisObject
	} else {
		if (typeof func == "string" && typeof thisObject == "string") {
			this._func = new Function(func, thisObject)
		}
	}
};
jindo.$Fn.prototype.$value = function () {
	return this._func
};
jindo.$Fn.prototype.bind = function () {
	var a = jindo.$A(arguments).$value();
	var f = this._func;
	var t = this._this;
	var b = function () {
		var args = jindo.$A(arguments).$value();
		if (a.length) {
			args = a.concat(args)
		}
		return f.apply(t, args)
	};
	return b
};
jindo.$Fn.prototype.bindForEvent = function () {
	var a = arguments;
	var f = this._func;
	var t = this._this;
	var m = this._tmpElm || null;
	var b = function (e) {
		var args = jindo.$A(a);
		if (typeof e == "undefined") {
			e = window.event
		}
		if (typeof e.currentTarget == "undefined") {
			e.currentTarget = m
		}
		args.unshift(jindo.$Event(e));
		return f.apply(t, args.$value())
	};
	return b
};
jindo.$Fn.prototype.attach = function (oElement, sEvent) {
	var fn = null,
		l, ev = sEvent,
		el = oElement,
		ua = navigator.userAgent;
	if ((el instanceof Array) || (jindo.$A && (el instanceof jindo.$A) && (el = el.$value()))) {
		for (var i = 0; i < el.length; i++) {
			this.attach(el[i], ev)
		}
		return this
	}
	if (!el || !ev) {
		return this
	}
	if (typeof el.$value == "function") {
		el = el.$value()
	}
	el = jindo.$(el);
	ev = ev.toLowerCase();
	this._tmpElm = el;
	fn = this.bindForEvent();
	this._tmpElm = null;
	if (typeof el.addEventListener != "undefined") {
		if (ev == "domready") {
			ev = "DOMContentLoaded"
		} else {
			if (ev == "mousewheel" && ua.indexOf("WebKit") < 0) {
				ev = "DOMMouseScroll"
			} else {
				if (ev == "mouseenter") {
					ev = "mouseover";
					fn = jindo.$Fn._fireWhenElementBoundary(el, fn)
				} else {
					if (ev == "mouseleave") {
						ev = "mouseout";
						fn = jindo.$Fn._fireWhenElementBoundary(el, fn)
					}
				}
			}
		}
		el.addEventListener(ev, fn, false)
	} else {
		if (typeof el.attachEvent != "undefined") {
			if (ev == "domready") {
				jindo.$Fn._domready(el, fn);
				return this
			} else {
				el.attachEvent("on" + ev, fn)
			}
		}
	}
	if (!this._key) {
		this._key = "$" + jindo.$Fn.gc.count++;
		jindo.$Fn.gc.pool[this._key] = this
	}
	this._events[this._events.length] = {
		element: el,
		event: sEvent.toLowerCase(),
		func: fn
	};
	return this
};
jindo.$Fn.prototype.detach = function (oElement, sEvent) {
	var fn = null,
		l, el = oElement,
		ev = sEvent,
		ua = navigator.userAgent;
	if ((el instanceof Array) || (jindo.$A && (el instanceof jindo.$A) && (el = el.$value()))) {
		for (var i = 0; i < el.length; i++) {
			this.detach(el[i], ev)
		}
		return this
	}
	if (!el || !ev) {
		return this
	}
	if (jindo.$Element && el instanceof jindo.$Element) {
		el = el.$value()
	}
	el = jindo.$(el);
	ev = ev.toLowerCase();
	var e = this._events;
	for (var i = 0; i < e.length; i++) {
		if (e[i].element !== el || e[i].event !== ev) {
			continue
		}
		fn = e[i].func;
		this._events = jindo.$A(this._events).refuse(e[i]).$value();
		break
	}
	if (typeof el.removeEventListener != "undefined") {
		if (ev == "domready") {
			ev = "DOMContentLoaded"
		} else {
			if (ev == "mousewheel" && ua.indexOf("WebKit") < 0) {
				ev = "DOMMouseScroll"
			} else {
				if (ev == "mouseenter") {
					ev = "mouseover"
				} else {
					if (ev == "mouseleave") {
						ev = "mouseout"
					}
				}
			}
		}
		el.removeEventListener(ev, fn, false)
	} else {
		if (typeof el.detachEvent != "undefined") {
			if (ev == "domready") {
				jindo.$Fn._domready.list = jindo.$Fn._domready.list.refuse(fn);
				return this
			} else {
				el.detachEvent("on" + ev, fn)
			}
		}
	}
	return this
};
jindo.$Fn.prototype.delay = function (nSec, args) {
	if (typeof args == "undefined") {
		args = []
	}
	setTimeout(this.bind.apply(this, args), nSec * 1000);
	return this
};
jindo.$Fn.prototype.free = function () {
	var len = this._events.length;
	while (len > 0) {
		this.detach(this._events[--len].element, this._events[len].event)
	}
	try {
		delete jindo.$Fn.gc.pool[this._key]
	} catch(e) {}
};
jindo.$Fn._domready = function (doc, func) {
	if (typeof jindo.$Fn._domready.list == "undefined") {
		var f = null,
			l = jindo.$Fn._domready.list = jindo.$A([func]);
		(function () {
			try {
				doc.documentElement.doScroll("left")
			} catch(e) {
				setTimeout(arguments.callee, 0);
				return
			}
			var evt = {
				type: "domready",
				target: doc,
				currentTarget: doc
			};
			while (f = l.shift()) {
				f(evt)
			}
		})()
	} else {
		jindo.$Fn._domready.list.push(func)
	}
};
jindo.$Fn._fireWhenElementBoundary = function (doc, func) {
	return function (evt) {
		var oEvent = jindo.$Event(evt);
		var relatedElement = jindo.$Element(oEvent.relatedElement);
		if (relatedElement && (relatedElement.isEqual(this) || relatedElement.isChildOf(this))) {
			return
		}
		func.call(this, evt)
	}
};
jindo.$Fn.gc = function () {
	var p = jindo.$Fn.gc.pool;
	for (var key in p) {
		try {
			p[key].free()
		} catch(e) {}
	}
	jindo.$Fn.gc.pool = p = {}
};
jindo.$Fn.gc.count = 0;
jindo.$Fn.gc.pool = {};
if (typeof window != "undefined") {
	jindo.$Fn(jindo.$Fn.gc).attach(window, "unload")
}
jindo.$Event = function (e) {
	var cl = arguments.callee;
	if (e instanceof cl) {
		return e
	}
	if (! (this instanceof cl)) {
		return new cl(e)
	}
	if (typeof e == "undefined") {
		e = window.event
	}
	if (e === window.event && document.createEventObject) {
		e = document.createEventObject(e)
	}
	this._event = e;
	this._globalEvent = window.event;
	this.type = e.type.toLowerCase();
	if (this.type == "dommousescroll") {
		this.type = "mousewheel"
	} else {
		if (this.type == "DOMContentLoaded") {
			this.type = "domready"
		}
	}
	this.canceled = false;
	this.element = e.target || e.srcElement;
	this.currentElement = e.currentTarget;
	this.relatedElement = null;
	if (typeof e.relatedTarget != "undefined") {
		this.relatedElement = e.relatedTarget
	} else {
		if (e.fromElement && e.toElement) {
			this.relatedElement = e[(this.type == "mouseout") ? "toElement" : "fromElement"]
		}
	}
};
jindo.$Event.prototype.mouse = function () {
	var e = this._event;
	var delta = 0;
	var left = (e.which && e.button == 0) || !!(e.button & 1);
	var mid = (e.which && e.button == 1) || !!(e.button & 4);
	var right = (e.which && e.button == 2) || !!(e.button & 2);
	var ret = {};
	if (e.wheelDelta) {
		delta = e.wheelDelta / 120
	} else {
		if (e.detail) {
			delta = -e.detail / 3
		}
	}
	ret = {
		delta: delta,
		left: left,
		middle: mid,
		right: right
	};
	this.mouse = function () {
		return ret
	};
	return ret
};
jindo.$Event.prototype.key = function () {
	var e = this._event;
	var k = e.keyCode || e.charCode;
	var ret = {
		keyCode: k,
		alt: e.altKey,
		ctrl: e.ctrlKey,
		meta: e.metaKey,
		shift: e.shiftKey,
		up: (k == 38),
		down: (k == 40),
		left: (k == 37),
		right: (k == 39),
		enter: (k == 13),
		esc: (k == 27)
	};
	this.key = function () {
		return ret
	};
	return ret
};
jindo.$Event.prototype.pos = function (bGetOffset) {
	var e = this._event;
	var b = (this.element.ownerDocument || document).body;
	var de = (this.element.ownerDocument || document).documentElement;
	var pos = [b.scrollLeft || de.scrollLeft, b.scrollTop || de.scrollTop];
	var ret = {
		clientX: e.clientX,
		clientY: e.clientY,
		pageX: "pageX" in e ? e.pageX : e.clientX + pos[0] - b.clientLeft,
		pageY: "pageY" in e ? e.pageY : e.clientY + pos[1] - b.clientTop,
		layerX: "offsetX" in e ? e.offsetX : e.layerX - 1,
		layerY: "offsetY" in e ? e.offsetY : e.layerY - 1
	};
	if (bGetOffset) {
		var offset = jindo.$Element(this.element).offset();
		ret.offsetX = ret.pageX - offset.left;
		ret.offsetY = ret.pageY - offset.top
	}
	return ret
};
jindo.$Event.prototype.stop = function (nCancel) {
	nCancel = nCancel || jindo.$Event.CANCEL_ALL;
	var e = (window.event && window.event == this._globalEvent) ? this._globalEvent : this._event;
	var b = !!(nCancel & jindo.$Event.CANCEL_BUBBLE);
	var d = !!(nCancel & jindo.$Event.CANCEL_DEFAULT);
	this.canceled = true;
	if (typeof e.preventDefault != "undefined" && d) {
		e.preventDefault()
	}
	if (typeof e.stopPropagation != "undefined" && b) {
		e.stopPropagation()
	}
	if (d) {
		e.returnValue = false
	}
	if (b) {
		e.cancelBubble = true
	}
	return this
};
jindo.$Event.CANCEL_BUBBLE = 1;
jindo.$Event.CANCEL_DEFAULT = 2;
jindo.$Event.CANCEL_ALL = 3;
jindo.$ElementList = function (els) {
	var cl = arguments.callee;
	if (els instanceof cl) {
		return els
	}
	if (! (this instanceof cl)) {
		return new cl(els)
	}
	if (els instanceof Array || (jindo.$A && els instanceof jindo.$A)) {
		els = jindo.$A(els)
	} else {
		if (typeof els == "string" && cssquery) {
			els = jindo.$A(cssquery(els))
		} else {
			els = jindo.$A()
		}
	}
	this._elements = els.map(function (v, i, a) {
		return jindo.$Element(v)
	})
};
jindo.$ElementList.prototype.get = function (idx) {
	return this._elements.$value()[idx]
};
jindo.$ElementList.prototype.getFirst = function () {
	return this.get(0)
};
jindo.$ElementList.prototype.getLast = function () {
	return this.get(Math.Max(this._elements.length - 1, 0))
};
(function (proto) {
	var setters = "show,hide,toggle,addClass,removeClass,toggleClass,fireEvent,leave,";
	setters += "empty,appear,disappear,className,width,height,text,html,css,attr";
	jindo.$A(setters.split(",")).forEach(function (name) {
		proto[name] = function () {
			var args = jindo.$A(arguments).$value();
			this._elements.forEach(function (el) {
				el[name].apply(el, args)
			});
			return this
		}
	});
	jindo.$A(["appear", "disappear"]).forEach(function (name) {
		proto[name] = function (duration, callback) {
			var len = this._elements.length;
			var self = this;
			this._elements.forEach(function (el, idx) {
				if (idx == len - 1) {
					el[name](duration, function () {
						callback(self)
					})
				} else {
					el[name](duration)
				}
			});
			return this
		}
	})
})(jindo.$ElementList.prototype);
jindo.$S = function (str) {
	var cl = arguments.callee;
	if (typeof str == "undefined") {
		str = ""
	}
	if (str instanceof cl) {
		return str
	}
	if (! (this instanceof cl)) {
		return new cl(str)
	}
	this._str = str + ""
};
jindo.$S.prototype.$value = function () {
	return this._str
};
jindo.$S.prototype.toString = jindo.$S.prototype.$value;
jindo.$S.prototype.trim = function () {
	return jindo.$S(this._str.replace(/^\s+|\s+$/g, ""))
};
jindo.$S.prototype.escapeHTML = function () {
	var entities = {
		'"': "quot",
		"&": "amp",
		"<": "lt",
		">": "gt"
	};
	var s = this._str.replace(/[<>&"]/g, function (m0) {
		return entities[m0] ? "&" + entities[m0] + ";" : m0
	});
	return jindo.$S(s)
};
jindo.$S.prototype.stripTags = function () {
	return jindo.$S(this._str.replace(/<\/?(?:h[1-5]|[a-z]+(?:\:[a-z]+)?)[^>]*>/ig, ""))
};
jindo.$S.prototype.times = function (nTimes) {
	var buf = [];
	for (var i = 0; i < nTimes; i++) {
		buf[buf.length] = this._str
	}
	return jindo.$S(buf.join(""))
};
jindo.$S.prototype.unescapeHTML = function () {
	var entities = {
		quot: '"',
		amp: "&",
		lt: "<",
		gt: ">"
	};
	var s = this._str.replace(/&([a-z]+);/g, function (m0, m1) {
		return entities[m1] ? entities[m1] : m0
	});
	return jindo.$S(s)
};
jindo.$S.prototype.escape = function () {
	var s = this._str.replace(/([\u0080-\uFFFF]+)|[\n\r\t"'\\]/g, function (m0, m1, _) {
		if (m1) {
			return escape(m1).replace(/%/g, "\\")
		}
		return (_ = {
			"\n": "\\n",
			"\r": "\\r",
			"\t": "\\t"
		})[m0] ? _[m0] : "\\" + m0
	});
	return jindo.$S(s)
};
jindo.$S.prototype.bytes = function (nBytes) {
	var code = 0,
		bytes = 0,
		i = 0,
		len = this._str.length;
	var charset = ((document.charset || document.characterSet || document.defaultCharset) + "").toLowerCase();
	var cut = (typeof nBytes == "number");
	if (charset == "utf-8") {
		for (i = 0; i < len; i++) {
			code = this._str.charCodeAt(i);
			if (code < 128) {
				bytes += 1
			} else {
				if (code < 2048) {
					bytes += 2
				} else {
					if (code < 65536) {
						bytes += 3
					} else {
						bytes += 4
					}
				}
			}
			if (cut && bytes > nBytes) {
				this._str = this._str.substr(0, i);
				break
			}
		}
	} else {
		for (i = 0; i < len; i++) {
			bytes += (this._str.charCodeAt(i) > 128) ? 2 : 1;
			if (cut && bytes > nBytes) {
				this._str = this._str.substr(0, i);
				break
			}
		}
	}
	return cut ? this : bytes
};
jindo.$S.prototype.parseString = function () {
	var str = this._str.split(/&/g),
		pos, key, val, buf = {};
	for (var i = 0; i < str.length; i++) {
		key = str[i].substring(0, pos = str[i].indexOf("="));
		val = decodeURIComponent(str[i].substring(pos + 1));
		if (key.substr(key.length - 2, 2) == "[]") {
			key = key.substring(0, key.length - 2);
			if (typeof buf[key] == "undefined") {
				buf[key] = []
			}
			buf[key][buf[key].length] = val
		} else {
			buf[key] = val
		}
	}
	return buf
};
jindo.$S.prototype.escapeRegex = function () {
	var s = this._str;
	var r = /([\?\.\*\+\-\/\(\)\{\}\[\]\:\!\^\$\\\|])/g;
	return jindo.$S(s.replace(r, "\\$1"))
};
jindo.$S.prototype.format = function () {
	var args = arguments;
	var idx = 0;
	var s = this._str.replace(/%([ 0])?(-)?([1-9][0-9]*)?([bcdsoxX])/g, function (m0, m1, m2, m3, m4) {
		var a = args[idx++];
		var ret = "",
			pad = "";
		m3 = m3 ? +m3 : 0;
		if (m4 == "s") {
			ret = a + ""
		} else {
			if (" bcdoxX".indexOf(m4) > 0) {
				if (typeof a != "number") {
					return ""
				}
				ret = (m4 == "c") ? String.fromCharCode(a) : a.toString(({
					b: 2,
					d: 10,
					o: 8,
					x: 16,
					X: 16
				})[m4]);
				if (" X".indexOf(m4) > 0) {
					ret = ret.toUpperCase()
				}
			}
		}
		if (ret.length < m3) {
			pad = jindo.$S(m1 || " ").times(m3 - ret.length).toString()
		}(m2 == "-") ? (ret += pad) : (ret = pad + ret);
		return ret
	});
	return jindo.$S(s)
};
jindo.$Document = function (el) {
	var cl = arguments.callee;
	if (el instanceof cl) {
		return el
	}
	if (! (this instanceof cl)) {
		return new cl(el)
	}
	this._doc = el || document;
	this._docKey = this.renderingMode() == "Standards" ? "documentElement" : "body"
};
jindo.$Document.prototype.$value = function () {
	return this._doc
};
jindo.$Document.prototype.scrollSize = function () {
	var oBrowser = jindo.$Agent().navigator();
	var oDoc = this._doc[(oBrowser.chrome || oBrowser.safari) ? "body" : this._docKey];
	return {
		width: Math.max(oDoc.scrollWidth, oDoc.clientWidth),
		height: Math.max(oDoc.scrollHeight, oDoc.clientHeight)
	}
};
jindo.$Document.prototype.clientSize = function () {
	var oBrowser = jindo.$Agent().navigator();
	var oDoc = this._doc[this._docKey];
	return (oBrowser.safari) ? {
		width: window.innerWidth,
		height: window.innerHeight
	} : {
		width: oDoc.clientWidth,
		height: oDoc.clientHeight
	}
};
jindo.$Document.prototype.renderingMode = function () {
	var oBrowser = jindo.$Agent().navigator();
	var sRet;
	if ("compatMode" in this._doc) {
		sRet = this._doc.compatMode == "CSS1Compat" ? "Standards" : (oBrowser.ie ? "Quirks" : "Almost")
	} else {
		sRet = oBrowser.safari ? "Standards" : "Quirks"
	}
	return sRet
};
jindo.$Form = function (el) {
	var cl = arguments.callee;
	if (el instanceof cl) {
		return el
	}
	if (! (this instanceof cl)) {
		return new cl(el)
	}
	el = jindo.$(el);
	if (!el.tagName || el.tagName.toUpperCase() != "FORM") {
		throw new Error("The element should be a FORM element")
	}
	this._form = el
};
jindo.$Form.prototype.$value = function () {
	return this._form
};
jindo.$Form.prototype.serialize = function () {
	var self = this;
	var oRet = {};
	var nLen = arguments.length;
	var fpInsert = function (sKey) {
		var sVal = self.value(sKey);
		if (typeof sVal != "undefined") {
			oRet[sKey] = sVal
		}
	};
	if (nLen == 0) {
		jindo.$A(this.element()).forEach(function (o) {
			if (o.name) {
				fpInsert(o.name)
			}
		})
	} else {
		for (var i = 0; i < nLen; i++) {
			fpInsert(arguments[i])
		}
	}
	return jindo.$H(oRet).toQueryString()
};
jindo.$Form.prototype.element = function (sKey) {
	if (arguments.length > 0) {
		return this._form[sKey]
	}
	return this._form.elements
};
jindo.$Form.prototype.enable = function () {
	var sKey = arguments[0];
	if (typeof sKey == "object") {
		var self = this;
		jindo.$H(sKey).forEach(function (bFlag, sKey) {
			self.enable(sKey, bFlag)
		});
		return this
	}
	var aEls = this.element(sKey);
	if (!aEls) {
		return this
	}
	aEls = aEls.nodeType == 1 ? [aEls] : aEls;
	if (arguments.length < 2) {
		var bEnabled = true;
		jindo.$A(aEls).forEach(function (o) {
			if (o.disabled) {
				bEnabled = false;
				jindo.$A.Break()
			}
		});
		return bEnabled
	} else {
		var sFlag = arguments[1];
		jindo.$A(aEls).forEach(function (o) {
			o.disabled = !sFlag
		});
		return this
	}
};
jindo.$Form.prototype.value = function (sKey) {
	if (typeof sKey == "object") {
		var self = this;
		jindo.$H(sKey).forEach(function (bFlag, sKey) {
			self.value(sKey, bFlag)
		});
		return this
	}
	var aEls = this.element(sKey);
	if (!aEls) {
		throw new Error("The element is not exist")
	}
	aEls = aEls.nodeType == 1 ? [aEls] : aEls;
	if (arguments.length > 1) {
		var sVal = arguments[1];
		jindo.$A(aEls).forEach(function (o) {
			switch (o.type) {
			case "radio":
			case "checkbox":
				o.checked = (o.value == sVal);
				break;
			case "select-one":
				var nIndex = -1;
				for (var i = 0, len = o.options.length; i < len; i++) {
					if (o.options[i].value == sVal) {
						nIndex = i
					}
				}
				o.selectedIndex = nIndex;
				break;
			default:
				o.value = sVal;
				break
			}
		});
		return this
	}
	var aRet = [];
	jindo.$A(aEls).forEach(function (o) {
		switch (o.type) {
		case "radio":
		case "checkbox":
			if (o.checked) {
				aRet.push(o.value)
			}
			break;
		case "select-one":
			if (o.selectedIndex != -1) {
				aRet.push(o.options[o.selectedIndex].value)
			}
			break;
		default:
			aRet.push(o.value);
			break
		}
	});
	return aRet.length > 1 ? aRet : aRet[0]
};
jindo.$Form.prototype.submit = function (sTargetName) {
	var sOrgTarget = null;
	if (typeof sTargetName != "undefined") {
		sOrgTarget = this._form.target;
		this._form.target = sTargetName
	}
	this._form.submit();
	if (sOrgTarget !== null) {
		this._form.target = sOrgTarget
	}
	return this
};
jindo.$Form.prototype.reset = function () {
	this._form.reset();
	return this
};
jindo.$Template = function (str) {
	var obj = null,
		tag = "";
	var cl = arguments.callee;
	if (str instanceof cl) {
		return str
	}
	if (! (this instanceof cl)) {
		return new cl(str)
	}
	if (typeof str == "undefined") {
		str = ""
	} else {
		if ((obj = jindo.$(str)) && obj.tagName && (tag = obj.tagName.toUpperCase()) && (tag == "TEXTAREA" || (tag == "SCRIPT" && obj.getAttribute("type") == "text/template"))) {
			str = (obj.value || obj.innerHTML).replace(/^\s+|\s+$/g, "")
		}
	}
	this._str = str + ""
};
jindo.$Template.splitter = /(?!\\)[\{\}]/g;
jindo.$Template.pattern = /^(?:if (.+)|elseif (.+)|for (?:(.+)\:)?(.+) in (.+)|(else)|\/(if|for)|=(.+)|js (.+)|set (.+))$/;
jindo.$Template.prototype.process = function (data) {
	var key = "\x01";
	var leftBrace = "\x02";
	var rightBrace = "\x03";
	var tpl = (" " + this._str + " ").replace(/\\{/g, leftBrace).replace(/\\}/g, rightBrace).replace(/(?!\\)\}\{/g, "}" + key + "{").split(jindo.$Template.splitter),
		i = tpl.length;
	var map = {
		'"': '\\"',
		"\\": "\\\\",
		"\n": "\\n",
		"\r": "\\r",
		"\t": "\\t",
		"\f": "\\f"
	};
	var reg = [/("(?:(?:\\.)+|[^\\"]+)*"|[a-zA-Z_][\w\.]*)/g, /[\n\r\t\f"\\]/g, /^\s+/, /\s+$/, /#/g];
	var cb = [function (m) {
		return (m.substring(0, 1) == '"') ? m : "d." + m
	},


	function (m) {
		return map[m] || m
	},
	"", ""];
	var stm = [];
	var lev = 0;
	tpl[0] = tpl[0].substr(1);
	tpl[i - 1] = tpl[i - 1].substr(0, tpl[i - 1].length - 1);
	if (i < 2) {
		return tpl
	}
	while (i--) {
		if (i % 2) {
			tpl[i] = tpl[i].replace(jindo.$Template.pattern, function () {
				var m = arguments;
				if (m[10]) {
					return m[10].replace(/(\w+)=(?:"(\w+)"=|'(\w+)'|([0-9]+)|(\w+))/g, function () {
						var mm = arguments;
						var str = "d." + mm[1] + "=";
						if (mm[2] || mm[3] || mm[4]) {
							str += '"' + (mm[2] || mm[3] || mm[4]) + '"'
						} else {
							str += "d." + mm[5]
						}
						return str
					}) + ";"
				}
				if (m[9]) {
					return "s[i++]=" + m[9].replace(/(=(?:[a-zA-Z_][\w\.]*)+)/g, function (m) {
						return (m.substring(0, 1) == "=") ? "d." + m.replace("=", "") : m
					}) + ";"
				}
				if (m[8]) {
					return "s[i++]= d." + m[8] + ";"
				}
				if (m[1]) {
					return "if(" + m[1].replace(reg[0], cb[0]) + "){"
				}
				if (m[2]) {
					return "}else if(" + m[2].replace(reg[0], cb[0]) + "){"
				}
				if (m[5]) {
					return ("var t#=d." + m[5] + "||{},p#=isArray(t#),i#=0;for(var x# in t#){ if( (p# && isNaN(i#=parseInt(x#))) || (!p# && !t#.propertyIsEnumerable(x#)) ) continue; d." + m[4] + "=t#[x#];" + (m[3] ? "d." + m[3] + "=p#?i#:x#;" : "")).replace(reg[4], lev++)
				}
				if (m[6]) {
					return "}else{"
				}
				if (m[7]) {
					return "};"
				}
				return m[0]
			})
		} else {
			if (tpl[i] == key) {
				tpl[i] = ""
			} else {
				if (tpl[i]) {
					tpl[i] = 's[i++]="' + tpl[i].replace(reg[1], cb[1]) + '";'
				}
			}
		}
	}
	tpl = tpl.join("").replace(new RegExp(leftBrace, "g"), "{").replace(new RegExp(rightBrace, "g"), "}");
	tpl = (new Function("d", 'var s=[],i=0;function isArray(o){ return Object.prototype.toString.call(o) == "[object Array]" };' + tpl + 'return s.join("");'))(data);
	return tpl
};
jindo.$Date = function (src) {
	var a = arguments,
		t = "";
	var cl = arguments.callee;
	if (src && src instanceof cl) {
		return src
	}
	if (! (this instanceof cl)) {
		return new cl(a[0], a[1], a[2], a[3], a[4], a[5], a[6])
	}
	if ((t = typeof src) == "string") {
		this._date = cl.parse(src).$value()
	} else {
		if (t == "number") {
			if (typeof a[1] == "undefined") {
				this._date = new Date(src)
			} else {
				this._date = new Date(a[0], a[1], a[2], a[3], a[4], a[5], a[6])
			}
		} else {
			if (t == "object" && src.constructor == Date) {
				(this._date = new Date).setTime(src.getTime());
				this._date.setMilliseconds(src.getMilliseconds())
			} else {
				this._date = new Date
			}
		}
	}
};
jindo.$Date.names = {
	month: ["January", "Febrary", "March", "April", "May", "June", "July", "August", "September", "October", "Novermber", "December"],
	s_month: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
	day: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
	s_day: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
	ampm: ["AM", "PM"]
};
jindo.$Date.now = function () {
	return Date.now()
};
jindo.$Date.parse = function (strDate) {
	return Date.parse(strDate)
};
jindo.$Date.prototype.$value = function () {
	return this._date
};
jindo.$Date.prototype.format = function (strFormat) {
	var o = {};
	var d = this._date;
	return (strFormat || "").replace(/[a-z]/ig, function callback(m) {
		if (typeof o[m] != "undefined") {
			return o[m]
		}
		switch (m) {
		case "d":
		case "j":
			o.j = d.getDate();
			o.d = (o.j > 9 ? "" : "0") + o.j;
			return o[m];
		case "l":
		case "D":
		case "w":
		case "N":
			o.w = d.getDay();
			o.N = o.w ? o.w : 7;
			o.D = jindo.$Date.names.s_day[o.w];
			o.j = jindo.$Date.names.day[o.w];
			return o[m];
		case "S":
			return ( !! (o.S = ["st", "nd", "rd"][d.getDate()])) ? o.S : (o.S = "th");
		case "z":
			o.z = Math.floor((d.getTime() - (new Date(d.getFullYear(), 0, 1)).getTime()) / (3600 * 24 * 1000));
			return o.z;
		case "m":
		case "n":
			o.n = d.getMonth() + 1;
			o.m = (o.n > 9 ? "" : "0") + o.n;
			return o[m];
		case "L":
			o.L = this.isLeapYear();
			return o.L;
		case "o":
		case "Y":
		case "y":
			o.o = o.Y = d.getFullYear();
			o.y = (o.o + "").substr(2);
			return o[m];
		case "a":
		case "A":
		case "g":
		case "G":
		case "h":
		case "H":
			o.G = d.getHours();
			o.g = (o.g = o.G % 12) ? o.g : 12;
			o.A = o.G < 12 ? jindo.$Date.names.ampm[0] : jindo.$Date.names.ampm[1];
			o.a = o.A.toLowerCase();
			o.H = (o.G > 9 ? "" : "0") + o.G;
			o.h = (o.g > 9 ? "" : "0") + o.g;
			return o[m];
		case "i":
			o.i = (((o.i = d.getMinutes()) > 9) ? "" : "0") + o.i;
			return o.i;
		case "s":
			o.s = (((o.s = d.getSeconds()) > 9) ? "" : "0") + o.s;
			return o.s;
		case "u":
			o.u = d.getMilliseconds();
			return o.u;
		case "U":
			o.U = this.time();
			return o.U;
		default:
			return m
		}
	})
};
jindo.$Date.prototype.time = function (nTime) {
	if (typeof nTime == "number") {
		this._date.setTime(nTime);
		return this
	}
	return this._date.getTime()
};
jindo.$Date.prototype.year = function (nYear) {
	if (typeof nYear == "number") {
		this._date.setFullYear(nYear);
		return this
	}
	return this._date.getFullYear()
};
jindo.$Date.prototype.month = function (nMon) {
	if (typeof nMon == "number") {
		this._date.setMonth(nMon);
		return this
	}
	return this._date.getMonth()
};
jindo.$Date.prototype.date = function (nDate) {
	if (typeof nDate == "number") {
		this._date.setDate(nDate);
		return this
	}
	return this._date.getDate()
};
jindo.$Date.prototype.day = function () {
	return this._date.getDay()
};
jindo.$Date.prototype.hours = function (nHour) {
	if (typeof nHour == "number") {
		this._date.setHours(nHour);
		return this
	}
	return this._date.getHours()
};
jindo.$Date.prototype.seconds = function (nSec) {
	if (typeof nSec == "number") {
		this._date.setSeconds(nSec);
		return this
	}
	return this._date.getSeconds()
};
jindo.$Date.prototype.minutes = function (nMin) {
	if (typeof nMin == "number") {
		this._date.setMinutes(nMin);
		return this
	}
	return this._date.getMinutes()
};
jindo.$Date.prototype.isLeapYear = function () {
	var y = this._date.getFullYear();
	return ! (y % 4) && !!(y % 100) || !(y % 400)
};
jindo.$Window = function (el) {
	var cl = arguments.callee;
	if (el instanceof cl) {
		return el
	}
	if (! (this instanceof cl)) {
		return new cl(el)
	}
	this._win = el || window
};
jindo.$Window.prototype.$value = function () {
	return this._win
};
jindo.$Window.prototype.resizeTo = function (nWidth, nHeight) {
	this._win.resizeTo(nWidth, nHeight);
	return this
};
jindo.$Window.prototype.resizeBy = function (nWidth, nHeight) {
	this._win.resizeBy(nWidth, nHeight);
	return this
};
jindo.$Window.prototype.moveTo = function (nLeft, nTop) {
	this._win.moveTo(nLeft, nTop);
	return this
};
jindo.$Window.prototype.moveBy = function (nLeft, nTop) {
	this._win.moveBy(nLeft, nTop);
	return this
};
jindo.$Window.prototype.sizeToContent = function () {
	if (typeof this._win.sizeToContent == "function") {
		this._win.sizeToContent()
	} else {
		var doc = jindo.$Document(this._win.document);
		var clientSize = doc.clientSize();
		var scrollSize = doc.scrollSize();
		this.resizeBy(scrollSize.width - clientSize.width, scrollSize.height - clientSize.height)
	}
	return this
};
if (typeof window != "undefined") {
	for (prop in jindo) {
		window[prop] = jindo[prop]
	}
}
var cssquery = (function () {
	var sVersion = "2.3";
	var debugOption = {
		repeat: 1
	};
	var UID = 1;
	var cost = 0;
	var validUID = {};
	var bSupportByClassName = document.createElement("DIV").getElementsByClassName ? true : false;
	var safeHTML = false;
	var getUID4HTML = function (oEl) {
		var nUID = safeHTML ? (oEl._cssquery_UID && oEl._cssquery_UID[0]) : oEl._cssquery_UID;
		if (nUID && validUID[nUID] == oEl) {
			return nUID
		}
		nUID = UID++;
		oEl._cssquery_UID = safeHTML ? [nUID] : nUID;
		validUID[nUID] = oEl;
		return nUID
	};
	var getUID4XML = function (oEl) {
		var oAttr = oEl.getAttribute("_cssquery_UID");
		var nUID = safeHTML ? (oAttr && oAttr[0]) : oAttr;
		if (!nUID) {
			nUID = UID++;
			oEl.setAttribute("_cssquery_UID", safeHTML ? [nUID] : nUID)
		}
		return nUID
	};
	var getUID = getUID4HTML;
	var uniqid = function (sPrefix) {
		return (sPrefix || "") + new Date().getTime() + parseInt(Math.random() * 100000000)
	};

	function getElementsByClass(searchClass, node, tag) {
		var classElements = new Array();
		if (node == null) {
			node = document
		}
		if (tag == null) {
			tag = "*"
		}
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
		for (i = 0, j = 0; i < elsLen; i++) {
			if (pattern.test(els[i].className)) {
				classElements[j] = els[i];
				j++
			}
		}
		return classElements
	}
	var getChilds_dontShrink = function (oEl, sTagName, sClassName) {
		if (bSupportByClassName && sClassName) {
			if (oEl.getElementsByClassName) {
				return oEl.getElementsByClassName(sClassName)
			}
			if (oEl.querySelectorAll) {
				return oEl.querySelectorAll(sClassName)
			}
			return getElementsByClass(sClassName, oEl, sTagName)
		} else {
			if (sTagName == "*") {
				return oEl.all || oEl.getElementsByTagName(sTagName)
			}
		}
		return oEl.getElementsByTagName(sTagName)
	};
	var clearKeys = function () {
		backupKeys._keys = {}
	};
	var oDocument_dontShrink = document;
	var bXMLDocument = false;
	var backupKeys = function (sQuery) {
		var oKeys = backupKeys._keys;
		sQuery = sQuery.replace(/'(\\'|[^'])*'/g, function (sAll) {
			var uid = uniqid("QUOT");
			oKeys[uid] = sAll;
			return uid
		});
		sQuery = sQuery.replace(/"(\\"|[^"])*"/g, function (sAll) {
			var uid = uniqid("QUOT");
			oKeys[uid] = sAll;
			return uid
		});
		sQuery = sQuery.replace(/\[(.*?)\]/g, function (sAll, sBody) {
			if (sBody.indexOf("ATTR") == 0) {
				return sAll
			}
			var uid = "[" + uniqid("ATTR") + "]";
			oKeys[uid] = sAll;
			return uid
		});
		var bChanged;
		do {
			bChanged = false;
			sQuery = sQuery.replace(/\(((\\\)|[^)|^(])*)\)/g, function (sAll, sBody) {
				if (sBody.indexOf("BRCE") == 0) {
					return sAll
				}
				var uid = "_" + uniqid("BRCE");
				oKeys[uid] = sAll;
				bChanged = true;
				return uid
			})
		} while (bChanged);
		return sQuery
	};
	var restoreKeys = function (sQuery, bOnlyAttrBrace) {
		var oKeys = backupKeys._keys;
		var bChanged;
		var rRegex = bOnlyAttrBrace ? /(\[ATTR[0-9]+\])/g : /(QUOT[0-9]+|\[ATTR[0-9]+\])/g;
		do {
			bChanged = false;
			sQuery = sQuery.replace(rRegex, function (sKey) {
				if (oKeys[sKey]) {
					bChanged = true;
					return oKeys[sKey]
				}
				return sKey
			})
		} while (bChanged);
		sQuery = sQuery.replace(/_BRCE[0-9]+/g, function (sKey) {
			return oKeys[sKey] ? oKeys[sKey] : sKey
		});
		return sQuery
	};
	var restoreString = function (sKey) {
		var oKeys = backupKeys._keys;
		var sOrg = oKeys[sKey];
		if (!sOrg) {
			return sKey
		}
		return eval(sOrg)
	};
	var wrapQuot = function (sStr) {
		return '"' + sStr.replace(/"/g, '\\"') + '"'
	};
	var getStyleKey = function (sKey) {
		if (/^@/.test(sKey)) {
			return sKey.substr(1)
		}
		return null
	};
	var getCSS = function (oEl, sKey) {
		if (oEl.currentStyle) {
			if (sKey == "float") {
				sKey = "styleFloat"
			}
			return oEl.currentStyle[sKey] || oEl.style[sKey]
		} else {
			if (window.getComputedStyle) {
				return oDocument_dontShrink.defaultView.getComputedStyle(oEl, null).getPropertyValue(sKey.replace(/([A-Z])/g, "-$1").toLowerCase()) || oEl.style[sKey]
			}
		}
		if (sKey == "float" && /MSIE/.test(window.navigator.userAgent)) {
			sKey = "styleFloat"
		}
		return oEl.style[sKey]
	};
	var oCamels = {
		accesskey: "accessKey",
		cellspacing: "cellSpacing",
		cellpadding: "cellPadding",
		"class": "className",
		colspan: "colSpan",
		"for": "htmlFor",
		maxlength: "maxLength",
		readonly: "readOnly",
		rowspan: "rowSpan",
		tabindex: "tabIndex",
		valign: "vAlign"
	};
	var getDefineCode = function (sKey) {
		var sVal;
		var sStyleKey;
		if (bXMLDocument) {
			sVal = 'oEl.getAttribute("' + sKey + '")'
		} else {
			if (sStyleKey = getStyleKey(sKey)) {
				sKey = "$$" + sStyleKey;
				sVal = 'getCSS(oEl, "' + sStyleKey + '")'
			} else {
				switch (sKey) {
				case "checked":
					sVal = 'oEl.checked + ""';
					break;
				case "disabled":
					sVal = 'oEl.disabled + ""';
					break;
				case "enabled":
					sVal = '!oEl.disabled + ""';
					break;
				case "readonly":
					sVal = 'oEl.readOnly + ""';
					break;
				case "selected":
					sVal = 'oEl.selected + ""';
					break;
				default:
					if (oCamels[sKey]) {
						sVal = "oEl." + oCamels[sKey]
					} else {
						sVal = 'oEl.getAttribute("' + sKey + '")'
					}
				}
			}
		}
		return "_" + sKey + " = " + sVal
	};
	var getReturnCode = function (oExpr) {
		var sStyleKey = getStyleKey(oExpr.key);
		var sVar = "_" + (sStyleKey ? "$$" + sStyleKey : oExpr.key);
		var sVal = oExpr.val ? wrapQuot(oExpr.val) : "";
		switch (oExpr.op) {
		case "~=":
			return "(" + sVar + ' && (" " + ' + sVar + ' + " ").indexOf(" " + ' + sVal + ' + " ") > -1)';
		case "^=":
			return "(" + sVar + " && " + sVar + ".indexOf(" + sVal + ") == 0)";
		case "$=":
			return "(" + sVar + " && " + sVar + ".substr(" + sVar + ".length - " + oExpr.val.length + ") == " + sVal + ")";
		case "*=":
			return "(" + sVar + " && " + sVar + ".indexOf(" + sVal + ") > -1)";
		case "!=":
			return "(" + sVar + " != " + sVal + ")";
		case "=":
			return "(" + sVar + " == " + sVal + ")"
		}
		return "(" + sVar + ")"
	};
	var getNodeIndex = function (oEl) {
		var nUID = getUID(oEl);
		var nIndex = oNodeIndexes[nUID] || 0;
		if (nIndex == 0) {
			for (var oSib = (oEl.parentNode || oEl._IE5_parentNode).firstChild; oSib; oSib = oSib.nextSibling) {
				if (oSib.nodeType != 1) {
					continue
				}
				nIndex++;
				setNodeIndex(oSib, nIndex)
			}
			nIndex = oNodeIndexes[nUID]
		}
		return nIndex
	};
	var oNodeIndexes = {};
	var setNodeIndex = function (oEl, nIndex) {
		var nUID = getUID(oEl);
		oNodeIndexes[nUID] = nIndex
	};
	var unsetNodeIndexes = function () {
		setTimeout(function () {
			oNodeIndexes = {}
		},
		0)
	};
	var oPseudoes_dontShrink = {
		contains: function (oEl, sOption) {
			return (oEl.innerText || oEl.textContent || "").indexOf(sOption) > -1
		},
		"last-child": function (oEl, sOption) {
			for (oEl = oEl.nextSibling; oEl; oEl = oEl.nextSibling) {
				if (oEl.nodeType == 1) {
					return false
				}
			}
			return true
		},
		"first-child": function (oEl, sOption) {
			for (oEl = oEl.previousSibling; oEl; oEl = oEl.previousSibling) {
				if (oEl.nodeType == 1) {
					return false
				}
			}
			return true
		},
		"only-child": function (oEl, sOption) {
			var nChild = 0;
			for (var oChild = (oEl.parentNode || oEl._IE5_parentNode).firstChild; oChild; oChild = oChild.nextSibling) {
				if (oChild.nodeType == 1) {
					nChild++
				}
				if (nChild > 1) {
					return false
				}
			}
			return nChild ? true : false
		},
		empty: function (oEl, _) {
			return oEl.firstChild ? false : true
		},
		"nth-child": function (oEl, nMul, nAdd) {
			var nIndex = getNodeIndex(oEl);
			return nIndex % nMul == nAdd
		},
		"nth-last-child": function (oEl, nMul, nAdd) {
			var oLast = (oEl.parentNode || oEl._IE5_parentNode).lastChild;
			for (; oLast; oLast = oLast.previousSibling) {
				if (oLast.nodeType == 1) {
					break
				}
			}
			var nTotal = getNodeIndex(oLast);
			var nIndex = getNodeIndex(oEl);
			var nLastIndex = nTotal - nIndex + 1;
			return nLastIndex % nMul == nAdd
		}
	};
	var getExpression = function (sBody) {
		var oRet = {
			defines: "",
			returns: "true"
		};
		var sBody = restoreKeys(sBody, true);
		var aExprs = [];
		var aDefineCode = [],
			aReturnCode = [];
		var sId, sTagName;
		var sBody = sBody.replace(/:([\w-]+)(\(([^)]*)\))?/g, function (_, sType, _, sOption) {
			switch (sType) {
			case "not":
				var oInner = getExpression(sOption);
				var sFuncDefines = oInner.defines;
				var sFuncReturns = oInner.returnsID + oInner.returnsTAG + oInner.returns;
				aReturnCode.push("!(function() { " + sFuncDefines + " return " + sFuncReturns + " })()");
				break;
			case "nth-child":
			case "nth-last-child":
				sOption = restoreString(sOption);
				if (sOption == "even") {
					sOption = "2n"
				} else {
					if (sOption == "odd") {
						sOption = "2n+1"
					}
				}
				var nMul, nAdd;
				if (/([0-9]*)n([+-][0-9]+)*/.test(sOption)) {
					nMul = parseInt(RegExp.$1) || 1;
					nAdd = parseInt(RegExp.$2) || 0
				} else {
					nMul = Infinity;
					nAdd = parseInt(sOption)
				}
				aReturnCode.push("oPseudoes_dontShrink[" + wrapQuot(sType) + "](oEl, " + nMul + ", " + nAdd + ")");
				break;
			case "first-of-type":
			case "last-of-type":
				sType = (sType == "first-of-type" ? "nth-of-type" : "nth-last-of-type");
				sOption = 1;
			case "nth-of-type":
			case "nth-last-of-type":
				sOption = restoreString(sOption);
				if (sOption == "even") {
					sOption = "2n"
				} else {
					if (sOption == "odd") {
						sOption = "2n+1"
					}
				}
				var nMul, nAdd;
				if (/([0-9]*)n([+-][0-9]+)*/.test(sOption)) {
					nMul = parseInt(RegExp.$1) || 1;
					nAdd = parseInt(RegExp.$2) || 0
				} else {
					nMul = Infinity;
					nAdd = parseInt(sOption)
				}
				oRet.nth = [nMul, nAdd, sType];
				break;
			default:
				sOption = sOption ? restoreString(sOption) : "";
				aReturnCode.push("oPseudoes_dontShrink[" + wrapQuot(sType) + "](oEl, " + wrapQuot(sOption) + ")");
				break
			}
			return ""
		});
		var sBody = sBody.replace(/\[(@?[\w-]+)(([!^~$*]?=)([^\]]*))?\]/g, function (_, sKey, _, sOp, sVal) {
			sKey = restoreString(sKey);
			sVal = restoreString(sVal);
			if (sKey == "checked" || sKey == "disabled" || sKey == "enabled" || sKey == "readonly" || sKey == "selected") {
				if (!sVal) {
					sOp = "=";
					sVal = "true"
				}
			}
			aExprs.push({
				key: sKey,
				op: sOp,
				val: sVal
			});
			return ""
		});
		var sClassName = null;
		var sBody = sBody.replace(/\.([\w-]+)/g, function (_, sClass) {
			aExprs.push({
				key: "class",
				op: "~=",
				val: sClass
			});
			if (!sClassName) {
				sClassName = sClass
			}
			return ""
		});
		var sBody = sBody.replace(/#([\w-]+)/g, function (_, sIdValue) {
			if (bXMLDocument) {
				aExprs.push({
					key: "id",
					op: "=",
					val: sIdValue
				})
			} else {
				sId = sIdValue
			}
			return ""
		});
		sTagName = sBody == "*" ? "" : sBody;
		var oVars = {};
		for (var i = 0, oExpr; oExpr = aExprs[i]; i++) {
			var sKey = oExpr.key;
			if (!oVars[sKey]) {
				aDefineCode.push(getDefineCode(sKey))
			}
			aReturnCode.unshift(getReturnCode(oExpr));
			oVars[sKey] = true
		}
		if (aDefineCode.length) {
			oRet.defines = "var " + aDefineCode.join(",") + ";"
		}
		if (aReturnCode.length) {
			oRet.returns = aReturnCode.join("&&")
		}
		oRet.quotID = sId ? wrapQuot(sId) : "";
		oRet.quotTAG = sTagName ? wrapQuot(bXMLDocument ? sTagName : sTagName.toUpperCase()) : "";
		if (bSupportByClassName) {
			oRet.quotCLASS = sClassName ? wrapQuot(sClassName) : ""
		}
		oRet.returnsID = sId ? "oEl.id == " + oRet.quotID + " && " : "";
		oRet.returnsTAG = sTagName && sTagName != "*" ? "oEl.tagName == " + oRet.quotTAG + " && " : "";
		return oRet
	};
	var splitToParts = function (sQuery) {
		var aParts = [];
		var sRel = " ";
		var sBody = sQuery.replace(/(.*?)\s*(!?[+>~ ]|!)\s*/g, function (_, sBody, sRelative) {
			if (sBody) {
				aParts.push({
					rel: sRel,
					body: sBody
				})
			}
			sRel = sRelative.replace(/\s+$/g, "") || " ";
			return ""
		});
		if (sBody) {
			aParts.push({
				rel: sRel,
				body: sBody
			})
		}
		return aParts
	};
	var isNth_dontShrink = function (oEl, sTagName, nMul, nAdd, sDirection) {
		var nIndex = 0;
		for (var oSib = oEl; oSib; oSib = oSib[sDirection]) {
			if (oSib.nodeType == 1 && (!sTagName || sTagName == oSib.tagName)) {
				nIndex++
			}
		}
		return nIndex % nMul == nAdd
	};
	var compileParts = function (aParts) {
		var aPartExprs = [];
		for (var i = 0, oPart; oPart = aParts[i]; i++) {
			aPartExprs.push(getExpression(oPart.body))
		}
		var sFunc = "";
		var sPushCode = "aRet.push(oEl); if (oOptions.single) { bStop = true; }";
		for (var i = aParts.length - 1, oPart; oPart = aParts[i]; i--) {
			var oExpr = aPartExprs[i];
			var sPush = (debugOption.callback ? "cost++;" : "") + oExpr.defines;
			var sReturn = "if (bStop) {" + (i == 0 ? "return aRet;" : "return;") + "}";
			if (oExpr.returns == "true") {
				sPush += (sFunc ? sFunc + "(oEl);" : sPushCode) + sReturn
			} else {
				sPush += "if (" + oExpr.returns + ") {" + (sFunc ? sFunc + "(oEl);" : sPushCode) + sReturn + "}"
			}
			var sCheckTag = "oEl.nodeType != 1";
			if (oExpr.quotTAG) {
				sCheckTag = "oEl.tagName != " + oExpr.quotTAG
			}
			var sTmpFunc = "(function(oBase" + (i == 0 ? ", oOptions) { var bStop = false; var aRet = [];" : ") {");
			if (oExpr.nth) {
				sPush = "if (isNth_dontShrink(oEl, " + (oExpr.quotTAG ? oExpr.quotTAG : "false") + "," + oExpr.nth[0] + "," + oExpr.nth[1] + ',"' + (oExpr.nth[2] == "nth-of-type" ? "previousSibling" : "nextSibling") + '")) {' + sPush + "}"
			}
			switch (oPart.rel) {
			case " ":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oCandi = oEl;for (; oCandi; oCandi = (oCandi.parentNode || oCandi._IE5_parentNode)) {if (oCandi == oBase) break;}if (!oCandi || " + sCheckTag + ") return aRet;" + sPush
				} else {
					sTmpFunc += "var aCandi = getChilds_dontShrink(oBase, " + (oExpr.quotTAG || '"*"') + ", " + (oExpr.quotCLASS || "null") + ");for (var i = 0, oEl; oEl = aCandi[i]; i++) {" + (oExpr.quotCLASS ? "if (" + sCheckTag + ") continue;" : "") + sPush + "}"
				}
				break;
			case ">":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");if ((oEl.parentNode || oEl._IE5_parentNode) != oBase || " + sCheckTag + ") return aRet;" + sPush
				} else {
					sTmpFunc += "for (var oEl = oBase.firstChild; oEl; oEl = oEl.nextSibling) {if (" + sCheckTag + ") { continue; }" + sPush + "}"
				}
				break;
			case "+":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oPrev;for (oPrev = oEl.previousSibling; oPrev; oPrev = oPrev.previousSibling) { if (oPrev.nodeType == 1) break; }if (!oPrev || oPrev != oBase || " + sCheckTag + ") return aRet;" + sPush
				} else {
					sTmpFunc += "for (var oEl = oBase.nextSibling; oEl; oEl = oEl.nextSibling) { if (oEl.nodeType == 1) break; }if (!oEl || " + sCheckTag + ") { return aRet; }" + sPush
				}
				break;
			case "~":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oCandi = oEl;for (; oCandi; oCandi = oCandi.previousSibling) { if (oCandi == oBase) break; }if (!oCandi || " + sCheckTag + ") return aRet;" + sPush
				} else {
					sTmpFunc += "for (var oEl = oBase.nextSibling; oEl; oEl = oEl.nextSibling) {if (" + sCheckTag + ") { continue; }if (!markElement_dontShrink(oEl, " + i + ")) { break; }" + sPush + "}"
				}
				break;
			case "!":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");for (; oBase; oBase = (oBase.parentNode || oBase._IE5_parentNode)) { if (oBase == oEl) break; }if (!oBase || " + sCheckTag + ") return aRet;" + sPush
				} else {
					sTmpFunc += "for (var oEl = (oBase.parentNode || oBase._IE5_parentNode); oEl; oEl = (oEl.parentNode || oEl._IE5_parentNode)) {if (" + sCheckTag + ") { continue; }" + sPush + "}"
				}
				break;
			case "!>":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oRel = (oBase.parentNode || oBase._IE5_parentNode);if (!oRel || oEl != oRel || (" + sCheckTag + ")) return aRet;" + sPush
				} else {
					sTmpFunc += "var oEl = (oBase.parentNode || oBase._IE5_parentNode);if (!oEl || " + sCheckTag + ") { return aRet; }" + sPush
				}
				break;
			case "!+":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oRel;for (oRel = oBase.previousSibling; oRel; oRel = oRel.previousSibling) { if (oRel.nodeType == 1) break; }if (!oRel || oEl != oRel || (" + sCheckTag + ")) return aRet;" + sPush
				} else {
					sTmpFunc += "for (oEl = oBase.previousSibling; oEl; oEl = oEl.previousSibling) { if (oEl.nodeType == 1) break; }if (!oEl || " + sCheckTag + ") { return aRet; }" + sPush
				}
				break;
			case "!~":
				if (oExpr.quotID) {
					sTmpFunc += "var oEl = oDocument_dontShrink.getElementById(" + oExpr.quotID + ");var oRel;for (oRel = oBase.previousSibling; oRel; oRel = oRel.previousSibling) { if (oRel.nodeType != 1) { continue; }if (oRel == oEl) { break; }}if (!oRel || (" + sCheckTag + ")) return aRet;" + sPush
				} else {
					sTmpFunc += "for (oEl = oBase.previousSibling; oEl; oEl = oEl.previousSibling) {if (" + sCheckTag + ") { continue; }if (!markElement_dontShrink(oEl, " + i + ")) { break; }" + sPush + "}"
				}
				break
			}
			sTmpFunc += (i == 0 ? "return aRet;" : "") + "})";
			sFunc = sTmpFunc
		}
		eval("var fpCompiled = " + sFunc + ";");
		return fpCompiled
	};
	var parseQuery = function (sQuery) {
		var sCacheKey = sQuery;
		var fpSelf = arguments.callee;
		var fpFunction = fpSelf._cache[sCacheKey];
		if (!fpFunction) {
			sQuery = backupKeys(sQuery);
			var aParts = splitToParts(sQuery);
			fpFunction = fpSelf._cache[sCacheKey] = compileParts(aParts);
			fpFunction.depth = aParts.length
		}
		return fpFunction
	};
	parseQuery._cache = {};
	var parseTestQuery = function (sQuery) {
		var fpSelf = arguments.callee;
		var aSplitQuery = backupKeys(sQuery).split(/\s*,\s*/);
		var aResult = [];
		var nLen = aSplitQuery.length;
		var aFunc = [];
		for (var i = 0; i < nLen; i++) {
			aFunc.push((function (sQuery) {
				var sCacheKey = sQuery;
				var fpFunction = fpSelf._cache[sCacheKey];
				if (!fpFunction) {
					sQuery = backupKeys(sQuery);
					var oExpr = getExpression(sQuery);
					eval("fpFunction = function(oEl) { " + oExpr.defines + "return (" + oExpr.returnsID + oExpr.returnsTAG + oExpr.returns + "); };")
				}
				return fpFunction
			})(restoreKeys(aSplitQuery[i])))
		}
		return aFunc
	};
	parseTestQuery._cache = {};
	var distinct = function (aList) {
		var aDistinct = [];
		var oDummy = {};
		for (var i = 0, oEl; oEl = aList[i]; i++) {
			var nUID = getUID(oEl);
			if (oDummy[nUID]) {
				continue
			}
			aDistinct.push(oEl);
			oDummy[nUID] = true
		}
		return aDistinct
	};
	var markElement_dontShrink = function (oEl, nDepth) {
		var nUID = getUID(oEl);
		if (cssquery._marked[nDepth][nUID]) {
			return false
		}
		cssquery._marked[nDepth][nUID] = true;
		return true
	};
	var oResultCache = null;
	var bUseResultCache = false;
	var cssquery = function (sQuery, oParent, oOptions) {
		if (typeof sQuery == "object") {
			var oResult = {};
			for (var k in sQuery) {
				oResult[k] = arguments.callee(sQuery[k], oParent, oOptions)
			}
			return oResult
		}
		cost = 0;
		var executeTime = new Date().getTime();
		var aRet;
		for (var r = 0, rp = debugOption.repeat; r < rp; r++) {
			aRet = (function (sQuery, oParent, oOptions) {
				oOptions = oOptions || {};
				if (!oParent) {
					oParent = document
				}
				oDocument_dontShrink = oParent.ownerDocument || oParent.document || oParent;
				if (/\bMSIE\s([0-9]+(\.[0-9]+)*);/.test(navigator.userAgent) && parseFloat(RegExp.$1) < 6) {
					try {
						oDocument_dontShrink.location
					} catch(e) {
						oDocument_dontShrink = document
					}
					oDocument_dontShrink.firstChild = oDocument_dontShrink.getElementsByTagName("html")[0];
					oDocument_dontShrink.firstChild._IE5_parentNode = oDocument_dontShrink
				}
				bXMLDocument = (typeof XMLDocument != "undefined") ? (oDocument_dontShrink.constructor === XMLDocument) : (!oDocument_dontShrink.location);
				getUID = bXMLDocument ? getUID4XML : getUID4HTML;
				clearKeys();
				var aSplitQuery = backupKeys(sQuery).split(/\s*,\s*/);
				var aResult = [];
				var nLen = aSplitQuery.length;
				for (var i = 0; i < nLen; i++) {
					aSplitQuery[i] = restoreKeys(aSplitQuery[i])
				}
				for (var i = 0; i < nLen; i++) {
					var sSingleQuery = aSplitQuery[i];
					var aSingleQueryResult = null;
					var sResultCacheKey = sSingleQuery + (oOptions.single ? "_single" : "");
					var aCache = bUseResultCache ? oResultCache[sResultCacheKey] : null;
					if (aCache) {
						for (var j = 0, oCache; oCache = aCache[j]; j++) {
							if (oCache.parent == oParent) {
								aSingleQueryResult = oCache.result;
								break
							}
						}
					}
					if (!aSingleQueryResult) {
						var fpFunction = parseQuery(sSingleQuery);
						cssquery._marked = [];
						for (var j = 0, nDepth = fpFunction.depth; j < nDepth; j++) {
							cssquery._marked.push({})
						}
						aSingleQueryResult = distinct(fpFunction(oParent, oOptions));
						if (bUseResultCache) {
							if (! (oResultCache[sResultCacheKey] instanceof Array)) {
								oResultCache[sResultCacheKey] = []
							}
							oResultCache[sResultCacheKey].push({
								parent: oParent,
								result: aSingleQueryResult
							})
						}
					}
					aResult = aResult.concat(aSingleQueryResult)
				}
				unsetNodeIndexes();
				return aResult
			})(sQuery, oParent, oOptions)
		}
		executeTime = new Date().getTime() - executeTime;
		if (debugOption.callback) {
			debugOption.callback(sQuery, cost, executeTime)
		}
		return aRet
	};
	cssquery.test = function (oEl, sQuery) {
		clearKeys();
		var aFunc = parseTestQuery(sQuery);
		for (var i = 0, nLen = aFunc.length; i < nLen; i++) {
			if (aFunc[i](oEl)) {
				return true
			}
		}
		return false
	};
	cssquery.useCache = function (bFlag) {
		if (typeof bFlag != "undefined") {
			bUseResultCache = bFlag;
			cssquery.clearCache()
		}
		return bUseResultCache
	};
	cssquery.clearCache = function () {
		oResultCache = {}
	};
	cssquery.getSingle = function (sQuery, oParent) {
		return cssquery(sQuery, oParent, {
			single: true
		})[0] || null
	};
	cssquery.xpath = function (sXPath, oParent) {
		var sXPath = sXPath.replace(/\/(\w+)(\[([0-9]+)\])?/g, function (_, sTag, _, sTh) {
			sTh = sTh || "1";
			return ">" + sTag + ":nth-of-type(" + sTh + ")"
		});
		return cssquery.getSingle(sXPath, oParent)
	};
	cssquery.debug = function (fpCallback, nRepeat) {
		debugOption.callback = fpCallback;
		debugOption.repeat = nRepeat || 1
	};
	cssquery.safeHTML = function (bFlag) {
		var bIE = /MSIE/.test(window.navigator.userAgent);
		if (arguments.length > 0) {
			safeHTML = bFlag && bIE
		}
		return safeHTML || !bIE
	};
	cssquery.version = sVersion;
	return cssquery
})();
(function () {
	var $El = typeof jindo == "undefined" ? window.$Element : jindo.$Element;
	var $Doc = typeof jindo == "undefined" ? window.$Document : jindo.$Document;
	if (typeof $El != "undefined" && $El.prototype && "$value" in $El.prototype) {
		$El.prototype.queryAll = function (sQuery) {
			return cssquery(sQuery, this._element)
		};
		$El.prototype.query = function (sQuery) {
			return cssquery.getSingle(sQuery, this._element)
		};
		$El.prototype.test = function (sQuery) {
			return cssquery.test(this._element, sQuery)
		};
		$El.prototype.xpathAll = function (sXpath) {
			return cssquery.xpath(sXpath, this._element)
		}
	}
	if (typeof $Doc != "undefined" && $Doc.prototype) {
		$Doc.prototype.queryAll = function (sQuery) {
			return cssquery(sQuery, this._document)
		};
		$Doc.prototype.query = function (sQuery) {
			return cssquery.getSingle(sQuery, this._document)
		};
		$Doc.prototype.xpathAll = function (sXpath) {
			return cssquery.xpath(sXpath, this._document)
		}
	}
})();
if (typeof window.$$ == "undefined") {
	window.$$ = cssquery
}(function () {
	$.verifyPackageName = function (namespace) {
		namespace = $S(namespace).trim().$value();
		if (namespace == "") {
			return null
		}
		var names = namespace.split(".");
		var componentName = "",
			parent = window;
		if (names.length == 1) {
			componentName = names.pop()
		} else {
			for (var i = 0, length = names.length; i < length; i++) {
				var n = names[i];
				if (i == names.length - 1) {
					componentName = n;
					break
				}
				if (parent[n] == undefined) {
					parent[n] = {}
				}
				parent = parent[n]
			}
		}
		return {
			container: parent,
			name: componentName
		}
	}
})();
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = function (target, func, initState) {
		func = func || {};
		func.enter = func.enter ||
		function () {};
		func.leave = func.leave ||
		function () {};
		var isIn = initState;
		var refOver = $Fn(function (event) {
			try {
				var node = event.element;
				do {
					if (target == node) {
						break
					}
					try {
						if (node.tagName.toUpperCase() == "BODY") {
							return
						}
					} catch(e) {
						return
					}
				} while (node = node.parentNode);
				var parent = event.relatedElement.parentNode;
				do {
					if (target == parent) {
						return
					}
					try {
						if (parent.tagName.toUpperCase() == "BODY") {
							break
						}
					} catch(e) {
						break
					}
				} while (parent = parent.parentNode);
				if (!isIn) {
					isIn = true;
					func.enter(event, target)
				}
			} catch(e) {}
		},
		this).attach(target, "mouseover");
		var refOut = $Fn(function (event) {
			try {
				var node = event.relatedElement;
				if (node == target) {
					return
				}
				do {
					if (node == target) {
						return
					}
					try {
						if (node.tagName.toUpperCase() == "BODY") {
							break
						}
					} catch(e) {
						break
					}
				} while (node = node.parentNode);
				if (isIn) {
					isIn = false;
					func.leave(event, target)
				}
			} catch(e) {}
		},
		this).attach(target, "mouseout");
		return [refOver, refOut]
	};
	nj.Hover = pkg.container[pkg.name]
})("nj.hover");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = nj.hover;
	jp.Hover = nj.hover
})("jp.hover");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = function (str, myCut, jpSize, engUpperSize, engLowSize, others) {
		var cnt = 0;
		var cutPos = 0;
		var length = 0;
		var sHankaku = "ｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｧｨｩｪｫｬｭｮｯﾞﾟｰ､｡｢｣";
		for (var i = 0; i < str.length; i++) {
			length = i;
			var code = str.charAt(i).charCodeAt(0);
			if (sHankaku.indexOf(str.charAt(i)) >= 0) {
				cnt += others
			} else {
				if (code >= 256) {
					cnt += jpSize
				} else {
					if (code >= 65 && code <= 90) {
						cnt += engUpperSize
					} else {
						if (code >= 97 && code <= 122) {
							cnt += engLowSize
						} else {
							cnt += others
						}
					}
				}
			}
			if (cnt >= myCut) {
				break
			}
		}
		return {
			str: str.substring(0, length + 1),
			size: Math.floor(cnt)
		}
	}
})("nj.cutStr");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = function (sTemplate, oData) {
		var reg = (arguments.length == 2) ? /#([a-z0-9_]+)#/gi : arguments[2];
		return sTemplate.replace(reg, function (m, p) {
			return oData[p] || ""
		})
	}
})("nj.replaceStr");
var CK_MEMBERID = 0;
var CK_PASSWORD = 1;
var CK_NAME = 2;
var CK_SEX = 3;
var CK_AGE = 4;
var CK_VALID = 5;
var CK_AVATARID = 6;
var CK_IDVALID = 7;
var CK_NICKNAME = 8;
var CK_SOCIALID = 9;
var CK_ABSUID = 10;
var CK_ABSSTATUS = 11;
var CK_PLUSLINK = 12;
var CK_SERVICE = 13;
var CK_SUBUPDATE = 14;
var CK_REGPATH = 15;
var CK_ROOMID = 20;
var CK_FIGCLASS = 21;
var CK_EMAILCHK = 22;
var CK_BIRTHDAY = 23;
var CK_USERNO = 24;
var CK_AVITEMEXPIRE = 25;
var CK_CHCLASSNO = 26;
var MAX_PASSWORD_LEN = 4;
var FIX_DOMAIN = "hangame.co.jp";
var FIX_DOMAIN_MOBILE = "hange.jp";
var __host_suffix = "";
var __host_prefix = "";
var GMT_KOREA = -540;
var IspHost = new Array("netcafe", "goo", "ocn");
var aspcounter = 0;
var bAspFlg = 0;
var sHost = document.URL.substr(7);
sHost = sHost.substr(0, sHost.indexOf("."));
for (aspcounter = 0; aspcounter < IspHost.length; aspcounter++) {
	if (sHost == IspHost[aspcounter]) {
		bAspFlg = 1
	}
}
var sAdHead = "";
var sAdFoot = "&showme=js";
var sAdAsp = "";
if (bAspFlg == 1) {
	sAdAsp = "_aff"
}

/** OS情報取得 **/
function getOSInfo() {
	var info = {};
	var u = navigator.userAgent;
	var p = navigator.platform;

	// Return boolean.
	var f = function(s,h){ return (h.indexOf(s) > -1) };

	info.getName = function(){
		var name = "";
		for(x in info){
			if(typeof info[x] == "boolean" && info[x]&&info.hasOwnProperty(x))
				name = x;
			}
		return name;
	};

	info.win = f("Win",p);
	info.mac = f("Mac",p);
	info.win2000 = info.win && (f("NT 5.0",u) || f("2000",u));
	info.winxp = info.win && f("NT 5.1",u);
	info.xpsp2 = info.winxp && f("SV1",u);
	info.vista = info.win && f("NT 6.0",u);
	info.win7 = info.win && f("NT 6.1",u);
	info.iphone = f("iPhone",u);
	info.android = f("Android",u);

	//getClientInfo
	info.iphone2 = f("iPhone OS 2",u);
	info.iphone3 = f("iPhone OS 3",u);
	info.iphone4 = f("iPhone OS 4",u);
	info.ipad = f("iPad",u);
	info.android16 = f("Android 1.6",u);
	info.android21 = f("Android 2.1",u);
	info.android22 = f("Android 2.2",u);

	info.ie = f("MSIE",p);
	info.firefox = f("Firefox",p);
	info.opera = f("Opera",p);
	info.netscape = f("Netscape",u);
	info.safari = f("Safari",u);
	info.chrome = f("Chrome",u);
	info.webkit = f("HangameApp",u);

	return info;
}

function getCookie(n) {
	var ckLogin = getStrCookie("login");
	if (ckLogin == "" || ckLogin == "undefined" || ckLogin == null) {
		return ""
	}
	var sList = ckLogin.split("%2C");
	if (n < sList.length) {
		if (n == CK_AVATARID) {
			return sList[n].customReplace("%2D", "-").replace(/%5F/g, "_")
		} else {
			return sList[n]
		}
	}
	return ""
}
function getStrCookie(sName) {
	var lName, aRec, aData, aValue, n, sCook;
	lName = sName.toLowerCase();
	var aCook = document.cookie.replace(/\0$/, "").split("; "); // for IE9beta's bug
	for (var i = 0; i < aCook.length; i++) {
		aRec = aCook[i].split("=");
		if (aRec.length == 1 && (lName == aRec[0].toLowerCase())) {
			return ""
		} else {
			if (aRec.length == 2) {
				if (lName == aRec[0].toLowerCase()) {
					return aRec[1]
				}
			} else {
				if (aCook[i].indexOf("&") > 0) {
					aData = aCook[i].split("&");
					for (var j = 0; j < aData.length; j++) {
						if (j == 0) {
							n = aData[0].indexOf("=");
							sCook = aData[0].substring(0, n);
							aData[0] = aData[0].substring(n + 1, aData[0].length)
						}
						aValue = aData[j].split("=");
						if ((lName == sCook.toLowerCase()) && (getKey() == aValue[0].toLowerCase())) {
							return aValue[1]
						}
					}
				} else {
					aValue = aCook[i].split("=");
					if ((lName == aValue[0].toLowerCase()) && aValue.length < 3) {
						return ""
					} else {
						if ((lName == aValue[0].toLowerCase()) && (getKey() == aValue[1].toLowerCase())) {
							return aValue[2]
						}
					}
				}
			}
		}
	}
	return ""
}
function setStrCookie(sName, sValue) {
	document.cookie = sName + "=" + sValue + ";domain=" + getFixDomain();
	return ""
}
function setStrCookieForCui(sName, sValue)
{
	if (typeof nExpireDay == 'number') {
		var exDate = new Date;
		exDate.setMonth(exDate.getMonth() + nExpireDay);
		sValue += ';expires=' + exDate.toGMTString();
	}

	document.cookie = sName + "=" + sValue + "; domain=" + getFixDomain() + "; Path=/";
	return "";
}
function setMenuURL(sValue) {
	setStrCookie("menuurl", sValue)
}
function numberFormat(nVar, nSize) {
	if (nSize == null) {
		nSize = 2
	}
	var s = "0000000000" + nVar;
	var n = s.length;
	return s.substring(n - nSize, n)
}
function isNum(sVal) {
	if (sVal == "") {
		return false
	}
	for (var i = 0; i < sVal.length; i++) {
		if (sVal.charAt(i) < "0") {
			return false
		}
		if (sVal.charAt(i) > "9") {
			return false
		}
	}
	return true
}
function isErrorID_Char(sBuf) {
	var sChk = "!@#$%&*()|'[];:\" ^|><~`=+-\\/{}^_,.?";
	for (var i = 0; i < sBuf.length; i++) {
		if (sChk.indexOf(sBuf.charAt(i)) >= 0) {
			return true
		}
	}
	return false
}
function isErrorAddress(sBuf) {
	var sChk = "!@#$%&*()|'[];:\"^|><~`=+-\\/{}^_,.?";
	for (var i = 0; i < sBuf.length; i++) {
		if (sChk.indexOf(sBuf.charAt(i)) >= 0) {
			return true
		}
	}
	return false
}
function isErrorID_Word(sBuf) {
	var sChk = "admin,root,doumi,ubnf,qlor,anbf,mouky".split(",");
	for (var i = 0; i < sChk.length; i++) {
		if (sBuf.indexOf(sChk[i]) >= 0) {
			return true
		}
	}
	return false
}
String.prototype.trim = function () {
	return this.replace(/(^\s*)|(\s*$)/g, "")
};
String.prototype.customReplace = function (a, b) {
	var s = this;
	var n1, n2, s1, s2;
	while (true) {
		if (s == "" || a == "") {
			break
		}
		n1 = s.indexOf(a);
		if (n1 < 0) {
			break
		}
		n2 = n1 + a.length;
		if (n1 == 0) {
			s1 = b
		} else {
			s1 = s.substring(0, n1) + b
		}
		if (n2 >= s.length) {
			s2 = ""
		} else {
			s2 = s.substring(n2, s.length)
		}
		s = s1 + s2
	}
	return s
};

function getTimezone() {
	now = new Date();
	return now.getTimezoneOffset()
}
function isKorean() {
	return (getTimezone() == GMT_KOREA)
}
function getAdvurl(sAdcase, sGameid) {
	var sTarget = getTargetString(sGameid);
	var sKor = "" + sAdcase + sTarget;
	var sEtc = "" + sAdcase + sTarget;
	if (!isKorean()) {
		if (typeof(fraUsid) == "object") {
			fraUsid.location.href = "" + (getTimezone() / 60) + "&uid=" + txtUsid.value
		}
	}
	return (isKorean()) ? sKor : sEtc
}
function getFixDomain() {
	var s = document.domain;
	if (s.indexOf(FIX_DOMAIN) >= 0) {
		return FIX_DOMAIN
	} else {
		var n = s.indexOf(".");
		return s.substring(n + 1, s.length)
	}
}
function getKey() {
	var s, sKey;
	s = document.location.href;
	var protocol = document.location.protocol;
	var isHttpRequest = (protocol == ("http:") || protocol == ("https:"));
	if ((getFixDomain() == FIX_DOMAIN) && isHttpRequest) {
		s = s.substring(protocol.length + 2, s.length);
		sKey = s.substring(0, s.indexOf("."));
		if (sKey.toLowerCase() != "gamegate") {
			if (__bTest) {
				sKey = "hangametest"
			} else {
				sKey = "hangame"
			}
		}
	} else {
		sKey = ""
	}
	return sKey.toLowerCase()
}
function putAdCode(sAdId) {
	document.write('<script language=javascript src="' + sAdHead + sAdId + sAdAsp + sAdFoot + '"><\/script>')
}
var LOGINHOST_domain = new Array("hgj", "ncf", "gof", "ocn");

function putAdCodeNew(sAdSv, sAdId, sAdHost) {
	var sAdAff = "";
	var aff_host = getCookieHost();
	var cnt;
	for (cnt = 0; cnt <= LOGINHOST_domain.length; cnt++) {
		if (aff_host == LOGINHOST_domain[cnt]) {
			sAdAff = "_aff"
		}
	}
	if (sAdHost == "www.") {
		sAdAff = ""
	}
	document.write('<script language=javascript src="http://' + sAdSv + "" + sAdId + sAdAff + sAdFoot + '"><\/script>')
}
var JCT11280;

function escapeSJIS(str) {
	if (typeof JCT11280 == "undefined") {
		JCT11280 = Function('var a="zKV33~jZ4zN=~ji36XazM93y!{~k2y!o~k0ZlW6zN?3Wz3W?{EKzK[33[`y|;-~j^YOTz$!~kNy|L1$353~jV3zKk3~k-4P4zK_2+~jY4y!xYHR~jlz$_~jk4z$e3X5He<0y!wy|X3[:~l|VU[F3VZ056Hy!nz/m1XD61+1XY1E1=1y|bzKiz!H034zKj~mEz#c5ZA3-3X$1~mBz$$3~lyz#,4YN5~mEz#{ZKZ3V%7Y}!J3X-YEX_J(3~mAz =V;kE0/y|F3y!}~m>z/U~mI~j_2+~mA~jp2;~m@~k32;~m>V}2u~mEX#2x~mBy+x2242(~mBy,;2242(~may->2&XkG2;~mIy-_2&NXd2;~mGz,{4<6:.:B*B:XC4>6:.>B*BBXSA+A:X]E&E<~r#z+625z s2+zN=`HXI@YMXIAXZYUM8X4K/:Q!Z&33 3YWX[~mB`{zKt4z (zV/z 3zRw2%Wd39]S11z$PAXH5Xb;ZQWU1ZgWP%3~o@{Dgl#gd}T){Uo{y5_d{e@}C(} WU9|cB{w}bzvV|)[} H|zT}d||0~{]Q|(l{|x{iv{dw}(5}[Z|kuZ }cq{{y|ij}.I{idbof%cu^d}Rj^y|-M{ESYGYfYsZslS`?ZdYO__gLYRZ&fvb4oKfhSf^d<Yeasc1f&a=hnYG{QY{D`Bsa|u,}Dl|_Q{C%xK|Aq}C>|c#ryW=}eY{L+`)][YF_Ub^h4}[X|?r|u_ex}TL@YR]j{SrXgo*|Gv|rK}B#mu{R1}hs|dP{C7|^Qt3|@P{YVV |8&}#D}ef{e/{Rl|>Hni}R1{Z#{D[}CQlQ||E}[s{SG_+i8eplY[=[|ec[$YXn#`hcm}YR|{Ci(_[ql|?8p3]-}^t{wy}4la&pc|3e{Rp{LqiJ],] `kc(]@chYnrM`O^,ZLYhZB]ywyfGY~aex!_Qww{a!|)*lHrM{N+n&YYj~Z b c#e_[hZSon|rOt`}hBXa^i{lh|<0||r{KJ{kni)|x,|0auY{D!^Sce{w;|@S|cA}Xn{C1h${E]Z-XgZ*XPbp]^_qbH^e[`YM|a||+=]!Lc}]vdBc=j-YSZD]YmyYLYKZ9Z>Xcczc2{Yh}9Fc#Z.l{}(D{G{{mRhC|L3b#|xK[Bepj#ut`H[,{E9Yr}1b{[e]{ZFk7[ZYbZ0XL]}Ye[(`d}c!|*y`Dg=b;gR]Hm=hJho}R-[n}9;{N![7k_{UbmN]rf#pTe[x8}!Qcs_rs[m`|>N}^V})7{^r|/E}),}HH{OYe2{Skx)e<_.cj.cjoMhc^d}0uYZd!^J_@g,[[[?{i@][|3S}Yl3|!1|eZ|5IYw|1D}e7|Cv{OHbnx-`wvb[6[4} =g+k:{C:}ed{S]|2M]-}WZ|/q{LF|dYu^}Gs^c{Z=}h>|/i|{W]:|ip{N:|zt|S<{DH[p_tvD{N<[8Axo{X4a.^o^X>Yfa59`#ZBYgY~_t^9`jZHZn`>G[oajZ;X,i)Z.^~YJe ZiZF^{][[#Zt^|]Fjx]&_5dddW]P0C[-]}]d|y {C_jUql] |OpaA[Z{lp|rz}:Mu#]_Yf6{Ep?f5`$[6^D][^u[$[6^.Z8]]ePc2U/=]K^_+^M{q*|9tYuZ,s(dS{i=|bNbB{uG}0jZOa:[-]dYtu3]:]<{DJ_SZIqr_`l=Yt`gkTnXb3d@kiq0a`Z{|!B|}e}Ww{Sp,^Z|0>_Z}36|]A|-t}lt{R6pi|v8hPu#{C>YOZHYmg/Z4nicK[}hF_Bg|YRZ7c|crkzYZY}_iXcZ.|)U|L5{R~qi^Uga@Y[xb}&qdbd6h5|Btw[}c<{Ds53[Y7]?Z<|e0{L[ZK]mXKZ#Z2^tavf0`PE[OSOaP`4gi`qjdYMgys/?[nc,}EEb,eL]g[n{E_b/vcvgb.{kcwi`~v%|0:|iK{Jh_vf5lb}KL|(oi=LrzhhY_^@`zgf[~g)[J_0fk_V{T)}I_{D&_/d9W/|MU[)f$xW}?$xr4<{Lb{y4}&u{XJ|cm{Iu{jQ}CMkD{CX|7A}G~{kt)nB|d5|<-}WJ}@||d@|Iy}Ts|iL|/^|no|0;}L6{Pm]7}$zf:|r2}?C_k{R(}-w|`G{Gy[g]bVje=_0|PT{^Y^yjtT[[[l!Ye_`ZN]@[n_)j3nEgMa]YtYpZy].d-Y_cjb~Y~[nc~sCi3|zg}B0}do{O^{|$`_|D{}U&|0+{J3|8*]iayx{a{xJ_9|,c{Ee]QXlYb]$[%YMc*]w[aafe]aVYi[fZEii[xq2YQZHg]Y~h#|Y:thre^@^|_F^CbTbG_1^qf7{L-`VFx Zr|@EZ;gkZ@slgko`[e}T:{Cu^pddZ_`yav^Ea+[#ZBbSbO`elQfLui}.F|txYcbQ`XehcGe~fc^RlV{D_0ZAej[l&jShxG[ipB_=u:eU}3e8[=j|{D(}dO{Do[BYUZ0/]AYE]ALYhZcYlYP/^-^{Yt_1_-;YT`P4BZG=IOZ&]H[e]YYd[9^F[1YdZxZ?Z{Z<]Ba2[5Yb[0Z4l?]d_;_)a?YGEYiYv`_XmZs4ZjY^Zb]6gqGaX^9Y}dXZr[g|]Y}K aFZp^k^F]M`^{O1Ys]ZCgCv4|E>}8eb7}l`{L5[Z_faQ|c2}Fj}hw^#|Ng|B||w2|Sh{v+[G}aB|MY}A{|8o}X~{E8paZ:]i^Njq]new)`-Z>haounWhN}c#{DfZ|fK]KqGZ=:u|fqoqcv}2ssm}.r{]{nIfV{JW)[K|,Z{Uxc|]l_KdCb%]cfobya3`p}G^|LZiSC]U|(X|kBlVg[kNo({O:g:|-N|qT}9?{MBiL}Sq{`P|3a|u.{Uaq:{_o|^S}jX{Fob0`;|#y_@[V[K|cw[<_ }KU|0F}d3|et{Q7{LuZttsmf^kYZ`Af`}$x}U`|Ww}d]| >}K,r&|XI|*e{C/a-bmr1fId4[;b>tQ_:]hk{b-pMge]gfpo.|(w[jgV{EC1Z,YhaY^q,_G[c_g[J0YX]`[h^hYK^_Yib,` {i6vf@YM^hdOKZZn(jgZ>bzSDc^Z%[[o9[2=/YHZ(_/Gu_`*|8z{DUZxYt^vuvZjhi^lc&gUd4|<UiA`z]$b/Z?l}YI^jaHxe|;F}l${sQ}5g}hA|e4}?o{ih}Uz{C)jPe4]H^J[Eg[|AMZMlc}:,{iz}#*|gc{Iq|/:|zK{l&}#u|myd{{M&v~nV};L|(g|I]ogddb0xsd7^V})$uQ{HzazsgxtsO^l}F>ZB]r|{7{j@cU^{{CbiYoHlng]f+nQ[bkTn/}<-d9q {KXadZYo+n|l[|lc}V2{[a{S4Zam~Za^`{HH{xx_SvF|ak=c^[v^7_rYT`ld@]:_ub%[$[m](Shu}G2{E.ZU_L_R{tz`vj(f?^}hswz}GdZ}{S:h`aD|?W|`dgG|if{a8|J1{N,}-Ao3{H#{mfsP|[ bzn+}_Q{MT{u4kHcj_q`eZj[8o0jy{p7}C|[}l){MuYY{|Ff!Ykn3{rT|m,^R|,R}$~Ykgx{P!]>iXh6[l[/}Jgcg{JYZ.^qYfYIZl[gZ#Xj[Pc7YyZD^+Yt;4;`e8YyZVbQ7YzZxXja.7SYl[s]2^/Ha$[6ZGYrb%XiYdf2]H]kZkZ*ZQ[ZYS^HZXcCc%Z|[(bVZ]]:OJQ_DZCg<[,]%Zaa [g{C00HY[c%[ChyZ,Z_`PbXa+eh`^&jPi0a[ggvhlekL]w{Yp^v}[e{~;k%a&k^|nR_z_Qng}[E}*Wq:{k^{FJZpXRhmh3^p>de^=_7`|ZbaAZtdhZ?n4ZL]u`9ZNc3g%[6b=e.ZVfC[ZZ^^^hD{E(9c(kyZ=bb|Sq{k`|vmr>izlH[u|e`}49}Y%}FT{[z{Rk}Bz{TCc/lMiAqkf(m$hDc;qooi[}^o:c^|Qm}a_{mrZ(pA`,}<2sY| adf_%|}`}Y5U;}/4|D>|$X{jw{C<|F.hK|*A{MRZ8Zsm?imZm_?brYWZrYx`yVZc3a@f?aK^ojEd {bN}/3ZH]/$YZhm^&j 9|(S|b]mF}UI{q&aM]LcrZ5^.|[j`T_V_Gak}9J[ ZCZD|^h{N9{~&[6Zd{}B}2O|cv]K}3s}Uy|l,fihW{EG`j_QOp~Z$F^zexS`dcISfhZBXP|.vn|_HYQ|)9|cr]<`&Z6]m_(ZhPcSg>`Z]5`~1`0Xcb4k1{O!bz|CN_T{LR|a/gFcD|j<{Z._[f)mPc:1`WtIaT1cgYkZOaVZOYFrEe[}T$}Ch}mk{K-^@]fH{Hdi`c*Z&|Kt{if[C{Q;{xYB`dYIX:ZB[}]*[{{p9|4GYRh2ao{DS|V+[zd$`F[ZXKadb*A] Ys]Maif~a/Z2bmclb8{Jro_rz|x9cHojbZ{GzZx_)]:{wAayeDlx}<=`g{H1{l#}9i|)=|lP{Qq}.({La|!Y{i2EZfp=c*}Cc{EDvVB|;g}2t{W4av^Bn=]ri,|y?|3+}T*ckZ*{Ffr5e%|sB{lx^0]eZb]9[SgAjS_D|uHZx]dive[c.YPkcq/}db{EQh&hQ|eg}G!ljil|BO]X{Qr_GkGl~YiYWu=c3eb}29v3|D|}4i||.{Mv})V{SP1{FX}CZW6{cm|vO{pS|e#}A~|1i}81|Mw}es|5[}3w{C`h9aL]o{}p[G`>i%a1Z@`Ln2bD[$_h`}ZOjhdTrH{[j_:k~kv[Sdu]CtL}41{I |[[{]Zp$]XjxjHt_eThoa#h>sSt8|gK|TVi[Y{t=}Bs|b7Zpr%{gt|Yo{CS[/{iteva|cf^hgn}($_c^wmb^Wm+|55jrbF|{9^ q6{C&c+ZKdJkq_xOYqZYSYXYl`8]-cxZAq/b%b*_Vsa[/Ybjac/OaGZ4fza|a)gY{P?| I|Y |,pi1n7}9bm9ad|=d{aV|2@[(}B`d&|Uz}B}{`q|/H|!JkM{FU|CB|.{}Az}#P|lk}K{|2rk7{^8^?`/|k>|Ka{Sq}Gz}io{DxZh[yK_#}9<{TRdgc]`~Z>JYmYJ]|`!ZKZ]gUcx|^E[rZCd`f9oQ[NcD_$ZlZ;Zr}mX|=!|$6ZPZYtIo%fj}CpcN|B,{VDw~gb}@hZg`Q{LcmA[(bo`<|@$|o1|Ss}9Z_}tC|G`{F/|9nd}i=}V-{L8aaeST]daRbujh^xlpq8|}zs4bj[S`J|]?G{P#{rD{]I`OlH{Hm]VYuSYUbRc*6[j`8]pZ[bt_/^Jc*[<Z?YE|Xb|?_Z^Vcas]h{t9|Uwd)_(=0^6Zb{Nc} E[qZAeX[a]P^|_J>e8`W^j_Y}R{{Jp__]Ee#e:iWb9q_wKbujrbR}CY`,{mJ}gz{Q^{t~N|? gSga`V_||:#mi}3t|/I`X{N*|ct|2g{km}gi|{={jC}F;|E}{ZZjYf*frmu}8Tdroi{T[|+~}HG{cJ}DM{Lp{Ctd&}$hi3|FZ| m}Kr|38}^c|m_|Tr{Qv|36}?Up>|;S{DV{k_as}BK{P}}9p|t`jR{sAm4{D=b4pWa[}Xi{EjwEkI}3S|E?u=X0{jf} S|NM|JC{qo^3cm]-|JUx/{Cj{s>{Crt[UXuv|D~|j|d{YXZR}Aq}0r}(_{pJfi_z}0b|-vi)Z mFe,{f4|q`b{}^Z{HM{rbeHZ|^x_o|XM|L%|uFXm}@C_{{Hhp%a7|0p[Xp+^K}9U{bP}: tT}B|}+$|b2|[^|~h{FAby[`{}xgygrt~h1[li`c4vz|,7p~b(|mviN}^pg[{N/|g3|^0c,gE|f%|7N{q[|tc|TKA{LU}I@|AZp(}G-sz{F |qZ{}F|f-}RGn6{Z]_5})B}UJ{FFb2]4ZI@v=k,]t_Dg5Bj]Z-]L]vrpdvdGlk|gF}G]|IW}Y0[G| /bo|Te^,_B}#n^^{QHYI[?hxg{[`]D^IYRYTb&kJ[cri[g_9]Ud~^_]<p@_e_XdNm-^/|5)|h_{J;{kacVopf!q;asqd}n)|.m|bf{QW|U)}b+{tL|w``N|to{t ZO|T]jF}CB|0Q{e5Zw|k |We}5:{HO{tPwf_uajjBfX}-V_C_{{r~gg|Ude;s+}KNXH}! `K}eW{Upwbk%ogaW}9EYN}YY|&v|SL{C3[5s.]Y]I]u{M6{pYZ`^,`ZbCYR[1mNg>rsk0Ym[jrE]RYiZTr*YJ{Ge|%-lf|y(`=[t}E6{k!|3)}Zk} ][G{E~cF{u3U.rJ|a9p#o#ZE|?|{sYc#vv{E=|LC}cu{N8`/`3`9rt[4|He{cq|iSYxY`}V |(Q|t4{C?]k_Vlvk)BZ^r<{CL}#h}R+[<|i=}X|{KAo]|W<`K{NW|Zx}#;|fe{IMr<|K~tJ_x}AyLZ?{GvbLnRgN}X&{H7|x~}Jm{]-| GpNu0}.ok>|c4{PYisrDZ|fwh9|hfo@{H~XSbO]Odv]%`N]b1Y]]|eIZ}_-ZA]aj,>eFn+j[aQ_+]h[J_m_g]%_wf.`%k1e#Z?{CvYu_B^|gk`Xfh^M3`afGZ-Z|[m{L}|k3cp[it ^>YUi~d>{T*}YJ{Q5{Jxa$hg|%4`}|LAgvb }G}{P=|<;Ux{_skR{cV|-*|s-{Mp|XP|$G|_J}c6cM{_=_D|*9^$ec{V;|4S{qO|w_|.7}d0|/D}e}|0G{Dq]Kdp{}dfDi>}B%{Gd|nl}lf{C-{y}|ANZr}#={T~|-(}c&{pI|ft{lsVP}){|@u}!W|bcmB{d?|iW|:dxj{PSkO|Hl]Li:}VYk@|2={fnWt{M3`cZ6|)}|Xj}BYa?vo{e4|L7|B7{L7|1W|lvYO}W8nJ|$Vih|{T{d*_1|:-n2dblk``fT{Ky|-%}m!|Xy|-a{Pz}[l{kFjz|iH}9N{WE{x,|jz}R {P|{D)c=nX|Kq|si}Ge{sh|[X{RF{t`|jsr*fYf,rK|/9}$}}Nf{y!1|<Std}4Wez{W${Fd_/^O[ooqaw_z[L`Nbv[;l7V[ii3_PeM}.h^viqYjZ*j1}+3{bt{DR[;UG}3Og,rS{JO{qw{d<_zbAh<R[1_r`iZTbv^^a}c{iEgQZ<exZFg.^Rb+`Uj{a+{z<[~r!]`[[|rZYR|?F|qppp]L|-d|}K}YZUM|=Y|ktm*}F]{D;g{uI|7kg^}%?Z%ca{N[_<q4xC]i|PqZC]n}.bDrnh0Wq{tr|OMn6tM|!6|T`{O`|>!]ji+]_bTeU}Tq|ds}n|{Gm{z,f)}&s{DPYJ`%{CGd5v4tvb*hUh~bf]z`jajiFqAii]bfy^U{Or|m+{I)cS|.9k:e3`^|xN}@Dnlis`B|Qo{`W|>||kA}Y}{ERYuYx`%[exd`]|OyiHtb}HofUYbFo![5|+]gD{NIZR|Go}.T{rh^4]S|C9_}xO^i`vfQ}C)bK{TL}cQ|79iu}9a];sj{P.o!f[Y]pM``Jda^Wc9ZarteBZClxtM{LW}l9|a.mU}KX}4@{I+f1}37|8u}9c|v${xGlz}jP{Dd1}e:}31}%3X$|22i<v+r@~mf{sN{C67G97855F4YL5}8f{DT|xy{sO{DXB334@55J1)4.G9A#JDYtXTYM4, YQD9;XbXm9SX]IB^4UN=Xn<5(;(F3YW@XkH-X_VM[DYM:5XP!T&Y`6|,^{IS-*D.H>:LXjYQ0I3XhAF:9:(==.F*3F1189K/7163D,:@|e2{LS36D4hq{Lw/84443@4.933:0307::6D7}&l{Mx657;89;,K5678H&93D(H<&<>0B90X^I;}Ag1{P%3A+>><975}[S{PZE453?4|T2{Q+5187;>447:81{C=hL6{Me^:=7ii{R=.=F<81;48?|h8}Uh{SE|,VxL{ST,7?9Y_5Xk3A#:$%YSYdXeKXOD8+TXh7(@>(YdXYHXl9J6X_5IXaL0N?3YK7Xh!1?XgYz9YEXhXaYPXhC3X`-YLY_XfVf[EGXZ5L8BXL9YHX]SYTXjLXdJ: YcXbQXg1PX]Yx4|Jr{Ys4.8YU+XIY`0N,<H%-H;:0@,74/:8546I=9177154870UC]d<C3HXl7ALYzXFXWP<<?E!88E5@03YYXJ?YJ@6YxX-YdXhYG|9o{`iXjY_>YVXe>AYFX[/(I@0841?):-B=14337:8=|14{c&93788|di{cW-0>0<097/A;N{FqYpugAFT%X/Yo3Yn,#=XlCYHYNX[Xk3YN:YRT4?)-YH%A5XlYF3C1=NWyY}>:74-C673<69545v {iT85YED=64=.F4..9878/D4378?48B3:7:7/1VX[f4{D,{l<5E75{dAbRB-8-@+;DBF/$ZfW8S<4YhXA.(5@*11YV8./S95C/0R-A4AXQYI7?68167B95HA1*<M3?1/@;/=54XbYP36}lc{qzSS38:19?,/39193574/66878Yw1X-87E6=;964X`T734:>86>1/=0;(I-1::7ALYGXhF+Xk[@W%TYbX7)KXdYEXi,H-XhYMRXfYK?XgXj.9HX_SX]YL1XmYJ>Y}WwIXiI-3-GXcYyXUYJ$X`Vs[7;XnYEZ;XF! 3;%8;PXX(N3Y[)Xi1YE&/ :;74YQ6X`33C;-(>Xm0(TYF/!YGXg8 9L5P01YPXO-5%C|qd{{/K/E6,=0144:361:955;6443@?B7*7:F89&F35YaX-CYf,XiFYRXE_e{}sF 0*7XRYPYfXa5YXXY8Xf8Y~XmA[9VjYj*#YMXIYOXk,HHX40YxYMXU8OXe;YFXLYuPXP?EB[QV0CXfY{:9XV[FWE0D6X^YVP*$4%OXiYQ(|xp|%c3{}V`1>Y`XH00:8/M6XhQ1:;3414|TE|&o@1*=81G8<3}6<|(f6>>>5-5:8;093B^3U*+*^*UT30XgYU&7*O1953)5@E78--F7YF*B&0:%P68W9Zn5974J9::3}Vk|-,C)=)1AJ4+<3YGXfY[XQXmT1M-XcYTYZXCYZXEYXXMYN,17>XIG*SaS|/eYJXbI?XdNZ+WRYP<F:R PXf;0Xg`$|1GX9YdXjLYxWX!ZIXGYaXNYm6X9YMX?9EXmZ&XZ#XQ>YeXRXfAY[4 ;0X!Zz0XdN$XhYL XIY^XGNXUYS/1YFXhYk.TXn4DXjB{jg|4DEX]:XcZMW=A.+QYL<LKXc[vV$+&PX*Z3XMYIXUQ:ZvW< YSXFZ,XBYeXMM)?Xa XiZ4/EXcP3%}&-|6~:1(-+YT$@XIYRBC<}&,|7aJ6}bp|8)K1|Xg|8C}[T|8Q.89;-964I38361<=/;883651467<7:>?1:.}le|:Z=39;1Y^)?:J=?XfLXbXi=Q0YVYOXaXiLXmJXO5?.SFXiCYW}-;|=u&D-X`N0X^,YzYRXO(QX_YW9`I|>hZ:N&X)DQXP@YH#XmNXi$YWX^=!G6YbYdX>XjY|XlX^XdYkX>YnXUXPYF)FXT[EVTMYmYJXmYSXmNXi#GXmT3X8HOX[ZiXN]IU2>8YdX1YbX<YfWuZ8XSXcZU%0;1XnXkZ_WTG,XZYX5YSX Yp 05G?XcYW(IXg6K/XlYP4XnI @XnO1W4Zp-9C@%QDYX+OYeX9>--YSXkD.YR%Q/Yo YUX].Xi<HYEZ2WdCE6YMXa7F)=,D>-@9/8@5=?7164;35387?N<618=6>7D+C50<6B03J0{Hj|N9$D,9I-,.KB3}m |NzE0::/81YqXjMXl7YG; [.W=Z0X4XQY]:MXiR,XgM?9$9>:?E;YE77VS[Y564760391?14941:0=:8B:;/1DXjFA-564=0B3XlH1+D85:0Q!B#:-6&N/:9<-R3/7Xn<*3J4.H:+334B.=>30H.;3833/76464665755:/83H6633:=;.>5645}&E|Y)?1/YG-,93&N3AE@5 <L1-G/8A0D858/30>8<549=@B8] V0[uVQYlXeD(P#ID&7T&7;Xi0;7T-$YE)E=1:E1GR):--0YI7=E<}n9|aT6783A>D7&4YG7=391W;Zx<5+>F#J39}o/|cc;6=A050EQXg8A1-}D-|d^5548083563695D?-.YOXd37I$@LYLWeYlX<Yd+YR A$;3-4YQ-9XmA0!9/XLY_YT(=5XdDI>YJ5XP1ZAW{9>X_6R(XhYO65&J%DA)C-!B:97#A9;@?F;&;(9=11/=657/H,<8}bz|j^5446>.L+&Y^8Xb6?(CYOXb*YF(8X`FYR(XPYVXmPQ%&DD(XmZXW??YOXZXfCYJ79,O)XnYF7K0!QXmXi4IYFRXS,6<%-:YO(+:-3Q!1E1:W,Zo}Am|n~;3580534*?3Zc4=9334361693:30C<6/717:<1/;>59&:4}6!|rS36=1?75<8}[B|s809983579I.A.>84758=108564741H*9E{L{|u%YQ<%6XfH.YUXe4YL@,>N}Tv|ve*G0X)Z;/)3@A74(4P&A1X:YVH97;,754*A66:1 D739E3553545558E4?-?K17/770843XAYf838A7K%N!YW4.$T19Z`WJ*0XdYJXTYOXNZ 1XaN1A+I&Xi.Xk3Z3GB&5%WhZ1+5#Y[X<4YMXhQYoQXVXbYQ8XSYUX4YXBXWDMG0WxZA[8V+Z8X;D],Va$%YeX?FXfX[XeYf<X:Z[WsYz8X_Y]%XmQ(!7BXIZFX]&YE3F$(1XgYgYE& +[+W!<YMYFXc;+PXCYI9YrWxGXY9DY[!GXiI7::)OC;*$.>N*HA@{C|}&k=:<TB83X`3YL+G4XiK]i}(fYK<=5$.FYE%4*5*H*6XkCYL=*6Xi6!Yi1KXR4YHXbC8Xj,B9ZbWx/XbYON#5B}Ue}+QKXnF1&YV5XmYQ0!*3IXBYb71?1B75XmF;0B976;H/RXU:YZX;BG-NXj;XjI>A#D3B636N;,*%<D:0;YRXY973H5)-4FXOYf0:0;/7759774;7;:/855:543L43<?6=E,.A4:C=L)%4YV!1(YE/4YF+ F3%;S;&JC:%/?YEXJ4GXf/YS-EXEYW,9;E}X$}547EXiK=51-?71C%?57;5>463553Zg90;6447?<>4:9.7538XgN{|!}9K/E&3-:D+YE1)YE/3;37/:05}n<}:UX8Yj4Yt864@JYK..G=.(A Q3%6K>3(P3#AYE$-6H/456*C=.XHY[#S.<780191;057C)=6HXj?955B:K1 E>-B/9,;5.!L?:0>/.@//:;7833YZ56<4:YE=/:7Z_WGC%3I6>XkC*&NA16X=Yz2$X:Y^&J48<99k8}CyB-61<18K946YO4{|N}E)YIB9K0L>4=46<1K0+R;6-=1883:478;4,S+3YJX`GJXh.Yp+Xm6MXcYpX(>7Yo,/:X=Z;Xi0YTYHXjYmXiXj;*;I-8S6N#XgY}.3XfYGO3C/$XjL$*NYX,1 6;YH&<XkK9C#I74.>}Hd`A748X[T450[n75<4439:18A107>|ET}Rf<1;14876/Yb983E<5.YNXd4149>,S=/4E/<306443G/06}0&}UkYSXFYF=44=-5095=88;63844,9E6644{PL}WA8:>)7+>763>>0/B3A545CCnT}Xm|dv}Xq1L/YNXk/H8;;.R63351YY747@15YE4J8;46;.38.>4A369.=-83,;Ye3?:3@YE.4-+N353;/;@(X[YYD>@/05-I*@.:551741Yf5>6A443<3535;.58/86=D4753442$635D1>0359NQ @73:3:>><Xn?;43C14 ?Y|X611YG1&<+,4<*,YLXl<1/AIXjF*N89A4Z576K1XbJ5YF.ZOWN.YGXO/YQ01:4G38Xl1;KI0YFXB=R<7;D/,/4>;$I,YGXm94@O35Yz66695385.>:6A#5}W7n^4336:4157597434433<3|XA}m`>=D>:4A.337370?-6Q96{`E|4A}C`|Qs{Mk|J+~r>|o,wHv>Vw}!c{H!|Gb|*Ca5}J||,U{t+{CN[!M65YXOY_*B,Y[Z9XaX[QYJYLXPYuZ%XcZ8LY[SYPYKZM<LMYG9OYqSQYM~[e{UJXmQYyZM_)>YjN1~[f3{aXFY|Yk:48YdH^NZ0|T){jVFYTZNFY^YTYN~[h{nPYMYn3I]`EYUYsYIZEYJ7Yw)YnXPQYH+Z.ZAZY]^Z1Y`YSZFZyGYHXLYG 8Yd#4~[i|+)YH9D?Y^F~Y7|-eYxZ^WHYdYfZQ~[j|3>~[k|3oYmYqY^XYYO=Z*4[]Z/OYLXhZ1YLZIXgYIHYEYK,<Y`YEXIGZI[3YOYcB4SZ!YHZ*&Y{Xi3~[l|JSY`Zz?Z,~[m|O=Yi>??XnYWXmYS617YVYIHZ(Z4[~L4/=~[n|Yu{P)|];YOHHZ}~[o33|a>~[r|aE]DH~[s|e$Zz~[t|kZFY~XhYXZB[`Y}~[u|{SZ&OYkYQYuZ2Zf8D~[v}% ~[w3},Q[X]+YGYeYPIS~[y}4aZ!YN^!6PZ*~[z}?E~[{3}CnZ=~[}}EdDZz/9A3(3S<,YR8.D=*XgYPYcXN3Z5 4)~[~}JW=$Yu.XX~] }KDX`PXdZ4XfYpTJLY[F5]X~[2Yp}U+DZJ::<446[m@~]#3}]1~]%}^LZwZQ5Z`/OT<Yh^ -~]&}jx[ ~m<z!%2+~ly4VY-~o>}p62yz!%2+Xf2+~ly4VY-zQ`z (=] 2z~o2",C={" ":0,"!":1},c=34,i=2,p,s="",u=String.fromCharCode,t=u(12539);while(++c<127)C[u(c)]=c^39&&c^92?i++:0;i=0;while(0<=(c=C[a.charAt(i++)]))if(16==c)if((c=C[a.charAt(i++)])<87){if(86==c)c=1879;while(c--)s+=u(++p)}else s+=s.substr(8272,360);else if(c<86)s+=u(p+=c<51?c-16:(c-55)*92+C[a.charAt(i++)]);else if((c=((c-86)*92+C[a.charAt(i++)])*92+C[a.charAt(i++)])<49152)s+=u(p=c<40960?c:c|57344);else{c&=511;while(c--)s+=t;p=12539}return s')()
	}
	return str.replace(/[^*+.-9A-Z_a-z-]/g, function (s) {
		var c = s.charCodeAt(0),
			m;
		return c < 128 ? (c < 16 ? "%0" : "%") + c.toString(16).toUpperCase() : 65376 < c && c < 65440 ? "%" + (c - 65216).toString(16).toUpperCase() : (c = JCT11280.indexOf(s)) < 0 ? "%81E" : "%" + ((m = ((c < 8272 ? c : (c = JCT11280.lastIndexOf(s))) - (c %= 188)) / 188) < 31 ? m + 129 : m + 193).toString(16).toUpperCase() + (64 < (c += c < 63 ? 64 : 65) && c < 91 || 95 == c || 96 < c && c < 123 ? String.fromCharCode(c) : "%" + c.toString(16).toUpperCase())
	})
}
var MYPAGE_TID = ["profile", "blog", "avatar", "mygame", "friend", "mynews", "setting"];
var MYPAGE_STID = [
	["index.nhn"],
	["index.nhn"],
	["index.nhn", "myitem.nhn"],
	["index.nhn"],
	["index.nhn", "prishotsquare.nhn", "magokorotop.nhn"],
	["index.nhn", "clubhg.nhn"],
	["index.nhn", "sound.nhn"]
];
var MYPAGE_PROFILE = 0;
var MYPAGE_BLOG = 1;
var MYPAGE_AVATAR = 2;
var MYPAGE_MYGAME = 3;
var MYPAGE_FRIEND = 4;
var MYPAGE_MYNEWS = 5;
var MYPAGE_SETTING = 6;
var MYPAGE_WIN_NAME = "mypage";

function openProfile(url) {
	url = url.customReplace("&", "@");
	var win = window.open(__urlProfile + "/redirect.nhn?url=" + escapeSJIS(url), MYPAGE_WIN_NAME);
	win.focus();
	return win
}
function openPetitPage(mid, svcid) {
	if (mid.length > 0) {
		mid = "mid=" + mid + "&"
	}
	if (svcid == null) {
		svcid = ""
	} else {
		svcid = "svcid=" + svcid + "&"
	}
	return window.open(__urlProfile + "/petit/index.nhn?" + mid + svcid, "petit", "width=295,height=634,scroll=no")
}
function openMypage(mid, tid, stid) {
	if (typeof(tid) == "undefined") {
		tid = MYPAGE_PROFILE
	}
	if (typeof(stid) == "undefined") {
		stid = 0
	}
	if (typeof(mid) == "undefined") {
		mid = "";
		tid = MYPAGE_MYNEWS;
		if (getCookie(CK_MEMBERID).length == 0) {
			alert("ログインしていないため、プロフィールをご利用いただけません。");
			return
		}
	}
	if (mid.length > 0) {
		mid = "?mid=" + mid
	}
	var win = window.open(getMypageURL(mid, tid, stid), MYPAGE_WIN_NAME);
	win.focus()
}
function getMypageURL(mid, tid, stid) {
	return __urlProfile + "/" + MYPAGE_TID[tid] + "/" + MYPAGE_STID[tid][stid] + mid
}
var __bTest = (location.hostname.indexOf("test") >= 0) || (location.hostname.indexOf("dev") >= 0) || (location.hostname.indexOf("alpha-") >= 0);
if (location.hostname.indexOf("dev-") >= 0) {
	__host_suffix = "dev";
	__host_prefix = "dev-"
} else {
	if (location.hostname.indexOf("alpha-") >= 0) {
		__host_suffix = "test";
		__host_prefix = "alpha-"
	} else {
		if (location.hostname.indexOf("beta-") >= 0) {
			__host_suffix = "";
			__host_prefix = "beta-"
		} else {
			if (location.hostname.indexOf("test") >= 0) {
				__host_suffix = "test";
				__host_prefix = "alpha-"
			} else {
				if (location.hostname.indexOf("dev") >= 0) {
					__host_suffix = "dev";
					__host_prefix = "dev-"
				}
			}
		}
	}
}


function getLoginStatus() {
	return (getCookie(CK_MEMBERID).length > 0)
}
var FILENAME_SUPER_TOP = "index.html";
var FILENAME_EGAME_TOP = "easygame.hangame.co.jp";
var FILENAME_CGAME_TOP = "coregame.hangame.co.jp";
var FILENAME_COMMUNITY_TOP = "community.hangame.co.jp";
var FILENAME_AVATAR_TOP = "avatars.hangame.co.jp";
var FILENAME_SHOP_TOP = "shop.hangame.co.jp";
var FILENAME_PREMIUM_TOP = "premium.hangame.co.jp";
var __IMAGE_SERVER = "http://images.hangame.co.jp/";
var __STATIC_SERVER = "http://static.hangame.co.jp/";
var __COMMON_IMAGE_PATH = __IMAGE_SERVER + "hangame/common/";
var __COMMON_CSS_PATH = __STATIC_SERVER + "hangame/common/css/";
var __COMMON_JS_PATH = __STATIC_SERVER + "js/";
var IMG_LOGINLOGOUT = __COMMON_IMAGE_PATH + "header";
if (typeof customCommonJsUrlPath == "function") {
	customCommonJsUrlPath()
}
var __serviceMenu = new Array("game_top", "community_top", "avatar_top", "entame_top", "super_top", "item_shop", "premium_top");
var __serviceUrl = new Array("http://www.hangame.co.jp/" + FILENAME_SUPER_TOP, "http://" + FILENAME_EGAME_TOP, "http://" + FILENAME_CGAME_TOP, "http://" + FILENAME_COMMUNITY_TOP, "http://" + FILENAME_AVATAR_TOP, "http://" + FILENAME_SHOP_TOP, "http://" + FILENAME_PREMIUM_TOP);
var __subMenuIndex = new Array("http://www.hangame.co.jp/", "http://board.hangame.co.jp/bbs/notice/", "http://board.hangame.co.jp/bbs/event/", "http://guide.hangame.co.jp/", "http://customer.hangame.co.jp/", "http://top.hangame.co.jp/sitemap.nhn", "http://www.nhncorp.jp/main/index.html", "http://announce.hangame.co.jp/hgj/notice/kiyaku.htm", "http://announce.hangame.co.jp/hgj/notice/privacypolicy.htm", "http://www.nhncorp.jp/recruit/recruit_01.html", "http://www.cururu.jp/", "http://" + FIX_DOMAIN_MOBILE + "/");
var __communityIndex = new Array("http://portal.blog.hangame.co.jp/", "http://www.hangame.co.jp/gamenc/schat.asp", "http://circle2.hangame.co.jp/", "http://board.hangame.co.jp/bbs/friends/list.asp", "http://board2.hangame.co.jp/kiite/index.nhn", "http://anilog.hangame.co.jp/", "http://community.hangame.co.jp/clubhg/index.nhn");
var __shopIndex = new Array("http://shop.hangame.co.jp/pure.nhn", "http://shop.hangame.co.jp/cool.nhn", "http://market.hangame.co.jp/flea/index.nhn", "http://itemtrade.hangame.co.jp/itemtrade/index.asp", "http://www.hangame.co.jp/pointtrade/index.asp");
var __loginHost = new Array("hgj", "ncf", "gof", "ocn");
var __loginHostInfo = new Array(new Array("hgj", "http://www.hangame.co.jp/", "Hangame | 無料ゲーム・オンラインゲーム・PC ゲームのハンゲーム", "_self", "http://images.hangame.co.jp/hangame/common/header/logo_hangame.gif", "display:none"), new Array("ncf", "http://netcafe.hangame.co.jp/netcafe.asp", "Hangame | 無料ゲーム・オンラインゲーム・PC ゲームのハンゲーム", "_self", "http://images.hangame.co.jp/hangame/common/header/logo_hangame.gif", "display:none"), new Array("gof", "http://www.goo.ne.jp/", "goo", "_blank", "http://images.hangame.co.jp/_images/isp/logo/gof3.gif", "display:inline"), new Array("ocn", "http://www.ocn.ne.jp/", "OCN", "_blank", "http://images.hangame.co.jp/_images/isp/logo/ocn3.gif", "display:inline"));
var __loginHostInfoDefault = new Array("www", "http://www.hangame.co.jp/", "Hangame | 無料ゲーム・オンラインゲーム・PC ゲームのハンゲーム", "_self", "http://images.hangame.co.jp/hangame/common/header/logo_hangame.gif", "display:none");
setUrl();

function setUrl() {
	if (__bTest) {
		sSubDomain = setTestUrl(sSubDomain);
		__urlLogin = setTestServiceUrl(__urlLogin);
		__urlLogout = setTestServiceUrl(__urlLogout);
		__urlProfile = getMypageHost();
		__urlchat = setTestUrl(__urlchat);
		__urlAvatars = getAvatarsHost();
		__urlHangame = setTestUrl(__urlHangame);
		__urlBeginner = setTestUrl(__urlBeginner);
		__urlHelp = setTestUrl(__urlHelp);
		__urlSiteMap = setTestUrl(__urlSiteMap);
		for (var i = 0; i < __serviceUrl.length; i++) {
			__serviceUrl[i] = setTestServiceUrl(__serviceUrl[i])
		}
		__loginHostInfoDefault[1] = setTestUrl(__loginHostInfoDefault[1])
	}
	function setTestServiceUrl(url) {
		if (url.indexOf("www.") >= 0) {
			return url.customReplace("www.", __host_suffix + ".")
		} else {
			var urlArray = url.split("//");
			var result = "";
			for (var i = 0; i < urlArray.length; i++) {
				result += urlArray[i];
				if (i == 0) {
					result += "//" + __host_prefix
				}
			}
			return result
		}
	}
}
function setTestUrl(url) {
	if (url.indexOf("www.") >= 0) {
		return url.customReplace("www.", __host_suffix + ".")
	} else {
		if (url.indexOf(".") >= 0) {
			var testUrl = "";
			var sUrl = url.split(".");
			for (var i = 0; i < sUrl.length - 1; i++) {
				testUrl += sUrl[i] + ((sUrl[i].indexOf("http://") >= 0) ? __host_suffix + "." : ".")
			}
			testUrl += sUrl[sUrl.length - 1];
			return testUrl
		} else {
			return url
		}
	}
}
function getCookieHost() {
	return getStrCookie("loginhost")
}
function isAffSite() {
	var value = getCookieHost();
	var index = 0;
	for (var i = 0; i < __loginHost.length; i++) {
		if (__loginHost[i] == value) {
			return true
		}
	}
	return false
}
function equalsAffSite(host) {
	return (host == getCookieHost())
}
function getLoginHostInfo() {
	var value = getCookieHost();
	var index = -1;
	for (var i = 0; i < __loginHost.length; i++) {
		if (__loginHost[i] == value) {
			index = i;
			break
		}
	}
	return (index == -1) ? __loginHostInfoDefault : __loginHostInfo[index]
}
function findServiceIndex(serviceId) {
	var rtn;
	switch (serviceId) {
	case "easygame":
		rtn = 0;
		break;
	case "coregame":
		rtn = 0;
		break;
	case "community":
		rtn = 3;
		break;
	case "avatars":
		rtn = 4;
		break;
	case "shop":
		rtn = 5;
		break;
	case "chat":
	case "circle":
	case "board":
	case "kplus":
	case "mobile":
		rtn = 3;
		break;
	case "avatar":
	case "prishot":
		rtn = 4;
		break;
	case "item_shop":
		rtn = 5;
		break;
	default:
		rtn = 0;
		break
	}
	return rtn
}
function getLoginURL() {
	var loginButtonStatus = new Array();
	loginButtonStatus = privateGetLoginButtonStatus();
	location.href = loginButtonStatus[1] + "?nxtURL=" + loginButtonStatus[2]
}
var __dynamic_index = 10;
var __temp_host = getLoginHostInfo();
if (__temp_host[0] != "www") {
	__dynamic_index = 5
}
function openSearchid() {
	openProfile("/userinfo/index.asp?mid=_search")
}
function openPost(sOption) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインしてください。");
		return
	}
	if (typeof(sOption) == "undefined") {
		sOption = ""
	}
	openWin(getMMailHost() + "/main.nhn" + sOption, "mmail", 600, 623, "no")
}
function openPostToWindow(sMid) {
	openPost("?tid[]=" + sMid)
}
function clickLogout() {
	if (__bTest) {
		top.location.href = "http://ctrad.hangame.co.jp/go?loc=clate.logout&ad=AD1138864328242"
	} else {
		top.location.href = "http://ctrad.hangame.co.jp/go?loc=clate.logout&ad=AD1138864266428"
	}
}
function clickLogin() {
	$("simpleLoginLogout").action = __urlLogin;
	$("simpleLoginLogout").nexturl.value = document.URL;
	$("simpleLoginLogout").submit()
}
function clickLogoutToolbar() {
	if (__bTest) {
		top.location.href = "http://ctrad.hangame.co.jp/go?loc=clate.logout&ad=AD1138864442987"
	} else {
		top.location.href = "http://ctrad.hangame.co.jp/go?loc=clate.logout&ad=AD1138864374477"
	}
}
function execSearchid() {
	var target_id = "";
	target_id = document.footer_frm.find.value;
	if (!isFindInitialize || target_id == "" || target_id.length <= 0) {
		alert("検索したいハンゲームIDを入力してください");
		document.footer_frm.find.value = "";
		isFindInitialize = true;
		document.footer_frm.find.focus();
		return false
	}
	if (hg_getByteCount(target_id) > 20) {
		alert("ハンゲームIDを正しく入力してください。\n（全角10文字半角20文字まで）");
		isFindInitialize = true;
		document.footer_frm.find.focus();
		return false
	}
	return false
}
function openItemBag(menu, submenu, ver) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされていませんので、アイテムバッグをご利用いただけません。");
		return
	}
	var url = getMypageURL("", MYPAGE_AVATAR, 1);
	if (url.indexOf("?") == -1 && ((typeof ver != "undefined" && ver != null) || (typeof menu != "undefined" && menu != null) || (typeof submenu != "undefined" && submenu != null))) {
		url += "?"
	}
	if ((typeof ver != "undefined" && ver != null)) {
		url += "ver=" + ver
	}
	if ((typeof ver != "undefined" && ver != null) && (typeof menu != "undefined" && menu != null)) {
		url += "&menu=" + menu
	} else {
		if ((typeof ver == "undefined" || ver == null) && (typeof menu != "undefined" && menu != null)) {
			url += "menu=" + menu
		}
	}
	if ((typeof menu != "undefined" && menu != null) && (typeof submenu != "undefined" && submenu != null)) {
		url += "&submenu=" + submenu
	}
	var win = window.open(url, MYPAGE_WIN_NAME);
	win.focus()
}
function openCollectionBox(svcid, svcver) {
	var colpath = "";
	switch (svcid) {
	case "gachadx":
		colpath = "/avatar/collectgachadx.nhn";
		break;
	case "gachamini":
		colpath = "/avatar/collectgachamini.nhn";
		break;
	case "homegacha":
		colpath = "/avatar/collecthomegacha.nhn";
		break;
	case "itemtree":
		colpath = "/avatar/collectitemtree.nhn";
		break;
	case "nene":
		colpath = "/avatar/collectnene.nhn";
		break;
	case "bandai":
		colpath = "/avatar/collectbandai.nhn";
		break;
	case "stonage":
		colpath = "/avatar/collectstonage.nhn";
		break;
	case "collectionking":
		colpath = "/mygame/collectioncard.nhn";
		break;
	case "chocottoland":
		colpath = "/mygame/chocottoland.nhn";
		break;
	default:
		colpath = ""
	}
	if ((colpath != "") && (typeof(svcver) != "undefined")) {
		colpath = colpath + "?version=" + svcver
	}
	location.href = getMypageHost() + colpath
}
function getBlogHost() {
	return "http://" + __host_prefix + "blog.hangame.co.jp"
}
function getLinkLinkTownHost() {
	return "http://linklinktown.hangame.co.jp".replace(/\./, __host_suffix + ".")
}
function getMemberHost() {
	return "http://" + __host_prefix + "member.hangame.co.jp"
}
function getMypageHost() {
	return "http://" + __host_prefix + "mypage.hangame.co.jp"
}
function getAvatarsHost() {
	return "http://" + __host_prefix + "avatars.hangame.co.jp"
}
function getTopHost() {
	return "http://" + __host_prefix + "top.hangame.co.jp"
}
function getMMailHost() {
	return "http://" + __host_prefix + "mmail.hangame.co.jp"
}
function getMyinfoHost() {
	return "https://" + __host_prefix + "myinfo.hangame.co.jp"
}
function getWWWHost() {
	if (__host_suffix == "") {
		return "http://www.hangame.co.jp"
	} else {
		return "http://" + __host_suffix + ".hangame.co.jp"
	}
}
function getBillHost() {
	if (__host_suffix == "") {
		return "https://billing.hangame.co.jp"
	} else {
		return "https://billdev.hangame.co.jp"
	}
}
function privOpenBlogWin(url) {
	return window.open(url, MYPAGE_WIN_NAME)
}
function privOpenLinkLinkTownWin(url) {
	return window.open(url, "LinkLinkTown")
}
function openBlogTop() {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ハンゲームIDを指定してください。");
		return
	}
	return privOpenBlogWin(getBlogHost())
}
function openBlog(mid) {
	if (mid.length == 0) {
		alert("ハンゲームIDを指定して下さい。");
		return
	}
	var url = getBlogHost() + "/index.nhn?mid=" + mid;
	return privOpenBlogWin(url)
}
function openBlogPost() {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされている場合のみ投稿が可能です。");
		return
	}
	var url = getBlogHost() + "/write.nhn";
	return privOpenBlogWin(url)
}
function openBlogDetail(num, url) {
	var url = getBlogHost() + "/" + url + "/article/" + num + "/";
	return privOpenBlogWin(url)
}
function openBlogDetailCmt(num, cmt, url) {
	var url = getBlogHost() + "/" + url + "/article/" + num + "/cmt/" + cmt + "/";
	return privOpenBlogWin(url)
}
function openMyHome(mid) {
	top.location.href = privGetMyHomeURL(mid)
}
function openMyHomeNW(mid) {
	return privOpenLinkLinkTownWin(privGetMyHomeURL(mid))
}
function openHancoinBuy(rurl) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされていませんので、ハンコインをご購入いただけません。");
		return
	}
	if (typeof rurl != "string") {
		rurl = ""
	}
	openWin(getMyinfoHost() + "/bill/chargehancoin.nhn?rurl=" + escapeSJIS(rurl), "avItem", 720, 690, "yes")
}
function redirectHancoinBuy(rurl) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされていませんので、ハンコインをご購入いただけません。");
		return
	}
	if (typeof rurl != "string") {
		rurl = ""
	}
	location.href = getMyinfoHost() + "/bill/chargehancoin.nhn?rurl=" + escapeSJIS(rurl)
}
function openHancoinHist(selfWinFlg) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされていませんので、ハンコイン通帳をご利用いただけません。");
		return
	}
	if (typeof(selfWinFlg) == "undefined") {
		window.open(getMyinfoHost() + "/bankbook/hancoinbankbook.nhn")
	} else {
		if (selfWinFlg) {
			location.href = getMyinfoHost() + "/bankbook/hancoinbankbook.nhn"
		} else {
			window.open(getMyinfoHost() + "/bankbook/hancoinbankbook.nhn")
		}
	}
}
function openHangHist(selfWinFlg) {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("ログインされていませんので、ハンG通帳をご利用いただけません。");
		return
	}
	if (typeof(selfWinFlg) == "undefined") {
		window.open(getMyinfoHost() + "/bankbook/hangbankbook.nhn")
	} else {
		if (selfWinFlg) {
			location.href = getMyinfoHost() + "/bankbook/hangbankbook.nhn"
		} else {
			window.open(getMyinfoHost() + "/bankbook/hangbankbook.nhn")
		}
	}
}
function privGetMyHomeURL(mid) {
	var url;
	if (typeof(mid) == "undefined") {
		url = getLinkLinkTownHost() + "/myhome.asp"
	} else {
		url = getLinkLinkTownHost() + "/myhome.asp?mid=" + mid
	}
	return url
}
function openMyGarage(objWinHandle) {
	var url = getLinkLinkTownHost() + "/mygarage.asp";
	if (objWinHandle == null) {
		return privOpenLinkLinkTownWin(url)
	} else {
		try {
			objWinHandle.location.href = url;
			return
		} catch(e) {
			return privOpenLinkLinkTownWin(url)
		}
	}
}
function openEmailCheck(strServiceID) {
	if (strServiceID == "_hidden") {
		if (typeof(document.all.frmEmailCheck) == "undefined") {
			alert("タグが見つかりません:<iframe style='display:none;' id='frmEmailCheck' src='about:blank;'></iframe>")
		} else {
			document.all.frmEmailCheck.src = getMemberHost() + "/emailcheck/js/sendmail.nhn?&serviceid=" + strServiceID
		}
	} else {
		if (strServiceID == "present_avatar" || strServiceID == "present_coupon" || strServiceID == "present_bgm" || strServiceID == "present_myhome") {
			window.moveTo(100, 100);
			window.resizeTo(900, 600);
			location.href = getMemberHost() + "/emailcheck/top.nhn?&serviceid=" + strServiceID
		} else {
			window.open(getMemberHost() + "/emailcheck/top.nhn?&serviceid=" + strServiceID, "emailcheck", "")
		}
	}
}
function openAvatarChange() {
	if (getCookie(CK_MEMBERID).length == 0) {
		alert("現在ログインしていないため、アバターの変更を行えません。");
		return
	}
	top.location.href = "https://" + __host_prefix + "myinfo.hangame.co.jp/avatar/index.nhn"
}
function isCoolAvatarId(avatarID) {
	if (typeof(avatarID) == "undefined") {
		avatarID = getCookie(CK_AVATARID)
	}
	if (avatarID.length != 0 && avatarID.substring(0, 1) == "2") {
		return true
	}
	return false
}
function isPureAvatarId(avatarID) {
	return isCoolAvatarId(avatarID) ? false : true
}
if (navigator.userAgent.match(/MSIE 6/i) && typeof DD_belatedPNG == 'undefined') {
	var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden";}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c);
		if (c.isImg) {
			cW=c.width;cH=c.height;
			c.src = 'http://images.hangame.co.jp/hangame/common/spacer.gif';
			c.style.visibility="visible";
			c.style.width = cW;c.style.height = cH;
		}
	}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();

	DD_belatedPNG.fix('.png32');
}


(function(){
	 try {
		 var sCookieC = 'cui_c';
		 var sCookieS = 'cui_s';
		 var cookieC = getStrCookie(sCookieC);
		 var cookieS = getStrCookie(sCookieS);

		 if (cookieS == '' || cookieS == null || typeof cookieS == 'undefined') return;
		 if (cookieC == '' || cookieC == null || typeof cookieC == 'undefined') return;

		 if (cookieC == cookieS) {
			 removeCookieForCui(sCookieS);
			 removeCookieForCui(sCookieC);
			 setStrCookieForCui("cui_m", getCookie(CK_MEMBERID));
		 } else {
			 var nxturl = encodeURIComponent(location.href);
			 top.location.href = 'https://' +  __host_prefix  + 'id.hangame.co.jp/exlogout.nhn?nxturl=' + nxturl;
		 }
	 } catch (e) {
	 }
})();

(function(){
	 try {
		 var rcmipCookie = getStrCookie("rcmip");
		 var lUserID = getStrCookie("cui_m");

		 if(rcmipCookie == '' || rcmipCookie == null || typeof rcmipCookie == 'undefined') return;
		 if(lUserID == '' || lUserID == null || typeof lUserID == 'undefined') return;

		 var rUserID = rcmipCookie.split("%2C")[1].replace(/\"/g, ""); // for rcmip cookie created by jetty
		 if(lUserID != rUserID) {
			 var nxturl = encodeURIComponent(location.href);
			 top.location.href = 'https://' +  __host_prefix  + 'id.hangame.co.jp/rcmiplog.nhn?nxturl=' + nxturl + '&luserid=' + lUserID + '&ruserid=' + rUserID;
		 }
	 } catch (e) {
	 }
})();

function removeCookieForCui(sName)
{
	var exDate = new Date();
	exDate.setYear(exDate.getYear() - 1);

	document.cookie = sName + '=; expires=' + exDate.toGMTString() + "; domain=" + getFixDomain() + "; Path=/";
}

function createChecksum(str){
	var checksum = 0;
	for(var i=0; i<str.length; i++){
		checksum += str.charCodeAt(i);
	}
	return checksum;
}

function checkAutologinCookie()
{
	try{
		var autologin = getStrCookie("alk");
		var chka1 = getStrCookie("cui_a1");
		var chka2 = getStrCookie("cui_a2");

		if(autologin == null || autologin == '') return;
		if(chka1 == null || chka1 == '') {
			 setStrCookieForCui("cui_a1", createChecksum(autologin), 30);
			 removeCookieForCui("cui_a2");
			 return;
		}
		if(chka2 == null || chka2 == '') {
			return;
		}

		// exist all cookie
		if(chka1 == chka2) {
			 removeCookieForCui("cui_a2");
			 setStrCookieForCui("cui_a1", createChecksum(autologin), 30);
		} else {
			 removeCookieForCui("cui_a1");
			 removeCookieForCui("cui_a2");
			 var nxturl = encodeURIComponent(location.href);
			 top.location.href = 'https://' +  __host_prefix  + 'id.hangame.co.jp/exlogout.nhn?type=autologin&nxturl=' + nxturl + '&alk=' + autologin + '&a1=' + chka1 + '&a2=' + chka2;
		}
	 } catch (e) {
	 }
}
checkAutologinCookie();

document.write('<script type="text/javascript" src="' + __COMMON_JS_PATH + 'scouter.js"><\/script>');

function getIDServerHost(isSSL) {
	if (location.hostname.indexOf("test") >= 0 || location.hostname.indexOf("alpha-") >= 0) {
		return ((isSSL == true) ? "https" : "http") + "://alpha-id.hangame.co.jp"
	} else {
		if (location.hostname.indexOf("dev") >= 0) {
			return ((isSSL == true) ? "http" : "http") + "://alpha-id.hangame.co.jp"
		}else if(location.hostname.indexOf("beta") >= 0){
			return ((isSSL == true) ? "http" : "http") + "://beta-id.hangame.co.jp"
		} else {
			return ((isSSL == true) ? "https" : "http") + "://id.hangame.co.jp"
		}
	}
}
function setStrCookieExpire(strName, strValue, intExpireDay) {
	var exDate = new Date;
	exDate.setMonth(exDate.getMonth() + intExpireDay);
	document.cookie = strName + "=" + strValue + ";expires=" + exDate.toGMTString() + ";domain=" + getFixDomain() + ";path=/";
	return ""
}

var formLogin;

function initForm(form, isFocused) {
	formLogin = (form == null) ? document.loginform : form;
	var focusedObj;
	if (typeof(formLogin) == "object" && typeof(formLogin.strmemberid) == "object") {
		if(getStrCookie("LOGIN_IDSAVE") != "") {
			formLogin.strmemberid.value = getStrCookie("LOGIN_IDSAVE");
			if (typeof(formLogin.chkIdSave) != "undefined") formLogin.chkIdSave.checked = true;
			HTOP.LOGINPANEL._checkInput("idsave");
			try {
				focusedObj = formLogin.strpassword
			} catch(e) {}
		} else {
			try {
				focusedObj = formLogin.strmemberid
			} catch(e) {}
		}
		if (focusedObj != null && isFocused != false) {
			focusedObj.focus()
		}
	}
}

var isLoginProcessing = false;
var loginTimerId = 0;

function entersubmit() {
	if (isLoginProcessing && loginTimerId != 0) {
		return
	}
	if (formLogin.strmemberid.value.length == 0 || formLogin.strpassword.value.length == 0) {
		alert("IDまたはパスワードが入力されていません。");
		formLogin.strmemberid.focus()
	} else {
		if (formLogin.strmemberid.value.indexOf(",") >= 0) {
			alert("IDに特殊文字は入力できません。")
		} else {
			if (formLogin.strpassword.value.indexOf(",") >= 0) {
				alert("パスワードに特殊文字は入力できません。")
			} else {
				if (typeof(formLogin.chkSSLLogin) == "object" && formLogin.chkSSLLogin.checked) {
					formLogin.action = getIDServerHost(true) + "/login.asp"
				} else {
					formLogin.action = getIDServerHost(false) + "/login.asp"
				}
				if (typeof(formLogin.chkIdSave) == "object") {
					if (formLogin.chkIdSave.checked) {
						setStrCookieExpire("LOGIN_IDSAVE", formLogin.strmemberid.value, 365)
					} else {
						setStrCookieExpire("LOGIN_IDSAVE", "", 0)
					}
				}

				// For security check.
				try {
					var idEncoded = encodeURIComponent(formLogin.strmemberid.value.trim());
					var idCookie = MD5_hexhash(idEncoded);
					setStrCookieForCui("cui_c", idCookie);
				} catch (e) { }

				formLogin.strpassword.value = formLogin.strpassword.value.substring(0, 8);
				formLogin.submit();
				isLoginProcessing = true;
				loginTimerId = setTimeout(loginTimeout, 5000)
			}
		}
	}
}
function loginTimeout() {
	isLoginProcessing = false;
	loginTimerId = 0
}
function entersubmit_key(n, keyCode) {
	if (typeof(keyCode) == "undefined") {
		keyCode = event.keyCode
	}
	if (keyCode == 13) {
		if (n == 0) {
			formLogin.strpassword.focus()
		} else {
			entersubmit()
		}
	}
}
var autoLogin = {
	elMask: null,
	elLayer: null,
	elCheck: null,
	elDenyBtn: null,
	nWidth: 457,
	nHeight: 362,

	init: function() {
		this._loadCss();

		var f = function() {
			var elCheck = document.getElementById('cb_autologin');
			if (elCheck) elCheck.disabled = true;
		};

		if (getCookieHost() == 'ncf') {
			if (document.all) {
				window.attachEvent('onload', f);
			} else {
				window.addEventListener('load', f, false);
			}
		}
	},
	confirm: function(elCheck) {
		if (elCheck.checked == false) {
			setTimeout(function(){
				elCheck.checked = false;
			}, 100);
			return;
		}

		this.elCheck = elCheck;
		this._openLayer();
	},
	_openLayer: function() {
		this._embedMask();
		this._embedLayer();

		if (!this.elDenyBtn) {
			this.elDenyBtn = document.getElementById('lbGDeny');
		}
		try {
			this.elDenyBtn.focus();
		} catch (e) {
		}
	},
	closeLayer: function() {
		this.elMask.style.display = 'none';
		this.elLayer.style.display = 'none';
	},
	_loadCss: function() {
		var sCss = '.lboxAutLogin{width:457px;margin:0 auto;color:#333;z-index:30000;position:absolute;}  .lboxAutLogin .al_iframe{position:absolute;top:0;left:0;width:450px;height:420px;z-index:2;}  /* ↑ダミーiframe追加の為調整 */.lboxAutLogin *{margin:0,padding:0;background:none;border:none;list-style:none;line-height:18px;}  .lboxAutLogin .al_wrp_out{position:absolute;width:457px;padding-top:6px;background: url(http://images.hangame.co.jp/hangame/common/parts/lbox_guidance/bg_top.png) no-repeat center top;z-index:30;}  .lboxAutLogin .al_wrp_in{position:relative;_position:static;padding-bottom:15px;background: url(http://images.hangame.co.jp/hangame/common/parts/lbox_guidance/bg_btm.png) no-repeat center bottom;zoom:1;}  .lboxAutLogin p.al_cbtn{position:absolute;right:21px;top:9px;z-index:1;zoom:1;font-size:11px;line-height:13px;}  .lboxAutLogin p.al_cbtn a{display:block;padding:0 15px 0 0;background:url(http://images.hangame.co.jp/hangame/common/btn_x.gif) no-repeat right 0;color:#666;text-decoration:none;}  .lboxAutLogin div.al_wrp{position:relative;z-index:0;zoom:1;padding:40px 32px 20px 25px;background: url(http://images.hangame.co.jp/hangame/common/parts/lbox_guidance/bg_mdl.png) repeat-y center top;}  .lboxAutLogin div.al_wrp.al_ex div.al_content{font-size:12px;border-top:1px solid #EFEFEF;padding:15px 32px 0 25px;}  .lboxAutLogin div.al_wrp.al_ex div.al_content .al_c{text-align:center;}  .lboxAutLogin div.al_wrp p{zoom:1;padding:0 8px 15px;font-size:12px;margin:0 0 12px;}  .lboxAutLogin div.al_wrp p.al_titl{color:#f0783d;font-size:14px;font-weight:bold;text-align:center;}  .lboxAutLogin div.al_wrp.al_ex p.al_titl{border-bottom:1px solid #BCBCBC;margin-bottom:0;}  .lboxAutLogin div.al_wrp p.al_more{font-size:11px;text-align:right;padding:0;margin:0 0 -1px;clear:both;}  .lboxAutLogin div.al_wrp p.al_more a{color:#555;}  .lboxAutLogin div.al_wrp ul{margin:0 0 0 25px;padding:0 0 15px;}  .lboxAutLogin div.al_wrp li{margin:0;}  .lboxAutLogin div.al_wrp dl.al_exmpl{zoom:1;overflow:hidden;padding:0 8px 15px;}  .lboxAutLogin div.al_wrp dl.al_exmpl dt{float:left;}  .lboxAutLogin div.al_wrp dl.al_exmpl dd{margin-left:35px;}  .lboxAutLogin div.al_wrp ul.al_btn{padding-bottom:10px;margin:0 auto;text-align:center;}  .lboxAutLogin div.al_wrp ul.al_btn li{display:inline;}  .lboxAutLogin div.al_wrp ul.al_btn li a{display:inline-block;*position:relative;*zoom:1;width:123px;height:22px;*height:23px;padding-top:4px;*padding-top:3px;margin:0 5px;background: url(http://images.hangame.co.jp/hangame/common/parts/lbox_guidance/btn.gif) no-repeat center top;color:#666;font-weight:bold;text-decoration:none;text-align:center;}';

		var elStyle = document.createElement('style');
		elStyle.type = 'text/css';

		var elHead = document.getElementsByTagName('head')[0];
		elHead.appendChild(elStyle);

		if (elStyle.styleSheet) { // IE
			elStyle.styleSheet.cssText = sCss;
		} else {
			// Split with DOUBLE spaces.
			var aCss = sCss.split('  ');
			elStyle.appendChild(document.createTextNode(''));

			for (var i in aCss) {
				elStyle.sheet.insertRule(aCss[i], 0);
			}
		}
	},
	_embedMask: function() {
		if (this.elMask) {
			this.elMask.style.display = 'block';
			return;
		}

		var w =	this._getWidth();
		var h =	this._getHeight();

		this.elMask = document.createElement('div');
		this.elMask.style.cssText = 'top:0; left:0; position:absolute; width: ' + w + 'px; height: ' + h + 'px; background-image: url(http://images.hangame.co.jp/hangame/common/spacer.gif);';
		this.elMask.onclick = new Function('autoLogin.closeLayer()');

		document.body.appendChild(this.elMask);
	},
	_embedLayer: function() {
		var offset = parseInt((this._getClientHeight() - this.nHeight) / 2);
		var top = this._getTop() + offset;
		var left = parseInt((this._getWidth() - this.nWidth) / 2);

		if (this.elLayer) {
			this.elLayer.style.cssText = 'position:absolute; display: block; top: ' + top + 'px; left: ' + left + 'px';
			return;
		}

		var sHtml = '<div class="al_wrp_out png32"><div class="al_wrp_in png32"><div class="al_wrp png32 al_ex"><p class="al_titl">共用PCでは使わないで！</p><div class="al_content"><dl class="al_exmpl"><dt>(例)</dt><dd>・ネットカフェ、学校、会社など<br />・自宅で同じPCをご家族などが一緒に利用している</dd></dl><p>共用PCでこの機能を使うと、下記のような可能性があります。</p><ul><li>・ハンゲームの各サービスを利用されてしまう</li><li>・アバターアイテムなど、有料のアイテムを購入されてしまう</li><li>・登録情報など、個人情報を閲覧されてしまう</li></ul><p class="al_more"><a href="http://customer.hangame.co.jp/faq/detail.nhn?qid=2243&orderNo=24&actionId=3&searchText=">&gt;&gt; 詳しくはこちら</a></p><p>以上のことを確認、同意の上、自己責任において<br />この機能をご利用ください。</p><ul class="al_btn"><li><a href="#" onclick="autoLogin.accept();return false;">同意する</a></li><li><a id="lbGDeny" href="#" onclick="autoLogin.deny();return false;">同意しない</a></li></ul><p class="al_more"><a href="http://customer.hangame.co.jp/faq/detail.nhn?qid=2244&orderNo=21&actionId=3&searchText=">&gt;&gt; 何度もこの画面が表示されるのはなぜ？</a></p></div></div><p class="al_cbtn"><a href="#" onclick="autoLogin.closeLayer();return false;">閉じる</a></p></div></div><iframe src="http://static.hangame.co.jp/dummy.htm" class="al_iframe"></iframe>';

		this.elLayer = document.createElement('div');
		this.elLayer.className = 'lboxAutLogin';
		this.elLayer.style.cssText = 'position:absolute; top: ' + top + 'px; left: ' + left + 'px';
		this.elLayer.innerHTML = sHtml;

		document.body.appendChild(this.elLayer);
	},
	accept: function() {
		this.closeLayer();
		this.elCheck.checked = true;
	},
	deny: function() {
		this.closeLayer();
		this.elCheck.checked = false;
	},
	_getWidth: function() {
		return document.documentElement.scrollWidth || document.body.scrollWidth;
	},
	_getHeight: function() {
		return document.documentElement.scrollHeight || document.body.scrollHeight;
	},
	_getClientHeight: function() {
		return window.innerHeight ||document.documentElement.clientHeight ||  document.body.clientHeight;
	},
	_getTop: function() {
		return document.documentElement.scrollTop || document.body.scrollTop;
	}
};
autoLogin.init();


/* md5.js
 * md5_128bits = MD5_hash(data);
 * md5_hexstr = MD5_hexhash(data);
 */
var MD5_T = new Array(0x00000000, 0xd76aa478, 0xe8c7b756, 0x242070db,
		      0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613,
		      0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1,
		      0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e,
		      0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51,
		      0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681,
		      0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87,
		      0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9,
		      0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122,
		      0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60,
		      0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085,
		      0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8,
		      0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7,
		      0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d,
		      0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314,
		      0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb,
		      0xeb86d391);

var MD5_round1 = new Array(new Array( 0, 7, 1), new Array( 1,12, 2),
			   new Array( 2,17, 3), new Array( 3,22, 4),
			   new Array( 4, 7, 5), new Array( 5,12, 6),
			   new Array( 6,17, 7), new Array( 7,22, 8),
			   new Array( 8, 7, 9), new Array( 9,12,10),
			   new Array(10,17,11), new Array(11,22,12),
			   new Array(12, 7,13), new Array(13,12,14),
			   new Array(14,17,15), new Array(15,22,16));

var MD5_round2 = new Array(new Array( 1, 5,17), new Array( 6, 9,18),
			   new Array(11,14,19), new Array( 0,20,20),
			   new Array( 5, 5,21), new Array(10, 9,22),
			   new Array(15,14,23), new Array( 4,20,24),
			   new Array( 9, 5,25), new Array(14, 9,26),
			   new Array( 3,14,27), new Array( 8,20,28),
			   new Array(13, 5,29), new Array( 2, 9,30),
			   new Array( 7,14,31), new Array(12,20,32));

var MD5_round3 = new Array(new Array( 5, 4,33), new Array( 8,11,34),
			   new Array(11,16,35), new Array(14,23,36),
			   new Array( 1, 4,37), new Array( 4,11,38),
			   new Array( 7,16,39), new Array(10,23,40),
			   new Array(13, 4,41), new Array( 0,11,42),
			   new Array( 3,16,43), new Array( 6,23,44),
			   new Array( 9, 4,45), new Array(12,11,46),
			   new Array(15,16,47), new Array( 2,23,48));

var MD5_round4 = new Array(new Array( 0, 6,49), new Array( 7,10,50),
			   new Array(14,15,51), new Array( 5,21,52),
			   new Array(12, 6,53), new Array( 3,10,54),
			   new Array(10,15,55), new Array( 1,21,56),
			   new Array( 8, 6,57), new Array(15,10,58),
			   new Array( 6,15,59), new Array(13,21,60),
			   new Array( 4, 6,61), new Array(11,10,62),
			   new Array( 2,15,63), new Array( 9,21,64));

function MD5_F(x, y, z) { return (x & y) | (~x & z); }
function MD5_G(x, y, z) { return (x & z) | (y & ~z); }
function MD5_H(x, y, z) { return x ^ y ^ z;          }
function MD5_I(x, y, z) { return y ^ (x | ~z);       }

var MD5_round = new Array(new Array(MD5_F, MD5_round1),
			  new Array(MD5_G, MD5_round2),
			  new Array(MD5_H, MD5_round3),
			  new Array(MD5_I, MD5_round4));

function MD5_pack(n32) {
  return String.fromCharCode(n32 & 0xff) +
	 String.fromCharCode((n32 >>> 8) & 0xff) +
	 String.fromCharCode((n32 >>> 16) & 0xff) +
	 String.fromCharCode((n32 >>> 24) & 0xff);
}

function MD5_unpack(s4) {
  return  s4.charCodeAt(0)        |
	 (s4.charCodeAt(1) <<  8) |
	 (s4.charCodeAt(2) << 16) |
	 (s4.charCodeAt(3) << 24);
}

function MD5_number(n) {
  while (n < 0)
    n += 4294967296;
  while (n > 4294967295)
    n -= 4294967296;
  return n;
}

function MD5_apply_round(x, s, f, abcd, r) {
  var a, b, c, d;
  var kk, ss, ii;
  var t, u;

  a = abcd[0];
  b = abcd[1];
  c = abcd[2];
  d = abcd[3];
  kk = r[0];
  ss = r[1];
  ii = r[2];

  u = f(s[b], s[c], s[d]);
  t = s[a] + u + x[kk] + MD5_T[ii];
  t = MD5_number(t);
  t = ((t<<ss) | (t>>>(32-ss)));
  t += s[b];
  s[a] = MD5_number(t);
}

function MD5_hash(data) {
  var abcd, x, state, s;
  var len, index, padLen, f, r;
  var i, j, k;
  var tmp;

  state = new Array(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);
  len = data.length;
  index = len & 0x3f;
  padLen = (index < 56) ? (56 - index) : (120 - index);
  if(padLen > 0) {
    data += "\x80";
    for(i = 0; i < padLen - 1; i++)
      data += "\x00";
  }
  data += MD5_pack(len * 8);
  data += MD5_pack(0);
  len  += padLen + 8;
  abcd = new Array(0, 1, 2, 3);
  x    = new Array(16);
  s    = new Array(4);

  for(k = 0; k < len; k += 64) {
    for(i = 0, j = k; i < 16; i++, j += 4) {
      x[i] = data.charCodeAt(j) |
	    (data.charCodeAt(j + 1) <<  8) |
	    (data.charCodeAt(j + 2) << 16) |
	    (data.charCodeAt(j + 3) << 24);
    }
    for(i = 0; i < 4; i++)
      s[i] = state[i];
    for(i = 0; i < 4; i++) {
      f = MD5_round[i][0];
      r = MD5_round[i][1];
      for(j = 0; j < 16; j++) {
	MD5_apply_round(x, s, f, abcd, r[j]);
	tmp = abcd[0];
	abcd[0] = abcd[3];
	abcd[3] = abcd[2];
	abcd[2] = abcd[1];
	abcd[1] = tmp;
      }
    }

    for(i = 0; i < 4; i++) {
      state[i] += s[i];
      state[i] = MD5_number(state[i]);
    }
  }

  return MD5_pack(state[0]) +
	 MD5_pack(state[1]) +
	 MD5_pack(state[2]) +
	 MD5_pack(state[3]);
}

function MD5_hexhash(data) {
    var i, out, c;
    var bit128;

    bit128 = MD5_hash(data);
    out = "";
    for(i = 0; i < 16; i++) {
	c = bit128.charCodeAt(i);
	out += "0123456789abcdef".charAt((c>>4) & 0xf);
	out += "0123456789abcdef".charAt(c & 0xf);
    }
    return out;
}


function openWin(sURL, sWindowName, w, h, sScroll) {
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;
	if (sScroll == null) {
		sScroll = "no"
	}
	var sOption = "";
	sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, resizable=yes, menubar=no";
	sOption = sOption + ", scrollbars=" + sScroll + ", left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;
	if (window.name == sWindowName) {
		var win = window.open(sURL, "", sOption);
		win.name = sWindowName;
		window.close()
	} else {
		var win = window.open(sURL, sWindowName, sOption)
	}
	return win
}
var KEY_EXPIREUPDATEFLAG = "EXPIREUPDATEFLAG";
var VIEWTYPE_HANGAME = 0;
var VIEWTYPE_MYITEMBAG = 1;
var divLimitItemInit = true;

function getTimeLimitItemsTag() {
	var tag = "";
	if (divLimitItemInit) {
		tag += '<div id="divLimitItem" style="position:absolute;left:0px; top:0px; display:none; z-index:100000">';
		tag += '<table width="100%" height="100%" style="filter:alpha(opacity=70);background-color:#000000;"><tr><td bgcolor="#ffffff">';
		tag += '<div id="divLimitItemView" style="position:absolute;left:0px; top:0px;">';
		tag += "</div>";
		tag += "</td></tr></table>";
		tag += "</div>";
		divLimitItemInit = false
	}
	return tag
}
var host = location.hostname;
var HTOP = {};
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	var isNcfRedirect = false;
	pkg.container[pkg.name] = function () {
		if (host.indexOf("netcafe.hangame.co.jp") < 0) {
			if (getStrCookie("loginhost") == "ncf") {
				window.location = "http://" + __host_prefix + "netcafe.hangame.co.jp/index.html";
				NCFRD = true;
				isNcfRedirect = true
			}
		} else {
			if (getStrCookie("loginhost") != "ncf") {
				window.location = "http://" + __host_prefix + "netcafe.hangame.co.jp/netcafe.asp";
				isNcfRedirect = true
			}
		}
		if (!isNcfRedirect) {
			HTOP.HTOPCTRL = new hg.HtopCtrl({});
			HTOP.HTOPCTRL.initialize()
		}
	}
})("hg.HtopInit");
var SWFREQUESTTEMPID;

function _swfRequestOverride() {
	SWFREQUESTTEMPID = jindo.$Ajax.SWFRequest._tmpId;
	jindo.$Ajax.SWFRequest = jindo.$Class({
		_callback: function (success, data) {
			this.readyState = 4;
			if (success) {
				if (typeof data == "string") {
					try {
						this.responseText = decodeURIComponent(data);
						this.status = 200
					} catch(e) {}
				}
				this.onload(this)
			}
		},
		open: function (method, url) {
			var re = /https?:\/\/([a-z0-9_\-\.]+)/i;
			this._url = url;
			this._method = method
		},
		send: function (data) {
			this.responseXML = false;
			this.responseText = "";
			var t = this;
			var dat = {};
			var info = this._getCallbackInfo();
			var swf = window.document[SWFREQUESTTEMPID];
			var header = [];

			function f(arg) {
				switch (typeof arg) {
				case "string":
					return '"' + arg.replace(/\"/g, '\\"') + '"';
					break;
				case "number":
					return arg;
					break;
				case "object":
					var ret = "",
						arr = [];
					if (arg instanceof Array) {
						for (var i = 0; i < arg.length; i++) {
							arr[i] = f(arg[i])
						}
						ret = "[" + arr.join(",") + "]"
					} else {
						for (var x in arg) {
							arr[arr.length] = f(x) + ":" + f(arg[x])
						}
						ret = "{" + arr.join(",") + "}"
					}
					return ret;
				default:
					return '""'
				}
			}
			data = (data || "").split("&");
			for (var i = 0; i < data.length; i++) {
				pos = data[i].indexOf("=");
				key = data[i].substring(0, pos);
				val = data[i].substring(pos + 1);
				dat[key] = decodeURIComponent(val)
			}
			window.__jindo2_callback[info.id] = function (success, data) {
				try {
					t._callback(success, data)
				} finally {
					delete window.__jindo2_callback[info.id]
				}
			};
			swf.requestViaFlash(f({
				url: this._url,
				type: this._method,
				data: dat,
				charset: "shift_jis",
				callback: info.name,
				headers_json: this._headers
			}))
		}
	}).extend(jindo.$Ajax.RequestBase)
}
function _swfRequestOverride2() {
	jindo.$Ajax.SWFRequest = jindo.$Class({
		_callback: function (success, data) {
			this.readyState = 4;
			if (success) {
				if (typeof data == "string") {
					try {
						this.responseText = decodeURIComponent(data);
						this.status = 200
					} catch(e) {}
				}
				this.onload(this)
			}
		},
		open: function (method, url) {
			var re = /https?:\/\/([a-z0-9_\-\.]+)/i;
			this._url = url;
			this._method = method
		},
		send: function (data) {
			this.responseXML = false;
			this.responseText = "";
			var t = this;
			var dat = {};
			var info = this._getCallbackInfo();
			var swf = window.document[SWFREQUESTTEMPID];
			var header = [];

			function f(arg) {
				switch (typeof arg) {
				case "string":
					return '"' + arg.replace(/\"/g, '\\"') + '"';
					break;
				case "number":
					return arg;
					break;
				case "object":
					var ret = "",
						arr = [];
					if (arg instanceof Array) {
						for (var i = 0; i < arg.length; i++) {
							arr[i] = f(arg[i])
						}
						ret = "[" + arr.join(",") + "]"
					} else {
						for (var x in arg) {
							arr[arr.length] = f(x) + ":" + f(arg[x])
						}
						ret = "{" + arr.join(",") + "}"
					}
					return ret;
				default:
					return '""'
				}
			}
			data = (data || "").split("&");
			for (var i = 0; i < data.length; i++) {
				pos = data[i].indexOf("=");
				key = data[i].substring(0, pos);
				val = data[i].substring(pos + 1);
				dat[key] = decodeURIComponent(val)
			}
			window.__jindo2_callback[info.id] = function (success, data) {
				try {
					t._callback(success, data)
				} finally {
					delete window.__jindo2_callback[info.id]
				}
			};
			swf.requestViaFlash(f({
				url: this._url,
				type: this._method,
				data: dat,
				charset: "shift_jis",
				callback: info.name,
				headers_json: this._headers
			}))
		}
	}).extend(jindo.$Ajax.RequestBase)
}(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (opt) {
			var naList;
			(HTOP.impAnncFlg) ? naList = ["newlyImpAnnc", "newlyDefAnnc"] : naList = ["newlyDefAnnc", "newlyImpAnnc"];
			var impNewiconElm = $Element("impNewicon");
			if (impNewiconElm) {
				(HTOP.impAnncExIcon) ? impNewiconElm.show() : impNewiconElm.hide()
			}
			new hg.Htop.Tabs([{
				base: "cmntyCntPickup",
				tabCnt: ["pickupBBS", "pickupBlog"]
			},
			{
				base: "newlyInfo",
				tabCnt: naList
			}]);
			HTOP.LOGINPANEL = new hg.Htop.LoginPanel();
//			this._rta()
		},
		initialize: function () {
			$Element("newlyInfo").show();
			$Element("ht02bnr").show();
			$Element("ht04bnr").show();
			$Element("cmntySrchBox").show();
			$Element("HT07").show();
			$Element("HT08").show();
			$Element("HT09").show();
			$Element("HT10").show();
			this.generation = this._getGenerationCookie();
			if (this.generation) {
				this.generation = Math.floor((this.generation - 0) / 10) * 10
			}
			this.loginHostInfo = this._getLoginHostInfoCookie();
			this.gender = this._getGenderCookie();
			this.oAgent = $Agent().navigator();
			this.isNetCafe = this._isNetCafe();
			this.iconPathHash = {
				"new": "http://images.hangame.co.jp/hangame/htop/icn_new.gif",
				event: "http://images.hangame.co.jp/hangame/htop/icn_event.gif",
				update: "http://images.hangame.co.jp/hangame/htop/icn_update.gif",
				test: "http://images.hangame.co.jp/hangame/htop/icn_test.gif"
			};
			initHangameTopLoginPanel();
			if (this.isNetCafe) {
				HTOP.GAMELIST = new hg.Htop.GameList();
				HTOP.GAMELIST.initialize();
				$Element("netCafeNews").show()
			}
		},
		loginedInit: function (userid) {
			if (getCookie(CK_MEMBERID) == "") {
				this.logoutInit();
				return
			}
			if(this.isNetCafe){
				HTOP.LOGINPANEL.drawNcfLoginPanel(userid);
			}
			HTOP.FIGCLASSBANNER = new hg.Htop.FigClassBanner();
			HTOP.FIGCLASSBANNER.initialize();
			HTOP.MYMENU = new hg.Htop.MyMenu();
			HTOP.MINIMAIL = new hg.Htop.Minimail({
				defaultOpen: true
			});
			HTOP.MINIMAIL.initialize(userid)
		},
		logoutInit: function () {
			document.loginform.dispatchURL.value = location.href;
			HTOP.LOGINPANEL.initialize(false);
			initForm()
		},
		_rta: function () {
			cssquery.getSingle("EM", $("hangameRTA")).innerHTML = getRtaWithComma("totalRta")
		},
		_getGenerationCookie: function () {
			return getCookie(CK_AGE)
		},
		_getGenderCookie: function () {
			return getCookie(CK_SEX)
		},
		_getLoginHostInfoCookie: function () {},
		_getFigClassCookie: function () {
			return getCookie(CK_FIGCLASS)
		},
		_getAffHost: function () {
			if (isAffSite()) {
				return getCookieHost()
			} else {
				return "hgj"
			}
		},
		_isNetCafe: function () {
			if (getCookieHost() == "ncf") {
				return true
			}
			return false
		},
		_contentsDataCallback: function (data) {
			HTOP.MYMENU.setContentsData(data)
		}
	})
})("hg.HtopCtrl");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function () {
			this.sHostPrefix = (__host_prefix == "" || __host_prefix == "beta-") ? __host_prefix : "alpha-";
			this.jsonpPath = "http://static.hangame.co.jp/hangame/htop/js/cms/"
		},
		_jsonpRequest: function (jsonp) {
			this.ajax = new $Ajax(jsonp, {
				type: "jsonp",
				jsonp_charset: "shift_jis"
			});
			this.ajax.request()
		},
		_xhrRequest: function (url, param, type) {
			var _this = this;
			this.ajax = new $Ajax(url, {
				method: "get",
				type: "xhr",
				onload: function (res) {
					_this._callback(res, type)
				}
			});
			this.ajax.request(param)
		},
		_swfRequest: function (url, param, type, id) {
			var _this = this;
			this.ajax = new $Ajax(url, {
				method: "post",
				type: "flash",
				onload: function (res) {
					_this._callback(res, type, id)
				},
				onerror: function () {
					_this._swfRequestError()
				},
				_respHeaders: {
					charset: "shift_jis"
				}
			});
			try {
				this.ajax.request(param)
			} catch(e) {
				_this._swfRequestError()
			}
		},
		_callback: function () {},
		isIE: function () {
			return this.oAgent.ie
		},
		_checkLength: function (str) {
			return str.length
		},
		getGeneration: function () {
			return HTOP.HTOPCTRL.generation
		},
		getGender: function () {
			return HTOP.HTOPCTRL.gender
		},
		getIconPath: function (type) {
			return HTOP.HTOPCTRL.iconPathHash[type]
		},
		getLoginHost: function () {
			return HTOP.HTOPCTRL.loginHostInfo
		},
		getMyPageURL: function () {
			return HTOP.HTOPCTRL.myPageURL
		},
		isNetCafe: function () {
			return HTOP.HTOPCTRL.isNetCafe
		},
		strCutLeader: function (str, len) {
			if (str.length <= len) {
				return str
			}
			return str.substring(0, len) + "..."
		},
		addComma:function(num){
			return num.toString().replace(/([0-9]+?)(?=(?:[0-9]{3})+$)/g,'$1,');
		}
	})
})("hg.Htop");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function () {},
		initialize: function () {
			this._jsonpRequest("http://" + this.sHostPrefix + "top.hangame.co.jp/contentlist/netcafecontentlist.nhn")
		},
		_callback: function (data) {
			var _this = this;
			$A(data.serviceList).forEach(function (v) {
				_this._gameList(v)
			})
		},
		_gameList: function (data) {
			var service = data.service.toLowerCase();
			var baseElmID = service + "Contents";
			var baseElm = $(baseElmID);
			this._dispGameCnt(data.gameCount, service);
			var spBaseElm = $$.getSingle(".sp", baseElm);
			var pickUpData = data.pickupContent;
			if (pickUpData) {
				var a = $("<a>");
				a.href = pickUpData.url;
				if (pickUpData.target) {
					a.target = pickUpData.target
				}
				var img = $("<img>");
				img.src = pickUpData.imageUrl;
				img.alt = pickUpData.name;
				a.appendChild(img);
				spBaseElm.appendChild(a)
			} else {
				$Element(spBaseElm).hide()
			}
			var listUL = cssquery.getSingle("UL", baseElm);
			var _this = this;
			var catListTag = "";
			$A(data.contentList).forEach(function (v, i) {
				var gameLi = $("<li>");
				var a = $("<a>");
				a.href = v.url;
				if (v.target) {
					a.target = v.target
				}
				var gameImg = $("<img>");
				(v.imageUrl) ? gameImg.src = v.imageUrl : gameImg.src = "";
				gameImg.alt = v.name;
				a.appendChild(gameImg);
				var icon = v.icon;
				icon = (icon != "NONE") ? icon.toLowerCase() : null;
				var sttSpan = $("<span>");
				sttSpan.className = "stt";
				if (v.official) {
					var ofImg = $("<img>");
					ofImg.alt = "特約店";
					ofImg.src = "http://images.hangame.co.jp/hangame/htop/hgcntents/icn_tokuyaku.gif";
					sttSpan.appendChild(ofImg)
				}
				if (icon) {
					var sttImg = $("<img>");
					sttImg.alt = icon.toUpperCase();
					sttImg.src = _this.getIconPath(icon);
					sttSpan.appendChild(sttImg)
				}
				if (icon && v.official) {
					gameLi.className = "w"
				}
				a.appendChild(sttSpan);
				if (v.rtaView != "N" && v.rta) {
					var rtaSpan = $("<span>");
					rtaSpan.className = "rta";
					var rtaEm = $("<em>");
					rtaEm.innerHTML = v.rta;
					var rtaImg = $("<img>");
					rtaImg.src = "http://images.hangame.co.jp/hangame/htop/hgcntents/txt_nin.gif";
					rtaImg.alt = "人";
					rtaSpan.appendChild(rtaEm);
					rtaSpan.appendChild(rtaImg);
					a.appendChild(rtaSpan)
				}
				gameLi.appendChild(a);
				listUL.appendChild(gameLi)
			})
		},
		_dispGameCnt: function (cnt, service) {
			$(service + "Cnt").innerHTML = cnt
		}
	}).extend(hg.Htop)
})("hg.Htop.GameList");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function () {},
		imgError: function (elm) {
			$Element(elm).attr({
				src: "http://images.hangame.co.jp/hangame/community/blog/notfound.gif",
				width: "48px",
				height: "53px"
			})
		}
	})
})("hg.Htop.Blog");
HTOP.BLOG = new hg.Htop.Blog();
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (param) {},
		resizeImage: function (elm) {
			var elm = elm;
			var elmObj = $Element(elm);
			var fitW = 134;
			var fitH = 94;
			var srcW = elm.width - 0;
			var srcH = elm.height - 0;
			var ovW = srcW / fitW;
			var ovH = srcH / fitH;
			var reav = Math.max(ovW, ovH);
			if (ovW < 1 && ovH < 1) {
				var reW = Math.floor(srcW);
				var reH = Math.floor(srcH)
			} else {
				var reW = Math.floor(srcW / reav);
				var reH = Math.floor(srcH / reav)
			}
			if (reH < fitH) {
				elmObj.css({
					position: "relative",
					top: (fitH - reH) / 2 + "px"
				})
			}
			elmObj.attr({
				width: reW,
				height: reH
			}).css("visibility", "visible")
		}
	})
})("hg.Htop.Bbs");
HTOP.BBS = new hg.Htop.Bbs();
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (param) {},
		initialize: function () {
			this._setFigClassBanner()
		},
		_setFigClassBanner: function () {
			(getCookie(CK_FIGCLASS) > 3) ? $Element("hangameTips_first").hide() : $Element("hangameTips_safe").hide()
		}
	}).extend(hg.Htop)
})("hg.Htop.FigClassBanner");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (param) {},
		resizeImage: function (elm) {
			var elm = elm;
			var elmObj = $Element(elm);
			var fitW = 80;
			var fitH = 80;
			var srcW = elm.width - 0;
			var srcH = elm.height - 0;
			var ovW = srcW / fitW;
			var ovH = srcH / fitH;
			var reav = Math.max(ovW, ovH);
			if (ovW < 1 && ovH < 1) {
				var reW = Math.floor(srcW);
				var reH = Math.floor(srcH)
			} else {
				var reW = Math.floor(srcW / reav);
				var reH = Math.floor(srcH / reav)
			}
			if (reH < fitH) {
				elmObj.css({
					position: "relative",
					top: (fitH - reH) / 2 + "px"
				})
			}
			elmObj.attr({
				width: reW,
				height: reH
			}).css("visibility", "visible")
		}
	})
})("hg.Htop.CircleHG");
HTOP.CIRCLEHG = new hg.Htop.CircleHG();
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		emojiImg: new Array(),
		emojiTxt: new Array(),
		mailIconPath: {
			opened: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_read.gif",
			notopened: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_unread.gif",
			replyed: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_return.gif"
		},
		mailAlt: {
			opened: "既読",
			notopened: "未読",
			replyed: "返信済み"
		},
		$init: function (param) {
			this.api = 'http://' + this.sHostPrefix + 'mmail.hangame.co.jp/bloc.nhn?userid=$userid$&resource=inboxBo&procedure=getNewList&parameters={"count":3}';
			_swfRequestOverride();
			this.mmDefaultOpen = param.defaultOpen;
			this.baseID = "newlyMiniMail";
			this.baseElm = $(this.baseID);
			this.baseElmObj = $Element(this.baseElm);
			this.baseElmObj.show();
			this.ocElm = cssquery.getSingle("H2", this.baseElm);
			this.dispFlg;
			this.getDataFlg = false
		},
		initialize: function (userid) {
			this.userid = userid;
			this._attachEvent();
			if (this._getDispFlgCookie() == "n") {
				this._changeDisp("close");
				HTOP.MYMENU.initialize()
			} else {
				this._dataRequest()
			}
		},
		interimToTxt: function (interim) {
			return this.emojiTxt[interim]
		},
		_emojiMapRequest: function () {
			var api = "http://" + this.sHostPrefix + 'mmail.hangame.co.jp/bloc.nhn?userid=$userid$&resource=emojiBo&procedure=getEmojiMap&parameters={"fields":["pcimg","pctxt","interim"]}';
			api = api.replace("$userid$", this.userid);
			this._swfRequest(api, null, "map")
		},
		_dataRequest: function () {
			this.api = this.api.replace("$userid$", this.userid);
			this._swfRequest(this.api, null, "data")
		},
		_swfRequest: function (url, param, type, id) {
			var _this = this;
			this.ajax = new $Ajax(url, {
				method: 'post',
				type: 'flash',
				onload: function (res) {
					_this._callback(res, type, id);
				},
				onerror: function () {
					_this._swfRequestError();
				},
				_respHeaders: {
					'charset': 'shift_jis'
				}
			});
			try {
				this.ajax.request(param);
			} catch(e) {
				window.setTimeout($Fn(this._dataRequest, this).bind(), 100);
			}
		},
		_attachEvent: function () {
			$Fn(this.changeDispEv, this).attach(this.ocElm, "click")
		},
		_getDispFlgCookie: function () {
			var mmOpenFlg = getStrCookie("MINIMAIL_OPEN");
			return (mmOpenFlg) ? mmOpenFlg : (this.mmDefaultOpen) ? "y" : "n"
		},
		_changeDisp: function (type) {
			switch (type) {
			case "open":
				if (this.getDataFlg) {
					this.baseElmObj.className("nmmOpen");
					this.ocElm.title = "閉じる"
				} else {
					this._dataRequest()
				}
				this._setMMCookie("MINIMAIL_OPEN", "y", 365);
				break;
			case "close":
				this.baseElmObj.className("nmmClose");
				this.ocElm.title = "開く";
				this._setMMCookie("MINIMAIL_OPEN", "n", 365);
				break
			}
			this.dispFlg = type
		},
		_setMMCookie : function(strName, strValue, intExpireDay){

			//del cookie
			var oldExpireDate = new Date("Dec 1,2001 09:00:00");
			document.cookie = 'MINIMAIL_OPEN=;domain=hangame.co.jp;expires=' + oldExpireDate.toGMTString();
			//del cookie

			var exDate = new Date;
			exDate.setMonth(exDate.getMonth() + intExpireDay);
			document.cookie = strName + "=" + strValue + ";expires=" + exDate.toGMTString() + ";domain=" + this.sHostPrefix + 'www.hangame.co.jp' + ";path=/";
		},
		changeDispEv: function () {
			(this.dispFlg == "open") ? this._changeDisp("close") : this._changeDisp("open")
		},
		_callback: function (data, type) {
			switch (type) {
			case "map":
				var res = eval("(" + data.text() + ")");
				if (res.result) {
					for (var i in res.object) {
						this.emojiImg[res.object[i].interim] = res.object[i].pcimg;
						this.emojiTxt[res.object[i].interim] = res.object[i].pctxt
					}
					this.minimail(this.mmRes);
					HTOP.MYMENU.initialize()
				} else {
					this._changeDisp("close")
				}
				break;
			case "data":
				var res = eval("(" + data.text() + ")");
				this.mmRes = res;
				this.getDataFlg = true;
				this._changeDisp("open");
				if (this._emojiCheck(res)) {
					this._emojiMapRequest()
				} else {
					this.minimail(res);
					HTOP.MYMENU.initialize()
				}
				break
			}
		},
		_emojiCheck: function (res) {
			for (var i in res.object) {
				if (res.object[i].subject.match(/\{em:([0-9]{4})\}/g) != null) {
					return true
				}
			}
			return false
		},
		interimToTxt: function (interim) {
			return this.emojiTxt[interim]
		},
		interimToImg: function (interim) {
			return this.emojiImg[interim]
		},
		imgToInterim: function (img) {
			for (var i in this.emojiImg) {
				if (this.emojiImg[i] == img) {
					return i
				}
			}
		},
		imgToTxt: function (img) {
			for (var i in this.emojiImg) {
				if (img == this.emojiImg[i]) {
					return this.emojiTxt[i]
				}
			}
		},
		txtToImg: function (txt) {
			for (var i in this.emojiTxt) {
				if (txt == this.emojiTxt[i]) {
					return this.emojiImg[i]
				}
			}
		},
		minimail: function (data) {
			this._drawItems(data.object)
		},
		_drawItems: function (mailList) {
			var UL = cssquery.getSingle("UL", this.baseElm);
			var _this = this;
			var innerUL = "";
			if (mailList.length < 1) {
				innerUL += "新着メールはありません"
			} else {
				var _this = this;
				$A(mailList).forEach(function (v, i) {
					var iconState;
					switch (v.status) {
					case "U":
						iconState = "notopened";
						break;
					case "O":
						iconState = "opened";
					default:
						if (v.reply == "Y") {
							iconState = "replyed"
						}
						break
					}
					var subject = v.subject;
					subject = nj.mm.cutStr(subject, 150, 12, 9, 8, 7, v.systemMail).str;
					innerUL += "<li><a href=\"javascript:void(openPost('?mailid=" + v.mailId + '\'))"><img src="' + _this.mailIconPath[iconState] + '" alt="' + _this.mailAlt[iconState] + '" class="state" />' + subject + "<em>" + v.fromId + " " + v.receiveDate + "</em></a></li>"
				})
			}
			UL.innerHTML = innerUL
		},
		_swfRequestError: function () {
			HTOP.MYMENU.initialize()
		}
	}).extend(hg.Htop)
})("hg.Htop.Minimail");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		jsonpName: "contentsmast.js",
		myMenuId: "myMenuTab",
		hstryId: "playHstryTab",
		classNames: {
			myMenu: "tabOn_myMenuTab",
			hstry: "tabOn_playHstryTab",
			open: "ulOpen",
			close: "ulClose"
		},
		url: {
			thumb: "http://images.hangame.co.jp/_images/toppage/gicon_",
			ment: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_mainte.gif",
			ok: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_governing.gif",
			add: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_plus.gif",
			del: "http://images.hangame.co.jp/hangame/htop/extraarea/icn_delete.gif"
		},
		msg: {
			del: ["マイメニューから削除しました。"],
			add: ["マイメニューに登録しました。", "これ以上登録できません。", "すでに登録されています。", "登録が失敗しました。", "登録が失敗しました。"],
			emptyMyMenu: "サービスが未登録です。<br /><br />【マイメニューとは？】<br />よく利用するサービスのショートカットです♪<br />各サービスにある「マイメニューに追加」ボタンを押して登録してね。"
		},
		$init: function () {
			this.api = "http://" + this.sHostPrefix + "top.hangame.co.jp/mymenu/htop.nhn?m=";
			this.src = "http://" + this.sHostPrefix + "top.hangame.co.jp/contentlist/contentsmast.nhn";
			this.baseID = "usersLinks";
			this.baseElm = $(this.baseID);
			this.baseElmObj = $Element(this.baseElm);
			this.baseElmObj.show();
			this.ocElm = cssquery.getSingle("H2", this.baseElm);
			this.myMenuElm = $(this.myMenuId);
			this.myMenuTabElm = cssquery.getSingle("H3", this.myMenuElm);
			this.hstryElm = $(this.hstryId);
			this.hstryTabElm = cssquery.getSingle("H3", this.hstryElm);
			this.dispFlg;
			this.getDataFlg = false;
			this.emptyMyMenuFlg = false;
			this.initFlg = false
		},
		_jsonpRequest: function (jsonp) {
			var _this = this;
			this.ajax = new $Ajax(jsonp, {
				type: "jsonp",
				jsonp_charset: "shift_jis",
				onload: function(oData) {
					_this.setContentsData(oData);
				}
			});
			this.ajax.request()
		},
		initialize: function () {
			if (this.initFlg) {
				return
			}
			this.initFlg = true;
			this._jsonpRequest(this.src);
			this._attachEvent()
		},
		_loadContentsData: function () {
			var script = $("<SCRIPT>");
			$Element(script).attr({
				type: "text/javascript",
				src: this.src
			});
			$Element($$("head")[0]).append(script)
		},
		_attachEvent: function () {
			$Fn(this.openMyMenuEv, this).attach(this.myMenuTabElm, "click");
			$Fn(this.openHstryEv, this).attach(this.hstryTabElm, "click")
		},
		setContentsData: function (data) {
			if (!data) {
				return
			}
			this.contentsData = data.json();
			this._dataRequest("open")
		},
		_changeDisp: function (type) {
			switch (type) {
			case "open":
				if (this.getDataFlg) {
					this.baseElmObj.className(this.classNames.hstry + " " + this.classNames.open)
				} else {
					this._dataRequest("open")
				}
				break;
			case "close":
				this.baseElmObj.className(this.classNames.close);
				break
			}
			this.dispFlg = type
		},
		openMyMenuEv: function () {
			this.baseElmObj.removeClass(this.classNames.hstry);
			this.baseElmObj.addClass(this.classNames.myMenu)
		},
		openHstryEv: function () {
			this.baseElmObj.removeClass(this.classNames.myMenu);
			this.baseElmObj.addClass(this.classNames.hstry)
		},
		_dataRequest: function (type, itemid, e) {
			(type != 'open' && type != 'del' && type != 'add') ? type = this.reType : this.reType = 'open';
			(itemid) ? this.reItemid = itemid : itemid = this.reItemid;
			if (e) {
				$Event(e).stop()
			}
			if (type == "open") {
				var api = this.api + "openMymenu";
				this._swfRequest(api, null, type)
			} else {
				if (type == "del") {
					this.deleteItem = e.element.parentNode;
					var api = this.api + "delMymenu&gid=" + itemid;
					this._swfRequest(api, null, type, itemid)
				} else {
					if (type == "add") {
						this.addItem = e.element.parentNode;
						var api = this.api + "addMymenu&gid=" + itemid;
						this._swfRequest(api, null, type, itemid)
					}
				}
			}
		},
		_swfRequest: function (url, param, type, id) {
			var _this = this;
			this.ajax = new $Ajax(url, {
				method: 'post',
				type: 'flash',
				onload: function (res) {
					_this._callback(res, type, id);
				},
				onerror: function () {
					_this._swfRequestError();
				},
				_respHeaders: {
					'charset': 'shift_jis'
				}
			});
			try {
				this.ajax.request(param);
			} catch(e) {
				window.setTimeout($Fn(this._dataRequest, this).bind(), 100);
			}
		},
		_callback: function (data, type, id) {
			data = eval("(" + data.text() + ")");
			if (type == "open") {
				this.getDataFlg = true;
				this._drawItems(data);
				this._changeDisp("open")
			} else {
				if (type == "del") {
					this._deleteItem(data, id)
				} else {
					if (type == "add") {
						this._addItem(data, id)
					}
				}
			}
		},
		_drawItems: function (res) {
			if (res.status != 0) {
				return
			}
			this.myMenuList = $A(res.mymenu.split(","));
			this._drawMyMenu(this.myMenuList);
			this.hstryList = $A(res.myplayhist.split(","));
			this._drawHstry(this.hstryList)
		},
		_drawMyMenu: function (list) {
			var UL = cssquery.getSingle("UL", this.myMenuElm);
			var ULElm = $Element(UL);
			if (list.length() < 1 || list.$value()[0] == "") {
				this._showMyMenuEmptyMsg();
				return
			}
			var _this = this;
			list.forEach(function (v, i) {
				_this._drawItem(v, ULElm)
			})
		},
		_drawItem: function (id, ULElm) {
			var liElm = $Element("<LI>");
			var item = this.contentsData[id];
			if (!item) {
				var endGameFlg = true;
				var item = {};
				item.name = "終了したゲームです"
			}
			if (!endGameFlg) {
				var link = '<a href="' + item.url + '">' + item.name + "</a>"
			} else {
				var link = item.name
			}
			liElm.html(link);
			var btn = $("<IMG>");
			var btnElm = $Element(btn).attr({
				src: this.url.del,
				alt: "削除",
				tabindex: "0"
			});
			$Fn(function (e) {
				this._dataRequest("del", id, e)
			},
			this).attach(btn, "click");
			liElm.append(btnElm);
			ULElm.append(liElm)
		},
		_drawHstry: function (list) {
			var UL = cssquery.getSingle("UL", this.hstryElm);
			var ULElm = $Element(UL);
			var _this = this;
			var innerUL = "";
			if (list.length() == 1 && list._array[0] == "") {
				innerUL = '<p class="noPlayHistory">プレイ履歴がありません。</p>';
				ULElm.html(innerUL);
				return
			}
			list.forEach(function (v, i) {
				var liElm = $Element("<LI>");
				var item = _this.contentsData[v];
				var endGameFlg = false;
				if (!item) {
					endGameFlg = true;
					var item = {};
					item.contid = v;
					item.name = "サービス終了";
					var thumb = '<img class="thm" alt="サービス終了" src="http://images.hangame.co.jp/_images/toppage/gicon_closed.gif"/>'
				} else {
					var thumb = '<img class="thm" alt="" src="' + _this.url.thumb + item.contid.toLowerCase() + '.gif"/>'
				}
				if (!endGameFlg) {
					var ment = '<img class="stt" alt="" src="' + (item.ment == "Y" ? _this.url.ment : _this.url.ok) + '"/>';
					innerUL = '<a href="' + item.url + '">' + thumb + ment
				} else {
					var ment = "";
					innerUL = thumb + ment
				}
				var icon;
				(item.icon) ? icon = item.icon : icon = "NONE";
				icon = (icon != "NONE") ? icon.toLowerCase() : null;
				if (icon) {
					innerUL += '<img alt="' + icon.toUpperCase() + '" src="' + _this.getIconPath(icon) + '" class="stt"/>'
				}
				innerUL += "<br/><span>" + item.name + "</span>";
				if (!endGameFlg) {
					innerUL += "</a>"
				}
				liElm.html(innerUL);
				if (!endGameFlg) {
					var btn = $("<IMG>");
					var btnElm = $Element(btn);
					btnElm.attr({
						src: _this.url.add,
						title: "マイメニューに追加",
						alt: "+",
						tabindex: "0"
					});
					btnElm.className("add");
					$Fn(function (e) {
						_this._dataRequest("add", item.contid, e)
					},
					this).attach(btn, "click");
					if (_this.myMenuList.has(item.contid)) {
						btnElm.hide()
					}
					liElm.append(btnElm)
				} else {
					var btn = $("<IMG>");
					var btnElm = $Element(btn);
					btnElm.hide();
					btnElm.className("add");
					liElm.append(btnElm)
				}
				ULElm.append(liElm)
			})
		},
		_deleteItem: function (res, id) {
			if (res.status != 0) {
				return
			}
			var elm = $Element(this.deleteItem);
			var msg = $("<EM>");
			$Element(msg).text(this.msg.del[res.status]);
			elm.append(msg);
			var _this = this;
			_this._showAddBtn(id);
			$Fn(function () {
				elm.css("visibility", "hidden");
				elm.leave();
				var LI = $$("LI", _this.myMenuElm);
				if (LI.length < 1) {
					_this._showMyMenuEmptyMsg()
				}
			}).delay(3)
		},
		_showAddBtn: function (id) {
			var index = this.hstryList.indexOf(id);
			if (index < 0) {
				return
			}
			var img = $$("img.add", this.hstryElm);
			if (img[index].src) {
				$Element(img[index]).show()
			}
		},
		_addItem: function (res, id) {
			var elm = $Element(this.addItem);
			var msg = $("<EM>");
			var msgEl = $Element(msg);
			msgEl.text(this.msg.add[res.status]);
			elm.append(msg);
			$Fn(function () {
				msgEl.css("visibility", "hidden");
				msgEl.leave()
			}).delay(3);
			var UL = cssquery.getSingle("UL", this.myMenuElm);
			var ULElm = $Element(UL);
			var _this = this;
			if (res.status != 0) {
				return
			}
			var addBtn = $$("img.add", this.addItem)[0];
			$Element(addBtn).hide();
			if (this.emptyMyMenuFlg) {
				this._removeMyMenuEmptyMsg()
			}
			_this._drawItem(id, ULElm)
		},
		_showMyMenuEmptyMsg: function () {
			this.emptyMyMenuFlg = true;
			var pElm = $Element($("<P>"));
			pElm.html(this.msg.emptyMyMenu);
			$Element(this.myMenuElm).append(pElm)
		},
		_removeMyMenuEmptyMsg: function () {
			var P = cssquery.getSingle("P", this.myMenuElm);
			$Element(P).leave();
			this.emptyMyMenuFlg = false
		},
		_swfRequestError: function () {}
	}).extend(hg.Htop)
})("hg.Htop.MyMenu");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (param) {
			this.baseID = "userArea";
			this.baseElm = $(this.baseID);
			this.baseElmObj = $Element(this.baseElm);
			this.loginPanelElm = $("loginPanel");
			this.loginPanelElmObj = $Element(this.loginPanelElm);
			
			this.sTrendIconURl = 'http://images.hangame.co.jp/hangame/common/userarea/';
		},
		initialize: function (login) {
			if (login) {
				if(this.isNetCafe()){
					this.sLoginPanelAPI = "http://" + this.sHostPrefix + "netcafe.hangame.co.jp/api/loginpanelinfo.nhn";
				}else{
					this.sLoginPanelAPI = "http://" + this.sHostPrefix + "www.hangame.co.jp/api/loginpanelinfo.nhn";
				}
				this._getElms();
				this._xhrRequest(this.sLoginPanelAPI);
			} else {
				this._setEventLoginForm();
				this.loginPanelElmObj.show();
				this._checkInput();
				this._clearInputs();
				
			}
		},
		_getElms: function () {
			this.weMMCnt = $Element("mmCnt");
			this.weBBSCnt = $Element("bbsNewArrivalCnt");
			this.weHancoin = $Element("logininfo_hancoin");
			this.weHang = $Element("logininfo_hang");

			//
			this.weHpLevel = $Element("logininfo_hpLevel");
			this.weHpMedal = $Element("logininfo_hpMedal");
			this.weHpLvUpIcon = $Element("logininfo_hpLvUpIcon");
			this.wePlay = $Element("logininfo_play");
			this.wePopular = $Element("logininfo_popular");
			this.weFashion = $Element("logininfo_fashion");

			// ペット
			this.welPetBaseArea = $Element("lpPetArea");
			this.wePetState = $Element("logininfo_petState");
			this.wePetName = $Element("logininfo_petName");
			this.wePetLevel = $Element("logininfo_petLevel");
			this.welPetBnrArea = $Element("lpPetBnr");
		},
		_xhrRequest: function (url) {
			var _this = this;
			this.ajax = new $Ajax(url, {
				method: "post",
				type: "xhr",
				onload: function (res) {
					_this._callback(res);
				}
			});
			this.ajax.header("ajax", true);
			this.ajax.request();
		},
		_callback: function (res) {
			if (res.text() == "") {
				return;
			}
			data = eval("(" + res.text().replace("while(1);", "") + ")");
			this._setLoginPanelInfo(data);
		},
		_setLoginPanelInfo: function (data) {
			if (data.noReadMinimail != null) {
				this.weMMCnt.html(String(data.noReadMinimail));
			}
			if (data.bbsNewArrivalCount != null) {
				this.weBBSCnt.html(String(data.bbsNewArrivalCount));
			}
			if (data.hancoin != null && data.scebal != null) {
				this.weHancoin.html(this.addComma(String(data.hancoin + data.scebal)) + "<span>円<span>");
			}
			if (data.hang != null) {
				this.weHang.html(this.addComma(String(data.hang)) + "<span>G<span>");
			}
			//
			if (data.hpLevel != null) {
				this.weHpLevel.html(this.addComma(String(data.hpLevel)));
			}
			if (data.hpMedal != null) {
				this.weHpMedal.html(this.addComma(String(data.hpMedal)) + "<span>枚<span>");
			}
			if (data.hpLvUpIcon != null) {
				data.hpLvUpIcon ? this.weHpLvUpIcon.show() : this.weHpLvUpIcon.hide();
			}
			if (data.play != null) {
				data.play == 1 ? this.wePlay.attr('src', this.sTrendIconURl + 'ico_t-play_on.gif') : this.wePlay.attr('src', this.sTrendIconURl + 'ico_t-play_off.gif');
			}
			if (data.popular != null) {
				data.popular == 1 ? this.wePopular.attr('src', this.sTrendIconURl + 'ico_t-popular_on.gif') : this.wePopular.attr('src', this.sTrendIconURl + 'ico_t-popular_off.gif');
			}
			if (data.fashion != null) {
				data.fashion == 1 ? this.weFashion.attr('src', this.sTrendIconURl + 'ico_t-fashion_on.gif') : this.weFashion.attr('src', this.sTrendIconURl + 'ico_t-fashion_off.gif');
			}

			// ペット
			if (data.petName != null) {
				this.wePetName.html(data.petName);
			}
			if (data.petLevel != null) {
				this.wePetLevel.html(this.addComma(String(data.petLevel)));
			}
			if (data.petName != null && data.petName != '') {
				var obj = new SwfPutter({src: data.petImages + "/_images/petloginpanel/LoginPanel.swf", w:"80", h:"80"});
				obj.addVars({userid:data.userId, url:data.petUrl + "/pet/", images:data.petImages + "/_images/pet/"});
				obj.put("logininfo_petState");
				this.welPetBaseArea.show();
				this.welPetBnrArea.hide();
			} else {
				// ペット
				this.welPetBaseArea.hide();
				this.welPetBnrArea.show();
			}
		},
		_setEventLoginForm: function () {
			var idElm = $("strmemberid");
			var pwElm = $("strpassword");
			$Fn(this._checkInput, this).attach(idElm, "keydown");
			$Fn(this._checkInput, this).attach(pwElm, "keydown");
			$Fn(this._checkInputKeyUp, this).attach(idElm, "keyup");
			$Fn(this._checkInputKeyUp, this).attach(pwElm, "keyup");
			$Fn(this._checkInputEmpty, this).attach(idElm, "blur");
			$Fn(this._checkInputEmpty, this).attach(pwElm, "blur");
		},
		_checkInputEmpty: function (e) {
			if (e) {
				var keyObj = e.key();
				var keyCode = keyObj.keyCode;
				var elm = e.element;
				if (elm.value == "") {
					if (elm.id == "strmemberid") {
						elm.style.backgroundImage = "url(http://images.hangame.co.jp/hangame/htop/extraarea/txt_hgid.v02.gif)";
					} else {
						if (elm.id == "strpassword") {
							elm.style.backgroundImage = "url(http://images.hangame.co.jp/hangame/htop/extraarea/txt_pw.v02.gif)";
						}
					}
				}
			}
		},
		_checkInputKeyUp: function (e) {
			if (e) {
				var keyObj = e.key();
				var keyCode = keyObj.keyCode;
				var elm = e.element;
				if (elm.value != "") {
					elm.style.backgroundImage = "none"
				} else {
					if (elm.id == "strmemberid") {
						elm.style.backgroundImage = "url(http://images.hangame.co.jp/hangame/htop/extraarea/txt_hgid.v02.gif)";
					} else {
						if (elm.id == "strpassword") {
							elm.style.backgroundImage = "url(http://images.hangame.co.jp/hangame/htop/extraarea/txt_pw.v02.gif)";
						}
					}
				}
			}
		},
		_checkInput: function (e) {
			if (e != "idsave" && e != undefined) {
				var keyObj = e.key();
				var keyCode = keyObj.keyCode;
				var elm = e.element;
				if (keyCode == 13) {
					(elm.id == "strmemberid") ? $("strpassword").focus() : entersubmit();
				}
			} else {
				var elm = $("strmemberid");
			}
			if (elm.value != "" || e == "idsave") {
				elm.style.backgroundImage = "none";
			}
		},
		_clearInputs: function() {
			var elId = $('strmemberid');
			var elPw = $('strpassword');
			if (elId.value) elId.style.backgroundImage = 'none';
			if (elPw.value) elPw.style.backgroundImage = 'none';
		},
		//_drawLoginPanel: function () {
		//	this.loginPanelElmObj.className("login");
		//	if (this.isCool) {
		//		this.loginPanelElmObj.addClass("avtrCool");
		//		this.loginPanelElm.innerHTML = this.loginPanelCool
		//	} else {
		//		this.loginPanelElm.innerHTML = this.loginPanelPure
		//	}
		//	this.loginPanelElmObj.show();
		//	var avaData = this.ava.data;
		//	VIEWER_showAvatarNf(avaData[0], avaData[1], avaData[2], avaData[3], avaData[4]);
		//	this.puchihanElm.parentNode.removeChild(this.puchihanElm)
		//},
		_changeHeaderLoginout: function () {
			var hdLogInOutBtnElm = $("hdLogInOutBtn");
			cssquery.getSingle("A", hdLogInOutBtnElm).href = "javascript:(clickLogout());";
			var imgElm = cssquery.getSingle("IMG", hdLogInOutBtnElm);
			imgElm.src = "http://images.hangame.co.jp/hangame/common/header/btn_logout.gif";
			imgElm.alt = "ログアウト"
		},
		drawNcfLoginPanel:function(userid){
			var weID = $Element(cssquery.getSingle('H2 .name',$('loginPanel')));
			weID.attr('href','http://' + this.sHostPrefix + 'mypage.hangame.co.jp/profile/index.nhn?mid=' + userid);
			weID.html(userid);
		}
	}).extend(hg.Htop)
})("hg.Htop.LoginPanel");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function (idList) {
			var _this = this;
			this.tabInfoList = [];
			$A(idList).forEach(function (v, i) {
				_this._makeTabs(v, i);
				_this._changeTab(null, i, 0)
			})
		},
		_makeTabs: function (ids, num) {
			var elmList = [];
			$A(ids.tabCnt).forEach(function (v, i) {
				elmList.push($(v))
			});
			var tabElmList = [];
			var contentElmList = [];
			var imgElmList = [];
			$A(elmList).forEach(function (v) {
				tabElmList.push(cssquery.getSingle("H2 > A", v));
				contentElmList.push(cssquery.getSingle(".swElm", v));
				imgElmList.push(cssquery.getSingle("H2 > A > IMG", v))
			});
			var hash = {
				baseElm: $Element(ids.base),
				tabElm: tabElmList,
				contentElm: contentElmList,
				imgElm: imgElmList,
				cntID: ids.tabCnt
			};
			this.tabInfoList.push(hash);
			this._setEvent(tabElmList, num)
		},
		_setEvent: function (tabElmList, num) {
			var _this = this;
			$A(tabElmList).forEach(function (v, i) {
				$Fn(function (e) {
					_this._changeTab(e, num, i)
				},
				_this).attach(v, "click")
			})
		},
		_changeTab: function (e, gNum, tNum) {
			if (e != null) {
				$Event(e).stop()
			}
			var _this = this;
			if (!this.tabInfoList[gNum].baseElm) {
				return
			}
			this.tabInfoList[gNum].baseElm.className("tabOn_" + this.tabInfoList[gNum].cntID[tNum])
		}
	})
})("hg.Htop.Tabs");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function () {
			this.easeObj = $(arguments[0]);
			if (!this.easeObj) {
				return
			}
			this.defaultOptions = {
				sec: 1,
				ease: "linear",
				delay: 0,
				onStart: null,
				onStartParams: null,
				onUpdate: null,
				onUpdateParams: null,
				onComplete: null,
				onCompleteParams: null,
				axis: null
			};
			this.onEasing = false;
			this.objects = [];
			this.easingFunctionsLowerCase = {};
			for (var key in easingFunctions) {
				this.easingFunctionsLowerCase[key.toLowerCase()] = easingFunctions[key]
			}
		},
		_toNum: function (v) {
			return (v + "").match(/[0-9\.]/) ? Number((v + "").replace(/[^0-9\.-]/g, "")) : 0
		},
		_fill: function (v, p) {
			return v.replace(/\[(.*?)\]/g, function ($0, $1) {
				var key = $1.replace(/^\s*(.*?)\s*/, "$1");
				return p[key] ? p[key] : p[key] == 0 ? p[key] : ""
			})
		},
		_easeFunc: function (easeName) {
			return !easeName ? null : (typeof easeName == "function") ? easeName : this.easingFunctionsLowerCase[easeName.toLowerCase()]
		},
		tween: function (options) {
			var o = {};
			o.target = this.easeObj;
			o.targetPropeties = {};
			for (var key in this.defaultOptions) {
				if (options[key] || options[key] == 0) {
					o[key] = options[key];
					delete options[key]
				} else {
					o[key] = this.defaultOptions[key]
				}
			}
			o.easing = this._easeFunc.call(this, o.ease);
			for (var key in options) {
				var param = options[key];
				var from = ( !! param.from || param.from == 0) ? param.from : this._toNum($Element(this.easeObj).css(key));
				if (key == "alpha") {
					var from = ( !! param.from || param.from == 0) ? param.from : this._toNum($Element(this.easeObj).css("opacity"))
				}
				o.targetPropeties[key] = {
					direct: {
						from: from,
						to: param.to - from
					},
					unit: param.unit || "",
					template: param.template || "[value]px",
					filter: param.filter ||
					function (val) {
						return {
							value: val
						}
					},
					easing: this._easeFunc.call(this, param.ease) || o.easing
				};
				if (key == "height" && o.axis == "center") {
					o.targetPropeties.top = {
						direct: {
							from: this._toNum($Element(this.easeObj).css("top")),
							to: -(param.to - from) / 2
						},
						unit: param.unit || "",
						template: param.template || "[value]px",
						filter: param.filter ||
						function (val) {
							return {
								value: val
							}
						},
						easing: this._easeFunc.call(this, param.ease) || o.easing
					}
				}
				if (key == "width" && o.axis == "center") {
					o.targetPropeties.left = {
						direct: {
							from: this._toNum($Element(this.easeObj).css("left")),
							to: -(param.to - from) / 2
						},
						unit: param.unit || "",
						template: param.template || "[value]px",
						filter: param.filter ||
						function (val) {
							return {
								value: val
							}
						},
						easing: this._easeFunc.call(this, param.ease) || o.easing
					}
				}
			}
			var _this = this;
			setTimeout(function () {
				o.startTime = (new Date() - 0);
				o.endTime = (o.sec * 1000) + o.startTime;
				if (typeof o.onStart == "function") {
					if (o.onStartParams) {
						o.onStart.apply(o, o.onStartParams)
					} else {
						o.onStart()
					}
				}
				_this.objects.push(o);
				if (!_this.onEasing) {
					_this.onEasing = true;
					_this._eventLoop.call(_this)
				}
			},
			o.delay * 1000)
		},
		_eventLoop: function () {
			var now = (new Date() - 0);
			for (var i = 0; i < this.objects.length; i++) {
				var o = this.objects[i];
				var t = now - o.startTime;
				var d = o.endTime - o.startTime;
				if (t >= d) {
					for (var property in o.targetPropeties) {
						var prop = o.targetPropeties[property];
						var b = prop.direct.from;
						var c = prop.direct.to;
						if (property == "alpha") {
							$Element(o.target).opacity(prop.filter(c + b).value)
						} else {
							$Element(o.target).css(property, this._fill(prop.template, prop.filter(c + b)))
						}
					}
					this.objects.splice(i, 1);
					if (typeof o.onComplete == "function") {
						if (o.onCompleteParams) {
							o.onComplete.apply(o, o.onCompleteParams)
						} else {
							o.onComplete()
						}
					}
				} else {
					for (var property in o.targetPropeties) {
						var prop = o.targetPropeties[property];
						var b = prop.direct.from;
						var c = prop.direct.to;
						var val = prop.easing(t, b, c, d);
						if (property == "alpha") {
							$Element(o.target).opacity(prop.filter(val).value)
						} else {
							$Element(o.target).css(property, this._fill(prop.template, prop.filter(val)))
						}
					}
					if (typeof o.onUpdate == "function") {
						if (o.onUpdateParams) {
							o.onUpdate.apply(o, o.onUpdateParams)
						} else {
							o.onUpdate()
						}
					}
				}
			}
			if (this.objects.length > 0) {
				var _this = this;
				setTimeout(function () {
					_this._eventLoop()
				},
				10)
			} else {
				this.onEasing = false
			}
		}
	});
	easingFunctions = {
		linear: function (t, b, c, d) {
			return c * t / d + b
		},
		easeInSine: function (t, b, c, d) {
			return -c * Math.cos(t / d * (Math.PI / 2)) + c + b
		},
		easeOutSine: function (t, b, c, d) {
			return c * Math.sin(t / d * (Math.PI / 2)) + b
		},
		easeInOutSine: function (t, b, c, d) {
			return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b
		},
		easeOutInSine: function (t, b, c, d) {
			if (t < d / 2) {
				return easingFunctions.easeOutSine(t * 2, b, c / 2, d)
			}
			return easingFunctions.easeInSine((t * 2) - d, b + c / 2, c / 2, d)
		},
		easeInOutExpo: function (t, b, c, d) {
			if (t == 0) {
				return b
			}
			if (t == d) {
				return b + c
			}
			if ((t /= d / 2) < 1) {
				return c / 2 * Math.pow(2, 4 * (t - 1)) + b - c * 0.0005
			}
			return c / 2 * 1.0005 * (-Math.pow(2, -10 * --t) + 2) + b
		},
		easeInExpo: function (t, b, c, d) {
			return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b - c * 0.001
		},
		easeOutExpo: function (t, b, c, d) {
			return (t == d) ? b + c : c * 1.001 * (-Math.pow(2, -10 * t / d) + 1) + b
		},
		easeOutBack: function (t, b, c, d, s) {
			if (s == undefined) {
				s = 1.70158
			}
			return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b
		}
	}
})("nj.fx");
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = function (str, myCut, jpSize, engUpperSize, engLowSize, others, system) {
		var fix = null;
		var sys = (system) ? system : "N";
		var tempGarage = new Array();
		var emojiCnt = 0;
		var tmpStr = str.replace(/\r/g, "");
		if (myCut <= 100 || myCut == 410 * 3 || myCut == 228) {
			tmpStr = tmpStr.replace(/\n/g, "")
		}
		var idx = 0;
		var checkStr = tmpStr.replace(/\{em:([0-9]{4})\}/g, function (m, p1, ofs) {
			tempGarage[idx++] = m;
			emojiCnt += 16 - jpSize;
			return ""
		});
		var cnt = 0 + emojiCnt;
		var cutPos = 0;
		var length = 0;
		var sHankaku = "ｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｧｨｩｪｫｬｭｮｯﾞﾟｰ､｡｢｣";
		for (var i = 0; i < checkStr.length; i++) {
			length = i;
			var code = checkStr.charAt(i).charCodeAt(0);
			if (sHankaku.indexOf(checkStr.charAt(i)) >= 0) {
				cnt += others
			} else {
				if (code >= 256) {
					cnt += jpSize
				} else {
					if (code >= 65 && code <= 90) {
						cnt += engUpperSize
					} else {
						if (code >= 97 && code <= 122) {
							cnt += engLowSize
						} else {
							cnt += others
						}
					}
				}
			}
			if (cnt >= myCut) {
				break
			}
		}
		if (checkStr.length > length + 1) {
			fix = "..."
		}
		tmpStr = checkStr.substring(0, length + 1);
		if (sys == "N") {
			tmpStr = tmpStr.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br/>").replace(/\s/g, "&nbsp;")
		}
		var idx = 0;
		tmpStr = tmpStr.replace(//g, function (m, p1, ofs) {
			if (tempGarage[idx]) {
				var imgStr = HTOP.MINIMAIL.interimToImg(tempGarage[idx]);
				if (imgStr) {
					idx++;
					return "<img src='http://images.hangame.co.jp/hangame/mypage/blog/emoticon/" + imgStr + "' class='emoticon' />"
				} else {
					return tempGarage[idx++]
				}
			} else {
				idx++;
				return ""
			}
		});
		if (fix) {
			tmpStr += fix
		}
		return {
			str: tmpStr,
			size: Math.floor(cnt)
		}
	}
})("nj.mm.cutStr");
var sIsp;
var AFF = "aff";
var NCF = "ncf";
try {
	bIsp = isAffSite();
	if (bIsp) {
		if (getCookieHost() == "ncf") {
			sIsp = "ncf"
		} else {
			sIsp = "aff"
		}
	}
} catch(e) {}
function setAffImg() {
	if (bIsp) {
		var hangamelogo;
		var loginHost = getLoginHostInfo();
		hangamelogo = '<a href="' + loginHost[1] + '" target="' + loginHost[3] + '"><img src="' + loginHost[4] + '" alt="' + loginHost[2] + '"/></a>';
		$Element("hgLogo").html(hangamelogo)
	}
}

function setHangameTopLoginPanelInfo(memberid) {
	HTOP.HTOPCTRL.loginedInit(memberid);
}
function initHangameTopLoginPanel() {
	if (getCookie(CK_MEMBERID) == "") {
		HTOP.HTOPCTRL.logoutInit()
	} else {
		HTOP.LOGINPANEL.initialize(true)
	}
}
function searchID(strId) {
	var strTrimid = strTrim(strId);
	if (strTrimid.length == 0 || strTrimid == null || strTrimid == "") {
		alert("検索するIDを入力して下さい。");
		document.getElementById("searchid").style.background = "#fff url(http://images.hangame.co.jp/hangame/common/extraarea/txt_please_input_id.gif) no-repeat 3px 3px;"
	} else {
		window.open(__urlProfile + "/profile/index.nhn?mid=" + strTrimid, "mypage", "")
	}
}
function onSeachKeyDownEvent(keyCode, mid) {
	if (keyCode == 13) {
		searchID(mid)
	}
}
function strTrim(str) {
	return ltrim(rtrim(str))
}
function ltrim(str) {
	return str.replace(/^[\s　]+/, "")
}
function rtrim(str) {
	return str.replace(/[\s　]+$/g, "")
}
var Telop = $Class({
	$init: function () {
		var options = this.opt = this._getOptionSet(arguments[0]);
		this._base = $(options.id);
		if (!this._base) {
			return
		}
		this.parentNodeElmObj = $Element(this._base.parentNode);
		this.scrollAreaObj = $(this.opt.area);
		this.scrollAreaElm = $Element(this.scrollAreaObj);
		this.scrollAreaElm.css("position", "relative");
		this.scrollAreaElm.css("overflow", "hidden");
		this.telopLines;
		this.intvID;
		this.pauseIntvID;
		this.telopIndex = 0;
		this.scrollPx = 2;
		var telopTextDiv = $("<li>");
		this.telopTextDivObj = telopTextDiv;
		this.telopTextDivElm = $Element(telopTextDiv);
		this.telopTextDivElm.css("position", "absolute");
		this.telopTextDivElm.css("whiteSpace", "nowrap");
		this._addEvent();
		this._getTelopContent()
	},
	_getOptionSet: function (argu) {
		var option = {
			pauseMSec: 3000
		};
		if (typeof argu == "undefined") {
			argu = new Object
		}
		for (var x in argu) {
			option[x] = argu[x]
		}
		return option
	},
	_addEvent: function () {
		$Fn(this._onMouseover, this).attach(this.telopTextDivElm, "mouseover");
		$Fn(this._onMouseout, this).attach(this.telopTextDivElm, "mouseout")
	},
	_onMouseover: function (e) {
		if (!this._paused) {
			this.pause(1)
		}
	},
	_onMouseout: function (e) {
		if (this._paused) {
			this.resume()
		}
	},
	pause: function (type) {
		window.clearTimeout(this.intvID);
		this.intvID = null;
		if (type == 1) {
			this._paused = true;
			window.clearTimeout(this.pauseIntvID);
			this.pauseIntvID = null
		} else {
			if (type == 2) {
				var resumeFn = $Fn(function () {
					this.resume()
				},
				this).bind();
				this.pauseIntvID = setInterval(resumeFn, this.opt.pauseMSec)
			}
		}
	},
	resume: function () {
		window.clearTimeout(this.pauseIntvID);
		this.pauseIntvID = null;
		this._paused = false;
		this.restartTelop()
	},
	_getTelopContent: function () {
		var lineElmAry = $$("li", $("newlyImpAnnc"));
		if (lineElmAry.length <= 0) {
			return
		}
		var telopLines = new Array();
		$A(lineElmAry).forEach(function (v) {
			telopLines.push(v.innerHTML.replace(/<em>(.*)<\/em>/i, ""))
		});
		this.telopLines = telopLines;
		this._clearContent();
		this.scrollAreaElm.append(this.telopTextDivObj);
		this.scrollAreaElm.show();
		this.startTelop()
	},
	startTelop: function () {
		var telopText = this.telopLines[this.telopIndex];
		this.telopTextDivObj.innerHTML = telopText;
		this.telopTextDivElm.css("top", this.scrollAreaElm.height() + "px");
		this._setMove()
	},
	restartTelop: function () {
		this._setMove()
	},
	_setMove: function () {
		var moveFn = $Fn(function () {
			this._move()
		},
		this).bind();
		this.intvID = setInterval(moveFn, 30)
	},
	_move: function () {
		if (this.parentNodeElmObj.css("display") == "none") {
			return
		}
		var currentTop = parseInt(this.telopTextDivObj.style.top);
		var newTop = currentTop - this.scrollPx;
		if (newTop == 0 && !this.pauseIntvID) {
			this.telopTextDivObj.style.top = newTop + "px";
			this.pause(2)
		} else {
			if (newTop > -this.scrollAreaElm.height()) {
				this.telopTextDivObj.style.top = newTop + "px"
			} else {
				clearInterval(this.intvID);
				this.telopIndex++;
				if (this.telopIndex >= this.telopLines.length) {
					this.telopIndex = 0
				}
				this.startTelop()
			}
		}
	},
	_clearContent: function () {
		this.removeAllChild(this.scrollAreaObj)
	},
	removeAllChild: function (node) {
		while (node.hasChildNodes()) {
			node.removeChild(node.lastChild)
		}
	}
});
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		$init: function () {
			var htOptions = this.htOptions = this.getOptionSet(arguments[0]);
			this.elHolder = $(htOptions.holderID);
			this.aController = $$("." + htOptions.controller + " a", this.elHolder);
			this.aDisplay = $$("." + htOptions.display, this.elHolder);
			if (this.elHolder == null) {
				throw new Error()
			}
			this.hideAll();
			this.setTabSwitcher();
			this.showDefaultView();
			if (this.htOptions.tabOptions !== undefined) {
				var sHover = this.htOptions.tabOptions.hover;
				var sActive = this.htOptions.tabOptions.active;
				switch (this.htOptions.tabOptions.tabStyle) {
				case "text":
					this.setTextTabOption(sHover, sActive);
					break;
				case "image":
					this.setImageTabOption(sHover, sActive);
					break
				}
			}
		},
		setImageTabOption: function (sHover, sActive) {
			var self = this;
			$A(this.aController).forEach(function (elController) {
				if (sHover !== undefined && !(/mouse/i.test(self.htOptions.eventTrigger))) {
					$Fn(function (e) {
						var elImg = e.element;
						var sSrc = elImg.src;
						if (sActive !== undefined && sActive != "") {
							if (new RegExp(sActive + ".[a-z]+$", "i").test(sSrc)) {
								return
							}
						}
						sSrc = sSrc.replace(new RegExp(".([a-z]+)$", "i"), sHover + ".$1");
						elImg.src = sSrc
					}).attach(elController, "mouseover");
					$Fn(function (e) {
						var elImg = e.element;
						var sSrc = elImg.src;
						if (sActive !== undefined && sActive != "") {
							if (new RegExp(sActive + ".[a-z]+$", "i").test(sSrc)) {
								return
							}
						}
						sSrc = sSrc.replace(new RegExp(sHover + ".([a-z]+)$", "i"), ".$1");
						elImg.src = sSrc
					}).attach(elController, "mouseout")
				}
				if (sActive !== undefined) {
					$Fn(function (e) {
						$A(self.aController).forEach(function (elController) {
							var elImg = $$.getSingle("img", elController);
							var sSrc = elImg.src;
							sSrc = sSrc.replace(new RegExp(sActive + ".([a-z]+)$", "i"), ".$1");
							elImg.src = sSrc
						});
						var _activeImg = e.element;
						var _activeSrc = _activeImg.src;
						_activeSrc = _activeSrc.replace(new RegExp(sHover + ".([a-z]+)$", "i"), ".$1");
						_activeSrc = _activeSrc.replace(new RegExp(".([a-z]+)$", "i"), sActive + ".$1");
						_activeImg.src = _activeSrc
					}).attach(elController, self.htOptions.eventTrigger)
				}
			})
		},
		setTextTabOption: function (sHover, sActive) {
			var self = this;
			$A(this.aController).forEach(function (elController) {
				if (sHover !== undefined && !(/mouse/i.test(self.htOptions.eventTrigger))) {
					$Fn(function (e) {
						$Element(elController).parent().addClass(sHover)
					}).attach(elController, "mouseover");
					$Fn(function (e) {
						$Element(elController).parent().removeClass(sHover)
					}).attach(elController, "mouseout")
				}
				if (sActive !== undefined) {
					$Fn(function (e) {
						$A(self.aController).forEach(function (elController) {
							$Element(elController).parent().removeClass(sActive)
						});
						$Element(e.element).parent().addClass(sActive)
					}).attach(elController, self.htOptions.eventTrigger)
				}
			})
		},
		activateDefaultTab: function (nDefaultTab) {
			if (this.htOptions.tabOptions === undefined) {
				return
			}
			var sHover = this.htOptions.tabOptions.hover;
			var sActive = this.htOptions.tabOptions.active;
			switch (this.htOptions.tabOptions.tabStyle) {
			case "image":
				var _activeImg = $$.getSingle("img", this.aController[nDefaultTab]);
				var _activeSrc = _activeImg.src;
				_activeSrc = _activeSrc.replace(new RegExp(sHover + ".([a-z]+)$", "i"), ".$1");
				_activeSrc = _activeSrc.replace(new RegExp(".([a-z]+)$", "i"), sActive + ".$1");
				_activeImg.src = _activeSrc;
				break;
			case "text":
				$Element(this.aController[nDefaultTab]).parent().addClass(sActive);
				break
			}
		},
		hideAll: function () {
			$A(this.aDisplay).forEach(function (elDisplay) {
				$Element(elDisplay).hide()
			})
		},
		setTabSwitcher: function () {
			var self = this;
			$A(this.aController).forEach(function (elController) {
				$Fn(function (e) {
					self.switchTabs(e)
				}).attach(elController, self.htOptions.eventTrigger);
				$Fn(function (e) {
					e.stop()
				}).attach(elController, "click")
			})
		},
		switchTabs: function (e) {
			var tabTrigger = e.element;
			while (tabTrigger.tagName.toLowerCase() != "a") {
				tabTrigger = tabTrigger.parentNode
			}
			var targetHash = tabTrigger.href.split("#")[1];
			var targetDisplay = $Element(targetHash);
			this.hideAll();
			targetDisplay.show()
		},
		showDefaultView: function () {
			if (this.htOptions.defaultView !== undefined) {
				switch ((typeof this.htOptions.defaultView).toLowerCase()) {
				case "number":
					$Element(this.aDisplay[this.htOptions.defaultView - 1]).show();
					this.activateDefaultTab(this.htOptions.defaultView - 1);
					break;
				case "string":
					if (this.htOptions.defaultView == "*") {
						var nRandom = Math.floor(Math.random() * this.aDisplay.length);
						$Element(this.aDisplay[nRandom]).show();
						this.activateDefaultTab(nRandom)
					}
					break;
				default:
					$Element(this.aDisplay[0]).show();
					this.activateDefaultTab(0);
					break
				}
			} else {
				$Element(this.aDisplay[0]).show();
				this.activateDefaultTab(0)
			}
		},
		getOptionSet: function (htArgu) {
			var _option = {
				holderID: null,
				controller: null,
				display: null,
				eventTrigger: "click"
			};
			if (typeof htArgu === undefined) {
				htArgu = new Object
			}
			for (var x in htArgu) {
				_option[x] = htArgu[x]
			}
			return _option
		}
	})
})("nj.TabSwitcher");
var Static = $Class({
	$init: function (id) {
		this.obj = $(id);
		this.options = this._getOptionSet(arguments[1]);
		var offset = this.getPos(this.obj)[0];
		if (this.obj.style.position == "") {
			this.obj.style.position = "absolute";
			if (offset != this.getPos(this.obj)[0]) {
				this.obj.style.position = "relative"
			}
		}
		if (this.obj.style.position == "absolute") {
			this.obj.style.top = this.obj.offsetTop + "px"
		} else {
			if (offset == this.getPos(this.obj)[0]) {
				this.obj.style.top = "0px"
			} else {
				this.obj.style.top = (this.getPos(this.obj)[0] - offset) + "px"
			}
		}
		this._scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
		this._startTop = parseInt(this.obj.style.top);
		this._startPosY = this.getPos(this.obj)[0];
		$Fn(this.onScroll, this).attach(window, "scroll");
		this.onScroll()
	},
	_getOptionSet: function (argu) {
		var option = {
			enable: true,
			slowDown: false,
			topTrack: false,
			topMargin: 0,
			division: 50,
			limitArea: null
		};
		if (typeof argu == "undefined") {
			argu = new Object
		}
		for (var x in argu) {
			option[x] = argu[x]
		}
		return option
	},
	onScroll: function (e) {
		if (!this.options.enable) {
			return
		}
		var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
		var diff = scrollTop - this._scrollTop;
		if (this._timer != null) {
			clearTimeout(this._timer);
			this._timer = null
		}
		this._targetTop = this._startTop + diff;
		if (this.options.topTrack) {
			if (scrollTop + this.options.topMargin > this._startPosY) {
				this._targetTop -= this._startPosY - this.options.topMargin
			} else {
				this._targetTop = this._startTop
			}
			diff = this._targetTop - this._startTop
		}
		if (this.options.limitArea) {
			var objY = this.getPos(this.obj)[0];
			var area = $(this.options.limitArea);
			var posY = this.getPos(area)[0];
			if (this._startPosY + diff + this.obj.offsetHeight > posY + area.offsetHeight) {
				diff = posY + area.offsetHeight - this._startPosY - this.obj.offsetHeight;
				this._targetTop = this._startTop + diff
			}
		}
		this._timer = setTimeout($Fn(this.animate, this).bind(), 1)
	},
	animate: function () {
		var currTop = parseInt(this.obj.style.top);
		var unit = (this._targetTop - currTop) < 0 ? -1 : 1;
		var step = Math.ceil(this._targetTop - this._startTop / 100);
		if (this.options.slowDown) {
			step = parseInt((this._targetTop - currTop) / this.options.division);
			if (step == 0) {
				step = unit
			}
		}
		if ((step > 0 && currTop + step > this._targetTop) || (step < 0 && currTop + step < this._targetTop)) {
			step = this._targetTop - currTop
		}
		if (this._targetTop != currTop) {
			this.obj.style.top = (currTop + step) + "px";
			setTimeout($Fn(this.animate, this).bind(), 10)
		}
	},
	getPos: function (obj) {
		var top = 0,
			left = 0;
		while (obj.offsetParent) {
			top += obj.offsetTop;
			left += obj.offsetLeft;
			obj = obj.offsetParent
		}
		return [top, left]
	},
	setEnable: function (enable) {
		this.options.enable = enable
	}
});
var SwfPutter = $Class({
	$init: function () {
		this.vars = null;
		this.fElm = null;
		this.params = {
			allowScriptAccess: "always",
			swLiveConnect: "true",
			wmode: "transparent",
			quality: "high",
			loop: "false",
			menu: "false"
		};
		var options = this.opt = this._getOptions(arguments[0]);
		this.cFpVersion = new this._FPVersion(this.opt.fp.split("."));
		this.isIE = $Agent().navigator().ie;
		var url = location + "";
		this.protocol = url.match("^https?");
		(this.protocol) ? this.protocol = this.protocol[0] : this.protocol = "http"
	},
	_getOptions: function (param) {
		var option = {
			fp: "9.0.0",
			id: "",
			exi: false
		};
		if (typeof param == "undefined") {
			param = new Object
		}
		for (var x in param) {
			option[x] = param[x]
		}
		return option
	},
	put: function (elmID) {
		var fpVersion;
		(this.opt.fp == "any") ? fpVersion = true : fpVersion = this._getFPVersion();
		if (elmID) {
			this.fElm = $Element(elmID)
		}
		if (!fpVersion) {
			(this.fElm) ? this.fElm.html(this._makeTag()) : document.write(this._makeTag());
			return
		}
		if (!this._fpValid(fpVersion) && !$Agent().navigator().ie) {
			return
		}(this.fElm) ? this.fElm.html(this._makeTag()) : document.write(this._makeTag())
	},
	addVars: function (vars) {
		this.vars = this._makeParam(vars)
	},
	addParam: function (param) {
		for (var k in param) {
			this.params[k] = param[k]
		}
	},
	_makeTag: function () {
		if (this.isIE) {
			var fHTML = '<object id="' + this.opt.id + '" codebase="' + this.protocol + "://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + this.cFpVersion.major + "," + this.cFpVersion.minor + "," + this.cFpVersion.rev + ',0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" width="' + this.opt.w + '" height="' + this.opt.h + '">';
			fHTML += '<param name="movie" value="' + this.opt.src + '" />';
			for (var k in this.params) {
				fHTML += '<param name="' + k + '" value="' + this.params[k] + '" />'
			}
			if (this.vars) {
				fHTML += '<param name="FlashVars" value="' + this.vars + '" />'
			}
			fHTML += "</object>"
		} else {
			var sIdAttr = "";
			if (!this.opt.exi) {
				sIdAttr = 'id="' + this.opt.id + '"'
			}
			var fHTML = '<embed type="application/x-shockwave-flash" pluginspage="' + this.protocol + '://www.adobe.com/go/getflashplayer" src="' + this.opt.src + '" ' + sIdAttr + ' name="' + this.opt.id + '" width="' + this.opt.w + '" height="' + this.opt.h + '" ';
			for (var k in this.params) {
				fHTML += k + '="' + this.params[k] + '" '
			}
			if (this.vars) {
				fHTML += 'FlashVars="' + this.vars + '" '
			}
			fHTML += "/>"
		}
		return fHTML
	},
	_makeParam: function (obj) {
		var paramAry = new Array();
		for (var k in obj) {
			paramAry.push(k + "=" + obj[k])
		}
		return paramAry.join("&")
	},
	_FPVersion: function (verAry) {
		this.major = (verAry[0]) ? parseInt(verAry[0]) : 0;
		this.minor = (verAry[1]) ? parseInt(verAry[1]) : 0;
		this.rev = (verAry[2]) ? parseInt(verAry[2]) : 1
	},
	_fpValid: function (fpVersion) {
		if (fpVersion.major < this.cFpVersion.major) {
			this._errorAlert(fpVersion);
			return false
		}
		if (fpVersion.major > this.cFpVersion.major) {
			return true
		}
		if (fpVersion.minor < this.cFpVersion.minor) {
			this._errorAlert(fpVersion);
			return false
		}
		if (fpVersion.minor > this.cFpVersion.minor) {
			return true
		}
		if (fpVersion.rev < this.cFpVersion.rev) {
			this._errorAlert(fpVersion);
			return false
		}
		if (fpVersion.rev > this.cFpVersion.rev) {
			return true
		}
		return true
	},
	_errorAlert: function (fpVersion) {
		var installedFpVerStr = fpVersion.major + "." + fpVersion.minor + "." + fpVersion.rev;
		alert("現在インストールされているFlash Playerのバージョンは" + installedFpVerStr + "ですが、このコンテンツのご利用には、" + this.opt.fp + "以上のバージョンが必要です")
	},
	_getFPVersion: function () {
		var FPVersion = new this._FPVersion([0, 0, 0]);
		if (navigator.plugins && navigator.mimeTypes.length) {
			var fp = navigator.plugins["Shockwave Flash"];
			if (!fp) {
				return null
			}
			if (fp.description) {
				FPVersion = new this._FPVersion(fp.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
				return FPVersion
			}
		} else {
			if (window.ActiveXObject) {
				try {
					return this._makeIEVer(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"))
				} catch(e) {}
				try {
					var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					FPVersion = new this._FPVersion([6, 0, 21]);
					axo.AllowScriptAccess = "always";
					return this._makeIEVer(axo)
				} catch(e) {}
				try {
					return this._makeIEVer(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"))
				} catch(e) {}
				try {
					var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
					return new this._FPVersion([3, 0, 18])
				} catch(e) {}
			}
		}
		return null
	},
	_makeIEVer: function (axo) {
		return new this._FPVersion(axo.GetVariable("$version").split(" ")[1].split(","))
	}
});
SwfPutter.easyPut = function (sId, oOptions) {
	var _params = {
		src: "",
		id: "",
		w: 600,
		h: 400,
		allowScriptAccess: "always",
		swLiveConnect: "true",
		wmode: "transparent",
		quality: "high",
		loop: "false",
		menu: "false"
	};
	var _addParams = {};
	var _vars = {};
	for (var i in oOptions) {
		if (i == "vars") {
			_vars = oOptions.vars
		} else {
			if (typeof(_params[i]) != "undefined") {
				_params[i] = oOptions[i]
			} else {
				_addParams[i] = oOptions[i]
			}
		}
	}
	var oSwf = new SwfPutter(_params);
	oSwf.addParam(_addParams);
	oSwf.addVars(_vars);
	oSwf.put(sId);
	return oSwf
};
(function (namespace) {
	var pkg = $.verifyPackageName(namespace);
	pkg.container[pkg.name] = $Class({
		_appendIframe: function () {
			var iframe = $("<iframe>");
			iframe.src = this.requestUrl;
			iframe.name = "limitedAvatar";
			$Element(iframe).hide();
			document.body.appendChild(iframe)
		},
		$init: function (param) {
			this.swfPath = param.swf;
			this.width = param.width;
			this.height = param.height;
			this.requestUrl = param.requestUrl;
			$Fn(this._appendIframe, this).attach(window, "load")
		},
		disp: function () {
			this.eaElm = $("userArea").parentNode;
			if (!this.eaElm) {
				return
			}
			this._appendFlash()
		},
		_appendFlash: function () {
			var wDiv = $("<div>");
			this.wDiv = wDiv;
			$Element(wDiv).css({
				position: "absolute",
				top: "0px",
				right: "0px"
			});
			wDiv.id = "curtainFl_logInPnl";
			var fDiv = $("<div>");
			fDiv.id = "flashArea";
			wDiv.appendChild(fDiv);
			this.eaElm.appendChild(wDiv);
			var obj = new SwfPutter({
				src: this.swfPath,
				w: this.width,
				h: this.height,
				fp: "any"
			});
			obj.put("flashArea")
		},
		close: function () {
			$Element(this.wDiv).leave()
		}
	})
})("nj.lpCurtain");

(function($){

/**
 * TopPage's Banner
 * @name hg.RotationBanner
 * @param see this.prms
 **/
$.Class('hg.RotationBanner',{
	init : function(opt){
		this.prms = $.extend({
			mainId : "bnrArea",
			buttonId : "bnrBtn",
			loadbarId : "loadbar",
			fadeSpeed : 300,
			moveLayerSpeed : 300,
			rotationSpeed : 5000,
			isRotation : true,
			loadBar : true
		},opt);

		this.event = $({});
		this._getedBannerUrls = {};
		this._getedThumUrls = {};

		if( this._bannerEventBind() ){
			this._buttonEventBind();
			if( this.prms.isRotation ){
				this._loadbarEventBind();
			}
			this._setIframe();
			if( this._loadbarHander ){
				this._loadbarHander(null, 0);
			}
		};
	},

	_bannerEventBind : function(){
		var base = $("#" + this.prms.mainId);
		var banners = $('>li',base);
		var i=0;
		var _this = this;
        var bannersLen = banners.size();
		if(banners.size() == 0){
			this.noBanners();
			return false;
		}
		this.event.bind('moveTo',function(e, num, isClick){
			if(i==num){return;}
			banners.filter(':animated')
				.stop(true, true)
			.end()
			.eq(i)
				.fadeOut(_this.prms.fadeSpeed)
			.end()
			.eq(num)
				.fadeIn(_this.prms.fadeSpeed, function () {
					var url = $(this).find('a>img').attr('rel');
					if(url){
						_this._getBannerUrl(url);
					}
                });
			i=num;
		});
        var url = banners.eq(0).find('a>img').attr('rel');
        if(url){
            _this._getBannerUrl(url);
        }
		return true;
	},

	noBanners : function(){
		var errMsg = $("<p>")
			.addClass("errMsg")
			.text("データが取得できませんでした");
		$("#rotation").append(errMsg);
	},

	_buttonEventBind : function(){
		var base = $("#" + this.prms.buttonId);
		var self = $(">ul", base);
		var buttons = $('ul>li',base);
		var moveLayer = $(".btnFrame",base);
		var oldLeft = moveLayer.position().left;
		var outerWidth = buttons.eq(0).outerWidth(true);
		var _this = this;

		this.event.bind('moveTo',function(e, num, isStop){
			if(isStop){
				moveLayer.stop(true, true);
			}
			moveLayer.animate({
				left: oldLeft + outerWidth * num
			}, _this.prms.moveLayerSpeed);
		});
		this.event.bind('_moveTo', function(e, num){
			_this.event.trigger('moveTo', num >= buttons.size() ? 0 : num);
		});
		buttons.click(function(e){
			var url = $('>img', this).attr('rel');
			var i = buttons.index(this);

			_this.event.trigger('moveTo', [i, true]);
			if(url){
				_this._getThumUrl(url);
			}
		});
	},

	_loadbarEventBind : function(){
		var _this = this;

		if(!this.prms.loadBar){
			var timer
			this._loadbarHander = function(e, num, isStop){
				clearTimeout(timer);
				timer = setTimeout(function(){
						_this.event.trigger('_moveTo', num+1);
					}, _this.prms.rotationSpeed);
			};
			this.event.bind('moveTo', this._loadbarHander);
			return;
		}

		var base = $("#" + this.prms.loadbarId);
 		var _loadbar = $('>img', base);
 		var width = base.width();

 		this._loadbarHander = function(e, num, isStop){
			if(isStop){
				_loadbar.stop(true);
			}
			_loadbar.width(0)
				.animate({
					width: width
				}, _this.prms.rotationSpeed, 'linear', function(){
					_this.event.trigger('_moveTo', num+1);
				});
		}

		this.event.bind('moveTo', this._loadbarHander)
	},

	_setIframe : function(){
		this.bannerIframe = $("<iframe>").hide().appendTo("body");
		this.thumIframe = $("<iframe>").hide().appendTo("body");
        this._setIframe = function(){};
	},

	_getBannerUrl : function(url){
		this._setIframe();
		if(this._getedBannerUrls[url]){
			return;
		}
		this._getedBannerUrls[url] = true;
		this.bannerIframe.attr("src", url);
	},

	_getThumUrl : function(url){
        this._setIframe();
        if(this._getedThumUrls[url]){
			return;
		}
		this._getedThumUrls[url] = true;
		this.thumIframe.attr("src", url);
	},

	moveTo : function(num, isStop){
		this.event.trigger('moveTo', [num, isStop]);
	}
});

/**
 * TopPage's live Channel
 * @name hg.Channel
 * @param see this.prms
 **/
$.Class("hg.Channel",{

	DAY : 24*60*60*1000,
	MINUTE : 60*1000,

	init : function(opt){
		this.prms = $.extend({
			baseId : "hgChannel",
			nextClass : "nextBtn",
			backClass : "backBtn",
			speed : 400,
			currentTime : +( new Date() ),
			startTimes : [null, null]
		}, opt);

		this.base = $("#" + this.prms.baseId);
		this.channel = $("ul", this.base);
		this.channels = $("ul>li", this.base);
		this.nextBtn = $('.nextBtn', this.base);
		this.backBtn = $('.backBtn', this.base);
		this.height = this.channel.height()/this.channels.length;
		this.time = this.prms.currentTime;
		this.now = $Date(this.time);

		if(this.channels.size()===2){
			this._bindEvents();
			//this.nextBtn.show();
			//this.backBtn.hide();
			$(">img", this.nextBtn).hide();
			$(">a", this.nextBtn).show();
		}else{
			//this.nextBtn.show();
			//this.backBtn.hide();
			$(">img", this.nextBtn).show();
			$(">a", this.nextBtn).hide();
		}
		this.initCountDown();
	},

	initCountDown : function(){
		this.initCountDown = function(){};

		var elDate = $(".data", this.base);
		var elClock = $(".clock", this.base);

		this.dates = {
			M1 : $(".m1", elDate),
			M2 : $(".m2", elDate),
			D1 : $(".d1", elDate),
			D2 : $(".d2", elDate),
			h1 : $(".h1", elClock),
			h2 : $(".h2", elClock),
			m1 : $(".m1", elClock),
			m2 : $(".m2", elClock),
			week : $(".week>img", this.base)
		};
		$.extend(this.dates,{
			dateHeightStep : this.dates.M1.height() / 10,
			timeHeightStep : this.dates.h1.height() / 10,
			weekHeightStep : this.dates.week.height() / 7
		});

		setInterval($.proxy(this._step, this), 1000);
		this.resetDateTime();
		this.resetCountDown1();
		this.resetCountDown2();
	},

	_step : function(){
		var old = this.now;

		this.time += 1000;
		this.now = $Date(this.time);
		this.resetDateTime(old);
		this.resetCountDown1();
		this.resetCountDown2();
	},

	resetDateTime : function(oldDate){
		return !this.setMinute(oldDate) || !this.setHour(oldDate) ||
			!this.setWeek(oldDate) || !this.setDate(oldDate) || !this.setMonth(oldDate);
	},

	resetCountDown1 : function(){
		this.resetCountDown(0);
	},

	resetCountDown2 : function(){
		this.resetCountDown(1);
	},
	diffDate : function(date1, date2){
		var diff = new Date(date1.getFullYear(),date1.getMonth(),date1.getDate(),0,0,0,0)
					- new Date(date2.getFullYear(),date2.getMonth(),date2.getDate(),0,0,0,0);
		return ( +new Date(diff) )/(1000*60*60*24);

	},
	resetCountDown : function(i){
		var start = this.prms.startTimes[i],
			elChannel = this.channels[i];

		if(!start || !elChannel){
			return;
		}

		var timefix = start - this.time;
		if(timefix <= 0){
			$(".play", elChannel).show();
			$(".dateCountDown", elChannel).hide();
			$(".countDown", elChannel).hide();
			$(".secCountDown", elChannel).hide();
			if(i==0){
				this.resetCountDown1 = function(){};
			}
			if(i==1){
				this.resetCountDown2 = function(){};
			}
			return;
		}

		timefix = new Date(timefix);
		var h = timefix.getUTCHours(),
			m = timefix.getUTCMinutes(),
			s = timefix.getUTCSeconds(),
			d = timefix.getUTCDate()-1;

		var d2;
		if( d > 0 ){
			d2 = this.diffDate( new Date(start), new Date(this.time) );
		}

		if(!elChannel.isDateCoutDown && d > 0){
			elChannel.isDateCoutDown = true;
			$(".dateCountDown", elChannel).show();
			$(".countDown", elChannel).hide();
			$(".secCountDown", elChannel).hide();
		}
		if(!elChannel.isCoutDown && d == 0){
			elChannel.isCoutDown = true;
			$(".dateCountDown", elChannel).hide();
			$(".countDown", elChannel).show();
			$(".secCountDown", elChannel).hide();
		}
		if(!elChannel.isSecCoutDown && d == 0 && h==0){
			elChannel.isSecCoutDown = true;
			$(".dateCountDown", elChannel).hide();
			$(".countDown", elChannel).hide();
			$(".secCountDown", elChannel).show();
		}

		if(elChannel.isDateCoutDown && d2 !== elChannel.d){
			elChannel.d = d2;
			this.changeDateCoutDown(elChannel, d2);
		}
		if(elChannel.isCoutDown && m !== elChannel.m){
			elChannel.m = m;
			this.changeCoutDown(elChannel, h, m);
		}
		if(elChannel.isSecCoutDown){
			this.changSecCountDown(elChannel, m, s);
			return;
		}


		return;
	},

	changeDateCoutDown : function(el, date){
		var d1 = Math.floor(date / 10),
			d2 = date % 10;
		$(".d1", el).css("top", - d1 * 21);
		$(".d2", el).css("top", - d2 * 21);
	},

	changeCoutDown : function(el, h, m){
		var h1 = Math.floor(h / 10),
			h2 = h % 10,
			m1 = Math.floor(m / 10),
			m2 = m % 10;

		$(".h1", el).css("top", - h1 * 21);
		$(".h2", el).css("top", - h2 * 21);
		$(".countDown .m1", el).css("top", - m1 * 21);
		$(".countDown .m2", el).css("top", - m2 * 21);
	},

	changSecCountDown : function(el, m, s){
		var m1 = Math.floor(m / 10),
			m2 = m % 10,
			s1 = Math.floor(s / 10),
			s2 = s % 10;
		$(".secCountDown .m1", el).css("top", -m1 * 21);
		$(".secCountDown .m2", el).css("top", -m2 * 21);
		$(".s1", el).css("top", -s1 * 21);
		$(".s2", el).css("top", -s2 * 21);
	},

	setMonth : function(oldDate){
		var month = this.now.month()
		if(oldDate && oldDate.month() == month){
			return false;
		}
		month += 1;

		var m1 = Math.floor(month / 10),
			m2 = month % 10;

		this.dates.M1.css("top", - this.dates.dateHeightStep * m1 );
		this.dates.M2.css("top", - this.dates.dateHeightStep * m2 );
		return true;
	},

	setDate : function(oldDate){
		var date = this.now.date();
		if(oldDate && oldDate.date() == date){
			return false;
		}

		date = ("0" + date).slice(-2);
		var d1 = Math.floor(date / 10),
			d2 = date % 10;

		this.dates.D1.css("top", - this.dates.dateHeightStep * d1 );
		this.dates.D2.css("top", - this.dates.dateHeightStep * d2 );
		return true;
	},

	setWeek : function(oldDate){
		var day = this.now.day();
		if(oldDate && oldDate.day() == day){
			return false;
		}
		this.dates.week.css("top", -this.dates.weekHeightStep * day);
		return true;
	},
	setHour : function(oldDate){
		var hour = this.now.hours();
		if(oldDate && oldDate.hours() == hour){
			return false;
		}

		var h1 = Math.floor(hour / 10),
			h2 = hour % 10;

		this.dates.h1.css("top", - this.dates.timeHeightStep * h1 );
		this.dates.h2.css("top", - this.dates.timeHeightStep * h2 );
		return true;
	},
	setMinute : function(oldDate){
		var minute = this.now.minutes();
		if(oldDate && oldDate.minutes() == minute){
			return false;
		}

		var m1 = Math.floor(minute / 10),
			m2 = minute % 10;

		this.dates.m1.css("top", - this.dates.timeHeightStep * m1 );
		this.dates.m2.css("top", - this.dates.timeHeightStep * m2 );
		return true;
	},

	_bindEvents : function(){
		this.nextBtn.show().click($.proxy(this._clickNext, this));
		this.backBtn.hide().click($.proxy(this._clickBack, this));
	},

	_clickNext : function(e){
		e.preventDefault();
  		this.nextBtn.hide();
  		this.backBtn.show();
  		this.channel.animate({
			top: -this.height
		}, this.prms.speed);
	},

	_clickBack : function(e){
		e.preventDefault();
  		this.nextBtn.show();
  		this.backBtn.hide();
  		this.channel.animate({
			top: 0
		}, this.prms.speed);
	}
});

/**
 * Top Page's MsgQALayer
 */
$.Class('hg.MsgQLayer',{
	init : function(opt){
		this.prms = $.extend({
			contentId : 'msgQa', // 表示するcontentのdivのid
			maskId : 'jsMsgMask', // maskとして表示するclass
			iframeWidth: 457,
			iframeHeight: 333,
			horizontal: false
		},opt);

		if(!this._isShowMsgLayer()) return;

		this.bodyElm = $('body');
		this.content = $('#' + this.prms.contentId);
		this.contentIframe = $('iframe', this.content);
		this.overLay = $('#' + this.prms.maskId);

		this.openMsgModal = false;

		this._initMsgModal();
	},
	_isShowMsgLayer : function() {
		var bannerElm = $('#externalFlash');
		return (bannerElm.length > 0) ? false : true;
	},
	_initMsgModal : function() {
		if(!this.content.length || !this.overLay.length) {
			this._makeMsgViwerTag();
		}
		if(!this.prms.requestUrl) return;
		this.contentIframe.attr('src', this.prms.requestUrl);
	},
	disp : function() {
		if(this._isIE6()) return;
		if(!this.prms.contentUrl) return;

		this.contentIframe.attr('src', this.prms.contentUrl);

//		this._setOverLayCloseEvent();
		this._openAnimation();
	},
	close : function(e) {
//		if(e) e.preventDefault();
		this._overLayClick();
	},
	_openAnimation: function() {
		var targetPosObj = this._getPosition({w: this.prms.iframeWidth, h:this.prms.iframeHeight});
		var targetSizeObj = {w: this.prms.iframeWidth, h:this.prms.iframeHeight};

		var posObj = this._getPosition();
		var sizeObj = {w: '0px', h:'0px'};

		this.openMsgModal = true;

		this._setOverLay();
	},
	_getWindowSize: function() {
		return {w: $(window).width(), h:$(window).height()};
	},
	_openingOnComplete: function() {
		var _this = this;
		
		if(this.prms.horizontal) {
			this.contentIframe.animate({
				left: '50%'
			}, 800, 'easeInOutBack', function() {
				_this.openMsgModal = false;
			});
		} else {
			this.contentIframe.animate({
				top: '50%'
			}, 800, 'easeInOutBack', function() {
				_this.openMsgModal = false;
			});
		}
		
		// easeInBack easeOutBack
	},
	_setOverLay: function() {
		var _this = this;
		this.overLay.css('opacity', 0).show();
		this._setMsgContent();
		this.overLay.animate({
			opacity: '0.2'
		} ,700, function() {
			_this._openingOnComplete();
		});
	},
	_setMsgContent: function() {
		if(this.prms.horizontal) {
			this.contentIframe.css('left', '155%');
		} else {
			this.contentIframe.css('top', '-55%');
		}
		this.content.show();
	},
	_getPosition: function(elSize) {
		var windowSize = this._getWindowSize();
		if(elSize) {
			return {top: ($(document).scrollTop()+windowSize.h-elSize.h)/2,left: (windowSize.w-elSize.w)/2}
		}
		return {top: $(document).scrollTop()+windowSize.h/2, left: windowSize.w/2}
	},
	_getContentSize: function(el) {
		return {w: el.width(), h: el.height()};
	},
	_makeMsgViwerTag: function() {
		var contentDivElm = $('<div>');
		contentDivElm.attr('id', this.prms.contentId).css('display', 'none');
		var msgIframeTagStr = '<iframe src="" width="' + this.prms.iframeWidth + '" height="' + this.prms.iframeHeight + '" frameborder="0" scrolling="no" allowtransparency="true"></iframe>';
		contentDivElm.html(msgIframeTagStr);

		this.bodyElm.append(contentDivElm);

		this.content = contentDivElm;
		this.contentIframe = $('iframe', this.content);

		var overLayDivElm = $('<div>');
		overLayDivElm.addClass('mask').attr('id', this.prms.maskId).css('display', 'none');
		this.bodyElm.append(overLayDivElm);

		this.overLay = overLayDivElm;
	},
//	_setOverLayCloseEvent: function() {
//		var _this = this;
//		this.content.click(function(e) {
//			if(e) e.preventDefault();
//			_this._overLayClick();
//		}, this);
//	},
	_overLayClick: function() {
		if(!this.openMsgModal) {
			this.closeLayer();
		}
	},
	_overLayHideOnComplete: function() {
		this.closeLayer();
	},
	closeLayer: function() {
		var _this = this;
		this.overLay.animate({
			opacity: 0
		}, 200, 'linear', function() {
			_this._clear();
		});
//		this.content.hide('fast');
	},
	_clear: function() {
		var _this = this;
		
		if(this.prms.horizontal) {
			this.contentIframe.animate({
				left: '-50%'
			}, 380, 'easeInBack', function() {
				_this.overLay.remove();
				_this.content.remove();
			});
		} else {
			this.contentIframe.animate({
				top: '-50%'
			}, 380, 'easeInBack', function() {
				_this.overLay.remove();
				_this.content.remove();
			});
		}
		
	},
	_isIE6: function() {
		return typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined";
	}
});

})(jQuery)
