/* * Copyright(C) Cits.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.$Cits) $topWin = a; else return } })(); window.$Cits = function(h) { this.Variable = function() { this._ = h; this.__ = h.document; this.___ = h.__.documentElement; h.__.write("
<\/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","utf-8":"zh-cn"}[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:"b2cCityList", 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]; Cits.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 Cits.Object.apply(h.__.createTextNode(a.join("\n"))); else return Cits.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)) Cits.module.jmpInfo(l[1]) } else if ((m = a.match(j)) && (n = $(m[1]))) { if (c in Cits.module) new Cits.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) { Cits.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 = []; /** 加载tuna_address_071206.js文件 **/ //$topWin.$loadJs("http://webresource.ctrip.com/code/js/" + top.$$.module.list[a] + ".js", "utf-8"); $topWin.$loadJs("/citsonlineWeb/airticketlocal/js/b2cCityList.js", "utf-8"); } $topWin.$$.module[a].list.push(c); $topWin.$init() } else if (Cits.module[a]) { if (a == 'jmpInfo') Cits.module[a](c); else new Cits.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["Cits_debug"]; if (a) return a; with (a = $topWin.$c("iframe")) { frameBorder = 0; id = name = "Cits_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.$r("scroll", function() { with ($("Cits_debug").style) { zoom = 1; zoom = 0 } }); with ((a = u()).document) { open(); write("'); 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 Cits.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 Cits.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) { Cits.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 = '{$text}'; 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 = '
{$iframe}<\/div>'; var m = '
{$text}<\/div>'; var n = '