﻿/*
 * Copyright(C) Ctrip.COM 2008.All Rights Reserved. Not to be reused without
 * permission. Created by Chu Chengdong, UI group, IT department. Last modified
 * by Chu Chengdong, Tian Guofa, UI group, IT department. 2008/02/25
 */

var $topWin = window;

(function() {

	while (true) {

		var a = $topWin.parent;

		if (a && a != $topWin && a.$Ctrip)
			$topWin = a;

		else
			return

	}

})();

window.$Ctrip = function(h) {

	this.Variable = function() {

		this._ = h;

		this.__ = h.document;

		this.___ = h.__.documentElement;

		h.__
				.write("<div id=\"jsContainer\"><input id=\"jsSaveStatus\" type=\"text\" style=\"display:none;\" \/><div id=\"tuna_alert\" style=\"display:none;position:absolute;z-Index:999;overflow:hidden;\"><\/div><\/div>");

		this.$$$ = new function() {

			this.status = new function() {

				this.domReady = false;

				this.busy = 0;

				this.domReadyFunc = [];

				this.dealt = {

				};

				this.regEvent = [];

				this.regEventHash = {

				};

				this.charset = (((h.__.charset
						? h.__.charset
						: h.__.characterSet) || "")
						.match(/^(gb2312|big5|utf-8)$/gi) || "gb2312")
						.toString().toLowerCase();

				this.version = {

					"gb2312" : "zh-cn",
					"big5" : "zh-tw",
					"utf-8" : "en"

				}[this.charset];

				var a = $topWin.__.getElementsByTagName("script");

				this.debug = false;

				this.alertDiv = h.__.getElementById("tuna_alert");

				this.container = h.__.getElementById("jsContainer");

				this.saveStatus = h.__.getElementById("jsSaveStatus");

				this.today = new Date().toStdString()

			};

			this.module = {

				iframe : [],
				list : {

					address : "tuna_addressOffice",
					calendar : "tuna_calendar_071206"

				},
				tab : {

				},
				selectAll : {

				},
				checkInput : {

				},
				address : {

					source : {

					}

				},
				calendar : {

				},
				jmpInfo : {

					array : {

					}

				},
				init : []

			};

			with (navigator) {

				with (userAgent) {

					this.browser = {

						IE : !!match(/MSIE/),
						IE6 : !!appVersion.match(/MSIE 6\.0/i),
						Moz : match(/Mozilla/i) && !match(/compatible|WebKit/i),
						Opera : !!match(/Opera/i),
						Safari : !!match(/Mac|Safari/i)

					}

				}

			}
			this.string = {

				"zh-cn" : {

					weekday : "日一二三四五六",
					display : "@▲|▼@显示|隐藏@"

				},
				"zh-tw" : {

					weekday : "日一二三四五六",
					display : "@▲|▼@顯示|隱藏@"

				},
				"en" : {

					weekday : "SMTWTFS",
					display : "@Show|Hidden@"

				}

			}[this.status.version];

			this.access = {

			}

		}

	};

	this.window = function() {

		this.$fixE = function(a) {

			a = h.event || a || arguments.callee.caller.arguments[0];

			Ctrip.Object.apply(a.$target = a.target ? (a.target.nodeType == 3
					? a.target.parentNode
					: a.target) : a.srcElement);

			return a

		};

		this.$stopEvent = function(a, c) {

			a = $fixE(a);

			c = c || 0;

			if (c >= 0)
				a.preventDefault
						? a.stopPropagation()
						: (a.cancelBubble = true);

			if (c != 0)
				a.preventDefault ? a.preventDefault() : (a.returnValue = false)

		};

		this.$getUid = function() {

			return "uid_" + (new Date()).getTime()
					+ Math.random().toString().substr(2, 5)

		};

		this.$c = this.$createElement = function(a) {

			if (a.constructor == Array)
				return Ctrip.Object.apply(h.__.createTextNode(a.join("\n")));

			else
				return Ctrip.Object.apply(h.__.createElement(a))

		};

		this.$getQuery = function(a) {

			var c = (location.search || "").match(new RegExp("[\\?&]" + a
							+ "=([^&]+)", "i"));

			return c ? unescape(c[1]) : null

		};

		this.$loadJs = function(a, c, d) {

			var f = arguments.callee;

			var g = f.queue || (f.queue = {

			});

			c = c || $$$.status.charset;

			a = a.replace('{$charset}', c);

			if (a in g) {

				if (d) {

					if (g[a])
						g[a].push(d);

					else
						d()

				}
				return

			}
			g[a] = d ? [d] : [];

			var i = h.__.createElement("script");

			i.type = "text/javascript";

			i.charset = c;

			i.onload = i.onreadystatechange = function() {

				if (i.readyState && i.readyState != "loaded"
						&& i.readyState != "complete")
					return;

				i.onreadystatechange = i.onload = null;

				while (g[a].length)
					g[a].shift()();

				g[a] = null

			};

			i.src = a;

			h.__.getElementsByTagName("head")[0].appendChild(i)

		};

		this.$loadCss = function(a, c) {

			if ($topWin.$$$.browser.IE)
				h.__.createStyleSheet(a).charset = c || $$$.status.charset;

			else {

				var d = h.__.createElement("link");

				with (d) {

					type = "text\/css";

					rel = "stylesheet";

					href = a

				}
				h.__.$$$$("head")[0].appendChild(d)

			}

		};

		this.$getCookie = function(a, c) {

			var d = h.__.cookie.match(new RegExp("(?:^|;)\\s*"
					+ encodeURIComponent(a) + "=([^;]+)"));

			if (c === false)
				return d ? d[1] : null;

			if (d && c)
				d = d[1].match(new RegExp("(?:^|&)\\s*" + encodeURIComponent(c)
						+ "=([^&]+)"));

			return d ? decodeURIComponent(d[1]) : null

		};

		this.$delCookie = function(a, c) {

			if (c) {

				var d = $getCookie(a, false);

				if (d === null)
					return;

				d = d.replace(
						new RegExp("(^|&)\\s*" + encodeURIComponent(c)
								+ "=[^&]+"), "").replace(/^\s*&/, "");

				if (d) {

					h.__.cookie = encodeURIComponent(a) + "=" + d;

					return

				}

			}
			var f = new Date();

			f.setTime(f.getTime() - 1);

			h.__.cookie = encodeURIComponent(a) + "=;expires=" + f

		};

		this.$setCookie = function(a, c, d) {

			if (!d) {

				d = c;

				c = null

			}
			if (c) {

				var f = $getCookie(a, false) || "";

				if (f)
					f = (f + "&").replace(new RegExp("(^|&)\\s*"
									+ encodeURIComponent(c) + "=[^&]+&"), "$1");

				h.__.cookie = encodeURIComponent(a) + "=" + f
						+ encodeURIComponent(c) + "=" + encodeURIComponent(d)

			} else
				h.__.cookie = encodeURIComponent(a) + "="
						+ encodeURIComponent(d)

		};

		this.$init = function(a) {

			if (a)
				$$$.module.init.push(a);

			else
				$$$.module.init.each()

		};

		this.$parserRe = function(d) {

			var f = [];

			var g = /<[^>]+\smod=[\'\"]?([\w|]+)[^>]+/g;

			var i = /\smod_jmpInfo_page=[\'\"]?([^\'\"\s]+)/;

			var j = /id=[\'\"]?([\w\-]+)/i;

			var l = null;

			var m = null;

			var n = null;

			(d && d.innerHTML ? d : h.__.body).innerHTML.replace(g, function(a,
							c) {

						try {

							if (c == "jmpInfo") {

								if (l = a.match(i))
									Ctrip.module.jmpInfo(l[1])

							} else if ((m = a.match(j)) && (n = $$$$(m[1]))) {

								if (c in Ctrip.module)
									new Ctrip.module[c](n);

								else
									f.push(n)

							}

						} catch (e) {

							$t(		"parserRe函数错误:"
											+ func.toString().slice(0, 50)
											+ "...", "red")

						};

						return ""

					});

			var k = setInterval(function() {

						var a = f.shift();

						if (a)
							h.$d(a);

						else
							clearInterval(k)

					}, 50)

		};

		this.$d = this.$dealElement = function(c) {

			Ctrip.Object.apply(c);

			(c.getAttribute("mod") || "").replace(/\w+/ig, function(a) {

						if ($topWin.$$$.module.list[a]) {

							if (!$topWin.$$$.module[a].list) {

								$topWin.$$$.module[a].list = [];

								$topWin.$loadJs("/js/"
												+ $topWin.$$$.module.list[a]
												+ ".js", "utf-8")

							}

							$topWin.$$$.module[a].list.push(c);

							$topWin.$init()

						}

						else if (Ctrip.module[a])

						{

							if (a == 'jmpInfo')
								Ctrip.module[a](c);

							else
								new Ctrip.module[a](c)

						}
						return ''

					})

		};

		this.$i = function(i) {

			var j = h.$$$.access[i];

			if (j)
				return j;

			else {

				j = new function() {

					var f = [], g = [];

					this.get = function() {

						var a = j.value;

						for (var c = 0;

						c < f.length;

						c++) {

							var d = f[c].call(a);

							if (typeof d != 'undefined')
								a = d

						}
						return a

					};

					this.set = function(a) {

						for (var c = 0;

						c < g.length;

						c++) {

							var d = g[c].call(a);

							if (typeof d != 'undefined')
								a = d

						}
						return j.value = a

					};

					this.regGet = function(a) {

						if (!a)
							f = [];

						else
							f.push(a);

						return

					};

					this.regSet = function(a) {

						if (!a)
							g = [];

						else
							g.push(a);

						return

					}

				}

			}
			return h.$$$.access[i] = j

		};

		this.$fixElement = function(f) {

			function g(a, c, d) {

				if ('attachEvent' in a)
					a.attachEvent('on' + c, d);

				else
					a.addEventListener(c, d)

			}
			function i(a) {

				a = a.getElementsByTagName('input');

				for (var c = 0;

				c < a.length;

				c++)
					if (/checkbox|radio/.test(a[c].type))
						return a[c];

				return null

			}
			function j(a) {

				if (!a)
					a = window.event;

				return a.srcElement || a.target

			}
			function l(a) {

				var c = a._0;

				if (c) {

					a.htmlFor = c.id || (c.id = $getUid());

					a._0 = null

				}
				var d = a.style;

				d.borderBottom = '#aaa 1px dashed';

				d.paddingBottom = '0px';

				d.color = '#1E1A75'

			}
			function m(a) {

				var c = a.style;

				c.borderBottom = '';

				c.paddingBottom = '';

				c.color = ''

			}
			f = f && f.nodeType ? f : h.__;

			if ($$$.browser.IE6) {

				var n = f.getElementsByTagName("label");

				for (var k = 0;

				k < n.length;

				k++) {

					var o = i(n[k]);

					if (o && /checkbox|radio/.test(o.type))
						(function(lbl, box) {

							lbl._0 = box;

							g(lbl, 'mouseover', function() {

										l(lbl)

									});

							g(lbl, 'mouseout', function() {

										m(lbl)

									})

						})(n[k], o)

				}

			}
			if ($$$.browser.IE) {

				var t = f.getElementsByTagName("select");

				for (var k = 0;

				k < t.length;

				k++)
					t[k].onmousewheel = function() {

						return false

					}

			}

		};

		this.$ajax = function(a, c, d) {

			var f = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], g;

			try {

				g = new XMLHttpRequest()

			} catch (e) {

				for (var i = 0;

				i < f.length;

				i++)
					try {

						g = new ActiveXObject(f[i]);

						break

					} catch (e) {

					}

			}
			if (!g)
				return;

			g.open(c ? "POST" : "GET", a || h.location.href, !!d);

			g.setRequestHeader("Content-Type",
					"application\/x-www-form-urlencoded");

			g.setRequestHeader("If-Modified-Since", new Date(0));

			if (d)
				g.onreadystatechange = function() {

					if (g.readyState == 4)
						if (d(g.status == 200 ? g.responseText : null) === true) {

							setTimeout(function() {

										h.$ajax(a, c, d)

									}, 1000)

						}

				};

			g.send(c || '');

			return d ? g : (g.status == 200 ? g.responseText : null)

		};

		function u() {

			var a = $topWin.frames["Ctrip_debug"];

			if (a)
				return a;

			with (a = $topWin.$c("iframe")) {

				frameBorder = 0;

				id = name = "Ctrip_debug";

				style.border = "1px solid red";

				style.width = "400px";

				style.height = "300px";

				style.position = $$$.browser.IE6 ? "absolute" : "fixed";

				style.bottom = style.right = "10px"

			}
			$topWin.$$$.status.container.appendChild(a);

			if ($$$.browser.IE6)
				$topWin.$r1("scroll", function() {

							with ($$$$("Ctrip_debug").style) {

								zoom = 1;

								zoom = 0

							}

						});

			with ((a = u()).document) {

				open();

				write("<style>body{margin:0;padding:0;font-family:fixedsys;font-size:12px;overflow:hidden}<\/style><body><\/body>");

				close()

			}
			return a

		}
		this.$t = function(a, c) {

			if (!$topWin.$$$.status.debug)
				return;

			if (h != $topWin)
				return $topWin.$t(a, c);

			var d = u(), f = a;

			with (d.document.body) {

				f = new Date().getTime() % (1E7) + ":" + f;

				if (c)
					f = "<font color=\"" + c + "\">" + f + "<\/font>";

				innerHTML = f + "<br \/>" + innerHTML

			}
			return a

		};

		this.$alert = function(a, c, d, f, g) {

			var i = $$$$("alertInfo"), j = $$$$("alertTable"), l = 1;

			if (typeof(a) == "string")
				a = $$$$(a);

			else
				Ctrip.Object.apply(a);

			i.innerHTML = c;

			$$$.status.alertDiv.style.display = "";

			$$$.status.alertDiv.$setPos(a, f || "tl", g || "tr");

			$$$.status.alertDiv.$setIframe();

			a.className += " pubGlobal_checkinfo_input01";

			if (d !== false)
				a.$setDisplay();

			function m() {

				a.className = a.className.replace(
						"pubGlobal_checkinfo_input01", "");

				$$$.status.alertDiv.style.display = "none";

				$$$.status.alertDiv.$clearIframe();

				a.$ur("onblur", m);

				h.__.body.$ur("onmousedown", m);

				a.clearAlert = null;

				h.$alert.element = null

			}
			if (a.disabled)
				l = 0;

			else
				setTimeout(function() {

							try {

								a.focus()

							} catch (e) {

								l = 0

							}

						}, 0);

			if (l)
				a.$r1("onblur", m);

			else
				h.__.body.$r1("onmousedown", m);

			h.$alert.element = a;

			a.clearAlert = m

		};

		this.checkinfo = this.$alert;

		this.$fix_height = function() {

		};

		this.c_linklist = {

		};

		this.c_allyes_text = {

		};

		this.c_allyes_delay = 1000

	};

	this.Object = function() {

		if (!this || this.nodeType == 3 || this.$$$$)
			return this;

		if (this.__)
			this.$$$$ = function(objId, flag) {

				var r;

				if (flag) {

					var p = h.___.innerHTML.match(
							new RegExp("\\sid=([\\\'\\\"]?)([\\w$]+?[_$]"
									+ objId.toReString() + ")\\1"), "g");

					if (p) {

						for (var s = 0;

						s < p.length;

						s++) {

							r = h.$$$$(p[s]);

							if (r)
								return r

						}

					}
					return h.$$$$(objId)

				} else
					r = h.__.getElementById(objId);

				Ctrip.Object.apply(r);

				return r

			};

		else
			this.$$$$ = function(f) {

				var g = this.getElementsByTagName(f);

				g.$each = function(a) {

					var c;

					if (g.length !== undefined)
						for (var d = 0;

						d < g.length && (c = a.call(this, g[d], d)) !== false;

						d++);

					else
						a.call(this, g, 0);

					return c === false ? 0 : 1

				};

				for (var i = 0;

				i < g.length;

				i++)
					Ctrip.Object.apply(g[i]);

				return g

			};

		this.module = {

		};

		if (!this.hasAttribute)
			this.hasAttribute = function(str) {

				return typeof this.attributes[str] != "undefined"

			};

		this.$parentNode = function(a) {

			var c = Ctrip.Object.apply(this.parentNode);

			if (a && c && c.tagName
					&& c.tagName.toLowerCase() != a.toLowerCase())
				c = c.$parentNode(a);

			return c && c.tagName ? c : null

		};

		this.$firstChild = function() {

			return Ctrip.Object.apply(this.firstChild)

		};

		this.$lastChild = function() {

			return Ctrip.Object.apply(this.lastChild)

		};

		this.$childNodes = function() {

			var a = this.childNodes;

			for (var c = 0;

			c < a.length;

			c++)
				Ctrip.Object.apply(a[c]);

			return a

		};

		this.$nSib = this.$nextSibling = function() {

			return Ctrip.Object.apply(this.nextSibling)

		};

		this.$pSib = this.$previousSibling = function() {

			return Ctrip.Object.apply(this.previousSibling)

		};

		this.$click = function() {

			if (this.click)
				this.click();

			else {

				var a = __.createEvent("MouseEvents");

				a.initMouseEvent("click", true, true, h, 0, 0, 0, 0, 0, false,
						false, false, false, 0, null);

				this.dispatchEvent(a)

			}

		};

		this.$getStyle = function(a) {

			var c = this.currentStyle || h.getComputedStyle(this, null);

			return a ? c[a] : c

		};

		this.$getPara = function() {

			var a, c = (a = this.getAttribute(arguments[0]) || "").split(a
					.indexOf(" ") > -1 ? " " : "|");

			for (var d = 0;

			d < Math.max(arguments.length - 1, c.length);

			d++)
				c[d] = c[d] || arguments[d + 1] || "";

			return c

		};

		this.$r1 = this.$regEvent = function(d, f, g) {

			var i = this;

			if (d.constructor != Array)
				d = [d];

			if (f.constructor != Array)
				f = [f];

			d.each(function(c) {

						f.each(function(a) {

									if (i.__ && c.match(/^(on)?domready$/i)) {

										if ($$$.status.domReady)
											a();

										else
											$$$.status.domReadyFunc.push(a);

										return

									}
									if (i.attachEvent)
										i.attachEvent(c
														.replace(/^(on)?/i,
																"on"), a);

									else
										i.addEventListener(c.replace(/^(on)?/i,
														""), a, false);

									if ($$$.browser.IE6)
										$$$.status.regEvent.push([i, c, a]);

									if (g) {

										if (!$$$.status.regEventHash[g])
											$$$.status.regEventHash[g] = [];

										$$$.status.regEventHash[g]
												.push([i, c, a])

									}

								})

					})

		};

		this.$ur = this.$unregEvent = function(d, f) {

			var g = this;

			if (d.constructor != Array)
				d = [d];

			if (f.constructor != Array)
				f = [f];

			d.each(function(c) {

						f.each(function(a) {

									if (g.detachEvent)
										g.detachEvent(c
														.replace(/^(on)?/i,
																"on"), a);

									else
										g.removeEventListener(c.replace(
														/^(on)?/i, ""), a,
												false)

								})

					})

		};

		this.$urh = this.$unregEventHash = function(a) {

			var c = $$$.status.regEventHash[a];

			if (!c)
				return;

			for (var d = c.length - 1;

			d >= 0;

			d--) {

				if (this.__ || this == c[d][0]) {

					c[d][0].$ur(c[d][1], c[d][2]);

					c.splice(d, 1)

				}

			}
			$$$.status.regEventHash[a] = c.length ? c : null

		};

		this.$getWin = function() {

			var a = this.ownerDocument;

			return a.parentWindow || a.defaultView

		};

		this.$g = this.$selNode = function(y) {

			function z(l, m) {

				var n = [], k = l.match(/^([\.\#]*)([a-zA-Z0-9\-_*]+)(.*)$/i);

				if (!k)
					return [];

				if (k[1] == "#") {

					var o = $$$$(k[2]);

					if (o)
						n.push(o)

				} else if (k[1] == ".")
					m.each(function(r) {

								$each(r.$$$$("*"), function(a) {

											if (a.className
													.match(new RegExp("\\b"
															+ k[2] + "\\b")))
												n.push(Ctrip.Object.apply(a))

										})

							});

				else
					for (var t = 0;

					t < m.length;

					t++) {

						var o = m[t].$$$$(k[2]);

						if (o)
							for (var u = 0;

							u < o.length;

							u++)
								n.push(o[u])

					}
				k[3].replace(/\[([^!=]+)(=|!=)([^\]]*)\]/gi, function(d, f, g,
								i) {

							var j = n.slice(0);

							n = [];

							j.each(function(a) {

										f = {

											_3 : "className",
											_0 : "htmlFor"

										}["_" + f] || f;

										var c = a[f] || a.getAttribute(f);

										if (g != "=" ^ c == i)
											n.push(Ctrip.Object.apply(a))

									})

						});

				return n

			}
			var v = [this == h ? h.__.body : this];

			y.replace(/(#|\*)/gi, " $1").replace(/([^\^ ])\.(\w+)/gi,
					"$1[className=$2]").trim().split(/\s+/g).each(function(a) {

						v = z(a, v)

					});

			return v.length == 0 ? null : v

		};

		this.$getPos = function() {

			var a = this, c, d = [0, 0], f, g, i = {

				"thin" : 2,
				"medium" : 4,
				"thick" : 6

			}, j;

			function l() {

				j = [
						a.$getStyle("borderLeftStyle").match(/none|hidden/)
								? 0
								: a.$getStyle("borderLeftWidth"),
						a.$getStyle("borderTopStyle").match(/none|hidden/)
								? 0
								: a.$getStyle("borderTopWidth")];

				d[0] += i[j[0]] || parseInt(j[0]) || 0;

				d[1] += i[j[1]] || parseInt(j[1]) || 0

			}
			do {

				c = Ctrip.Object.apply(a).$getWin();

				if (a.tagName.match(/^(iframe|frameset)$/i))
					l();

				g = -1;

				do {

					d[0] += a.offsetLeft - a.scrollLeft;

					d[1] += a.offsetTop
							- ($$$.browser.Safari && a == c.document.body
									? 0
									: a.scrollTop);

					switch (a.$getStyle("position")) {

						case "absolute" :
							l();

							break;

						case "fixed" :
							g = 1;

							break

					}

				} while (a.offsetParent && a != a.offsetParent
						&& (a = Ctrip.Object.apply(a.offsetParent))
						&& a != h.___);

				if ($$$.browser.Safari) {

					d[0] += c.__.body.leftMargin || 0;

					d[1] += c.__.body.topMargin || 0

				}
				if (g == 1 || c != $topWin) {

					d[0] += c.___.scrollLeft * g;

					d[1] += c.___.scrollTop * g

				}

			} while (a = c.frameElement);

			return d

		};

		this.$setPos = function(l, m, n) {

			function k(g, i) {

				function j(a, c, d, f) {

					return d + {

						"l" : 0,
						"c" : c.offsetWidth / 2,
						"r" : c.offsetWidth,
						"t" : 0,
						"m" : c.offsetHeight / 2,
						"b" : c.offsetHeight

					}[a || "l"] * f

				}
				return j(m.match(g), this, j(n.match(g), l, o[i], 1), -1)
						+ "px"

			}
			var o = l.$getPos();

			m = m || "lt";

			n = n || "lb";

			this.style.left = k.call(this, /[lcr]/i, 0);

			this.style.top = k.call(this, /[tmb]/i, 1)

		};

		this.$setIframe = function(c) {

			if (c !== true && !$$$.browser.IE6)
				return;

			if (this.module.iframe)
				f = this.module.iframe;

			else {

				function d() {

					for (var a = 0;

					a < $topWin.$$$.module.iframe.length;

					a++) {

						if ($topWin.$$$.module.iframe[a].$getStyle("display") == "none")
							return $topWin.$$$.module.iframe[a]

					}

				}
				var f = d();

				if (!f) {

					f = $topWin.$c("iframe");

					with (f.style) {

						width = height = "0px";

						background = "#FFF";

						position = "absolute";

						display = "none";

						zIndex = 100

					}
					f.frameBorder = 0;

					f.id = f.name = $getUid();

					$topWin.$$$.status.container.appendChild(f);

					$topWin.$$$.module.iframe.push(f);

					with ($topWin.frames[f.id].document) {

						open();

						write('<style>html,body{overflow:hidden}</style>');

						close()

					}

				}
				this.module.iframe = f

			}
			f.$setPos(this, "tl", "tl");

			with (f.style) {

				width = this.offsetWidth + "px";

				height = this.offsetHeight + "px";

				display = ""

			}
			return f

		};

		this.$clearIframe = function() {

			var a = this.module.iframe;

			if (a) {

				a.style.display = "none";

				this.module.iframe = null

			}
			return a

		};

		function q(a, c, d) {

			if (!a)
				return null;

			c = c || "n";

			var f = new RegExp(({

						1 : "n",
						3 : "t",
						8 : "c"

					}[a.nodeType]) || "o", "i");

			return c.match(f) ? a : d.call(a, c)

		}
		this.$nAbs = function(a) {

			var c = this, d = c.firstChild || c.nextSibling;

			if (!d)
				do {

					c = c.parentNode;

					if (c == h.__.body)
						return null;

					d = c.nextSibling

				} while (!d);

			return Ctrip.Object.apply(q(d, a, arguments.callee))

		};

		this.$pAbs = function(a) {

			if (this == h.__.body)
				return null;

			var c = this.previousSibling;

			if (c) {

				while (c.lastChild)
					c = c.lastChild

			} else
				c = this.parentNode;

			return Ctrip.Object.apply(q(c, a, arguments.callee))

		};

		this.$focusNext = function() {

			if (!this.form)
				return;

			try {

				this.blur()

			} catch (e) {

			};

			var a = this.form.elements, c;

			for (var d = 0;

			d < a.length;

			d++) {

				if (c) {

					Ctrip.Object.apply(a[d]);

					if (!a[d].disabled && a[d].$isDisplay())
						try {

							a[d].focus();

							return

						} catch (e) {

						}

				}
				if (a[d] == this)
					c = true

			}

		};

		this.$setDisplay = function() {

			var a = this.$getPos();

			with ($topWin.___) {

				scrollLeft = a[0] - 80;

				scrollTop = a[1] - 80

			}

		};

		this.$isDisplay = function() {

			var a = this;

			do {

				if (a.tagName == "INPUT" && a.type == "hidden"
						|| a.$getStyle("display") == "none"
						|| a.$getStyle("visibility") == "hidden")
					return false

			} while ((a = a.$parentNode()) && a.nodeType == 1);

			return true

		};

		return this

	};

	this.Array = function() {

		this.each = function(a) {

			for (var c = 0;

			c < this.length;

			c++)
				if ((a ? a(this[c], c) : this[c]()) === false)
					return false;

			return true

		};

		if ($$$.browser.IE)
			this.map = function(func) {

				var d = [];

				for (var f = 0;

				f < this.length;

				f++)
					d.push(func(this[f]));

				return d

			}

	};

	this.Number = function() {

		this.parseCur = function(a) {

			var c = this.toFixed(a || 2), d = /(\d)(\d{3}[,\.])/;

			while (d.test(c))
				c = c.replace(d, "$1,$2");

			c = c.replace(/^(-?)\./, "$10.");

			return a === 0 ? c.replace(/\..*$/, "") : c

		}

	};

	this.String = function() {

		this.replaceWith = function(d) {

			return this.replace(/\{\$(\w+)\}/g, function(a, c) {

						if (c in d)
							return d[c];

						else
							return a

					})

		};

		this.trim = function() {

			return this.replace(/^\s+|\s+$/g, '')

		};

		this.isEmail = function() {

			var a = /^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/;

			return a.test(this)

		};

		this.isDateTime = function() {

			var a = $$$.status.version.match(/^zh-/) ? this : this.replace(
					/^(\d{1,2})-(\d{1,2})-(\d{4})$/, "$3-$1-$2");

			var c = a.match(/^((19|20)\d{2})-(\d{1,2})-(\d{1,2})$/);

			if (!c)
				return false;

			for (var d = 1;

			d < 5;

			d++)
				c[d] = parseInt(c[d], 10);

			if (c[3] < 1 || c[3] > 12 || c[4] < 1 || c[4] > 31)
				return false;

			var f = new Date(c[1], c[3] - 1, c[4]);

			return f.getDate() == c[4] ? f : null

		};

		this.toReString = function() {

			return this.replace(/\.\\\/\+\*\?\[\]\{\}\(\)\^\$\|/)

		};

		this.isChinaIDCard = function() {

			var a = this.toLowerCase().match(/./g);

			if (this.match(/^\d{17}[\dx]$/i)) {

				var c = 0, d = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8,
						4, 2];

				for (var f = 0;

				f < 17;

				f++)
					c += parseInt(a[f], 10) * d[f];

				if ("10x98765432".charAt(c % 11) != a[17])
					return false;

				return !!this.replace(/^\d{6}(\d{4})(\d{2})(\d{2}).+$/,
						"$1-$2-$3").isDateTime()

			}
			if (this.match(/^\d{15}$/))
				return !!this.replace(/^\d{6}(\d{2})(\d{2})(\d{2}).+$/,
						"19$1-$2-$3").isDateTime();

			return false

		};

		this.parseStdDate = function() {

			var c = "January|1@February|2@March|3@April|4@May|5@June|6@July|7@August|8@September|9@October|10@November|11@December|12", d = this
					.replace(/[ \-,\.\/]+/g, "-").replace(/(^|-)0+(?=\d+)/g,
							"$1").replace(/[a-z]{3,}/i, function(a) {

						return (_1 = c.match(new RegExp("(^|@)" + a
										+ "[^\\|]*\\|(\\d+)", "i")))
								? _1[2]
								: a

					}).replace(/^([^-]{1,2}-[^-]{1,2})-([^-]{4})$/, "$2-$1");

			return d.isDateTime() ? d : null

		};

		this.parseEngDate = function() {

			var a = this.parseStdDate();

			if (!a)
				return null;

			var c = a.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);

			return "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec".split("|")[parseInt(c[2])
					- 1]
					+ "-" + c[3] + "-" + c[1]

		}

	};

	this.Date = function() {

		this.dateValue = function() {

			return new Date(this.getFullYear(), this.getMonth(), this.getDate())

		};

		this.addDate = function(a) {

			return new Date(this.getFullYear(), this.getMonth(), this.getDate()
							+ a)

		};

		this.toStdString = function() {

			return this.getFullYear() + "-" + (this.getMonth() + 1) + "-"
					+ this.getDate()

		};

		this.toEngString = function() {

			return "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec".split("|")[this
					.getMonth()]
					+ "-" + this.getDate() + "-" + this.getFullYear()

		}

	};

	this.module = new function() {

		this.linklist = function(a) {

			var c = a.getAttribute('mod_linklist_class');

			if (c === null)
				c = 'pubSidebar_linkmargin01';

			var d = '<a class="'
					+ c
					+ '" href="{$link}" title="{$text}" target="{$target}">{$text}</a>';

			var f = a.getAttribute('mod_linklist_id');

			if (!f || !(f = window.c_linklist[f]) || f.constructor !== Array)
				return;

			for (var g = 0;

			g < f.length;

			g++) {

				var i = f[g].split('|', 2);

				f[g] = d.replaceWith({

							text : $s2t(i[0]),
							link : i[1],
							target : f[g].target || '_2'

						})

			}
			a.innerHTML = f.join('')

		};

		this.allyes = function(f) {

			var g = k("user") || k("mod_allyes_user");

			if (!g) {

				var i = k('mod_allyes_buttons', window);

				var j = k('mod_allyes_text', window.c_allyes_text);

				if (!i && !j)
					return

			}
			var l = '<div class="pubGlobal_ad140x60" style="height:{$height}px">{$iframe}<\/div>';

			var m = '<div class="pubGlobal_adtxt140">{$text}<\/div>';

			var n = '<iframe marginheight="0" width="100%" height="100%" marginwidth="0" frameborder="0" scrolling="no" src="http://allyes.ctrip.com/main/adfshow?user={$user}&db=ctrip&border=0&local=yes"><\/iframe>';

			setTimeout(function() {

						if (g) {

							if (g.indexOf('@') > -1)
								g = o(g.split('@'));

							f.innerHTML = n.replace('{$user}', g)

						} else {

							var a = [];

							if (i)
								a = i.map(function(b) {

											b.button = b.button || ';';

											return l.replace('{$height}',
													b.height).replace(
													'{$iframe}',
													n
															.replace('{$user}',
																	b.user))

										});

							if (j)
								a.push(m.replace('{$text}', $s2t(j)));

							f.innerHTML = a.join('')

						}

					}, window.c_allyes_delay);

			function k(a, c) {

				var d = f.getAttribute(a);

				if (!d)
					return null;

				if (c)
					return c[d] || null;

				else
					return d

			}
			function o(a) {

				var c = /^(SearchFlights\.aspx|SearchHotels\.aspx|query\.asp)$/i;

				var d = location.pathname;

				d = d.slice(d.lastIndexOf('/') + 1);

				return c.test(d) ? a[0] : a[1]

			}

		};

		this.notice = function(a) {

			a.module.notice = new function() {

				this.enabled = true;

				this.tip = a.getAttribute("mod_notice_tip") || "";

				this.check = function() {

					if (a.module.notice.enabled) {

						with (a) {

							if (isNull()) {

								style.color = "gray";

								value = module.notice.tip

							} else
								style.color = ""

						}

					}

				};

				this.isNull = a.isNull = function() {

					return a.value.trim() == ""
							|| a.value == a.module.notice.tip

				}

			};

			a.$r1("focus", function() {

						if (a.module.notice.enabled) {

							a.style.color = "";

							if (a.value == a.module.notice.tip)
								a.value = ""

						}

					});

			a.$r1("blur", function() {

						setTimeout(a.module.notice.check, 1)

					});

			a.module.notice.check()

		};

		this.tab = function(g) {

			var i = h.$g(g.getAttribute("mod_tab_button") || "");

			var j = h.$g(g.getAttribute("mod_tab_panel") || "");

			var l = parseInt(g.getAttribute("mod_tab_select") || 1, 10);

			var m = ((g.getAttribute("mod_tab_event") || "")
					.match(/^mouseover$/i) || "click").toString();

			var n = {

				"true" : "_" + "current",
				"false" : "_" + "nocurrent"

			};

			if (!i || !j)
				return;

			g.module.tab = new function() {

				this.funcListHash = {

				};

				this.select = function(a) {

					if (this.funcListHash[a - 1])
						this.funcListHash[a - 1]()

				}

			};

			i.each(function(d, f) {

				g.module.tab.funcListHash[f] = function() {

					i.each(function(a, c) {

						a.className = a.className.replace(n[f != c], n[f == c]);

						if (j[c])
							j[c].style.display = (f == c) ? "" : "none"

					})

				};

				d.$r1(m, g.module.tab.funcListHash[f])

			});

			g.module.tab.select(l)

		};

		this.display = function(j) {

			var l = j.$getPara("mod_display_panel"), m = [];

			l.each(function(a) {

						a = h.$$$$(a) || h.$selNode(a);

						if (a) {

							if (a.length)
								a.each(function(a) {

											m.push(a)

										});

							else
								m.push(a)

						}

					});

			j.$r1("click", function() {

			(function(f) {

					for (var g = 0;

					g < f.childNodes.length;

					g++) {

						with (f.childNodes[g]) {

							if (nodeType == 3) {

								var i = new RegExp($$$.string.display
												.match(/[^@]+/g).join("|"),
										"gi");

								nodeValue = nodeValue.replace(i, function(a) {

											var c = new RegExp(
													"@"
															+ a
															+ "\\|([^@]+)|([^@]+)\\|"
															+ a + "@", "i");

											var d = $$$.string.display.match(c);

											return d[1] || d[2]

										})

							} else
								arguments.callee(f.childNodes[g])

						}

					}

				})(j);

				m.each(function(a) {

							a.style.display = a.$getStyle("display") == "none"
									? ""
									: "none"

						})

			})

		};

		this.selectAll = function(d) {

			var f = $selNode(d.getAttribute("mod_selectAll_input") || "");

			if (!f)
				return;

			f.each(function(c) {

						if (c != d)
							c.$r1("onclick", function() {

										d.checked = f.each(function(a) {

													if (a != d && !a.checked)
														return false

												})

									})

					});

			d.$r1("click", function() {

						f.each(function(a) {

									a.checked = d.checked

								})

					})

		};

		this.validate = function(a) {

			var c = h.$$$$(a.getAttribute("mod_validate_true") || "");

			var d = h.$$$$(a.getAttribute("mod_validate_false") || "");

			var f = a.getAttribute("mod_validate_function") || "";

			if (!f)
				return;

			var g = f.match(/^\/(.*?[^\\])\/([gmi]*?)$/);

			var i, j, l;

			f = h[f];

			if (g || f) {

				a.module.validate = new function() {

					this.check = function() {

						if (a.value || !c && !d)
							l = !(j = f ? f(a.value, a) : a.value
									.match(new RegExp(g[1], g[2])));

						else
							j = l = false;

						if (c)
							c.style.display = j ? "" : "none";

						if (d)
							d.style.display = l ? "" : "none"

					}

				};

				a.$r1("focus", function() {

							i = setInterval(a.module.validate.check, 200)

						});

				a.$r1("blur", function() {

							a.module.validate.check();

							clearInterval(i)

						})

			}

		}

	};

	this.debug = new function() {

	};

	this.Date.apply(h.Date.prototype);

	this.Variable.apply(h);

	this.Number.apply(h.Number.prototype);

	this.String.apply(h.String.prototype);

	this.Array.apply(h.Array.prototype);

	this.window.apply(h);

	this.Object.apply(h);

	this.Object.apply(h.__);

	this.Object.apply(h.___);

	this.Object.apply($$$.status.alertDiv);

	this.init = new function() {

		var dm = __.domain;

		if (/\.ctrip(travel)?\.com$/i.test(dm)) {

			dm = /travel\.com$/i.test(dm)
					? dm.split('.').slice(1).join('.')
					: 'ctrip.com';

			_.$loadJs('http://www.' + dm + '/rp/uiScript.asp', 'gbk')

		};

		if ($$$.status.charset == 'big5')
			__
					.write('<script src="http://webresource.ctrip.com/code/js/public/public_s2t.js" charset="utf-8"></script>');

		else
			h.$s2t = function(a) {

				return a

			};

		if ($$$.browser.IE6)
			try {

				__.execCommand("BackgroundImageCache", false, true)

			} catch (e) {

			};

		$$$.status.debug = /^(true|1)$/.test($getQuery("debug"));

		$$$.status.alertDiv.innerHTML = $$$.status.version.match(/^zh-/)
				? "<table id=\"alertTable \" cellpadding=\"0\" cellspacing=\"0\" style=\"text- align:center;\"><tr><td style=\"width:10px;height:10px; background:url(http:\/\/pic.ctrip.com\/common \/blk_jmpInfo02_tl.gif) left top no-repeat;\">< \/td><td style=\"height:10px;background:url(http: \/\/pic.ctrip.com\/common \/blk_jmpInfo02_tm.gif) left top repeat-x;\">< \/td><td style=\"width:10px;height:10px;background:url(http: \/\/pic.ctrip.com\/common \/blk_jmpInfo02_tr.gif) left top no-repeat;\">< \/td><\/tr><tr><td style=\"width:10px; height:10px;background:url(http:\/\/pic.ctrip.com\/common \/blk_jmpInfo02_ml.gif) left top repeat-y;\">< \/td><td id=\"alertInfo\" style=\"margin:0;padding:5px& nbsp;10px 10px 5px;background:#FFFFE8;\">内容< \/td><td style=\"width:10px;height:10px;background:url(http:\/\/pic.ctrip.com\/common\/blk_jmpInfo02_mr.gif) left top repeat-y;\"><\/td><\/tr><tr><td style=\"width:10px;height:10px;background:url(http:\/\/pic.ctrip.com\/common\/blk_jmpInfo02_bl.gif) left top no-repeat;\"><\/td><td style=\"height:10px;background:url(http:\/\/pic.ctrip.com\/common\/blk_jmpInfo02_bm.gif) left top repeat-x;\"><\/td><td style=\"width:10px;height:10px;background:url(http:\/\/pic.ctrip.com\/common\/blk_jmpInfo02_br.gif) left top no-repeat;\"><\/td><\/tr><\/table>"
				: "<table id=\"alertTable \" style=\"font-family:Arial;margin:0;\" cellpadding=\"0\"& nbsp;cellspacing=\"0\"><tr><td style=\"margin:0; padding:0px 2px 2px 0px;background:#E7E7E7;\"><div id= \"alertInfo\" style=\"margin:0px;padding:10px;font-size:12px;text- align:left;background:#FFFFE8;border:1px solid #FFDF47;color:#000;white- space:nowrap;\">内容<\/div><\/td><\/tr>< \/table>";

		function d(a) {

			var c;

			$$$.status.domReady = true;

			while (c = $$$.status.domReadyFunc.shift())
				try {

					c(a)

				} catch (a) {

					$t("domReady函数错误:" + c.toString().slice(0, 50) + "...",
							"red")

				}

		}
		if ($$$.browser.Moz || $$$.browser.Opera)
			h.$r1("DOMContentLoaded", d);

		else if ($$$.browser.IE) {

			h.__
					.write("<script id=\"ieDomReady\" src=\":\/\/\" defer=\"true\"><\/script>");

			h.__.getElementById("ieDomReady").onreadystatechange = function() {

				if (this.readyState == "complete")
					d()

			}

		} else if ($$$.browser.Safari) {

			var f = setInterval(function() {

						if (h.__.readyState == "loaded"
								|| h.__.readyState == "complete") {

							clearInterval(f);

							d()

						}

					}, 10)

		}
		if ($$$.browser.IE6)
			h.$r1("unload", function() {

						var g;

						while (g = $$$.status.regEvent.shift()) {

							if (g[0])
								g[0].$ur(g[1], g[2])

						}

					});

		h.$r1("domready", [function() {

							Ctrip.Object.apply(h.__.body)

						}, h.$parserRe, h.$fixElement])

	}

};

var Ctrip = new $Ctrip(window);

Ctrip.module.jmpInfo = (function() {

	var o = '\/webresource\/ui\/jmpinfo_tuna\/';

	var t = '\/css\/popup.css';

	var u = {

		CraftType : 'http:\/\/webresource.ctrip.com\/code\/js\/resource\/jmpinfo_tuna/CraftType_{$charset}.js'

	};

	var y = {

		"align-center" : "cbct",
		"align-left" : "lblt",
		"corner-left" : "rblt",
		"align-right" : "rbrt",
		"corner-right" : "lbrt",
		"above-align-left" : "ltlb",
		"above-align-right" : "rtrb"

	};

	var z = '__jpi_';

	var v = 200;

	var r = 400;

	var p = null, s = null, q = null, h = 0, D = null, w = null, A = {

	}, x = {

	}, B = {

	}, E = false;

	window.$r1('domReady', F);

	return function(a) {

		F();

		if (a.nodeType == 1) {

			if (!a.id)
				a.id = z + h++;

			L(a)

		} else {

			M(a)

		}

	};

	function F() {

		if (E)
			return;

		E = true;

		$loadCss(t);

		p = document.createElement("div");

		p.id = 'tuna_jmpinfo';

		p.style.cssText = 'visibility:hidden;position:absolute;z-index:120;overflow:hidden';

		$$$.status.container.appendChild(p);

		p = $$$$(p.id);

		var a = document.documentElement;

		if (a.attachEvent)
			a.attachEvent('onmouseover', G);

		else
			a.addEventListener('mouseover', G, false)

	}
	function G(a) {

		var c = O(a), d = null;

		if (!c)
			return;

		if (c.id && (c.id in A)) {

			if (c != s && c != q) {

				q = c;

				clearTimeout(w);

				w = setTimeout(J, r)

			}

		} else if ((d = c.getAttribute('mod')) == 'jmpInfo') {

			L(c);

			if (c != s && c != q) {

				q = c;

				clearTimeout(w);

				w = setTimeout(J, r)

			}

		} else if (s) {

			if (K(c, s, p))
				clearTimeout(D);

			else
				D = setTimeout(N, v)

		} else if (q) {

			if (!K(c, q)) {

				clearTimeout(w);

				q = null

			}

		}

	}
	function H(a) {

		if (!a.$getPos)
			Ctrip.Object.apply(a);

		var c = a.$getPos();

		return {

			left : c[0],
			top : c[1]

		}

	}
	function I(a, c) {

		var d = a.style;

		if (!c) {

			d.visibility = 'hidden';

			d.left = d.top = '-500px';

			a.$clearIframe()

		} else {

			var d = a.style;

			d.left = c.left + 'px';

			d.top = c.top + 'px';

			d.visibility = 'visible';

			a.$setIframe()

		}

	}
	function J() {

		if (!q)
			return;

		var a = Q(q);

		if (!a)
			return;

		s = q;

		q = null;

		p.innerHTML = x[a.page];

		for (var c = 1;

		el = document.getElementById('para' + c);

		c++)
			el.innerHTML = a.content[c - 1] || '';

		for (var c = 1;

		el = document.getElementById('array' + c);

		c++)
			el.innerHTML = a.para[c - 1] || '';

		I(p, P(s, a.position))

	}
	function N() {

		s = null;

		I(p, null)

	}
	function K(a, c, d) {

		while (a && a != c && a != d)
			a = a.parentNode;

		return !!a

	}
	function O(a) {

		a = a || window.event;

		return a.srcElement || a.target

	}
	function P(a, c) {

		var d = H(a);

		var f = a.offsetWidth, g = a.offsetHeight;

		var i = p.offsetWidth, j = p.offsetHeight;

		var l = {

			l : 0,
			c : f >> 1,
			r : f

		};

		var m = {

			t : 0,
			c : g >> 1,
			b : g

		};

		var n = {

			l : 0,
			c : i >> 1,
			r : i

		};

		var k = {

			t : 0,
			c : j >> 1,
			b : j

		};

		d.left += l[c[0]] - n[c[2]];

		d.top += m[c[1]] - k[c[3]];

		return d

	}
	function L(a) {

		var c = C(a, 'mod_jmpInfo_page', 'default_normal.asp');

		var d = M(c);

		var f = C(a, 'mod_jmpInfo_position', '');

		if (!f || !(f in y)) {

			f = 'lblt'.split('');

			var g = H(a);

			if (g.left > 500)
				f[0] = f[2] = 'r'

		} else {

			f = y[f].split('')

		}
		d.position = f;

		d.content = C(a, 'mod_jmpInfo_content', '').split('|');

		A[a.id] = d

	}
	function Q(a) {

		var c = A[a.id];

		if (!x[c.page])
			return null;

		if (c.search)
			c.para = c.search.hash[c.search.key] || [];

		return c

	}
	function C(a, c, d) {

		return a.getAttribute(c) || d || ''

	}
	function M(a) {

		var c = a, d = null;

		var f = a.indexOf('?');

		if (f >= 0) {

			c = a.slice(0, f).trim();

			d = S(a.slice(f + 1))

		}
		if (!(c in x))
			R(c);

		return {

			page : c,
			search : d

		}

	}
	function R(c) {

		x[c] = false;

		$ajax(o + c, null, function(a) {

					if (a)
						x[c] = a.replace(/\n/g, '').replace(
								/^[\s\S]*<body.*?>|<\/body>[\s\S]*$/gi, '')

				})

	}
	function S(a) {

		var c = a.indexOf('=');

		if (c == -1)
			return null;

		var d = a.slice(0, c);

		var f = a.slice(c + 1);

		if (!(d in B))
			T(d);

		return {

			hash : B[d],
			key : f

		}

	}
	function T(f) {

		var g = B[f] = {

		};

		$loadJs(u[f], null, function() {

					var a = $$$.module.jmpInfo.array[f].slice(1, -1).split('@');

					for (var c = 0;

					c < a.length;

					c++) {

						var d = a[c].split('|');

						g[d[0]] = d

					}

				})

	}

})();
