var HotelLang = {
    hotCityConfig: {
        list: ["北京", "上海", "广州", "深圳", "青岛", "大连", "杭州", "南京", "成都", "武汉", "重庆", "三亚", "厦门", "西安", "香港", "澳门", "新加坡", "首尔", "曼谷", "悉尼"],
        number: 594
    },
    _CAPTIAL: "北京"
};
var _tabConfig = {
    "热门": {
        cityList: [{
            name: "北京",
            country: "中国"
        },
        {
            name: "上海",
            country: "中国"
        },
        {
            name: "广州",
            country: "中国"
        },
        {
            name: "深圳",
            country: "中国"
        },
        {
            name: "成都",
            country: "中国"
        },
        {
            name: "重庆",
            country: "中国"
        },
        {
            name: "厦门",
            country: "中国"
        },
        {
            name: "昆明",
            country: "中国"
        },
        {
            name: "杭州",
            country: "中国"
        },
        {
            name: "西安",
            country: "中国"
        },
        {
            name: "海口",
            country: "中国"
        },
        {
            name: "哈尔滨",
            country: "中国"
        },
        {
            name: "长沙",
            country: "中国"
        },
        {
            name: "武汉",
            country: "中国"
        },
        {
            name: "大连",
            country: "中国"
        },
        {
            name: "南京",
            country: "中国"
        },
        {
            name: "沈阳",
            country: "中国"
        },
        {
            name: "青岛",
            country: "中国"
        },
        {
            name: "三亚",
            country: "中国"
        },
        {
            name: "郑州",
            country: "中国"
        },
        {
            name: "天津",
            country: "中国"
        },
        {
            name: "长春",
            country: "中国"
        },
        {
            name: "南宁",
            country: "中国"
        },
        {
            name: "济南",
            country: "中国"
        },
        {
            name: "贵阳",
            country: "中国"
        },
        {
            name: "福州",
            country: "中国"
        },
        {
            name: "温州",
            country: "中国"
        },
        {
            name: "太原",
            country: "中国"
        },
        {
            name: "桂林",
            country: "中国"
        },
        {
            name: "宁波",
            country: "中国"
        }],
        title: "热门城市",
        desc: "可直接输入城市或城市拼音"
    },
    "A-G": {
        cityList: [{
            name: "安庆",
            country: "中国"
        },
        {
            name: "阿勒泰",
            country: "中国"
        },
        {
            name: "安康",
            country: "中国"
        },
        {
            name: "阿克苏",
            country: "中国"
        },
        {
            name: "白山",
            country: "中国"
        },
        {
            name: "包头",
            country: "中国"
        },
        {
            name: "北海",
            country: "中国"
        },
        {
            name: "北京",
            country: "中国"
        },
        {
            name: "百色",
            country: "中国"
        },
        {
            name: "保山",
            country: "中国"
        },
        {
            name: "长治",
            country: "中国"
        },
        {
            name: "长春",
            country: "中国"
        },
        {
            name: "常州",
            country: "中国"
        },
        {
            name: "昌都",
            country: "中国"
        },
        {
            name: "朝阳",
            country: "中国"
        },
        {
            name: "常德",
            country: "中国"
        },
        {
            name: "长白山",
            country: "中国"
        },
        {
            name: "成都",
            country: "中国"
        },
        {
            name: "重庆",
            country: "中国"
        },
        {
            name: "长沙",
            country: "中国"
        },
        {
            name: "赤峰",
            country: "中国"
        },
        {
            name: "大同",
            country: "中国"
        },
        {
            name: "大连",
            country: "中国"
        },
        {
            name: "达县",
            country: "中国"
        },
        {
            name: "东营",
            country: "中国"
        },
        {
            name: "大庆",
            country: "中国"
        },
        {
            name: "丹东",
            country: "中国"
        },
        {
            name: "大理",
            country: "中国"
        },
        {
            name: "敦煌",
            country: "中国"
        },
        {
            name: "鄂尔多斯",
            country: "中国"
        },
        {
            name: "恩施",
            country: "中国"
        },
        {
            name: "福州",
            country: "中国"
        },
        {
            name: "阜阳",
            country: "中国"
        },
        {
            name: "贵阳",
            country: "中国"
        },
        {
            name: "桂林",
            country: "中国"
        },
        {
            name: "广州",
            country: "中国"
        },
        {
            name: "广元",
            country: "中国"
        },
        {
            name: "赣州",
            country: "中国"
        },
        {
            name: "格尔木",
            country: "中国"
        }],
        title: "拼音A-G城市",
        desc: "可直接输入城市或城市拼音"
    },
    "H-L": {
        cityList: [{
            name: "呼和浩特",
            country: "中国"
        },
        {
            name: "哈密",
            country: "中国"
        },
        {
            name: "黑河",
            country: "中国"
        },
        {
            name: "海拉尔",
            country: "中国"
        },
        {
            name: "哈尔滨",
            country: "中国"
        },
        {
            name: "海口",
            country: "中国"
        },
        {
            name: "黄山",
            country: "中国"
        },
        {
            name: "杭州",
            country: "中国"
        },
        {
            name: "邯郸",
            country: "中国"
        },
        {
            name: "合肥",
            country: "中国"
        },
        {
            name: "黄龙",
            country: "中国"
        },
        {
            name: "汉中",
            country: "中国"
        },
        {
            name: "和田",
            country: "中国"
        },
        {
            name: "晋江",
            country: "中国"
        },
        {
            name: "锦州",
            country: "中国"
        },
        {
            name: "景德镇",
            country: "中国"
        },
        {
            name: "嘉峪关",
            country: "中国"
        },
        {
            name: "井冈山",
            country: "中国"
        },
        {
            name: "济宁",
            country: "中国"
        },
        {
            name: "九江",
            country: "中国"
        },
        {
            name: "佳木斯",
            country: "中国"
        },
        {
            name: "济南",
            country: "中国"
        },
        {
            name: "喀什",
            country: "中国"
        },
        {
            name: "昆明",
            country: "中国"
        },
        {
            name: "康定",
            country: "中国"
        },
        {
            name: "克拉玛依",
            country: "中国"
        },
        {
            name: "库尔勒",
            country: "中国"
        },
        {
            name: "喀纳斯",
            country: "中国"
        },
        {
            name: "库车",
            country: "中国"
        },
        {
            name: "兰州",
            country: "中国"
        },
        {
            name: "洛阳",
            country: "中国"
        },
        {
            name: "丽江",
            country: "中国"
        },
        {
            name: "林芝",
            country: "中国"
        },
        {
            name: "柳州",
            country: "中国"
        },
        {
            name: "泸州",
            country: "中国"
        },
        {
            name: "连云港",
            country: "中国"
        },
        {
            name: "黎平",
            country: "中国"
        },
        {
            name: "连城",
            country: "中国"
        },
        {
            name: "拉萨",
            country: "中国"
        },
        {
            name: "临沧",
            country: "中国"
        },
        {
            name: "临沂",
            country: "中国"
        }],
        title: "拼音H-L城市",
        desc: "可直接输入城市或城市拼音"
    },
    "M-T": {
        cityList: [{
            name: "牡丹江",
            country: "中国"
        },
        {
            name: "芒市",
            country: "中国"
        },
        {
            name: "满洲里",
            country: "中国"
        },
        {
            name: "绵阳",
            country: "中国"
        },
        {
            name: "梅县",
            country: "中国"
        },
        {
            name: "漠河",
            country: "中国"
        },
        {
            name: "南京",
            country: "中国"
        },
        {
            name: "南充",
            country: "中国"
        },
        {
            name: "南宁",
            country: "中国"
        },
        {
            name: "南阳",
            country: "中国"
        },
        {
            name: "南通",
            country: "中国"
        },
        {
            name: "那拉提",
            country: "中国"
        },
        {
            name: "南昌",
            country: "中国"
        },
        {
            name: "宁波",
            country: "中国"
        },
        {
            name: "攀枝花",
            country: "中国"
        },
        {
            name: "衢州",
            country: "中国"
        },
        {
            name: "秦皇岛",
            country: "中国"
        },
        {
            name: "庆阳",
            country: "中国"
        },
        {
            name: "黔南",
            country: "中国"
        },
        {
            name: "且末",
            country: "中国"
        },
        {
            name: "齐齐哈尔",
            country: "中国"
        },
        {
            name: "青岛",
            country: "中国"
        },
        {
            name: "汕头",
            country: "中国"
        },
        {
            name: "深圳",
            country: "中国"
        },
        {
            name: "石家庄",
            country: "中国"
        },
        {
            name: "三亚",
            country: "中国"
        },
        {
            name: "沈阳",
            country: "中国"
        },
        {
            name: "上海",
            country: "中国"
        },
        {
            name: "思茅",
            country: "中国"
        },
        {
            name: "铜仁",
            country: "中国"
        },
        {
            name: "塔城",
            country: "中国"
        },
        {
            name: "腾冲",
            country: "中国"
        },
        {
            name: "台州",
            country: "中国"
        },
        {
            name: "天水",
            country: "中国"
        },
        {
            name: "天津",
            country: "中国"
        },
        {
            name: "通辽",
            country: "中国"
        },
        {
            name: "太原",
            country: "中国"
        }],
        title: "拼音M-T城市",
        desc: "可直接输入城市或城市拼音"
    },
    "W-Z": {
        cityList: [{
            name: "威海",
            country: "中国"
        },
        {
            name: "武汉",
            country: "中国"
        },
        {
            name: "梧州",
            country: "中国"
        },
        {
            name: "文山",
            country: "中国"
        },
        {
            name: "无锡",
            country: "中国"
        },
        {
            name: "潍坊",
            country: "中国"
        },
        {
            name: "武夷山",
            country: "中国"
        },
        {
            name: "乌兰浩特",
            country: "中国"
        },
        {
            name: "温州",
            country: "中国"
        },
        {
            name: "乌鲁木齐",
            country: "中国"
        },
        {
            name: "万州",
            country: "中国"
        },
        {
            name: "乌海",
            country: "中国"
        },
        {
            name: "兴义",
            country: "中国"
        },
        {
            name: "西昌",
            country: "中国"
        },
        {
            name: "厦门",
            country: "中国"
        },
        {
            name: "香格里拉",
            country: "中国"
        },
        {
            name: "西安",
            country: "中国"
        },
        {
            name: "襄樊",
            country: "中国"
        },
        {
            name: "西宁",
            country: "中国"
        },
        {
            name: "锡林浩特",
            country: "中国"
        },
        {
            name: "西双版纳",
            country: "中国"
        },
        {
            name: "徐州",
            country: "中国"
        },
        {
            name: "义乌",
            country: "中国"
        },
        {
            name: "永州",
            country: "中国"
        },
        {
            name: "榆林",
            country: "中国"
        },
        {
            name: "延安",
            country: "中国"
        },
        {
            name: "运城",
            country: "中国"
        },
        {
            name: "烟台",
            country: "中国"
        },
        {
            name: "银川",
            country: "中国"
        },
        {
            name: "宜昌",
            country: "中国"
        },
        {
            name: "宜宾",
            country: "中国"
        },
        {
            name: "盐城",
            country: "中国"
        },
        {
            name: "延吉",
            country: "中国"
        },
        {
            name: "玉树",
            country: "中国"
        },
        {
            name: "伊宁",
            country: "中国"
        },
        {
            name: "珠海",
            country: "中国"
        },
        {
            name: "昭通",
            country: "中国"
        },
        {
            name: "张家界",
            country: "中国"
        },
        {
            name: "舟山",
            country: "中国"
        },
        {
            name: "郑州",
            country: "中国"
        },
        {
            name: "中卫",
            country: "中国"
        },
        {
            name: "芷江",
            country: "中国"
        },
        {
            name: "湛江",
            country: "中国"
        }],
        title: "拼音W-Z城市",
        desc: "可直接输入城市或城市拼音"
    },
    "国际": {
        cityList: [{
            name: "香港",
            country: "中国香港"
        },
        {
            name: "新加坡",
            country: "新加坡"
        },
        {
            name: "吉隆坡",
            country: "马来西亚"
        },
        {
            name: "首尔",
            country: "韩国"
        },
        {
            name: "澳门",
            country: "中国澳门"
        },
        {
            name: "曼谷",
            country: "泰国"
        },
        {
            name: "台北",
            country: "中国台湾"
        },
        {
            name: "东京",
            country: "日本"
        },
        {
            name: "悉尼",
            country: "澳大利亚"
        },
        {
            name: "巴黎",
            country: "法国"
        },
        {
            name: "伦敦",
            country: "英国"
        },
        {
            name: "纽约",
            country: "美国"
        },
        {
            name: "洛杉矶",
            country: "美国"
        },
        {
            name: "墨尔本",
            country: "澳大利亚"
        },
        {
            name: "胡志明市",
            country: "越南"
        },
        {
            name: "大阪",
            country: "日本"
        },
        {
            name: "温哥华",
            country: "加拿大"
        },
        {
            name: "法兰克福",
            country: "德国"
        },
        {
            name: "迪拜",
            country: "阿联酋"
        },
        {
            name: "多伦多",
            country: "加拿大"
        },
        {
            name: "马尼拉",
            country: "菲律宾"
        },
        {
            name: "河内",
            country: "越南"
        },
        {
            name: "旧金山",
            country: "美国"
        },
        {
            name: "加德满都",
            country: "印度"
        },
        {
            name: "金边",
            country: "柬埔寨"
        },
        {
            name: "釜山",
            country: "韩国"
        },
        {
            name: "莫斯科",
            country: "俄罗斯"
        },
        {
            name: "雅加达",
            country: "印度尼西亚"
        },
        {
            name: "马累",
            country: "马尔代夫"
        },
        {
            name: "名古屋",
            country: "日本"
        }],
        title: "热门国际城市",
        desc: "可直接输入城市或城市拼音",
        cls: "inter"
    },
    "热门城市1-30": {
        cityList: [{
            name: "香港",
            country: "中国香港"
        },
        {
            name: "新加坡",
            country: "新加坡"
        },
        {
            name: "首尔",
            country: "韩国"
        },
        {
            name: "曼谷",
            country: "泰国"
        },
        {
            name: "东京",
            country: "日本"
        },
        {
            name: "台北",
            country: "中国台湾"
        },
        {
            name: "吉隆坡",
            country: "马来西亚"
        },
        {
            name: "悉尼",
            country: "澳大利亚"
        },
        {
            name: "纽约",
            country: "美国"
        },
        {
            name: "澳门",
            country: "中国澳门"
        },
        {
            name: "伦敦",
            country: "英国"
        },
        {
            name: "巴黎",
            country: "伦敦"
        },
        {
            name: "洛杉矶",
            country: "美国"
        },
        {
            name: "马尼拉",
            country: "菲律宾"
        },
        {
            name: "墨尔本",
            country: "澳大利亚"
        },
        {
            name: "大阪",
            country: "日本"
        },
        {
            name: "胡志明市",
            country: "越南"
        },
        {
            name: "普吉",
            country: "泰国"
        },
        {
            name: "温哥华",
            country: "加拿大"
        },
        {
            name: "迪拜",
            country: "阿联酋"
        },
        {
            name: "釜山",
            country: "韩国"
        },
        {
            name: "多伦多",
            country: "加拿大"
        },
        {
            name: "法兰克福",
            country: "德国"
        },
        {
            name: "河内",
            country: "越南"
        },
        {
            name: "旧金山",
            country: "美国"
        },
        {
            name: "加德满都",
            country: "尼泊尔"
        },
        {
            name: "金边",
            country: "柬埔寨"
        },
        {
            name: "马累",
            country: "马尔代夫"
        },
        {
            name: "雅加达",
            country: "印度尼西亚"
        },
        {
            name: "名古屋",
            country: "日本"
        }],
        title: "热门城市1-30",
        desc: "可直接输入城市或城市拼音",
        cls: "inter"
    },
    "热门城市31-60": {
        cityList: [{
            name: "奥克兰",
            country: "新西兰"
        },
        {
            name: "芝加哥",
            country: "美国"
        },
        {
            name: "暹粒",
            country: "柬埔寨"
        },
        {
            name: "巴厘岛",
            country: "印度尼西亚"
        },
        {
            name: "莫斯科",
            country: "俄罗斯"
        },
        {
            name: "罗马",
            country: "意大利"
        },
        {
            name: "济州岛",
            country: "韩国"
        },
        {
            name: "布里斯班",
            country: "澳大利亚"
        },
        {
            name: "福冈",
            country: "日本"
        },
        {
            name: "阿姆斯特丹",
            country: "荷兰"
        },
        {
            name: "高雄",
            country: "中国台湾"
        },
        {
            name: "米兰",
            country: "意大利"
        },
        {
            name: "槟城",
            country: "马来西亚"
        },
        {
            name: "新德里",
            country: "印度"
        },
        {
            name: "慕尼黑",
            country: "伊朗"
        },
        {
            name: "亚庇",
            country: "马来西亚"
        },
        {
            name: "华盛顿",
            country: "美国"
        },
        {
            name: "西雅图",
            country: "美国"
        },
        {
            name: "马德里",
            country: "西班牙"
        },
        {
            name: "大邱",
            country: "韩国"
        },
        {
            name: "柏林",
            country: "德国"
        },
        {
            name: "宿务",
            country: "西班牙"
        },
        {
            name: "开罗",
            country: "埃及"
        },
        {
            name: "阿德莱德",
            country: "澳大利亚"
        },
        {
            name: "札幌",
            country: "日本"
        },
        {
            name: "波士顿",
            country: "美国"
        },
        {
            name: "斯德哥尔摩",
            country: "瑞典"
        },
        {
            name: "珀斯",
            country: "澳大利亚"
        },
        {
            name: "伊斯坦布尔",
            country: "土耳其"
        },
        {
            name: "雅典",
            country: "希腊"
        }],
        title: "热门城市31-60",
        desc: "可直接输入城市或城市拼音",
        cls: "inter"
    },
    "热门城市61-90": {
        cityList: [{
            name: "巴塞罗那",
            country: "西班牙"
        },
        {
            name: "仰光",
            country: "缅甸"
        },
        {
            name: "兰卡威",
            country: "马来西亚"
        },
        {
            name: "苏黎世",
            country: "瑞士"
        },
        {
            name: "蒙特利尔",
            country: "加拿大"
        },
        {
            name: "哥本哈根",
            country: "丹麦"
        },
        {
            name: "底特律",
            country: "美国"
        },
        {
            name: "维也纳",
            country: "奥地利"
        },
        {
            name: "布鲁塞尔",
            country: "比利时"
        },
        {
            name: "约翰内斯堡",
            country: "南非"
        },
        {
            name: "广岛",
            country: "日本"
        },
        {
            name: "亚特兰大",
            country: "美国"
        },
        {
            name: "塞班",
            country: "美国"
        },
        {
            name: "火奴鲁鲁",
            country: "美国"
        },
        {
            name: "丁加奴",
            country: "马来西亚"
        },
        {
            name: "孟买",
            country: "印度"
        },
        {
            name: "万象",
            country: "老挝"
        },
        {
            name: "休斯敦",
            country: "美国"
        },
        {
            name: "仙台",
            country: "日本"
        },
        {
            name: "曼彻斯特",
            country: "英国"
        },
        {
            name: "赫尔辛基",
            country: "芬兰"
        },
        {
            name: "日内瓦",
            country: "瑞士"
        },
        {
            name: "台中-清泉岗",
            country: "中国台湾"
        },
        {
            name: "清迈",
            country: "泰国"
        },
        {
            name: "科伦坡",
            country: "斯里兰卡"
        },
        {
            name: "杜塞尔多夫",
            country: "德国"
        },
        {
            name: "圣彼得堡",
            country: "俄罗斯"
        },
        {
            name: "达拉斯",
            country: "美国"
        },
        {
            name: "哥打巴鲁",
            country: "马来西亚"
        },
        {
            name: "拉斯维加斯",
            country: "美国"
        }],
        title: "热门城市61-90",
        desc: "可直接输入城市或城市拼音",
        cls: "inter"
    }
};
var FlightLang = {
    hotCityConfig: {
        domestic: {
            tabs: ["热门", "A-G", "H-L", "M-T", "W-Z"],
            contents: {
                "热门": _tabConfig["热门"],
                "A-G": _tabConfig["A-G"],
                "H-L": _tabConfig["H-L"],
                "M-T": _tabConfig["M-T"],
                "W-Z": _tabConfig["W-Z"]
            }
        },
        "international-from": {
            tabs: ["热门", "A-G", "H-L", "M-T", "W-Z", "国际"],
            contents: {
                "热门": _tabConfig["热门"],
                "A-G": _tabConfig["A-G"],
                "H-L": _tabConfig["H-L"],
                "M-T": _tabConfig["M-T"],
                "W-Z": _tabConfig["W-Z"],
                "国际": _tabConfig["国际"]
            }
        },
        "international-to": {
            tabs: ["热门城市1-30", "热门城市31-60", "热门城市61-90"],
            contents: {
                "热门城市1-30": _tabConfig["热门城市1-30"],
                "热门城市31-60": _tabConfig["热门城市31-60"],
                "热门城市61-90": _tabConfig["热门城市61-90"]
            }
        }
    },
    _CAPTIAL: "北京",
    _COUNTRY: "中国"
};
var recommendedHotels = {};
recommendedHotels.show = function(l, h, f) {
    var c = recommendedHotels.con;
    var m = recommendedHotels.type;
    var p = recommendedHotels.from;
    var g = recommendedHotels.city;
    var n = recommendedHotels.fromDate;
    var s = "lijiang,xianggelila,akesu,anshan,anshun,antu,baise,baoshan,bayannaoer,bazhong,cangnan,changle,changshan,chibei,chifeng,chongzuo,chuxiong,danyang,danzhou,daye,dengfeng,dingan,dongshan,dongtai,duyun,eerduosi,enping,ezhou,fengdu,fuyang_zhejiang,geermu,guigang,haicheng,hailuogou,hami,honghe,honghezhou,huairen,huangyan,huayin,jiangyan,jiangyou,jimo,jingjiang,jintan,kaili,kanasi,kuerle,kuitun,ledong,lincang,lingshi,linzhi,liuan,liuyang,longhai,mangshi,meishan,nanping,pingnan,pujiang,qianan,qidong,qinzhou,qujing,rikaze,rudong,shangqiu,shannan,shengsi,shihezi,songpan,suifenhe,suzhou_anhui,tianmen,tieling,tongliao,weinan,wenchang,wendeng,wenshan,wuxue,wuzhishan,wuzhou,xilinguole,xinglong,xinzhou,yanbian,yangquan,yining,yongzhou,yueqing,yuhang,yulin_guangxi,yuxi,zhangqiu,zhongxun".indexOf(l) >= 0 ? 2 : 1;
    var r = function() {
        switch (recommendedHotels.type) {
        case 0:
            return '					{if hotels.length > 0}						<div class="cvAD">						<h3>${city}高性价比酒店推荐</h3>							<ul>								{if city=="丽江"}									<li><h4><a target="_blank" href="http://union.qunar.com/live/wndj.php?bannerid=5911&zoneid=179&source=&dest=http%3A%2F%2Fwww.senlonghotel.com.cn%2Fsy.asp">丽江新森龙大酒店（五星）</a><span class="pr">¥560起</span></h4><p>位于:<a href="http://hotel.qunar.com/city/lijiang/#q=%E5%8F%A4%E5%9F%8E%E5%8C%BA&qtype=${qtype}" target="_blank">古城区</a></p><p>距丽江机场:27公里</p></li>								{/if}								{for hotel in hotels}									<li>										<h4><a href="${hotel.url}" title="${hotel.name}" target="_blank">${hotel.name}<span class="pr">&yen;${hotel.pr}起</span></a></h4>										{if hotel.cbd}											<p>位于：<a href="http://hotel.qunar.com/city/${city_url}/#from=${from}&qtype=${qtype}&q=${encodeURIComponent(hotel.cbd)}" target="_blank">${hotel.cbd}</a></p>										{/if}										{if hotel.ap.length > 0}											{if city == "上海"}												<p>距机场公里数:													{for airp in hotel.ap}														${airp.apname}（${airp.dist}）													{/for}												</p>											{else}												{for airp in hotel.ap}												<p>距${airp.apname}:${airp.dist}公里</p>												{/for}											{/if}										{else}											<p>暂无距离机场数据</p>										{/if}									</li>								{/for}							</ul>							<div class="more"><a target="_blank" href="http://hotel.qunar.com/city/${city_url}/#from=${from}&fromDate=${fromDate}">查看${city}全部${number}家酒店&gt;&gt;</a></div>						</div>					{/if}					';
        case 1:
            return '					{if hotels.length > 0}						<div class="cvAD cvAD_180">						<h3>${city}高性价比酒店推荐</h3>							<ul>								{if city=="丽江"}									<li><h4><a target="_blank" href="http://union.qunar.com/live/wndj.php?bannerid=5911&zoneid=179&source=&dest=http%3A%2F%2Fwww.senlonghotel.com.cn%2Fsy.asp">丽江新森龙大酒店（五星）</a><span class="pr">¥560起</span></h4><p>位于:<a href="http://hotel.qunar.com/city/lijiang/#q=%E5%8F%A4%E5%9F%8E%E5%8C%BA&qtype=${qtype}" target="_blank">古城区</a></p><p>距丽江机场:27公里</p></li>								{/if}								{for hotel in hotels}									<li>										<h4><a href="${hotel.url}" title="${hotel.name}" target="_blank">${hotel.name}<span class="pr">&yen;${hotel.pr}起</span></a></h4>										{if hotel.cbd}											<p>位于：<a href="http://hotel.qunar.com/city/${city_url}/#from=${from}&qtype=${qtype}&q=${encodeURIComponent(hotel.cbd)}" target="_blank">${hotel.cbd}</a></p>										{/if}										{if hotel.ap.length > 0}											{if city == "上海"}												<p>距机场公里数:													{for airp in hotel.ap}														${airp.apname}（${airp.dist}）													{/for}												</p>											{else}												{for airp in hotel.ap}												<p>距${airp.apname}:${airp.dist}公里</p>												{/for}											{/if}										{else}											<p>暂无距离机场数据</p>										{/if}									</li>								{/for}							</ul>							<div class="more"><a target="_blank" href="http://hotel.qunar.com/city/${city_url}/#from=${from}&fromDate=${fromDate}">查看${city}全部${number}家酒店&gt;&gt;</a></div>						</div>					{/if}					';
        default:
            return "";
        }
    } ();
    var k = document.getElementsByTagName("head")[0];
    var t = TrimPath.parseTemplate(r);
    for (var j = 0; j < h.length; j++) {
        h[j].url = "http://hotel.qunar.com/city/" + l + "/dt-" + h[j].seq + "/#from=" + p + "&fromDate=" + h[j].fromDate;
        h[j].sname = h[j].name.length > 14 ? h[j].name.substring(0, 12) + "...": h[j].name;
    }
    var o = t.process({
        city: decodeURIComponent(g),
        city_url: l,
        hotels: h,
        from: p,
        number: f,
        qtype: s,
        fromDate: n
    }).strip();
    if (o) {
        var a = document.createElement("style");
        a.setAttribute("type", "text/css");
        var b = ".cvAD { margin-bottom:10px; width:280px; }.cvAD h3 { padding:6px; font-size:12px; font-weight:700; background-color:#eee; color:#484846; }.cvAD ul { padding:6px 0 0 10px; list-style:none; }.cvAD li { padding-bottom:8px; }.cvAD a { color:#0069ca; }.cvAD a:hover { color:#f60; }.cvAD h4 { font-size:14px; font-weight:700; }.cvAD h4 a { font-weight:700; }.cvAD .pr { margin:0 0 0 8px; font-family:Arial; color:#f60; }.cvAD p { font-size:12px; line-height:1.231; color:#888; }.cvAD .more { padding:2px 0 0 10px; font-family:SimSun; font-size:12px; font-weight:700; }.cvAD_180 { width:180px; }.cvAD_180 h3 {padding:0 0 0 10px;}";
        if (a.styleSheet) {
            a.styleSheet.cssText = b;
        } else {
            var d = document.createTextNode(b);
            a.appendChild(d);
        }
        k.appendChild(a);
        recommendedHotels.con.innerHTML = o;
        recommendedHotels.con.style.display = "block";
    }
};
recommendedHotels.query = function(f, c, i, h, d) {
    var a = document.getElementById(i);
    if (!a) {
        throw new Error("推荐酒店初始化错误");
    }
    if (!d) {
        d = 0;
    }
    recommendedHotels.fromDate = c;
    recommendedHotels.city = f;
    recommendedHotels.con = a;
    recommendedHotels.type = d;
    recommendedHotels.from = h;
    var b = document.createElement("script");
    b.src = "http://hotel.qunar.com/fch/search.jsp?city=" + f + "&fromDate=" + c + "&callback=recommendedHotels.show";
    var g = document.getElementsByTagName("head")[0];
    g.appendChild(b);
};
function trackAction(c, b, a) {
    var d = "/track.htm?action=" + c + "&t=" + Date.parse(new Date());
    if (b) {
        d += "&rId=" + b;
    } else {
        if (trackAction.rid) {
            d += "&rId=" + trackAction.rid;
        }
    }
    if (a) {
        d = d.replace("track.htm", "timetrack.htm");
    }
    new Image().src = d;
}
var $jsex = {
    ie: 0,
    gecko: 0,
    opera: 0,
    safari: 0,
    browser: null,
    mobile: null,
    air: null,
    VOIDFUNC: function() {},
    globalID: (function() {
        var a = 0;
        return function() {
            return a++;
        };
    })(),
    $: function(a) {
        return document.getElementById(a);
    },
    _: function(f, d) {
        var g = function() {};
        g.prototype = d.prototype;
        f.prototype = new g();
    },
    _ex: function() {
        var a = Object.prototype.constructor;
        return function(b, g) {
            var c = g.prototype;
            var f = b.prototype;
            var d = function() {};
            d.prototype = c;
            f = b.prototype = new d();
            b.superclass = c;
            f.constructor = b;
            if (c.constructor == a) {
                c.constructor = g;
            }
            return b;
        };
    } (),
    body: function(a) {
        if (!a) {
            a = document;
        }
        return a.body ? a.body: a.getElementsByTagName("body")[0];
    },
    doc: function(a) {
        return a ? a.nodeType == 9 ? a: a.ownerDocument || document: document;
    },
    merge: function(b, d) {
        for (var a in d) {
            b[a] = d[a];
        }
        return b;
    },
    exec: function(a) {
        return a();
    },
    toInt: function(b, c) {
        var a;
        return isNaN(a = parseInt(b)) ? c: a;
    },
    toFloat: function(b, c) {
        var a;
        return isNaN(a = parseFloat(b)) ? c: a;
    },
    toBoolean: function(a) {
        if (!a) {
            return false;
        }
        return (a == true || (a = a.toUpperCase()) == "TRUE" || a == "1");
    },
    text: function(a) {
        return a.innerText || a.textContent;
    },
    trim: function(b, a) {
        switch (a) {
        case "l":
            return b.replace(/(^\s*)/g, "");
        case "r":
            return b.replace(/(\s*$)/g, "");
        default:
            return b.replace(/(^\s*)|(\s*$)/g, "");
        }
    },
    stripTag: function(a) {
        return a.replace(/<\/?[^>]+>/gi, "");
    },
    starsWith: function(b, a, c) {
        if (!c) {
            c = 0;
        }
        if (!b || b.length < c + a.length) {
            return false;
        }
        return b.substring(c, a.length) == a;
    },
    exists: function(d, a) {
        var c = a.split("."),
        b;
        for (b = 0; b < c.length; b++) {
            if (!d[c[b]]) {
                return false;
            }
            d = d[c[b]];
        }
        return true;
    },
    isNull: function(a) {
        return (typeof a == "object") && !a;
    },
    isNumber: function(a) {
        return typeof a == "number" && isFinite(a) ? true: false;
    },
    isArray: function(a) {
        return !! a && a.constructor == Array;
    },
    removeElement: function(a) {
        if (a && a.parentNode) {
            a.parentNode.removeChild(a);
        }
    },
    isChildrenOf: function(b, a, c) {
        if (c && b) {
            b = b.parentNode;
        }
        while (b) {
            if (b == a) {
                return true;
            }
            b = b.parentNode;
        }
        return false;
    },
    hasClassName: function(b, a) {
        return this.array.indexOf(b.className.split(/\s+/), a) != -1;
    },
    addClassName: function(b, a) {
        if (this.hasClassName(b, a)) {
            return;
        }
        b.className = b.className + " " + a;
    },
    removeClassName: function(a, b) {
        if (typeof b == "string") {
            b = [b];
        }
        a.className = this.array.select(a.className.split(/\s+/),
        function(c) {
            return ($jsex.array.indexOf(b, c) == -1);
        }).join(" ");
    },
    createCssText: function(f, d) {
        if (!f) {
            return;
        }
        if (!d) {
            d = document;
        }
        var c = d.createElement("style");
        c.setAttribute("type", "text/css");
        var a = d.getElementsByTagName("head")[0];
        if (!a) {
            return;
        } else {
            a.appendChild(c);
        }
        if (c.styleSheet) {
            c.styleSheet.cssText = f;
        } else {
            var b = d.createTextNode(f);
            c.appendChild(b);
        }
        return c;
    },
    createCssLink: function(a, d) {
        if (!a) {
            return;
        }
        if (!d) {
            d = document;
        }
        if (document.createStyleSheet) {
            document.createStyleSheet(a);
        } else {
            var c = d.createElement("link");
            c.setAttribute("rel", "stylesheet");
            c.setAttribute("type", "text/css");
            c.setAttribute("href", a);
            var b = d.getElementsByTagName("head")[0];
            if (!b) {
                return;
            } else {
                b.appendChild(c);
            }
        }
    },
    stopEvent: function(a) {
        if (window.event) {
            event.returnValue = false;
            event.cancelBubble = true;
        } else {
            a.preventDefault();
            a.stopPropagation();
        }
    },
    callback: function(b, a) {
        return function() {
            return a.apply(b, arguments);
        };
    },
    getDocumentWindow: function(a) {
        return a.parentWindow || window;
    },
    array: {
        toArray: function(c) {
            if (!c) {
                return [];
            }
            var b = [],
            a;
            for (a = 0; a < c.length; a++) {
                b.push(c[a]);
            }
            return b;
        },
        indexOf: function(a, b) {
            for (var c = 0,
            d = a.length; c < d; c++) {
                if (a[c] == b) {
                    return c;
                }
            }
            return - 1;
        },
        each: function(a, c) {
            if (!a) {
                return;
            }
            for (var b = 0,
            d = a.length; b < d; b++) {
                c(a[b], b);
            }
        },
        select: function(a, d) {
            if (!a) {
                return [];
            }
            var b = [],
            c,
            f;
            for (c = 0, f = a.length; c < f; c++) {
                if (d(a[c])) {
                    b.push(a[c]);
                }
            }
            return b;
        },
        copy: function(d, c, g, b) {
            var f = g || 0,
            a = b || d.length;
            for (; f < a; ++f) {
                c.push(d[f]);
            }
        },
        remove: function(a, d, g) {
            var b = 0,
            c, f;
            for (c = 0, f = a.length; c < f; c++) {
                if (a[c] === d || g && a[c] == d) {
                    a.splice(c--, 1);
                    b++;
                }
            }
            return b;
        }
    },
    hash: {
        each: function(c, b) {
            for (var a in c) {
                b(a, c[a]);
            }
        }
    },
    each: function(b, a) {
        if (b instanceof Array) {
            this.array.each(b, a);
        } else {
            this.hash.each(b, a);
        }
    },
    event: {
        doclick: function(c) {
            var b = document.getElementById(c);
            if (document.createEvent) {
                var a = document.createEvent("MouseEvents");
                a.initEvent("click", true, false);
                b.dispatchEvent(a);
            } else {
                if (document.createEventObject) {
                    b.fireEvent("onclick");
                }
            }
        },
        add: function(c, a, b) {},
        remove: function(a) {},
        bind: function(f, b, d) {
            var c = (f == window && b == "unload");
            if (f.addEventListener) {
                var a = false;
                if (b == "focusin") {
                    b = "focus";
                    a = true;
                } else {
                    if (b == "focusout") {
                        b = "blur";
                        a = true;
                    }
                }
                f.addEventListener(b, d, a);
                d = this.add(f, b, d, a ? 4 : 1, c);
            } else {
                if (f.attachEvent) {
                    d = $jsex.callback(f, d);
                    f.attachEvent("on" + b, d);
                    d = this.add(f, b, d, 2, c);
                } else {
                    f["on" + b] = d;
                    d = this.add(f, b, d, 3, c);
                }
            }
            return d;
        },
        bindDom: function(c, a, d, b) {
            return this.bind(c, a,
            function(f) {
                if (!f.target) {
                    f.target = f.srcElement;
                }
                b.call(d, f, this);
            });
        },
        stop: function(b, a) {
            this.bind(b, a,
            function(c) {
                $jsex.stopEvent(c);
                return false;
            });
        },
        trigger: function(c, b, a) {}
    },
    element: {
        hide: function(a) {
			if(a){
            	a.style.display = "none";
			}
            return a;
        },
        show: function(a) {
			if(a){
            	a.style.display = "block";
			}
            return a;
        },
        visible: function(a) {
            return a.style.display != "none";
        }
    }
};
$jsex.createXMLHttpRequest = $jsex.exec(function() {
    var b = 0,
    a = [function() {
        return new XMLHttpRequest();
    },
    function() {
        return new ActiveXObject("Msxml2.XMLHTTP");
    },
    function() {
        return new ActiveXObject("Microsoft.XMLHTTP");
    }];
    return function() {
        for (var c = b; c < a.length; c++) {
            try {
                b = c;
                return a[c]();
            } catch(d) {}
        }
        return $jsex.VOIDFUNC;
    };
});
$jsex.exec(function() {
    var b = navigator.userAgent,
    a;
    if ((/WebKit|KHTML/).test(b)) {
        $jsex.browser = "safari";
        $jsex.safari = 1;
    }
    a = b.match(/AppleWebKit\/([^\s]*)/);
    if (a && a[1]) {
        $jsex.safari = $jsex.toFloat(a[1]);
        if (/ Mobile\//.test(b)) {
            $jsex.mobile = "Apple";
        } else {
            a = b.match(/NokiaN[^\/]*/);
            if (a) {
                $jsex.mobile = a[0];
            }
        }
        a = b.match(/AdobeAIR\/([^\s]*)/);
        if (a) {
            $jsex.air = a[0];
        }
    } else {
        a = b.match(/Opera[\s\/]([^\s]*)/);
        if (a && a[1]) {
            $jsex.opera = $jsex.toFloat(a[1]);
            $jsex.browser = "opera";
            a = b.match(/Opera Mini[^;]*/);
            if (a) {
                $jsex.mobile = a[0];
            }
        } else {
            a = b.match(/MSIE\s([^;]*)/);
            if (a && a[1]) {
                $jsex.browser = "ie";
                $jsex.ie = $jsex.toFloat(a[1]);
            } else {
                a = b.match(/Gecko\/([^\s]*)/);
                if (a) {
                    $jsex.browser = "gecko";
                    $jsex.gecko = 1;
                    a = b.match(/rv:([^\s\)]*)/);
                    if (a && a[1]) {
                        $jsex.gecko = $jsex.toFloat(a[1]);
                    }
                }
            }
        }
    }
    return false;
});
$jsex.exec(function() {
    var a = -1;
    $jsex.boxModel = function() {
        if (a !== -1) {
            return a;
        }
        var b = document.createElement("div");
        b.style.width = b.style.paddingLeft = "1px";
        document.body.appendChild(b);
        a = b.offsetWidth === 2;
        document.body.removeChild(b).style.display = "none";
        return a;
    };
});
$jsex.exec(function() {
    var g = false,
    c, d, b, f;
    function a() {
        if (g) {
            return;
        }
        var o = document.body,
        i = document.createElement("div"),
        k,
        j,
        r,
        l,
        p,
        h,
        m = o.style.marginTop,
        n = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
        p = {
            position: "absolute",
            top: 0,
            left: 0,
            margin: 0,
            border: 0,
            width: "1px",
            height: "1px",
            visibility: "hidden"
        };
        for (h in p) {
            i.style[h] = p[h];
        }
        i.innerHTML = n;
        o.insertBefore(i, o.firstChild);
        k = i.firstChild,
        j = k.firstChild,
        l = k.nextSibling.firstChild.firstChild;
        c = (j.offsetTop !== 5);
        d = (l.offsetTop === 5);
        k.style.overflow = "hidden",
        k.style.position = "relative";
        b = (j.offsetTop === -5);
        o.style.marginTop = "1px";
        f = (o.offsetTop === 0);
        o.style.marginTop = m;
        o.removeChild(i);
        g = true;
    }
    if (document.documentElement.getBoundingClientRect) {
        $jsex.offset = function(j) {
            if (j === j.ownerDocument.body) {
                return $jsex.bodyOffset(j);
            }
            var l = j.getBoundingClientRect(),
            p = j.ownerDocument,
            m = p.body,
            h = p.documentElement,
            k = h.clientTop || m.clientTop || 0,
            n = h.clientLeft || m.clientLeft || 0,
            o = l.top + (self.pageYOffset || $jsex.boxModel && h.scrollTop || m.scrollTop) - k,
            i = l.left + (self.pageXOffset || $jsex.boxModel && h.scrollLeft || m.scrollLeft) - n;
            return {
                top: o,
                left: i
            };
        };
    } else {
        $jsex.offset = function(m) {
            if (m === m.ownerDocument.body) {
                return $jsex.bodyOffset(m);
            }
            g || a();
            var m = m,
            j = m.offsetParent,
            i = m,
            s = m.ownerDocument,
            p, k = s.documentElement,
            n = s.body,
            o = s.defaultView,
            h = o.getComputedStyle(m, null),
            r = m.offsetTop,
            l = m.offsetLeft;
            while ((m = m.parentNode) && m !== n && m !== k) {
                p = o.getComputedStyle(m, null);
                r -= m.scrollTop,
                l -= m.scrollLeft;
                if (m === j) {
                    r += m.offsetTop,
                    l += m.offsetLeft;
                    if (c && !(d && /^t(able|d|h)$/i.test(m.tagName))) {
                        r += parseInt(p.borderTopWidth, 10) || 0,
                        l += parseInt(p.borderLeftWidth, 10) || 0;
                    }
                    i = j,
                    j = m.offsetParent;
                }
                if (b && p.overflow !== "visible") {
                    r += parseInt(p.borderTopWidth, 10) || 0,
                    l += parseInt(p.borderLeftWidth, 10) || 0;
                }
                h = p;
            }
            if (h.position === "relative" || h.position === "static") {
                r += n.offsetTop,
                l += n.offsetLeft;
            }
            if (h.position === "fixed") {
                r += Math.max(k.scrollTop, n.scrollTop),
                l += Math.max(k.scrollLeft, n.scrollLeft);
            }
            return {
                top: r,
                left: l
            };
        };
    }
    $jsex.bodyOffset = function() {
        g || a();
        var i = body.offsetTop,
        h = body.offsetLeft;
        return {
            top: i,
            left: h
        };
    };
});
$jsex.exec(function() {
    function setObjectValue(target, id, obj) {
        if (!target[id]) {
            target[id] = obj;
        } else {
            if (target[id] instanceof Array) {
                var arr = target[id];
                if (obj instanceof Array) {
                    for (var i = 0; i < obj.length; i++) {
                        arr.push(obj[i]);
                    }
                } else {
                    target[id].push(obj);
                }
            } else {
                target[id] = [target[id], obj];
            }
        }
    }
    var readObject = $jsex.readObject = function(el, target, id) {
        var obj, text;
        var childs = el.getAttribute("jxChilds") || !target;
        if (text = el.getAttribute("jxObject")) {
            obj = eval("({" + text + "});");
        } else {
            if (text = el.getAttribute("jxValue")) {
                if (_Rp$(text, "%.")) {
                    obj = el.getAttribute(text.substring(2));
                } else {
                    obj = text;
                }
            } else {
                if (!childs) {
                    obj = el.innerHTML;
                } else {
                    obj = {};
                }
            }
        }
        if (childs == "1") {
            var els = el.childNodes;
            for (var i = 0; i < els.length; i++) {
                if (els[i].nodeType == 1) {
                    var _id = els[i].getAttribute("jxc");
                    if (_id) {
                        readObject(els[i], obj, _id);
                    }
                }
            }
        }
        if (id == ".") {
            asd = (obj);
        }
        if (target && id) {
            if (id == ".") {
                for (var i in obj) {
                    setObjectValue(target, i, obj[i]);
                }
            } else {
                setObjectValue(target, id, obj);
            }
        }
        return obj;
    };
    function getEventStack(obj, name, create) {
        var arr, prop = obj.__x_;
        if (prop) {
            arr = prop[name];
            if (!arr) {
                arr = [];
                if (create) {
                    prop[name] = arr;
                }
            }
        } else {
            arr = [];
            if (create) {
                obj.__x_ = {};
                obj.__x_[name] = arr;
            }
        }
        return arr;
    }
    function getEventStackCopy(obj, name) {
        var arr = [],
        prop = obj.__x_;
        if (prop) {
            if (name) {
                if (prop[name]) {
                    $jsex.array.copy(prop[name], arr);
                }
            } else {
                $jsex.array.each(prop,
                function(name, obj) {
                    $jsex.arraycopy(obj, arr);
                });
            }
        }
        return arr;
    }
    var events = [];
    $jsex.event.addEx = function(objarr, name, handler, type, notmark) {
        for (var i = 0,
        n = objarr.length; i < n; i++) {
            var obj = objarr[i];
            $jsex.event.add(obj, name, handler, type, notmark);
        }
    };
    $jsex.event.add = function(obj, name, handler, type, notmark) {
        obj = new EventListener(obj, name, handler, type);
        if (!notmark) {
            events.push(obj);
            obj.refer = events.length - 1;
        }
        return obj;
    };
    $jsex.event.remove = function(listener) {
        listener.remove();
        var i = listener.refer;
        if (! (i < 0)) {
            var obj = events.pop();
            if (i < events.length) {
                events[i] = obj;
                obj.refer = i;
            }
            listener.refer = -1;
        }
    };
    $jsex.event.clear = function(elem, name) {
        $jsex.array.each(getEventStackCopy(elem, name), $jsex.event.remove);
    };
    $jsex.event.trigger = function(elem, name, arg) {
        var args = [];
        $jsex.array.copy(arguments, args, 2);
        this.triggerParam(elem, name, args);
    };
    $jsex.event.triggerParam = function(elem, name, args) {
        $jsex.array.each(getEventStackCopy(elem, name),
        function(func) {
            func.apply(elem, args);
        });
    };
    $jsex.errorStack = [];
    window.onerror = function(e) {
        $jsex.errorStack.push(e);
    };
    function EventListener(elem, name, handler, type) {
        this.elem = elem;
        this.name = name;
        this.handler = handler;
        this.type = type;
        this.refer = -1;
        getEventStack(elem, name, true).push(this);
    }
    EventListener.prototype.remove = function() {
        if (this.elem) {
            switch (this.type) {
            case 1:
                this.elem.removeEventListener(this.name, this.handler, false);
                break;
            case 4:
                this.elem.removeEventListener(this.name, this.handler, true);
                break;
            case 2:
                this.elem.detachEvent("on" + this.name, this.handler);
                break;
            case 3:
                this.elem["on" + this.name] = null;
                break;
            }
            $jsex.array.remove(getEventStack(this.elem, this.name), this);
            this.elem = this.handler = null;
        }
    };
    EventListener.prototype.apply = function(obj, args) {
        return this.handler.apply(obj, args);
    };
});
function UIObject() {
    this._XGUI_ = true;
    this._content_ = [];
    this._childrens_ = [];
    this._GID_ = "XI" + $jsex.globalID();
}
UIObject.prototype.append = function(b) {
    var d = this._content_;
    var a = this._childrens_;
    var f = this._GID_;
    for (var c = 0; c < arguments.length; c++) {
        var g = arguments[c];
        if (g != null) {
            if (c % 2 == 0) {
                d.push(g);
            } else {
                if (g._XGUI_ == true) {
                    a.push(g);
                    d.push(g);
                } else {
                    d.push(' id="', g, f, '"');
                }
            }
        }
    }
    return this;
};
UIObject.prototype.text = function(c) {
    var b = this._content_;
    for (var a = 0; a < arguments.length; a++) {
        b.push(arguments[a]);
    }
    return this;
};
UIObject.prototype.getDomNode = function(a) {
    return $jsex.$(a + this._GID_, this._document_);
};
UIObject.prototype.initDocument = function(a) {
    this._document_ = a;
    var b = this._childrens_;
    for (var c = 0; c < b.length; c++) {
        b[c].initDocument(a);
    }
    this.initialize();
};
UIObject.prototype.write = function(a) {
    a.innerHTML = this.toString();
    this.initDocument($jsex.doc(a));
};
UIObject.prototype.toString = function() {
    return this._content_.join("");
};
UIObject.prototype.initialize = $jsex.VOIDFUNC;
function ActionDelay(a) {
    this.delay = a;
    this.timer = null;
}
ActionDelay.prototype.reset = function(a) {
    this.cancel();
    this.timer = setTimeout(a, this.delay);
};
ActionDelay.prototype.cancel = function() {
    if (this.timer) {
        clearTimeout(this.timer);
    }
};
function ActionFlow(a) {
    this.actions = {};
    this.logs = [];
    this.interval = a;
    this.tid = null;
}
ActionFlow.prototype.add = function(b, a, d) {
    var c = this.actions[a];
    if (c && c.order < b) {
        return;
    }
    this.actions[a] = {
        order: b,
        key: a,
        func: d
    };
    return this;
};
ActionFlow.prototype.remove = function(a) {
    delete this.actions[a];
};
ActionFlow.prototype.start = function() {
    if (this.tid !== null) {
        return;
    }
    var b = false;
    for (var a in this.actions) {
        b = true;
        break;
    }
    if (!b) {
        return;
    }
    this.tid = setTimeout($jsex.callback(this, this.run), this.interval);
};
ActionFlow.prototype.run = function() {
    clearTimeout(this.tid);
    this.tid = null;
    var a = this.actions,
    h = null;
    for (var b in a) {
        var c = a[b];
        if (!h || c.order < h.order) {
            h = c;
            delete a[b];
        }
    }
    if (h == null) {
        return;
    }
    var g = new Date().getTime();
    var d;
    try {
        h.func();
        d = "done";
    } catch(f) {
        d = "error:" + f;
    }
    this.logs.push([g, d, new Date().getTime() - g, h.key]);
    this.start();
};
if ($jsex.ie > 5 && $jsex.ie < 7) {
    try { (function() {
            document.execCommand("BackgroundImageCache", false, true);
            $jsex.addClassName(document.getElementsByTagName("html")[0], "jx-ie" + ($jsex.ie * 10));
        })();
    } catch(e) {}
}
function ScriptRequest(a) {
    if (a.funcName) {
        this.funcName = a.funcName;
    }
    this.callbackName = a.callbackName || "__jscallback";
    this.doc = a.doc || document;
    this.win = $jsex.getDocumentWindow(this.doc);
    if (a.onerror) {
        $jsex.event.add(this, "error", a.onerror);
    }
    if (a.ontimeout) {
        $jsex.event.add(this, "timeout", a.ontimeout);
    }
    if (a.oncancel) {
        $jsex.event.add(this, "cancel", a.oncancel);
    }
    if (a.oncomplete) {
        $jsex.event.add(this, "complete", a.oncomplete);
    }
}
ScriptRequest.loadScript = function(b, c) {
    c = c || document;
    var a = c.createElement("script");
    a.type = "text/javascript";
    a.src = b;
	if(b.indexOf("qunar.com") != -1){
    	a.src = b;
	}else{
    	a.src = "http://hotel.qunar.com" + b;
	}
    c.getElementsByTagName("head")[0].appendChild(a);
    return a;
};
ScriptRequest.prototype.send = function(b, c) {
    var g = this.callID = this.funcName ? this.funcName: "XQScript_" + $jsex.globalID();
    if (b.indexOf("?") == -1) {
        b = b + "?";
    }
    b += "&" + this.callbackName + "=" + g;
    var a = this;
    var f = this.win;
    var d;
    f[g] = function() {
        if (d) {
            window.clearTimeout(d);
            d = null;
        }
        a.release();
        f[g] = null;
        $jsex.event.triggerParam(a, "complete", $jsex.array.toArray(arguments));
    };
    if (c && c > 0) {
        d = window.setTimeout(function() {
            a.release();
            $jsex.event.trigger(a, "timeout");
        },
        c);
    }
    this.searchPort = ScriptRequest.loadScript(b, this.doc);
};
ScriptRequest.prototype.release = function() {
    if (this.searchPort) {
        $jsex.removeElement(this.searchPort);
        this.searchPort = null;
        this.win[this.callID] = $jsex.VOIDFUNC;
        return true;
    }
    return false;
};
ScriptRequest.prototype.cancel = function() {
    if (this.release()) {
        $jsex.event.trigger(this, "cancel");
    }
};
function FocusChecker(f, g) {
    var d = false;
    var a = false;
    var c = null;
    var b = 5;
    function h() {
        c = null;
        if (d != a) {
            d = a;
        }
        if (d) {
            g.focusin();
        } else {
            g.focusout();
        }
    }
    $jsex.event.bind(f, "focusin",
    function() {
        a = true;
        if (c) {
            clearTimeout(c);
        }
        c = setTimeout(h, b);
    });
    $jsex.event.bind(f, "focusout",
    function() {
        a = false;
        if (c) {
            clearTimeout(c);
        }
        c = setTimeout(h, b);
    });
}
function XCombox(j, a) {
    var c = this.elem = j.parentNode;
    this.inputEl = j;
    this.collateValue = j.value;
    this.tempValue = null;
    this._invalid = false;
    var g = $jsex.doc(c).createElement("DIV");
    g.className = "boxWrapper";
    c.insertBefore(g, j);
    var b = new UIObject().append("<div", "main", ' class="boxContainer">').append("<div", "sinfo", ' class="sinfo"></div><div class="sicon"></div>').text('<div style="clear:both"></div>').text("</div>");
    b.write(g);
    var h = b.getDomNode("main"),
    k = b.getDomNode("sinfo");
    this.infoPanel = k;
    $jsex.event.bind(h, "mouseover",
    function() {
        $jsex.addClassName(this, "switcher_in");
    });
    $jsex.event.bind(h, "mouseout",
    function() {
        $jsex.removeClassName(this, "switcher_in");
    });
    if (a.attrs) {
        for (var d in a.attrs) {
            this[d] = a.attrs[d];
        }
    }
    if (a.button) {
        if (a.button.mousedown) {
            $jsex.event.add(this, "buttonmousedown", a.button.mousedown);
        }
    }
    if (a.input) {
        if (a.input.click) {
            $jsex.event.bindDom(j, "click", this, a.input.click);
        }
        if (a.input.mousedown) {
            $jsex.event.bindDom(j, "mousedown", this, a.input.mousedown);
        }
        if (a.input.change) {
            $jsex.event.add(this, "valuechange", a.input.change);
        }
        if (a.input.keypress) {
            $jsex.event.bindDom(j, $jsex.ie || $jsex.safari ? "keydown": "keypress", this, a.input.keypress);
        }
    }
    FocusChecker(c, this, j);
    if (a.focus) {
        $jsex.event.add(this, "focus", a.focus);
    }
    if (a.blur) {
        $jsex.event.add(this, "blur", a.blur);
    }
    $jsex.event.bindDom(j, "keyup", this,
    function(i) {
        setTimeout($jsex.callback(this, this._listenKey), 0);
    });
    var f = this.popContainer = $jsex.doc(c).createElement("DIV");
    f.className = "popContainer";
    f.display = "none";
    c.appendChild(f);
    this.popups = new XPopupManager(f);
    if (a.popups) {
        for (var d in a.popups) {
            this.popups.createPopup(d, a.popups[d]).own = this;
        }
    }
    $jsex.ie && $jsex.event.bind(j, "beforedeactivate",
    function(i) {
        if (this._f_leave) {
            $jsex.stopEvent(i);
        }
        this._f_leave = 0;
    });
    $jsex.ie && $jsex.event.bind(j, "focus",
    function(i) {
        this._f_leave = 0;
    });
    $jsex.event.bindDom(h, "mousedown", this, this.mousedown);
    f.onmousedown = function(i) {
        j._f_leave = 1;
        return false;
    };
}
XCombox.prototype.show = function() {
    this.elem.style.display = "block";
};
XCombox.prototype.hide = function() {
    this.elem.style.display = "none";
};
XCombox.prototype.setValue = function(a) {
    this.tempValue = null;
    this.inputEl.value = a;
    this._listenKey(true);
};
XCombox.prototype.volateValue = function(a) {
    this.tempValue = this.inputEl.value = a;
    this._listenKey();
};
XCombox.prototype.initValue = function(a) {
    this.collateValue = this.inputEl.value = a;
    this.tempValue = null;
};
XCombox.prototype.getValue = function() {
    return this.inputEl.value;
};
XCombox.prototype.setInfo = function(d, b, c) {
    this.infoPanel.innerHTML = d || "";
    var a = "sinfo";
    if (b) {
        a = a + " " + b;
    }
    this.infoPanel.className = a;
    this.infoPanel.title = c || "";
};
XCombox.prototype.focusin = function() {
    $jsex.addClassName(this.elem, "qbc_fin");
    $jsex.event.trigger(this, "focus");
    this.timerListen(true);
};
XCombox.prototype.focusout = function() {
    this.popups.close();
    $jsex.removeClassName(this.elem, "qbc_fin");
    $jsex.event.trigger(this, "blur");
    this.timerListen(false);
};
XCombox.prototype.mousedown = function(a) {
    var b = this.inputEl;
    $jsex.ie && (b._f_leave = 1);
    window.setTimeout(function() {
        b.focus();
    },
    0);
    $jsex.stopEvent(a);
    $jsex.event.trigger(this, "buttonmousedown", a);
    return false;
};
XCombox.prototype.openMainMenu = function() {
    var a = this.popups.get("main");
    if (a && a.isOpend()) {
        this.popups.close();
    } else {
        this.popups.open("main");
    }
};
XCombox.prototype._listenKey = function(b) {
    if (this.inputEl.value == this.tempValue) {} else {
        if (this.inputEl.value != this.collateValue) {
            var a = this.collateValue;
            this.collateValue = this.inputEl.value;
            $jsex.event.trigger(this, "valuechange", this.inputEl.value, a, b === true);
        }
    }
};
XCombox.prototype.timerListen = function(a) {
    if (a) {
        if (!this.listenID) {
            this.listenID = setInterval($jsex.callback(this, this._listenKey), 50);
        }
    } else {
        if (this.listenID) {
            clearInterval(this.listenID);
            this.listenID = null;
        }
    }
};
function XPopup(a) {
    this.panel = null;
    this.className = "popPanel" + (a.className ? " " + a.className: "");
    if (a.close) {
        $jsex.event.add(this, "close", a.close);
    }
    if (a.open) {
        $jsex.event.add(this, "open", a.open);
    }
    if (a.initialize) {
        this.initialize = a.initialize;
    }
}
XPopup.prototype.initialize = function(a) {};
XPopup.prototype._open = function() {
    this.panel.style.display = "";

	if(document.getElementById("search_type")){
		var oPoint=document.elementFromPoint(event.clientX,event.clientY); 
		var oT = oPoint.offsetParent.offsetParent.offsetTop;
		var oL = oPoint.offsetParent.offsetParent.offsetLeft;
		var vW = document.body.offsetWidth;
		var vH = document.body.offsetHeight;
		var sW = document.body.scrollWidth;
		var sH = document.body.scrollHeight;
		var divW = 400;
		var divH = 300;
		var rW = 0;
		if(event.clientY < 190){
			rW = -228;
		}else{
			rW = -198;
		}
		this.panel.style.left = (((vW-sW) - divW >= 400)?1:rW) + "px";
		this.panel.style.top = (((vH-sH) - divH >= 300)?1:1) + "px"
	}

    $jsex.event.trigger(this, "open");
};
XPopup.prototype.isOpend = function() {
    return this.panel && this.panel.style.display != "none";
};
XPopup.prototype.close = function() {
    $jsex.event.trigger(this, "close");
    this.panel.style.display = "none";
};
function XPopupManager(a) {
    this.popups = {};
    this.container = a;
    this.current = null;
    this.defaultName = null;
}
XPopupManager.prototype.createPopup = function(a, b) {
    return this.popups[a] = new XPopup(b);
};
XPopupManager.prototype.open = function(b) {
    var a = this.popups[b];
    if (a) {
        if (!a.inited) {
            var c = a.panel;
            if (!c) {
                c = $jsex.doc(this.container).createElement("DIV");
                c.className = a.className;
                c.style.display = "none";
                this.container.appendChild(c);
                a.panel = c;
            }
            a.initialize();
            a.inited = true;
        }
        if (this.current && this.current != a && this.current.isOpend()) {
            this.current.close();
        }
        if (!a.isOpend()) {
            a._open();
        }
        return this.current = a;
    }
};
XPopupManager.prototype.close = function(a) {
    if (a && !this.isOpend(a)) {
        return;
    }
    if (this.current != null) {
        this.current.close();
        this.current = null;
    }
};
XPopupManager.prototype.isOpend = function(a) {
    if (a) {
        if (this.popups[a]) {
            return this.popups[a].isOpend();
        }
    } else {
        if (this.current != null) {
            return this.current.isOpend();
        }
    }
    return false;
};
XPopupManager.prototype.get = function(a) {
    return this.popups[a];
};
var $cs = function(a) {
    return document.getElementById(a);
};
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
};
var ADManager = new(function() {
    this.urlparams = "";
    this.urlParamsFunc = null;
    this._cityInfo = false;
    this.outtime = 5000;
    this.recived = false;
    this._cancelRequest = false;
    this.margin = {};
    this._adId = null;
    this._tile = new Date().getTime().toString() + new String(parseInt(Math.random() * 10000000));
    this._tileGroup = function(a) {
        var b = a.getAttribute("tilegroup");
        if (b) {
            return "tile=" + (this._tile + b);
        } else {
            return "tile=" + this._tile;
        }
    };
    this.load = function(a) {
        var c = this;
        if (typeof a != "undefined") {
            this._adId = a;
        }
        if (!this._cityInfo) {
            var b = c._script = document.createElement("script");
            b.type = "text/javascript";
            b.src = "http://api.qunar.com/ips.jcp?callback=ADManager._showAd";
            b.onload = b.onreadystatechange = function() {
                if (b.readyState && b.readyState != "loaded" && b.readyState != "complete") {
                    return;
                }
                b.onreadystatechange = b.onload = null;
                c.recived = true;
            };
            var d = document.getElementsByTagName("HEAD")[0];
            d.appendChild(b);
            requested = true;
            setTimeout(function() {
                if (!c._cityInfo) {
                    c._cityInfo = {
                        city: ""
                    };
                    c._showAd({
                        city: ""
                    });
                    c._cancelRequest = true;
                    if (c._script) {
                        try {
                            c._script.parentNode.removeChild(c._script);
                        } catch(f) {}
                    }
                }
            },
            this.outtime);
        } else {
            this._showAd(this._cityInfo);
        }
    };
    this._getQueryString = function(c) {
        var b = window.location.search;
        var a = new RegExp("" + c + "=([^&?]*)", "ig");
        return ((b.match(a)) ? (b.match(a)[0].substr(c.length + 1)) : null);
    };
    this._showAd = function(l) {
        var o = this;
        this._cityInfo = l;
        this.ipCity = encodeURIComponent(l.city);
        if (this.urlParamsFunc && typeof this.urlParamsFunc == "function" && this.urlparams == "") {
            this.urlparams = this.urlParamsFunc() || "";
        }
        if (this.ipCity != "") {
            var m = ["city=", this.ipCity, this.urlparams];
        } else {
            var m = [this.urlparams];
        }
        var d = this._getQueryString("adtest");
        var f = this._getQueryString("testad");
        if (d) {
            m.push(["&adtest=", d].join(""));
        }
        if (f) {
            m.push(["&testad=", f].join(""));
        }
        this.allUrlparams = m.join("");
        if (this._adId) {
            this._tile = new Date().getTime().toString() + new String(parseInt(Math.random() * 10000000));
            var b = $cs(this._adId).getAttribute("marginTop") || 0;
            var j = $cs(this._adId).getAttribute("marginBottom") || 0;
            this.margin[this._adId] = {
                marginTop: b,
                marginBottom: j
            };
            this._creatAng($cs(this._adId));
        } else {
            var k = document.getElementsByTagName("iframe");
            if (!k || k.length <= 0) {
                return;
            }
            for (var h = 0; h < k.length; h++) {
                var n = k[h];
                var g = n.getAttribute("delay");
                var c = n.id;
                var a = n.getAttribute("depend");
                var b = n.getAttribute("marginTop") || 0;
                var j = n.getAttribute("marginBottom") || 0;
                this.margin[c] = {
                    marginTop: b,
                    marginBottom: j
                };
                n.style.marginTop = "0px";
                n.style.marginBottom = "0px";
                if (!a) {
                    if (!g) {
                        this._creatAng(n);
                    } else {
                        g = parseInt(g, 10);
                        setTimeout(function(i) {
                            return function() {
                                o._creatAng($cs(i));
                            };
                        } (c), g);
                    }
                } else {
                    $cs(a).dependimpl = (function(i) {
                        return function() {
                            o._creatAng($cs(i));
                        };
                    })(c);
                }
            }
        }
    };
    this._creatAng = function(g) {
        var c = g.getAttribute("src");
        if (c == null || (c != null && c.trim() == "") || c.indexOf("ad.html") > -1) {
            var b = g.getAttribute("id");
            if (!b) {
                return;
            }
            var d = g.getAttribute("querystring");
            var f = g.getAttribute("zonid");
            var a = g.getAttribute("count");
            if (!a) {
                a = 1;
            }
            if (!d && !f) {
                return;
            }
            if (d) {
                g.src = ["adframe/banner.html?framId=", b, "&", this.allUrlparams, "&", d, "&", this._tileGroup(g)].join("");
            } else {
                if (f) {
                    g.src = ["adframe/banner.html?framId=", b, "&", this.allUrlparams, "&zonid=", f, "&count=", a, this._tileGroup(g)].join("");
                }
            }
        }
        this._adId = null;
    };
    this.setIfrmHeight = function(b, a, c) {
        if (!$cs(b)) {
            return;
        }
        if (c) {
            $cs(b).style.display = c;
        }
        if (a == "auto") {
            $cs(b).style.height = a;
            if ($cs(b + "_title")) {
                $cs(b + "_title").style.display = "block";
            }
        } else {
            if (a < 10) {
                $cs(b).style.height = a + "px";
                $cs(b).style.marginTop = "0px";
                $cs(b).style.marginBottom = "0px";
            } else {
                $cs(b).style.height = a + "px";
                if (this.margin[b]) {
                    $cs(b).style.marginTop = this.margin[b].marginTop + "px";
                }
                if (this.margin[b]) {
                    $cs(b).style.marginBottom = this.margin[b].marginBottom + "px";
                }
                if ($cs(b + "_title")) {
                    $cs(b + "_title").style.display = "block";
                }
            }
        }
        if ($cs(b).dependimpl) {
            $cs(b).dependimpl();
        }
    };
    window.setIfrmHeight = function(b, a, c) {
        if (!$cs(b)) {
            return;
        }
        if (c) {
            $cs(b).style.display = c;
        }
        if (a == "auto") {
            $cs(b).style.height = a;
        } else {
            $cs(b).style.height = a + "px";
        }
    };
})();
var QunarDate = $jsex.exec(function() {
    var b = {
        "2010-01-01": {
            holidayName: "元旦节",
            beforeTime: 3,
            afterTime: 3,
            dayindex: 0
        },
        "2010-02-14": {
            holidayName: "春节",
            beforeTime: 7,
            afterTime: 0,
            dayindex: 0
        },
        "2010-04-05": {
            holidayName: "清明节",
            beforeTime: 3,
            afterTime: 3,
            dayindex: 0
        },
        "2010-05-01": {
            holidayName: "劳动节",
            beforeTime: 3,
            afterTime: 3,
            dayindex: 0
        },
        "2010-06-16": {
            holidayName: "端午节",
            beforeTime: 3,
            afterTime: 3,
            dayindex: 0
        },
        "2010-09-22": {
            holidayName: "中秋节",
            beforeTime: 3,
            afterTime: 3,
            dayindex: 0
        },
        "2010-10-01": {
            holidayName: "国庆节",
            beforeTime: 3,
            afterTime: 0,
            dayindex: 0
        }
    };
    var f = ["今天", "明天", "后天"];
    var i = 24 * 60 * 60 * 1000;
    var h = ["日", "一", "二", "三", "四", "五", "六"];
    var c = {
        week: "周",
        day: "天",
        before: "前",
        after: "后"
    };
    var g = {
        SECOND: "秒",
        MILLISECOND: "毫秒",
        MINUTE: "分钟",
        HOUR: "小时",
        DAY: "天",
        YEAR: "年"
    };
    var a = null;
    var d = null;
    return {
        isHoliday: function(j) {
            return !! b[j];
        },
        parseTimeToNL_et: function(j) {
            if (j >= i) {
                j = i;
            }
            return this.parseTimeToNL(j);
        },
        parseTimeToNL: function(o) {
            var n = o % 1000;
            var m = (o - n) % 60000;
            var k = (o - m * 1000 - n) % 3600000;
            var p = (o - k * 60000 - m * 1000 - n) % (24 * 3600000);
            var j = (o - p * 3600000 - k * 60000 - m * 1000 - n) % (24 * 3600000);
            var l = "";
            if (o < 1000) {
                l = o + g.MILLISECOND;
            } else {
                if (o < 60000) {
                    l = parseInt(o / 1000) + g.SECOND;
                } else {
                    if (o < 3600000) {
                        l = parseInt(o / 60000) + g.MINUTE;
                    } else {
                        if (o < (24 * 3600000)) {
                            l = parseInt(o / 3600000) + g.HOUR;
                        } else {
                            if (o < (365 * 24 * 3600000)) {
                                l = parseInt(o / (24 * 3600000)) + g.DAY;
                            } else {
                                l = parseInt(o / (365 * 24 * 3600000)) + g.YEAR;
                            }
                        }
                    }
                }
            }
            return l;
        },
        plus: function(j, k) {
            return new Date(j.getTime() + k * i);
        },
        today: function() {
            if (a) {
                return a;
            }
            var j = window.SERVER_TIME || new Date();
            return a = new Date(j.getFullYear(), j.getMonth(), j.getDate());
        },
        parse: function(k) {
            var j = k.split("-");
            return new Date(j[0], j[1] - 1, j[2]);
        },
        format: function(j) {
            if (typeof j == "number") {
                j = new Date(j);
            }
            return j.getFullYear() + "-" + this.convert2digit(j.getMonth() + 1) + "-" + this.convert2digit(j.getDate());
        },
        convert2digit: function(j) {
            return j < 10 ? "0" + j: j;
        },
        compareDate: function(k, j) {
            return k.getTime() - j.getTime();
        },
        getFirstDaysOfMonth: function(j) {
            return new Date(j.getFullYear(), j.getMonth(), 1);
        },
        getLastDaysOfMonth: function(j) {
            return new Date(j.getFullYear(), j.getMonth() + 1, 0);
        },
        getDateTip: function(j) {
            var k = this.parse(j);
            var l = (k.getTime() - this.today().getTime()) / 1000 / 3600 / 24;
            var m = "";
            if (l < 3) {
                m = f[l];
            } else {
                this.initDataTable();
                if (d[j]) {
                    m = d[j].holidayName;
                }
            }
            if (m == "") {
                m = c.week + h[k.getDay()];
            }
            return m;
        },
        initDataTable: function() {
            if (d != null) {
                return d;
            }
            d = {};
            for (var t in b) {
                var k = t;
                var o = b[t];
                d[t] = o;
                var n = "";
                var p = "";
                if (o.beforeTime > 0) {
                    for (var l = 1; l <= o.beforeTime; l++) {
                        var r = {};
                        var u = new Date(this.parse(k).getTime() - l * 24 * 3600 * 1000);
                        var m = this.format(u);
                        r.holidayName = o.holidayName + c.before + l + c.day;
                        r.dayindex = o.dayindex;
                        if (!d[m]) {
                            d[m] = r;
                        } else {
                            if ((o.dayindex > d[m].dayindex) && d[m].beforeTime == null) {
                                d[m] = r;
                            }
                        }
                    }
                }
                if (o.afterTime > 0) {
                    for (var l = 1; l <= o.afterTime; l++) {
                        var r = {};
                        var s = new Date(this.parse(k).getTime() + l * 24 * 3600 * 1000);
                        var j = this.format(s);
                        r.holidayName = o.holidayName + c.after + l + c.day;
                        r.dayindex = o.dayindex;
                        if (!d[j]) {
                            d[j] = r;
                        } else {
                            if ((o.dayindex > d[j].dayindex) && d[this.format(new Date(u))].afterTime == null) {
                                d[j] = r;
                            }
                        }
                    }
                }
            }
        }
    };
});
function DateChecker(a, g, f) {
    a = a || 89;
    spanByDate1 = 89;
    g = g || 2;
    f = f || 3;
    var b = QunarDate.today();
    var d = new Date(b.getTime() + a * 24 * 3600000);
    var c = new Date(b.getTime() + g * 24 * 3600000);
    this.date1 = c;
    this.setDate1 = function(h) {
        return this.date1 = this.checkDate1(h).recommendDate;
    };
    this.getDate1 = function() {
        return QunarDate.format(this.date1);
    };
    this.date2 = new Date(c.getTime() + f * 24 * 3600000);
    this.setDate2 = function(i, h) {
        return this.date2 = this.checkDate2(i, QunarDate.format(this.date1), h).recommendDate;
    };
    this.getDate2 = function() {
        return QunarDate.format(this.date2);
    };
    this.checkDate1 = function(h) {
        return this.checkDate(h, b, d, c);
    };
    this.checkDate2 = function(l, j, i) {
        var h = d;
        if (i) {
            h = QunarDate.parse(i);
        }
        var k = new Date(this.date1.getTime() + f * 24 * 3600000);
        if (k.getTime() > h.getTime()) {
            k = h;
        }
        return this.checkDate(l, this.date1, h, k);
    };
    this.checkDate = function(o, l, p, h) {
        var j = null;
        var k = false;
        var i = null;
        var n = "";
        try {
            j = QunarDate.parse(o);
        } catch(m) {
            k = true;
            i = "格式错误";
            n = "日期格式如: " + QunarDate.format(h);
            j = h;
        }
        if (isNaN(j)) {
            k = true;
            i = "格式错误";
            n = "日期格式如: " + QunarDate.format(h);
            j = h;
        } else {
            if (l.getTime() > j.getTime()) {
                k = true;
                i = "超出范围";
                n = "应选择" + QunarDate.format(l) + "至" + QunarDate.format(p) + "之间的日期";
                j = h;
            } else {
                if (j.getTime() > p.getTime()) {
                    k = true;
                    i = "超出范围";
                    n = "应选择" + QunarDate.format(l) + "至" + QunarDate.format(p) + "之间的日期";
                    j = h;
                }
            }
        }
        return {
            error: k,
            recommend: QunarDate.format(j),
            recommendDate: j,
            value: i,
            tip: n
        };
    };
    this.getMin = function() {
        return b;
    };
    this.getMax = function() {
        return d;
    };
    this.resetMax = function(i, j) {
        var k = i || b;
        var h = j || a;
        d = new Date(k.getTime() + h * 24 * 3600000);
    };
    this.setSpan = function(h) {
        a = h;
    };
    this.marks = {};
    this.date2Hide = false;
    this.hideDate2 = function() {
        this.date2Hide = true;
    };
    this.showDate2 = function() {
        this.date2Hide = false;
    };
    this.getTdStyle = function(i, j, h) {
        h = h || d;
        j = j || b;
        var l = i.getTime();
        var k = "";
        if (l == this.date1.getTime()) {
            k += " curr";
        } else {
            if (l == this.date2.getTime() && this.date2Hide == false) {
                k += " othr";
            }
        }
        if (i.getDay() == 0 || i.getDay() == 6 || QunarDate.isHoliday(QunarDate.format(i))) {
            k += " holi";
        }
        if (l == b.getTime()) {
            k += " today";
        }
        if (! (j.getTime() <= l && l <= h.getTime())) {
            k += " out";
        }
        return k;
    };
}
function DateLayer(c, f) {
    this.panel = c;
    this.nodes = [];
    var a = this;
    this.render = function(l, m, s) {
        var m = m || f.getMin();
        var s = s || f.getMax();
        for (var o = 0,
        h = this.nodes.length; o < h; o++) {
            var k = this.nodes[o];
            $jsex.event.clear(k);
        }
        this.nodes = [];
        var g = new UIObject().text('<div class="dpanel">');
        var p = 0;
        var r = 0;
        $jsex.array.each([0, 1],
        function(w, C) {
            var E = new Date(l.getFullYear(), l.getMonth() + w, 1);
            var x = E.getMonth() + 1;
            var y = QunarDate.convert2digit(x);
            var G = E.getFullYear();
            var z = new Date(G, E.getMonth(), 0);
            var v = new Date(G, E.getMonth(), 1);
            var D = new Date(G, E.getMonth() + 1, 1);
            var n = new Date(G, x - 1, 1).getDay() - 1;
            if (n < 0) {
                n = 6;
            }
            var H = new Date(G, x, 0).getDate();
            var A = C == 0 ? m.getTime() <= z.getTime() : D.getTime() <= s.getTime();
            g.text('<div class="dpart dbg', x, '">');
            g.text("<h3>");
            g.append("<span ", "a" + (r++)).text(' class="', (C ? "downTd": "upTd"), '" ym="', (QunarDate.format(C ? v: z)), '" style="', (A ? "display:block": "display:none"), '"></span>', G, "年", x, "月</h3>");
            g.text('<table cellspacing="0" cellpadding="0" border="0">');
            g.text('<tr class="thead"><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td class="holi">六</td><td class="holi">日</td></tr>');
            var F = 0;
            for (var B = 0; B < 42; B++) {
                if (B % 7 == 0) {
                    g.text('<tr class="tdate">');
                }
                if (B < n) {
                    g.text('<td class="cnone">&nbsp;</td>');
                } else {
                    if (F < H) {
                        F++;
                        var J = QunarDate.convert2digit(F);
                        var K = G + "-" + y + "-" + J;
                        var I = new Date(G, x - 1, F);
                        g.append("<td ", p++).text(' value="', K, '" class="', f.getTdStyle(I, m, s), '" >', F, "</td>");
                    } else {
                        g.text('<td class="cnone">&nbsp;</td>');
                    }
                }
                if (B % 7 == 6) {
                    g.text("</tr>");
                }
            }
            g.text("</table></div>");
        });
        g.text("</div>");
        g.write(this.panel);
        function u() {
            var i = this.getAttribute("value");
            var n = QunarDate.parse(i);
            if ((n.getTime() >= m.getTime()) && (n.getTime() <= s.getTime())) {
                $jsex.event.trigger(a, "selected", n);
            }
        }
        function j(i) {
            a.render(QunarDate.parse(this.getAttribute("ym")), m, s);
        }
        for (var o = 0; o < p; o++) {
            var k = g.getDomNode(o);
            $jsex.event.bind(k, "mouseover", b);
            $jsex.event.bind(k, "mouseout", d);
            $jsex.event.bind(k, "click", u);
            this.nodes.push(k);
        }
        for (var o = 0; o < r; o++) {
            var t = g.getDomNode("a" + o);
            $jsex.event.bind(t, "mousedown", j);
            this.nodes.push(t);
        }
    };
    function b(g) {
        $jsex.addClassName(this, "onmouseover");
    }
    function d(g) {
        $jsex.removeClassName(this, "onmouseover");
    }
}
function SearchSwitcher(b, a) {
    this._settings = b || {};
    this._oldtype = null;
    this._memories = {};
    this._state = {};
    if (a) {
        a();
    }
}
SearchSwitcher.prototype.getCurrent = function() {
    return this._newtype;
};
SearchSwitcher.prototype.active = function(b) {
    var a = this._settings[b];
    if (!a) {
        return;
    }
    if (!this._state[b]) {
        this._state[b] = {};
    }
    var c = this._state[b];
    this._newtype = b;
    if (!c.initialized && a.initial) {
        a.initial();
    }
    this.memories(this._oldtype || b);
    if (a.active) {
        a.active();
    }
	this._oldtype = b;
};
SearchSwitcher.prototype.memories = function(c) {
    var a = this._settings.memories;
    if (!a) {
        return;
    }
    for (var b in a) {
        var d = a[b].value();
        if (d) {
            this._memories[c + "_" + b] = a[b].value();
        }
    }
};
SearchSwitcher.prototype.getmem = function(b, a) {
    return this._memories[b + "_" + a] || "";
};
function TabGroup(a) {
    this._contentMAP = {};
    this.setting = a || {};
    this.setting.activeTab = this.setting.activeTab || 0;
    this.setting.activeCls = "active";
    this._initPanels();
    this._bindEvent();
    this.activeTab();
    this.bindedEvent = false;
}
TabGroup.prototype._got = function(a) {
    if (typeof a == "string") {
        return $jsex.$(a);
    } else {
        return a;
    }
};
TabGroup.prototype._initPanels = function() {
    if (!this.setting.panelContainerID) {
        return;
    }
    var a = this.setting.items;
    var g = this._got(this.setting.panelContainerID);
    for (var b = 0; b < a.length; b++) {
        var d = a[b];
        if (d.render && !d.panelID) {
            var f = document.createElement("DIV");
            f.id = "TG_PANEL_" + $jsex.globalID();
            g.appendChild(f);
            $jsex.element.hide(f);
            d.panelID = f.id;
        }
    }
};
TabGroup.prototype.activeTab = function(a) {
    a = a || 0;
    var d = this.setting;
    var b = this.setting.items;
    if (this.currentTab != null && this.currentPanel != null) {
        $jsex.removeClassName(this.currentTab, d.activeCls);
        $jsex.element.hide(this.currentPanel);
    }
    var f = b[a];
    if (!f) {
        return;
    }
    var c = this.currentTab = this._got(f.tabID);
    var g = this.currentPanel = this._got(f.panelID);
    if (f.render && !this._contentMAP[f.panelID]) {
        f.container = g;
        f.render(g);
        this._contentMAP[f.panelID] = true;
    }
    $jsex.addClassName(c, d.activeCls);
    $jsex.element.show(g);
    $jsex.event.trigger(this, "onselected", f);
};
TabGroup.prototype._bindEvent = function() {
    if (this.bindedEvent) {
        return;
    }
    var a = this.setting.items;
    for (var c = 0; c < a.length; c++) {
        var d = a[c];
        var b = this._got(d.tabID);
        $jsex.event.bindDom(b, "mousedown", this,
        function(f) {
            return function() {
                this.activeTab(f);
            };
        } (c));
    }
    this.bindedEvent = true;
};
function DatePickerXCombox(f, g, d) {
    var b = this;
    var a = new ActionDelay(100);
    this.setting = d || {};
    var c = this.fromDateBox = this.setting.fromDateBox || null;
    var h = this.dateChecker = this.setting.dateChecker || null;
    DatePickerXCombox.superclass.constructor.call(this, f, {
        button: {
            mousedown: function(i) {
                this.openMainMenu();
                $jsex.stopEvent(i);
            }
        },
        input: {
            click: function(i) {
                this.openMainMenu();
                $jsex.stopEvent(i);
            },
            change: function(k, i, j) {
                if (!b.fromDateBox) {
                    var l = h.checkDate1(this.getValue());
                    if (!l.error) {
                        h.setDate1(l.recommend);
                        a.reset(function() {
                            $jsex.event.trigger(g, "fromDateChanged");
                        });
                    }
                    this.setTip(l);
                } else {
                    var l = h.checkDate2(this.getValue(), c.getValue(), QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                    if (!l.error) {
                        h.setDate2(l.recommend, QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                        a.reset(function() {
                            $jsex.event.trigger(g, "toDateChanged");
                        });
                    }
                    this.setTip(l);
                }
            },
            keypress: function(i) {
                this.keypress(i, i.keyCode);
            }
        },
        blur: function() {
            if (b.fromDateBox) {
                var i = h.checkDate2(this.getValue(), c.getValue(), QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                h.setDate2(i.recommend, QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                this.setValue(i.recommend);
            } else {
                var i = h.checkDate1(this.getValue());
                h.setDate1(i.recommend);
                this.setValue(i.recommend);
            }
        },
        popups: {
            main: {
                initialize: function() {
                    this.dateLayer = new DateLayer(this.panel, h);
                    var j = this.own;
                    var i = this;
                    $jsex.event.add(this.dateLayer, "selected",
                    function(k) {
                        j.setValue(QunarDate.format(k));
                        i.close();
                    });
                    $jsex.event.add(this, "open",
                    function() {
                        $jsex.event.trigger(b, "openDatepicker");
                    });
                },
                open: function() {
                    if (b.fromDateBox) {
                        h.resetMax(h.date1, 90);
                        var i = h.checkDate2(this.own.getValue(), c.getValue(), QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                        this.dateLayer.render(i.recommendDate, new Date(QunarDate.parse(c.getValue()).getTime()), new Date(QunarDate.plus(h.getMax(), 1)));
                    } else {
                        h.resetMax();
                        var i = h.checkDate1(this.own.getValue());
                        this.dateLayer.render(i.recommendDate, h.getMin());
                    }
                }
            }
        },
        attrs: {
            keypress: function(i, j) {
                switch (j) {
                case 13:
                    if (this.popups.isOpend()) {
                        $jsex.stopEvent(i);
                        this.popups.close();
                    }
                    break;
                case 27:
                    $jsex.stopEvent(i);
                    this.popups.close();
                    break;
                default:
                }
            },
            setTip: function(i) {
                if (b.fromDateBox) {
                    var i = i || h.checkDate2(this.getValue(), c.getValue(), QunarDate.format(QunarDate.plus(h.getMax(), 1)));
                } else {
                    var i = i || h.checkDate1(this.getValue());
                }
                if (i.error) {
                    this.setInfo(i.value, "errtext", i.tip);
                } else {
                    this.setInfo(QunarDate.getDateTip(i.recommend), "", "");
                }
            },
            invalid: function() {
                return $jsex.hasClassName(this.infoPanel, "errtext");
            }
        }
    });
}
$jsex._ex(DatePickerXCombox, XCombox);
var QunarHistory = new
function() {
    var l = this;
    var h = [];
    var d = null;
    var k = null;
    var j = null;
    var c = null;
    this.SFList = null;
    this.DFList = null;
    this.HLList = null;
    this.firstDSF = null;
    this.firstISF = null;
    this.firstDDF = null;
    this.firstIDF = null;
    this.firstChina = null;
    this.firstInter = null;
    this.firstFlight = null;
    this.firstHL = null;
    var b = this.cache = function(m, n) {
        if ((typeof this["_" + m] == "undefined" || this["_" + m] === null) && n) {
            this["_" + m] = n;
        }
        return this["_" + m];
    };
    var f = {
        SF: {
            Type: function() {
                return "SF";
            },
            FromCity: function() {
                return l.cache.call(this, "fromCity") || l.cache.call(this, "formCity", decodeURIComponent(this.fromCity));
            },
            ToCity: function() {
                return l.cache.call(this, "toCity") || l.cache.call(this, "toCity", decodeURIComponent(this.toCity));
            },
            FromDate: function() {
                return l.cache.call(this, "fromDate") || l.cache.call(this, "fromDate", QunarDate.format(this.fromDate));
            },
            FromCountry: function() {
                return l.cache.call(this, "fromCountry") || l.cache.call(this, "fromCountry", decodeURIComponent(this.fromCountry).split("-")[0]);
            },
            ToCountry: function() {
                return l.cache.call(this, "toCountry") || l.cache.call(this, "toCountry", decodeURIComponent(this.fromCountry).split("-")[1]);
            },
            isInter: function() {
                return this.FromCountry() != "中国" || this.ToCountry() != "中国";
            },
            validate: function() {
                return true;
            },
            Timestamp: function() {
                return l.cache.call(this, "timestamp") || l.cache.call(this, "timestamp", parseInt(this.timestamp, 10));
            }
        },
        DF: {
            Type: function() {
                return "DF";
            },
            FromCity: function() {
                return l.cache.call(this, "fromCity") || l.cache.call(this, "formCity", decodeURIComponent(this.fromCity));
            },
            ToCity: function() {
                return l.cache.call(this, "toCity") || l.cache.call(this, "toCity", decodeURIComponent(this.toCity));
            },
            FromDate: function() {
                return l.cache.call(this, "fromDate") || l.cache.call(this, "fromDate", QunarDate.format(this.fromDate));
            },
            ToDate: function() {
                return l.cache.call(this, "toDate") || l.cache.call(this, "toDate", QunarDate.format(this.toDate));
            },
            FromCountry: function() {
                return l.cache.call(this, "fromCountry") || l.cache.call(this, "fromCountry", decodeURIComponent(this.fromCountry).split("-")[0]);
            },
            ToCountry: function() {
                return l.cache.call(this, "toCountry") || l.cache.call(this, "toCountry", decodeURIComponent(this.fromCountry).split("-")[1]);
            },
            isInter: function() {
                return this.FromCountry() != "中国" || this.ToCountry() != "中国";
            },
            validate: function() {
                return true;
            },
            Timestamp: function() {
                return l.cache.call(this, "timestamp") || l.cache.call(this, "timestamp", parseInt(this.timestamp, 10));
            }
        },
        HL: {
            ToCity: function() {
                return l.cache.call(this, "toCity") || l.cache.call(this, "toCity", decodeURIComponent(this.toCity));
            },
            FromDate: function() {
                return l.cache.call(this, "fromDate") || l.cache.call(this, "fromDate", QunarDate.format(this.fromDate));
            },
            ToDate: function() {
                return l.cache.call(this, "toDate") || l.cache.call(this, "toDate", QunarDate.format(this.toDate));
            },
            validate: function() {
                return true;
            }
        }
    };
    var g = function(o, m) {
        var n = l[o];
        if (!n || n.Timestamp() < m.Timestamp()) {
            l[o] = m;
        }
    };
    var a = function(p, m, r) {
        if (!m) {
            return;
        }
        for (var o = 0; o < m.length; o++) {
            for (var n in r) {
                m[o][n] = r[n];
            }
            switch (p) {
            case "SF":
                if (m[o].isInter()) {
                    g("firstISF", m[o]);
                    g("firstInter", m[o]);
                } else {
                    g("firstDSF", m[o]);
                    g("firstChina", m[o]);
                }
                g("firstFlight", m[o]);
                break;
            case "DL":
                if (m[o].isInter()) {
                    g("firstIDF", m[o]);
                    g("firstInter", m[o]);
                } else {
                    g("firstDDF", m[o]);
                    g("firstChina", m[o]);
                }
                g("firstFlight", m[o]);
                break;
            case "HL":
                if (!l.firstHL) {
                    l.firstHL = m[o];
                }
                break;
            }
        }
        return m;
    };
    var i = function(m, n) {
        return - (parseInt(m.timestamp, 10) - parseInt(n.timestamp, 10));
    };
    this.load = function() {
        var m = $jsex.$("ifrmHistory");
        if (m) {
            $jsex.event.bindDom(m, "load", this,
            function() {
                window.jx05CFEventFC.call(this, m);
            });
            m.src = "http://history.qunar.com/history/newhistory.html";
        }
    };
    this.parseQunarHistory = function() {
        this.SFList = a("SF", d.findEntries("SF"), f.SF);
        this.DFList = a("DL", d.findEntries("DL").concat(d.findEntries("IF")), f.DF);
        this.HLList = a("HL", d.findEntries("HL"), f.HL);
        try {
            $jsex.event.trigger(QunarHistory, "onload");
        } catch(m) {}
    };
    window.jx05CFEventFC = function(m) {
        k = m.contentWindow.SFlight;
        j = m.contentWindow.DFlight;
        c = m.contentWindow.HotelDetail;
        d = m.contentWindow.QunarHistory;
        this.parseQunarHistory();
    };
};
var DabaoWeather = new(function() {
    var a = this;
    this.outtime = 2000;
    this._cityInfo = false;
    this._cacheData = {};
    this._defalutCity = "北京";
    this._cityList = {
        "北京": "Beijing",
        "上海": "Shanghai",
        "广州": "Guangzhou",
        "成都": "Chengdu",
        "武汉": "Wuhan",
        "深圳": "Shenzhen",
        "昆明": "Kunming",
        "三亚": "Sanya",
        "重庆": "Chongqing",
        "长沙": "Changsha",
        "西安": "Xian",
        "济南": "Jinan",
        "长春": "Changchun",
        "郑州": "Zhengzhou",
        "杭州": "Hangzhou"
    };
    this._tempData = {
        now: {
            temperature: "24/30",
            humidity: "湿度： 89%",
            wind: "风向： 北、风力：≤3级",
            weather: "多云",
            icon: "http://source.qunar.com/weatherimg/mostly_cloudy.gif"
        },
        all: {
            today: {
                mintemperature: 24,
                maxtemperature: 30,
                weather: "多云",
                icon: "http://source.qunar.com/weatherimg/mostly_cloudy.gif"
            },
            tomorrow: {
                mintemperature: 26,
                maxtemperature: 34,
                weather: "晴间多云",
                icon: "http://source.qunar.com/weatherimg/mostly_sunny.gif"
            },
            aftertomorrow: {
                mintemperature: 26,
                maxtemperature: 34,
                weather: "晴间多云",
                icon: "http://source.qunar.com/weatherimg/mostly_sunny.gif"
            }
        }
    };
    this.load = function() {
        if (!this._cityInfo) {
            this._request = new ScriptRequest({
                callbackName: "callback",
                oncomplete: function(b) {
                    a._loadWeather(b);
                },
                ontimeout: function() {
                    if (!a._cityInfo) {
                        a._loadWeather({
                            city: "广州"
                        });
                        a._request.cancel();
                    }
                }
            });
            this._request.send("http://api.qunar.com/ips.jcp");
        } else {
            this._loadWeather(this._cityInfo);
        }
    };
    this._loadWeather = function(c) {
        this._cityInfo = c;
        this._city = c.city;
        if (!this._cityList[this._city]) {
            this._city = this._defalutCity;
        }
        var b = new ScriptRequest({
            callbackName: "callback",
            oncomplete: function(d) {
                a._showWeather(d);
            }
        });
        b.send("http://ws.qunar.com/weatherjson_spf.jcp?city=" + this._cityList[this._city] + "&n=" + parseInt(Math.random() * 10000));
    };
    this._showWeather = function(b) {
        if (!b || b == "") {
            return;
        }
        this._cacheData = b;
        var c = {
            wdata: this._cacheData,
            city: this._city
        };
        $jsex.$("weatherInfo").innerHTML = this._weatherTemplateInfo(c);
        $jsex.$("weatherSoon").innerHTML = this._weatherTemplateSoon(c);
        $jsex.element.show($jsex.$("weatherPannel"));
    };
    this._weatherTemplateInfo = function(b) {
        return ['<b class="hl">', b.city, "</b> ", b.wdata.now.temperature, "℃ ", b.wdata.now.weather, " <br /><span>紫外线指数：", b.wdata.now.spf, "</span>"].join("");
    };
    this._weatherTemplateSoon = function(b) {
        return ['<li><img title="', b.wdata.all.today.weather, '" src="', b.wdata.all.today.icon, '" width="24" height="24" />今天<br />', b.wdata.all.today.mintemperature, "/", b.wdata.all.today.maxtemperature, '℃</li><li><img title="', b.wdata.all.tomorrow.weather, '" src="', b.wdata.all.tomorrow.icon, '" width="24" height="24" />明天<br />', b.wdata.all.tomorrow.mintemperature, "/", b.wdata.all.tomorrow.maxtemperature, "℃</li>"].join("");
    };
})();
var SpecialFlightTicketModule = new
function() {
    this.name = "国内特价机票";
    this.lpUrl = "http://ws.qunar.com/lowerPrice.jcp";
    var c = null;
    var b = this;
    this.currentTab = null;
    this.dealsSearch = function() {
        c = new ScriptRequest({
            oncomplete: function(f) {
                b.showLowPrice(f);
            },
            callbackName: "callback"
        });
        c.send(this.lpUrl);
    };
    var d = function(h) {
        var g = ['<ul class="qn_tabs">'];
        var i = 0;
        for (var f in h.cities) {
            g.push('<li class="', (i == 0 ? "active": ""), '">', '<a href="#" hidefocus="on">', h.cities[f], "</a></li>");
            i++;
        }
        g.push('<li class="more"><a href="http://flight.qunar.com/site/lplist.htm" target="_blank">更多</a></li>', "</ul>", '<div class="qn_title">国内特价机票</div>');
        return g.join("");
    };
    var a = function(j) {
        var i = [];
        var h = encodeURIComponent(j.deptCity);
        i.push('<ul class="fList">');
        for (var g in j.lines1) {
            var f = j.lines1[g];
            i.push('<li><a title="&yen;', f.price, " ", j.deptCity, "-", f.arrCity, " ", f.date, " ", f.discount, '折" href="', f.url, '" target="_blank" hidefocus="on"><span class="pr">&yen;', f.price, '</span><span class="date">', f.date, '</span><span class="dis">', f.discount, "折</span>", j.dcCity, "-", f.arrCity, "</a></li>");
        }
        i.push("</ul>");
        i.push('<ul class="fList">');
        for (var g in j.lines2) {
            var f = j.lines2[g];
            i.push('<li><a title="&yen;', f.price, " ", j.deptCity, "-", f.arrCity, " ", f.date, " ", f.discount, '折" href="', f.url, '" target="_blank" hidefocus="on"><span class="pr">&yen;', f.price, '</span><span class="date">', f.date, '</span><span class="dis">', f.discount, "折</span>", j.dcCity, "-", f.arrCity, "</a></li>");
        }
        i.push("</ul>");
        i.push('<p class="subs"><span><a href="http://flight.qunar.com/site/lplist.htm?dcity=', h, '&from=tejia_i_ct" target="_blank">查看全部', j.deptCity, '特价机票</a></span><a href="http://user.qunar.com/login.jsp?ret=http%3A%2F%2Fuser.qunar.com%2Findex.jsp%23subscribe" target="_blank">您还可以预约未来多日特价机票</a></p>');
        return i.join("");
    };
    this.showLowPrice = function(m) {
        try {
            var x = m.ipCity || "";
            var v = m.data;
            var k = [];
            for (var g in m.data) {
                if (g == x) {
                    k.unshift(g);
                } else {
                    k.push(g);
                }
            }
            var p = $jsex.$("dFightTitle");
            var n = d({
                cities: k
            });
            p.innerHTML = n;
            for (var z in m.data) {
                var y = m.data[z].records;
                var l = z;
                for (var s = 0; s < y.length; s++) {
                    var o = y[s];
                    o.fromDate = o.date;
                    o.url = "http://www.qunar.com/twell/flight/Search.jsp?fromCity=" + encodeURIComponent(l) + "&toCity=" + encodeURIComponent(o.arrCity) + "&fromDate=" + o.date + "&toDate=" + o.date + "&searchType=OnewayFlight&from=indexdeals";
                    o.date = o.date.replace(/\d\d\d\d-(\d\d)-(\d\d)/ig, "$1月$2日");
                }
            }
            var w = function(D) {
                var C = v[D].records;
                var A = C.slice(0, 12);
                var i = C.slice(12, 24);
                var B = D.substring(0, 2);
                return {
                    deptCity: D,
                    lines1: A,
                    lines2: i,
                    dcCity: B
                };
            };
            var j = $jsex.$("dFlightContent");
            var r = w(k[0]);
            var f = a(r);
            j.innerHTML = (f);
            var u = p.getElementsByTagName("a");
            for (var s = 0; s < u.length; s++) {
                var h = u[s];
                $jsex.event.bindDom(h, "click", h,
                function(A) {
                    var B = this.innerHTML;
                    if (B == "更多") {
                        return;
                    }
                    var i = a(w(B));
                    j.innerHTML = (i);
                    if (b.currentTab) {
                        $jsex.removeClassName(b.currentTab.parentNode, "active");
                    } else {
                        $jsex.removeClassName(u[0].parentNode, "active");
                    }
                    b.currentTab = this;
                    $jsex.addClassName(this.parentNode, "active");
                    $jsex.stopEvent(A);
                });
            }
        } catch(t) {
			if($jsex.$("dFlight")){
            	$jsex.$("dFlight").style.display = "none";
			}
        } finally {
			if($jsex.$("dFlight")){
            	$jsex.$("dFlight").style.display = "block";
			}
        }
    };
};
function FlightSuggestItemListLayer(a) {
    this.popup = a;
    this.cursor = -1;
    this.nodes = [];
}
FlightSuggestItemListLayer.prototype.error = function() {
    var a = new UIObject();
    a.append("<table", "suggestList", ' class="ill" cellspacing="0" cellpadding="0" >');
    a.text('<tr class="illrow error">', "<td>对不起，不支持该目的地</td>", "</tr>");
    a.write(this.popup.panel);
};
FlightSuggestItemListLayer.prototype.refresh = function(g) {
    this.cursor = -1;
    if (this.nodes.length > 0) {
        for (var h = 0; h < this.nodes.length; h++) {
            var d = this.nodes[h];
            d.item = null;
            d.layer = null;
            $jsex.event.clear(d);
        }
    }
    this.nodes.length = 0;
    var k = g.q;
    var j = g.result;
    var l = g.userInput;
    var a = new RegExp("(" + l + ")", "i");
    var c = new UIObject();
    c.append("<table", "suggestList", ' class="ill" cellspacing="0" cellpadding="0" >');
    for (var h = 0; h < j.length; h++) {
        var f = j[h];
        var m = (f.type == 4) ? "nearbyAirport": "";
        c.text('<tr class="illrow ', m, '"', ">");
        c.append("<td ", h).text(' class="illn" hashkey="', f.key, '"', ((f.type == 1) ? 'noAirport="true"': ""), ">", ((f.type == 4) ? "·邻近机场:": ""), ((f.type == 9) ? "·相关城市:": ""), f.display.replace(a, '<span class="keystring">$1</span>'), ((f.type == 9) ? "<span>(" + f.enname + ")</span>": ""), ((f.length) ? "<span>-" + f.length + "公里</span>": ""), ((f.type == 1) ? "-该城市没有机场": ""), ((f.type == 2) ? "-该地区的机场有": ""), ((f.type == 6) ? "-该景点没有机场": ""), ((f.type == 7) ? "-该目的地为省份": ""), ((f.type == 8) ? "-该目的地为国家": ""), "</td>");
        c.text("</tr>");
    }
    c.text("</table>");
    c.write(this.popup.panel);
    var b = this.nodes;
    for (var h = 0; h < j.length; h++) {
        var d = c.getDomNode(h);
        d.item = j[h];
        d.layer = this;
        d.idx = h;
        b[h] = d;
        $jsex.event.bind(d, "mouseover", this.mouseover);
        $jsex.event.bind(d, "click", this.click);
    }
};
FlightSuggestItemListLayer.prototype.mouseover = function(a) {
    if (this.item.type == 1 || this.item.type == 6 || this.item.type == 7 || this.item.type == 8) {
        return;
    }
    this.layer.enter(this.idx);
};
FlightSuggestItemListLayer.prototype.click = function(a) {
    this.layer.select(this.idx, true);
	getMinPrice();
};
FlightSuggestItemListLayer.prototype.select = function(a, b) {
    $jsex.event.trigger(this, "select", a, b);
};
FlightSuggestItemListLayer.prototype.enter = function(a) {
    for (var b = 0; b < this.nodes.length; b++) {
        $jsex.removeClassName(this.nodes[b].parentNode, "tllover");
    }
    if (a > -1) {
        var c = this.nodes[a].item;
        if (c.type == 1 || c.type == 6 || c.type == 7 || c.type == 8) {
            a++;
        }
        $jsex.addClassName(this.nodes[a].parentNode, "tllover");
        this.cursor = a;
    }
};
FlightSuggestItemListLayer.prototype.moveCursor = function(c, b) {
    if (this.nodes.length == 0) {
        return;
    }
    if (this.cursor == -1 && c == -1) {
        this.cursor = this.nodes.length - 1;
    } else {
        var a = this.nodes[this.cursor + c];
        if (a) {
            if (a.item.type == 1 || a.item.type == 6 || a.item.type == 7 || a.item.type == 8) {
                c *= 2;
            }
        }
        this.cursor += c;
        if (this.cursor < -1 || this.cursor >= this.nodes.length) {
            this.cursor = -1;
        }
    }
    this.enter(this.cursor);
    if (b) {
        this.select(this.cursor);
    }
};
function FlightCityXCombox(c, d, b) {
    var g = new Date();
    var a = this;
    this.country = "中国";
    this.setting = b || {};
    var f = new ScriptRequest({
        oncomplete: function(h) {
            a.suggLoaded(h);
        },
        callbackName: "callback"
    });
    FlightCityXCombox.superclass.constructor.call(this, c, {
        button: {
            mousedown: function(h) {
                this.openMainMenu();
                $jsex.stopEvent(h);
            }
        },
        input: {
            change: function(k, i, j) {
                if (!j) {
                    this.vidx = -1;
                    this.inputold = k;
                    k = k.replace(/[~!@#\$%\^&\*\(\)_\+<>\?:\\\\"\|\{\}`,\.\/;'\\\{\}]+/ig, "");
                    if (k) {
                        var h = this.popups.get("suggest");
                        h && h.layer && (h.layer.cursor = -1);
                        f.cancel();
                        if (this.cache[k]) {
                            a.suggLoaded(this.cache[k]);
                        } else {
                            f.send("http://www.qunar.com/suggest/livesearch2.jsp?lang=zh&q=" + encodeURIComponent(k) + "&sa=true");
                        }
                    } else {
                        this.popups.close();
                    }
                } else {
                    $jsex.event.trigger(d, "cityfinished", this.getValue());
                }
            },
            keypress: function(h) {
                this.keypress(h, h.keyCode);
            }
        },
        focus: function() {
            this.inputEl.select();
        },
        blur: function() {
            if (this.vidx == -1) {
                var h = this.popups.get("suggest");
                if (h && h.layer && (h.layer.cursor > -1)) {
                    try {
                        this.setCountry(h.layer.nodes[h.layer.cursor].item.country);
                        this.setValue(h.layer.nodes[h.layer.cursor].item.key);
                    } catch(i) {}
                }
            } else {
                if (this.getValue() == "") {
                    this.setTip();
                }
            }
        },
        popups: {
            main: {
                initialize: function() {
                    var p = a.getHotCityConfig("tabs");
                    var m = a.getHotCityConfig("contents");
                    var h = [];
                    var k = new UIObject();
                    var r = "__flightcitybox_" + $jsex.globalID();
                    var o = function(i) {
                        return function(x) {
                            var t = [];
                            var w = m[i].cityList;
                            t.push("<ul>");
                            for (var u = 0; u < w.length; u++) {
                                var v = w[u];
                                t.push('<li country="' + v.country + '" key="' + v.name + '"><a href="#nogo#">' + v.name + "</a></li>");
                            }
                            t.push("</ul>");
                            x.innerHTML = t.join("");
                            if (m[i].cls) {
                                $jsex.$(r).className = m[i].cls;
                            }
                        };
                    };
                    k.text('<div class="cityinput" hotcitytype="1"><div class="hint">').append("<img", "close", ' class="closeImg" src="http://source.qunar.com/site/images/new_main/Button_Hotcity_Close.gif"/>').append("<span ", "title", ">热门城市</span>").append("<span>(<span ", "desc").text(' class="CIunderline">可直接输入城市或城市拼音</span>)</span>', "<hr/>", '<div class="hotCityNav">');
                    for (var n = 0; n < p.length; n++) {
                        var j = "tab_" + n + $jsex.globalID();
                        h.push({
                            tabID: j,
                            tabname: p[n],
                            render: o(p[n])
                        });
                        k.text('<span id="', j, '" key="', p[n], '"');
                        if (n == 0) {
                            k.text(' class="active" ');
                        }
                        k.text(">", p[n], "</span>");
                    }
                    k.text("</div>", '<div id="', r, '"></div>', "</div>");
                    k.write(this.panel);
                    var l = new TabGroup({
                        panelContainerID: r,
                        items: h
                    });
                    $jsex.event.bind(l, "onselected",
                    function(t) {
                        var i = m[t.tabname];
                        k.getDomNode("title").innerHTML = i.title;
                        k.getDomNode("desc").innerHTML = i.desc;
                        if (i.cls) {
                            $jsex.$(r).className = i.cls;
                        } else {
                            $jsex.$(r).className = "";
                        }
                    });
                    $jsex.event.add(this, "open",
                    function() {
                        $jsex.event.trigger(a, "openHotCity");
                    });
                    var s = this.own;
                    $jsex.event.bindDom($jsex.$(r), "mousedown", this,
                    function(i, t) {
                        if (i.target.tagName == "A") {
                            var u = $jsex.trim(i.target.innerHTML);
                            s.setCountry(i.target.parentNode.getAttribute("country"));
                            s.popups.close();
                            s.setValue(u);
                            s.setInfo("");
                            $jsex.event.trigger(a, "selectHotCity", u);
                            a._invalid = false;
							getMinPrice();
                        }
                    });
                    $jsex.event.bind(k.getDomNode("close"), "click",
                    function() {
                        s.popups.close();
                    });
                },
                open: function() {
                    this.own.setInfo("");
                }
            },
            suggest: {
                initialize: function() {
                    this.layer = new FlightSuggestItemListLayer(this);
                    $jsex.event.bind(this.layer, "select",
                    function(h, i) {
                        if (h > -1) {
                            this.popup.own.setCountry(this.nodes[h].item.country);
                        }
                        if (h > -1) {
                            i ? this.popup.own.setValue(this.nodes[h].item.key) : this.popup.own.volateValue(this.nodes[h].item.key);
                        } else {
                            i ? this.popup.own.initValue(this.popup.own.inputold) : this.popup.own.volateValue(this.popup.own.inputold);
                        }
                        this.popup.own.vidx = h;
                        if (i) {
                            this.popup.close();
                        }
                    });
                }
            }
        },
        attrs: {
            setTip: function() {
                if (this.getValue() == "") {
                    this.setInfo((this.info || "城市名"), "infotext");
                } else {
                    this.setInfo("");
                }
            },
            clear: function() {
                var h = this.popups.get("suggest");
                h && h.layer && (h.layer.cursor = -1);
                this.setValue("");
                this.setTip();
            },
            getHotCityConfig: function(i) {
                var h = this.setting.hotCityConfig;
                if (h && h[i]) {
                    return h[i];
                }
            },
            setHotCityConfig: function(h) {
                this.setting.hotCityConfig = h;
            },
            invalid: function() {
                return this._invalid;
            },
            cache: {},
            suggLoaded: function(h) {
                if (h) {
                    this.cache[h.userInput] = h;
                }
                if (!h || !h.result || h.result.length == 0) {
                    this.setInfo("");
                    h.q = h.userInput;
                    var i = this.popups.open("suggest");
                    i.layer.error();
                    this._invalid = true;
                    return;
                }
                this._invalid = false;
                this.setInfo("");
                h.q = h.userInput;
                var i = this.popups.open("suggest");
                i.layer.refresh(h);
                i.layer.enter(0);
            },
            keypress: function(i, j) {
                if (this._invalid) {
                    return;
                }
                var h = this.popups.get("suggest");
                if (!h || !h.isOpend()) {
                    return;
                }
                switch (j) {
                case 40:
                    h.layer.moveCursor(1, true);
                    break;
                case 38:
                    h.layer.moveCursor( - 1, true);
                    break;
                case 13:
                    $jsex.stopEvent(i);
                    h.layer.select(h.layer.cursor, true);
                    h.close();
                    break;
                default:
                }
            }
        }
    });
}
$jsex._ex(FlightCityXCombox, XCombox);
FlightCityXCombox.prototype.setCountry = function(a) {
    this.country = a;
};
FlightCityXCombox.prototype.getCountry = function(a) {
    return this.country;
};
function domesticFlightSearch(c, g) {
    this.type = "domestic";
    var b = this;
    var d = FlightLang;
    var g = new DateChecker(210);
    this.sswitcher = null;
    this.form = c;
    c.from.value = "qunarindex";
    var l = this.fromCity = new FlightCityXCombox(c.fromCity, b);
    l.setHotCityConfig(d.hotCityConfig.domestic);
    var j = this.toCity = new FlightCityXCombox(c.toCity, b);
    j.setHotCityConfig(d.hotCityConfig.domestic);
    var k = this.fromDate = new DatePickerXCombox(c.fromDate, b, {
        dateChecker: g
    });
    var h = this.toDate = new DatePickerXCombox(c.toDate, b, {
        dateChecker: g,
        fromDateBox: k
    });
    this.setHistoryRecord = function(o) {
        var n = o;
        if (!n) {
            return;
        }
        if (!n.validate || !n.validate()) {
            return;
        }
        l.setCountry(n.FromCountry());
        l.setValue(n.FromCity());
        l.setTip();
        j.setCountry(n.ToCountry());
        j.setValue(n.ToCity());
        j.setTip();
        k.setValue(n.FromDate());
        k.setTip();
        if (n.ToDate && n.ToDate()) {
            h.setValue(n.ToDate());
            h.setTip();
        }
        $jsex.event.trigger(k, "blur");
        if (n.Type() == "DF") {
            $jsex.$("searchTypeRnd").checked = true;
            this.sswitcher.active("roundtrip");
        } else {
            $jsex.$("searchTypeSng").checked = true;
            this.sswitcher.active("oneway");
        }
    };
    $jsex.event.add(this, "fromDateChanged",
    function() {
        var o = g.checkDate1(k.getValue()).recommend;
        var n = g.checkDate2(h.getValue(), o, QunarDate.format(QunarDate.plus(g.getMax(), 1))).recommend;
        g.setDate2(n, QunarDate.format(QunarDate.plus(g.getMax(), 1)));
        h.setValue(n);
    });
    $jsex.event.addEx([l, j], "openHotCity",
    function() {
        $jsex.event.trigger(b, "openHotCity");
    });
    $jsex.event.addEx([l, j], "selectHotCity",
    function(n) {
        $jsex.event.trigger(b, "selectHotCity", n);
    });
    $jsex.event.addEx([k, h], "openDatepicker",
    function() {
        $jsex.event.trigger(b, "openDatepicker");
    });
    var f = new ActionDelay(200);
    function a() {
        f.reset(function() {
            $jsex.event.trigger(b, "dateFinish");
        });
    }
    $jsex.event.addEx([l, j], "valuechange",
    function(o, n, p) {
        if (p) {
            $jsex.event.trigger(b, "citychange", this.inputEl.name, o);
        }
    });
    $jsex.event.add(this, "fromDateChanged", a);
    $jsex.event.add(this, "toDateChanged", a);
    $jsex.event.bindDom(c, "submit", this,
    function(n) {
        if ((l.invalid() || j.invalid()) || ((!l.getValue() || !j.getValue()) && b.searchType != "lowestprice")) {
            $jsex.stopEvent(n);
            return false;
        }
        $jsex.event.trigger(b, "pre_submit");
    });
    l.setTip();
    j.setTip();
    k.setValue(g.getDate1());
    k.setTip();
    h.setValue(g.getDate2());
    h.setTip();
    var i = {
        memories: {
            fromCity: {
                value: function() {
                    return l.getValue();
                }
            },
            toCity: {
                value: function() {
                    return j.getValue();
                }
            }
        },
        oneway: {
            initial: function() {},
            active: function() {
                l.info = "城市名";
                j.info = "城市名";
                l.setValue(m.getmem("oneway", "fromCity"));
                j.setValue(m.getmem("oneway", "toCity"));
                l.setTip();
                j.setTip();
                g.setSpan(210);
                g.hideDate2();
                //$jsex.addClassName($jsex.$("pingxing_china"), "pxroundtrip");
                $jsex.$("dIpuntFrom").style.visibility = "hidden";
                $jsex.element.hide($jsex.$("arrivalDateDiv"));
                c.from.value = "qunarindex";
                $jsex.event.trigger(b, "switch", b, "oneway");
            }
        },
        roundtrip: {
            initial: function() {},
            active: function() {
                l.info = "城市名";
                j.info = "城市名";
                l.setValue(m.getmem("oneway", "fromCity"));
                j.setValue(m.getmem("oneway", "toCity"));
                l.setTip();
                j.setTip();
                g.setSpan(210);
                g.showDate2();
                //$jsex.removeClassName($jsex.$("pingxing_china"), "pxroundtrip");
                $jsex.$("dIpuntFrom").style.visibility = "visible";
                $jsex.element.show($jsex.$("arrivalDateDiv"));
                c.from.value = "qunarindex";
                $jsex.event.trigger(b, "switch", b, "roundtrip");
            }
        },
        lowestprice: {
            initial: function() {},
            active: function() {
                l.info = "城市名(可不填)";
                j.info = "城市名(可不填)";
                l.clear();
                j.clear();
                g.setSpan(90);
                g.showDate2();
                $jsex.removeClassName($jsex.$("pingxing_china"), "pxroundtrip");
                $jsex.$("dIpuntFrom").style.visibility = "visible";
                $jsex.element.show($jsex.$("arrivalDateDiv"));
                c.from.value = "tejia_fi";
                $jsex.event.trigger(b, "switch", b, "lowestprice");
            }
        }
    };
    var m = this.sswitcher = new SearchSwitcher(i,
    function() {
        for (var o = 0,
        p = c.searchType.length; o < p; o++) { (function(n) {
                $jsex.event.bindDom(c.searchType[n], "click", c.searchType[n],
                function() {
                    switch (this.id) {
                    case "searchTypeSng":
                        m.active("oneway");
                        b.searchType = "oneway";
                        break;
                    case "searchTypeRnd":
                        m.active("roundtrip");
                        b.searchType = "searchTypeRnd";
                        break;
                    case "searchTypeDeals":
                        m.active("lowestprice");
                        b.searchType = "lowestprice";
                        break;
                    }
                });
            })(o);
        }
    });
    m.active("oneway");
}
function internationalFlightSearch(c, g) {
    this.type = "international";
    var b = this;
    var d = FlightLang;
    var g = new DateChecker(210);
    this.sswitcher = null;
    this.form = c;
    c.from.value = "qunarindex";
    var l = this.fromCity = new FlightCityXCombox(c.fromCity, b);
    l.setHotCityConfig(d.hotCityConfig["international-from"]);
    var j = this.toCity = new FlightCityXCombox(c.toCity, b);
    j.setHotCityConfig(d.hotCityConfig["international-to"]);
    var k = this.fromDate = new DatePickerXCombox(c.fromDate, b, {
        dateChecker: g
    });
    var h = this.toDate = new DatePickerXCombox(c.toDate, b, {
        dateChecker: g,
        fromDateBox: k
    });
    this.setHistoryRecord = function(o) {
        var n = o;
        if (!n) {
            return;
        }
        if (!n.validate || !n.validate()) {
            return;
        }
        l.setCountry(n.FromCountry());
        l.setValue(n.FromCity());
        l.setTip();
        j.setCountry(n.ToCountry());
        j.setValue(n.ToCity());
        j.setTip();
        k.setValue(n.FromDate());
        k.setTip();
        if (n.ToDate && n.ToDate()) {
            h.setValue(n.ToDate());
            h.setTip();
        }
        $jsex.event.trigger(k, "blur");
        if (n.Type() == "DF") {
            $jsex.$("searchTypeInterRnd").checked = true;
            this.sswitcher.active("roundtrip");
        } else {
            $jsex.$("searchTypeInterSng").checked = true;
            this.sswitcher.active("oneway");
        }
    };
    l.setTip();
    j.setTip();
    k.setValue(g.getDate1());
    k.setTip();
    h.setValue(g.getDate2());
    h.setTip();
    $jsex.event.addEx([l, j], "openHotCity",
    function() {
        $jsex.event.trigger(b, "openHotCity");
    });
    $jsex.event.addEx([l, j], "selectHotCity",
    function(n) {
        $jsex.event.trigger(b, "selectHotCity", n);
    });
    $jsex.event.addEx([k, h], "openDatepicker",
    function() {
        $jsex.event.trigger(b, "openDatepicker");
    });
    $jsex.event.add(this, "fromDateChanged",
    function() {
        var o = g.checkDate1(k.getValue()).recommend;
        var n = g.checkDate2(h.getValue(), o, QunarDate.format(QunarDate.plus(g.getMax(), 1))).recommend;
        g.setDate2(n, QunarDate.format(QunarDate.plus(g.getMax(), 1)));
        h.setValue(n);
    });
    $jsex.event.addEx([l, j], "valuechange",
    function(o, n, p) {
        if (p) {
            $jsex.event.trigger(b, "citychange", this.inputEl.name, o);
        }
    });
    var f = new ActionDelay(200);
    function a() {
        f.reset(function() {
            $jsex.event.trigger(b, "dateFinish");
        });
    }
    $jsex.event.add(this, "fromDateChanged", a);
    $jsex.event.add(this, "toDateChanged", a);
    $jsex.event.bindDom(c, "submit", this,
    function(n) {
        if (l.invalid() || j.invalid() || !l.getValue() || !j.getValue()) {
            $jsex.stopEvent(n);
            return false;
        }
        $jsex.event.trigger(b, "pre_submit");
    });
    var i = {
        memories: {
            fromCity: {
                value: function() {
                    return l.getValue();
                }
            },
            toCity: {
                value: function() {
                    return j.getValue();
                }
            }
        },
        oneway: {
            initial: function() {},
            active: function() {
                l.setTip();
                j.setTip();
                g.hideDate2();
                $jsex.addClassName($jsex.$("pingxing_inter"), "pxroundtrip");
                $jsex.$("dIpuntInterFrom").style.visibility = "hidden";
                $jsex.element.hide($jsex.$("arrivalDateInterDiv"));
                c.from.value = "qunarindex";
                $jsex.event.trigger(b, "switch", b, "oneway");
            }
        },
        roundtrip: {
            initial: function() {},
            active: function() {
                l.setTip();
                j.setTip();
                g.showDate2();
                $jsex.removeClassName($jsex.$("pingxing_inter"), "pxroundtrip");
                $jsex.$("dIpuntInterFrom").style.visibility = "visible";
                $jsex.element.show($jsex.$("arrivalDateInterDiv"));
                c.from.value = "qunarindex";
                $jsex.event.trigger(b, "switch", b, "roundtrip");
            }
        }
    };
    var m = this.sswitcher = new SearchSwitcher(i,
    function() {
        for (var o = 0,
        p = c.searchType.length; o < p; o++) { (function(n) {
                $jsex.event.bindDom(c.searchType[n], "click", c.searchType[n],
                function() {
                    switch (this.id) {
                    case "searchTypeInterSng":
                        m.active("oneway");
                        break;
                    case "searchTypeInterRnd":
                        m.active("roundtrip");
                        break;
                    }
                });
            })(o);
        }
    });
    m.active("oneway");
}
function ItemListLayer(a, b) {
    this.popup = a;
    this.nodes = [];
    this.cursor = -1;
    if (b.select) {
        $jsex.event.add(this, "select", b.select);
    }
}
ItemListLayer.prototype.error = function() {
    var a = new UIObject();
    a.append("<table", "suggestList", ' class="ill" cellspacing="0" cellpadding="0" >');
    a.text('<tr class="illrow error">', "<td>暂未收录</td>", "</tr>");
    a.write(this.popup.panel);
};
ItemListLayer.prototype.refresh = function(f) {
    this.cursor = -1;
    if (this.nodes.length > 0) {
        for (var g = 0; g < this.nodes.length; g++) {
            var d = this.nodes[g];
            d.item = null;
            d.layer = null;
            $jsex.event.clear(d);
        }
    }
    this.nodes.length = 0;
    var j = f.q;
    var h = f.result;
    var k = f.userInput;
    var a = new RegExp("(" + k + ")", "i");
    var c = new UIObject();
    c.text('<table class="ill" cellspacing="0" cellpadding="0">');
    for (var g = 0; g < h.length; g++) {
        var l = h[g].display || h[g].key;
        l = l.replace(a, '<span class="keystring">$1</span>');
        c.append('<tr class="illrow"', g, ">").text('<td class="illn">', l, '</td><td class="illt">', h[g].tip || "", "</td>", "</tr>");
    }
    c.text("</table>");
    c.write(this.popup.panel);
    var b = this.nodes;
    for (var g = 0; g < h.length; g++) {
        var d = c.getDomNode(g);
        d.item = h[g];
        d.layer = this;
        d.idx = g;
        b[g] = d;
        $jsex.event.bind(d, "mouseover", this.mouseover);
        $jsex.event.bind(d, "click", this.click);
    }
};
ItemListLayer.prototype.mouseover = function(a) {
    this.layer.enter(this.idx);
};
ItemListLayer.prototype.click = function(a) {
    this.layer.select(this.idx, true);
};
ItemListLayer.prototype.select = function(a, b) {
    $jsex.event.trigger(this, "select", a, b);
};
ItemListLayer.prototype.enter = function(a) {
    for (var b = 0; b < this.nodes.length; b++) {
        $jsex.removeClassName(this.nodes[b], "tllover");
    }
    if (a > -1) {
        $jsex.addClassName(this.nodes[a], "tllover");
        this.cursor = a;
    }
};
ItemListLayer.prototype.moveCursor = function(b, a) {
    if (this.nodes.length == 0) {
        return;
    }
    if (this.cursor == -1 && b == -1) {
        this.cursor = this.nodes.length - 1;
    } else {
        this.cursor += b;
        if (this.cursor < -1 || this.cursor >= this.nodes.length) {
            this.cursor = -1;
        }
    }
    this.enter(this.cursor);
    if (a) {
        this.select(this.cursor);
    }
};
function HotelSearchForm(f, c) {
    this.type = "hotel";
    c = c || {};
    this._invalid = false;
    var l = this;
    var s = HotelLang.hotCityConfig;
    var o, d, g, r;
    var f = f;
    f.from.value = "qunarindex";
    var n = QunarDate.format(QunarDate.today().getTime() + 2 * 24 * 60 * 60 * 1000);
    var m = QunarDate.format(QunarDate.today().getTime() + 3 * 24 * 60 * 60 * 1000);
    this.setHistoryRecord = function(u) {
        var t = u;
        if (!t) {
            return;
        }
        if (!t.validate || !t.validate()) {
            return;
        }
        o.initValue(t.ToCity());
        o.setTip();
        g.setValue(t.FromDate());
        g.setTip();
        r.setValue(t.ToDate());
        r.setTip();
        $jsex.event.trigger(g, "blur");
    };
    var k = new DateChecker(89, 2, 1);
    k.setDate1(n);
    k.setDate2(m, QunarDate.format(QunarDate.plus(k.getMax(), 1)));
    var b = new ScriptRequest({
        oncomplete: function(t) {
            o.suggLoaded(t);
        },
        callbackName: "callback"
    });
    o = this.toCity = new XCombox(f.toCity, {
        button: {
            mousedown: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            }
        },
        input: {
            change: function(w, u, v) {
                if (!v) {
                    this.vidx = -1;
                    this.inputold = w;
                    w = w.replace(/[~!@#\$%\^&\*\(\)_\+<>\?:\\\\"\|\{\}`,\.\/;'\\\{\}]+/ig, "");
                    if (w) {
                        var t = this.popups.get("suggest");
                        t && t.layer && (t.layer.cursor = -1);
                        b.cancel();
                        if (this.cache[w]) {
                            this.suggLoaded(this.cache[w]);
                        } else {
                            b.send("http://hotel.qunar.com/suggest/livesearch.jsp?lang=zh&q=" + encodeURIComponent(w) + "&sa=false");
                        }
                    } else {
                        this.popups.close();
                    }
                } else {
                    if (d.city != w) {
                        d.setValue("");
                        d.setTip();
                    }
                    $jsex.event.trigger(l, "cityfinished", this.getValue());
                }
            },
            keypress: function(t) {
                this.keypress(t, t.keyCode);
            }
        },
        focus: function() {
            this.inputEl.select();
        },
        blur: function() {
            if (this.vidx == -1) {
                var t = this.popups.get("suggest");
                if (t && t.layer && (t.layer.cursor > -1)) {
                    this.setValue(t.layer.nodes[t.layer.cursor].item.key);
                }
            } else {
                if (this.getValue() == "") {
                    this.setTip();
                }
            }
            if (d.city != this.getValue()) {
                d.setValue("");
                d.setTip();
            }
        },
        popups: {
            main: {
                initialize: function() {
                    var y = s.list;
                    var u = s.number;
                    var w = new UIObject().text('<div class="cityinput cityinput_hotel" hotcitytype="1"><div class="hint">').append("<img", "close", ' class="closeImg" src="http://source.qunar.com/site/images/new_main/Button_Hotcity_Close.gif"/>').text('<span class="">Top ', y.length, "热门城市</span>", '<span class=""> (<span class="CIunderline">直接输入可搜索', u, "个城市</span>)</span>", "<hr/><ul>");
                    for (var v = 0; v < y.length; v++) {
                        w.text("<li>");
                        w.append("<a ", v).text(' href="javascript:void(0);">', y[v], "</a></li>");
                    }
                    w.text('<div class="clear"></div>', "</ul>", "</div></div>");
                    w.write(this.panel);
                    var t = this.own;
                    for (var v = 0; v < y.length; v++) {
                        var x = w.getDomNode(v);
                        $jsex.event.bind(x, "click",
                        function() {
                            var z = $jsex.trim(this.innerHTML);
                            t.setValue(z);
                            t.setInfo("");
                            t.popups.close();
                            $jsex.event.trigger(l, "selectHotCity", z);
                        });
                    }
                    $jsex.event.bind(w.getDomNode("close"), "click",
                    function() {
                        t.popups.close();
                    });
                    $jsex.event.add(this, "open",
                    function() {
                        $jsex.event.trigger(l, "openHotCity");
                    });
                },
                open: function() {
                    this.own.setInfo("");
                }
            },
            suggest: {
                initialize: function() {
                    this.layer = new ItemListLayer(this, {
                        select: function(t, u) {
                            if (t > -1) {
                                u ? this.popup.own.setValue(this.nodes[t].item.key) : this.popup.own.volateValue(this.nodes[t].item.key);
                            } else {
                                u ? this.popup.own.initValue(this.popup.own.inputold) : this.popup.own.volateValue(this.popup.own.inputold);
                            }
                            this.popup.own.vidx = t;
                            if (u) {
                                this.popup.close();
                            }
                        }
                    });
                }
            }
        },
        attrs: {
            setTip: function() {
                if (this.getValue() == "") {
                    this.setInfo(("城市名" || this.info), "infotext");
                } else {
                    this.setInfo("");
                }
            },
            suggRequest: new ScriptRequest({
                oncomplete: function(t) {
                    o.dataLoaded(t);
                },
                callbackName: "callback"
            }),
            invalid: function() {
                return this._invalid;
            },
            cache: {},
            suggLoaded: function(t) {
                if (t) {
                    this.cache[t.userInput] = t;
                }
                if (!t || !t.result || t.result.length == 0) {
                    var u = this.popups.open("suggest");
                    u.layer.error();
                    this._invalid = true;
                    return;
                }
                this._invalid = false;
                this.setInfo("");
                t.q = t.userInput;
                var u = this.popups.open("suggest");
                u.layer.refresh(t);
                u.layer.enter(0);
            },
            keypress: function(u, v) {
                if (this._invalid) {
                    return;
                }
                var t = this.popups.get("suggest");
                if (!t || !t.isOpend()) {
                    return;
                }
                switch (v) {
                case 40:
                    t.layer.moveCursor(1, true);
                    break;
                case 38:
                    t.layer.moveCursor( - 1, true);
                    break;
                case 13:
                    $jsex.stopEvent(u);
                    t.layer.select(t.layer.cursor, true);
                    t.close();
                    break;
                default:
                }
            }
        }
    });
    var h = new ScriptRequest({
        oncomplete: function(t, u) {
            d.listLoaded(t, u);
        }
    });
    var j = new ScriptRequest({
        oncomplete: function(t) {
            d.suggLoaded(t);
        },
        callbackName: "callback"
    });
    var d = this.q = new XCombox(f.q, {
        button: {
            mousedown: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            }
        },
        input: {
            click: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            },
            change: function(v, t, u) {
                if (!u) {
                    this.inputold = v;
                    if (v) {
                        j.send("http://hsuggest.qunar.com/suggestion/do.jsp?city=" + encodeURI(o.getValue()) + "&q=" + encodeURIComponent(v));
                        this.popups.close("main");
                    } else {
                        this.popups.open("main");
                    }
                }
            },
            keypress: function(t) {
                this.keypress(t, t.keyCode);
            }
        },
        focus: function() {
            this.city = o.getValue();
            this.setInfo("");
            this.inputEl.select();
        },
        popups: {
            main: {
                open: function() {
                    this.panel.innerHTML = "";
                    if (!o.invalid()) {
                        var t = o.getValue();
                        if (this.own.cache[t]) {
                            this.own.listLoaded(this.own.cache[t], encodeURI(o.getValue()));
                        } else {
                            h.send("http://hotel.qunar.com/sugg.jsp?v=1&city=" + encodeURI(o.getValue()));
                        }
                    } else {
                        this.close();
                    }
                }
            },
            suggest: {
                initialize: function() {
                    this.layer = new ItemListLayer(this, {
                        select: function(t, u) {
                            if (t > -1) {
                                u ? this.popup.own.setValue(this.nodes[t].item.key) : this.popup.own.volateValue(this.nodes[t].item.key);
                            } else {
                                u ? this.popup.own.initValue(this.popup.own.inputold) : this.popup.own.volateValue(this.popup.own.inputold);
                            }
                            this.popup.own.vidx = t;
                            if (u) {
                                this.popup.close();
                                $jsex.event.trigger(l, "qsug");
                                f.from.value = "qunarindex|sug";
                            }
                        }
                    });
                }
            }
        },
        blur: function() {
            this.setTip();
        },
        attrs: {
            setValue: function() {
                XCombox.prototype.setValue.apply(this, arguments);
                this.setTip();
            },
            setTip: function() {
                if (this.getValue() == "") {
                    this.setInfo("输入酒店名称、品牌或地址", "infotext");
                } else {
                    this.setInfo("");
                }
            },
            keypress: function(u, v) {
                var t = this.popups.get("suggest");
                if (!t || !t.isOpend()) {
                    return;
                }
                switch (v) {
                case 40:
                    t.layer.moveCursor(1, true);
                    break;
                case 38:
                    t.layer.moveCursor( - 1, true);
                    break;
                case 13:
                    $jsex.stopEvent(u);
                    t.layer.select(t.layer.cursor, true);
                    $jsex.event.trigger(l, "qsug");
                    f.from.value = "qunarindex|sug";
                    t.close();
                    break;
                default:
                }
            },
            cache: {},
            listLoaded: function(x, y) {
                this.cache[decodeURI(y)] = x;
                if (o.getValue() == decodeURI(y)) {
                    var v = this;
                    var t = this.popups.get("main");
                    t.panel.innerHTML = x.replace(/onmousedown="return searchword\(.*\)"/ig, "");
                    var u = t.panel.getElementsByTagName("a");
                    for (var w = 0,
                    z = u.length; w < z; w++) {
                        u[w].onclick = function() {
                            v.setValue($jsex.trim(this.innerHTML));
                            v.popups.close();
                            $jsex.event.trigger(l, "qdiv");
                            f.from.value = "qunarindex|div";
                        };
                    }
                } else {
                    this.popups.close("main");
                }
            },
            suggLoaded: function(t) {
                if (!t || !t.result || t.result.length == 0) {
                    this.popups.close("suggest");
                } else {
                    t.q = t.userInput;
                    var u = this.popups.open("suggest");
                    u.layer.refresh(t);
                }
            }
        }
    });
    var p = new ActionDelay(100);
    g = this.fromDate = new XCombox(f.fromDate, {
        button: {
            mousedown: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            }
        },
        input: {
            click: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            },
            change: function(v, t, u) {
                var w = k.checkDate1(this.getValue());
                if (!w.error) {
                    k.setDate1(w.recommend);
                    p.reset(function() {
                        $jsex.event.trigger(l, "fromDateChanged");
                    });
                }
                this.setTip(w);
            },
            keypress: function(t) {
                this.keypress(t, t.keyCode);
            }
        },
        blur: function() {
            var t = k.checkDate1(this.getValue());
            k.setDate1(t.recommend);
            this.setValue(t.recommend);
        },
        popups: {
            main: {
                initialize: function() {
                    this.dateLayer = new DateLayer(this.panel, k);
                    var u = this.own;
                    var t = this;
                    $jsex.event.add(this.dateLayer, "selected",
                    function(v) {
                        u.setValue(QunarDate.format(v));
                        t.close();
                    });
                    $jsex.event.add(this, "open",
                    function() {
                        $jsex.event.trigger(l, "openDatepicker");
                    });
                },
                open: function() {
                    var t = k.checkDate1(this.own.getValue());
                    this.dateLayer.render(t.recommendDate, k.getMin());
                }
            }
        },
        attrs: {
            keypress: function(t, u) {
                switch (u) {
                case 13:
                    if (this.popups.isOpend()) {
                        $jsex.stopEvent(t);
                        this.popups.close();
                    }
                    break;
                case 27:
                    $jsex.stopEvent(t);
                    this.popups.close();
                    break;
                default:
                }
            },
            setTip: function(t) {
                var t = t || k.checkDate1(this.getValue());
                if (t.error) {
                    this.setInfo(t.value, "errtext", t.tip);
                } else {
                    this.setInfo(QunarDate.getDateTip(t.recommend), "", "");
                }
            },
            invalid: function() {
                return $jsex.hasClassName(this.infoPanel, "errtext");
            }
        }
    });
    r = this.toDate = new XCombox(f.toDate, {
        button: {
            mousedown: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            }
        },
        input: {
            click: function(t) {
                this.openMainMenu();
                $jsex.stopEvent(t);
            },
            change: function(v, t, u) {
                var w = k.checkDate2(this.getValue(), g.getValue(), QunarDate.format(QunarDate.plus(k.getMax(), 1)));
                if (!w.error) {
                    k.setDate2(w.recommend, QunarDate.format(QunarDate.plus(k.getMax(), 1)));
                    p.reset(function() {
                        $jsex.event.trigger(l, "toDateChanged");
                    });
                }
                this.setTip(w);
            },
            keypress: function(t) {
                this.keypress(t, t.keyCode);
            }
        },
        blur: function() {
            var t = k.checkDate2(this.getValue(), g.getValue(), QunarDate.format(QunarDate.plus(k.getMax(), 1)));
            k.setDate2(t.recommend, QunarDate.format(QunarDate.plus(k.getMax(), 1)));
            this.setValue(t.recommend);
        },
        popups: {
            main: {
                initialize: function() {
                    this.dateLayer = new DateLayer(this.panel, k);
                    var u = this.own;
                    var t = this;
                    $jsex.event.add(this.dateLayer, "selected",
                    function(v) {
                        u.setValue(QunarDate.format(v));
                        t.close();
                    });
                    $jsex.event.add(this, "open",
                    function() {
                        $jsex.event.trigger(l, "openDatepicker");
                    });
                },
                open: function() {
                    var t = k.checkDate2(this.own.getValue(), g.getValue(), QunarDate.format(QunarDate.plus(k.getMax(), 1)));
                    this.dateLayer.render(t.recommendDate, new Date(QunarDate.parse(g.getValue()).getTime() + 24 * 3600 * 1000), new Date(QunarDate.plus(k.getMax(), 1)));
                }
            }
        },
        attrs: {
            keypress: function(t, u) {
                switch (u) {
                case 13:
                    if (this.popups.isOpend()) {
                        $jsex.stopEvent(t);
                        this.popups.close();
                    }
                    break;
                case 27:
                    $jsex.stopEvent(t);
                    this.popups.close();
                    break;
                default:
                }
            },
            setTip: function(t) {
                var t = t || k.checkDate2(this.getValue(), g.getValue(), QunarDate.format(QunarDate.plus(k.getMax(), 1)));
                if (t.error) {
                    this.setInfo(t.value, "errtext", t.tip);
                } else {
                    this.setInfo(QunarDate.getDateTip(t.recommend), "", "");
                }
            },
            invalid: function() {
                return $jsex.hasClassName(this.infoPanel, "errtext");
            }
        }
    });
    o.setTip();
    g.initValue(k.getDate1());
    g.setTip();
    r.initValue(k.getDate2());
    r.setTip();
    if (c.q) {
        d.initValue(q);
        d.city = o.getValue();
    } else {
        d.setTip();
    }
    $jsex.event.bindDom(f, "submit", this,
    function(t) {
        if (o.invalid() || o.getValue() == "") {
            $jsex.stopEvent(t);
            return false;
        }
        $jsex.event.trigger(l, "pre_submit");
    });
    $jsex.event.add(this, "fromDateChanged",
    function() {
        var u = k.checkDate1(g.getValue()).recommend;
        var t = k.checkDate2(r.getValue(), u, QunarDate.format(QunarDate.plus(k.getMax(), 1))).recommend;
        k.setDate2(t, QunarDate.format(QunarDate.plus(k.getMax(), 1)));
        r.setValue(t);
    });
    var i = new ActionDelay(200);
    function a() {
        i.reset(function() {
            $jsex.event.trigger(l, "dateFinish");
        });
    }
    $jsex.event.add(this, "fromDateChanged", a);
    $jsex.event.add(this, "toDateChanged", a);
	
} (function() {
    function b(g, f) {
        var d = f.parentNode;
        if (d.lastChild == f) {
            d.appendChild(g);
        } else {
            d.insertBefore(g, f.nextSibling);
        }
    }
    function a(g, f) {
        var h;
        function d() {
            var i = g.value;
            if (i != h) {
                f();
            }
            h = i;
        }
        g.setValue = function(i) {
            g.value = i;
            d();
        };
        Event.observe(g, document.all ? "keydown": "keypress", d);
        setInterval(d, 50);
    }
    var c = window.HotelSuggest = function(p, d) {
        var i = {
            infovalue: "酒店名称或者地址"
        };
        if (d) {
            for (var g in d) {
                i[g] = d[g];
            }
        }
        var l = $(p);
        var t = l.value = i.infovalue;
        l.setAttribute("infovalue", t);
        var j = function() {
            var x = l.value.trim();
            if (x == t) {
                l.value = "";
                l.removeClassName("infotext");
            }
        };
        var u = function() {
            var x = l.value.trim();
            if (x == "") {
                l.value = t;
                l.addClassName("infotext");
            }
        };
        Event.observe(l, "focus", j);
        var w = document.createElement("div");
        w.id = "jxHotPanel";
        w.className = "keywordTips";
        w.style.display = "none";
        w.innerHTML = "";
        b(w, l);
        var w = $(w);
        var v = {};
        var s = "北京";
        var o = {};
        var k = {};
        this.getTypeHash = function() {
            return o;
        };
        var f = function(z) {
            if (z) {
                var C = v[s];
                if (C && (l.value == "" || l.value == t)) {
                    w.innerHTML = '<div class="topTips">' + C + "</div>";
                    if (!k[s]) {
                        var y = w.getElementsByTagName("a");
                        for (var B = 0; B < y.length; B++) {
                            var E = y[B];
                            if (E.onmousedown) {
                                var x = E.onmousedown.toString();
                                var A = E.innerHTML.stripTags();
                                var D = x.replace(/\D/g, "");
                                o[A] = D;
                            }
                        }
                        if (y.length > 0) {
                            k[s] = {};
                        }
                    }
                    if ((l.value.trim() == 0) && (C.length > 0)) {
                        w.show();
                    }
                } else {
                    if ((s.length > 0) && (!(C === ""))) {
                        new Ajax.Request("http://hotel.qunar.com/sugg.jsp", {
                            crossSite: true,
                            removeScriptElement: true,
                            method: "get",
                            parameters: "__jscallback=hotelSuggest.retrieve&city=" + encodeURIComponent(s)
                        });
                    }
                }
            } else {
                w.hide();
            }
        };
        this.retrieve = function(x) {
            if (arguments.length > 0) {
                v[s] = x;
                f(true);
            } else {
                v[s] = "";
            }
        };
        var h = function() {
            if (l.value == "") {
                l.value = l.getAttribute("infovalue");
            }
            if (l.value == l.getAttribute("infovalue")) {
                l.addClassName("infotext");
            }
            r();
            f(false);
        };
        var r = this.click = function() {};
        var m = false;
        var n = $("jxHotPanel");
        Event.observe(n, document.all ? "mouseenter": "mouseover",
        function() {
            m = true;
        });
        Event.observe(n, document.all ? "mouseleave": "mouseout",
        function() {
            m = false;
        });
        Event.observe(n, "click",
        function() {
            l.focus();
        });
        Event.observe(l, "blur",
        function() {
            if (!m) {
                h();
            }
        });
        l.onfocus = function() {
            var x = l.getAttribute("infovalue");
            l.removeClassName("infotext");
            if (l.value == x) {
                l.value = "";
            }
            l.select();
        };
        a(l,
        function() {
            if (l.value && l.value != l.getAttribute("infovalue")) {
                f(false);
            } else {
                if (l.value == "" || l.value == t) {
                    f(true);
                }
            }
        });
        this.orignal = function() {
            var x = l.getAttribute("infovalue");
            if (x) {
                l.value = x;
                l.addClassName("infotext");
            }
        };
        this.setCity = function(x) {
            s = x;
        };
        this.hide = function() {
            w.show();
        };
        this.show = function() {
            w.show();
        };
    };
})(); (function() {
    var o = null;
    var i = null;
    var n = null;
    var c = null;
    function k() {
        c = new TabGroup({
            items: [{
                tabID: "chinaLine",
                panelID: "chinaPanel",
                render: function() {
                    o = new domesticFlightSearch($jsex.$("jipiaoform"));
                    o.alsoSearch = [r, a];
                    s(o);
                    o.setHistoryRecord(QunarHistory.firstChina);
                }
            },
            {
                tabID: "interLine",
                panelID: "interPanel",
                render: function() {
                    i = new internationalFlightSearch($jsex.$("hotelform"));
                    i.alsoSearch = [b, f];
                    s(i);
                    i.setHistoryRecord(QunarHistory.firstInter);
                }
            }]
        });
        $jsex.event.add(c, "onselected",
        function(w) {
            var v = (w.tabID == "chinaLine" ? o: i);
            h(v);
        });
    }
    function h(w) {
        if (!w || !w.sswitcher) {
            return;
        }
        if (w.sswitcher.getCurrent() == "oneway") {
            $jsex.element.hide($jsex.$("pxhotel"));
        } else {
            var v = w.checkAlsoSearch();
            if (v) {
                $jsex.element.show($jsex.$("pxhotel"));
            } else {
                $jsex.element.hide($jsex.$("pxhotel"));
            }
        }
    }
    function s(v) {
        v.checkAlsoSearch = function() {
            if (!v.alsoSearch) {
                return;
            }
            for (var x = 0; x < v.alsoSearch.length; x++) {
                var w = v.alsoSearch[x];
                w.form = v;
                if (w.isActive()) {
                    w.active();
                    return w;
                } else {
                    w.hide();
                }
            }
            return null;
        };
        $jsex.event.add(v, "openHotCity",
        function() {
            trackAction("QH|HCT|open");
        });
        $jsex.event.add(v, "selectHotCity",
        function(w) {
            trackAction("QH|HCT|select|" + encodeURIComponent(w));
        });
        $jsex.event.add(v, "openDatepicker",
        function() {
            trackAction("QH|DP|open");
        });
		if($jsex.$("hSearchForm")){
			checkHotels();
			fixHotelHotUrl();
		}
		$jsex.event.add(v, "fromDateChanged",
        function() {
			if($jsex.$("hSearchForm")){
				fixHotelHotUrl();
			}
            this.checkAlsoSearch();
            h(v);
        });
		$jsex.event.add(v, "toDateChanged",
        function() {
			if($jsex.$("hSearchForm")){
				fixHotelHotUrl();
			}
            this.checkAlsoSearch();
            h(v);
        });
        $jsex.event.add(v, "citychange",
        function(w, x) {
            this.checkAlsoSearch();
            h(v);
        });
		if($jsex.$("hSearchForm")){
			$jsex.event.add(v, "cityfinished",
			function() {
				setTimeout(function() {
					checkHotels()
				},
				0)
			});
		}
        $jsex.event.add(v, "pre_submit",
        function() {
            window.SUBMIT_FORM = true;
            var w = this.checkAlsoSearch();
            if (w) {
                w.action();
            }
            h(v);
        });
        $jsex.event.add(v, "switch",
        function(x, w) {
            this.checkAlsoSearch();
            h(x);
        });
    }
    function p() {
		if($jsex.$("hSearchForm")){
        	n = new HotelSearchForm($jsex.$("hSearchForm"));
        	s(n);
		}
    }
    function u() {
        var w = navigator.appName;
        var y = navigator.appVersion;
        var v = y.split(";");
        var x = v[1].replace(/[ ]/g, "");
        if (w == "Microsoft Internet Explorer" && x == "MSIE6.0") {
            $jsex.addClassName(document.getElementsByTagName("body")[0], "jx-ie6");
        }
    }
    function l() {
        $jsex.event.add(QunarHistory, "onload",
        function() {
            if (!QunarHistory.firstFlight || QunarHistory.firstFlight.isInter() == false) {
                c.activeTab(0);
            } else {
                c.activeTab(1);
            }
            if (o) {
                o.setHistoryRecord(QunarHistory.firstChina);
            }
            if (i) {
                i.setHistoryRecord(QunarHistory.firstInter);
            }
            if (n) {
                n.setHistoryRecord(QunarHistory.firstHL);
            }
        });
        QunarHistory.load();
    }
    function d() {
        var v = "ver=" + __QUNARVER__;
		if($jsex.$("hSearchForm")){
			window.hotelRec_onload = function() {
				if($jsex.$("hotelRec_fake")){
					$jsex.$("hotelRec_fake").style.display = "none";
				}
			};
			$jsex.$("hotelRom").src = "http://hotel.qunar.com/recommandHotels.htm?frmid=hotelRom&" + v;
		}
        ADManager.load();
    }
    var m = function(w, v) {
        this.id = w;
        this.form = null;
        this.checked = true;
        if (v.checked != null) {
            this.checked = v.checked;
        }
        var v = this.opts = v;
        this.isActive = v.isActive ||
        function() {};
        this.visible = function() {
            return $jsex.$(v.container).style.display != "none";
        };
        this.render = function() {
            if (window.SUBMIT_FORM) {
                return;
            }
            $jsex.$(v.container).innerHTML = ["<strong>同时搜索</strong>", '<input type="checkbox" id="alsosearchchk_', w, '" ', v.checkit ? (v.checkit.call(this) ? 'checked="checked"': "") : (this.checked ? 'checked="checked"': ""), " />", '<label for="alsosearchchk_', w, '">', v.title, "</label>"].join("");
            var x = this;
            $jsex.event.bindDom($jsex.$("alsosearchchk_" + w), "click", $jsex.$("alsosearchchk_" + w),
            function() {
                x.checked = this.checked;
            });
        };
        this.active = function() {
			var x = $jsex.$(v.container);
            this.render();
            $jsex.element.show(x);
        };
        this.hide = function() {
            var x = $jsex.$(v.container);
            $jsex.element.hide(x);
        };
        this.action = function() {
            var C = $jsex.$(v.container);
            var x = $jsex.$("alsosearchchk_" + w);
            if (C.style.display != "none" && x.checked == true) {
                try {
                    var B = window.screen.availHeight * 1;
                    var A = window.screen.availWidth * 1;
                    var z = window.open("about:blank", "qunar", "scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes,titlebar=yes,toolbar=yes,width=" + Math.round(A) + ",height=" + Math.round(B));
                    z.blur();
                    z.opener.focus();
                    z.location = v.url;
                } catch(y) {}
            }
        };
    };
    var j = function(v) {
        this.parseD = function(x) {
            x = x.toLowerCase();
            if (x.indexOf("t+") >= 0) {
                var w = this.today();
                return w + (parseInt(x.replace("t+", ""), 10) * 86400000);
            } else {
                return new Date(x.replace(/-/g, "/")).getTime();
            }
        };
        this.checkFromCity = function(w) {
            if (!v.fc) {
                return true;
            }
            return v.fc == w;
        };
        this.checkToCity = function(w) {
            if (!v.tc) {
                return true;
            }
            return v.tc == w;
        };
        this.checkDate = function(w) {
            if (!v.d1 || !v.d2) {
                return true;
            }
            var x = new Date(w.replace(/-/g, "/")).getTime();
            return this.parseD(v.d1) <= x && x <= this.parseD(v.d2);
        };
    };
    j.parseTime = j.prototype.parseTime = function(v) {
        var w = new Date(v);
        return w.getFullYear() + "-" + (w.getMonth() + 1) + "-" + w.getDate();
    };
    j.today = j.prototype.today = function() {
        var w = window.SERVER_TIME || new Date();
        var v = new Date(w.getFullYear(), w.getMonth(), w.getDate()).getTime();
        return v;
    };
    var g = function(v) {
        this.config = v;
        this.check = function(y) {
            for (var x = 0; x < v.length; x++) {
                var w = new j(v[x]);
                if (w.checkFromCity(y.fromCity.getValue()) && w.checkToCity(y.toCity.getValue()) && w.checkDate(y.fromDate.getValue())) {
                    return true;
                }
            }
            return false;
        };
    };
    var t = new g(alsoSearchConfig.ana);
    var r = new m("singepo_china", {
        container: "pingxing_china",
        title: "新加坡酒店",
        url: "http://hotel.qunar.com/city/singapore_city/",
        isActive: function() {
            return (this.form.toCity.getValue() == "新加坡");
        }
    });
    var a = new m("ana_china", {
        container: "pingxing_china",
        title: "美女乘全日空日本游",
        checked: false,
        url: "http://www.qunar.com/twell/flight/redirect.jsp?url=http://www.anabeautytrip.com?utm_medium=cpc?id=anatrip",
        isActive: function() {
            if (!this.form.form.searchType[0].checked) {
                return false;
            }
            if (j.today() < 1280073600000) {
                return false;
            }
            if (this.form.fromCity.getCountry() == "中国" && this.form.toCity.getCountry() == "中国") {
                return false;
            }
            return true;
        },
        checkit: function() {
            if (j.today() < new Date("2010/09/29").getTime()) {
                if (this.form.fromCity.getValue() == "北京" && this.form.toCity.getValue() == "大阪") {
                    return true;
                } else {
                    return false;
                }
            }
        }
    });
    var b = new m("singepo_inter", {
        container: "pingxing_inter",
        title: "新加坡酒店",
        url: "http://hotel.qunar.com/city/singapore_city/",
        isActive: function() {
            return (this.form.toCity.getValue() == "新加坡");
        }
    });
    var f = new m("ana_inter", {
        container: "pingxing_inter",
        title: "美女乘全日空日本游",
        checked: false,
        url: "http://www.qunar.com/twell/flight/redirect.jsp?url=http://www.anabeautytrip.com?utm_medium=cpc?id=anatrip",
        isActive: function() {
            if (!this.form.form.searchType[0].checked) {
                return false;
            }
            if (j.today() < 1280073600000) {
                return false;
            }
            if (this.form.fromCity.getCountry() == "中国" && this.form.toCity.getCountry() == "中国") {
                return false;
            }
            return true;
        },
        checkit: function() {
            if (j.today() < new Date("2010/09/29").getTime()) {
                if (this.form.fromCity.getValue() == "北京" && this.form.toCity.getValue() == "大阪") {
                    return true;
                } else {
                    return false;
                }
            }
        }
    });
    u();
    k();
    p();
	if($jsex.$("hSearchForm")){	
    	d();
	}
	l();
	
    SpecialFlightTicketModule.dealsSearch();
    if ((SERVER_TIME.getTime() >= new Date(2010, 4, 27).getTime()) && (SERVER_TIME.getTime() < new Date(2010, 6, 3, 14).getTime())) {
        DabaoWeather.load();
    }
    trackAction("QH|domload|" + (new Date().getTime() - CLIENT_TIME.getTime()) / 1000, null, true);
    $jsex.event.bindDom(window, "load", window,
    function() {
        trackAction("QH|load|" + (new Date().getTime() - CLIENT_TIME.getTime()) / 1000, null, true);
    });
    trackAction("QH|search|" + (new Date().getTime() - CLIENT_TIME.getTime()) / 1000, null, true);
})();

function fixHotelHotUrl() {
    var e = ["prices", "grades", "pois"];
    var d = document.getElementById("fromDate_hotel").value,c = document.getElementById("toDate_hotel").value;
    for (var b = 0; b < e.length; ++b) {
        var a = $jsex.$("dl" + e[b].charAt(0).toUpperCase() + e[b].substring(1)).getElementsByTagName("dd")[0];
        $jsex.array.each(a.getElementsByTagName("a"),
        function(f) {
            hrefByDate(f, d, c)
        })
    }
}
function hrefByDate(b, e, d) {
    var c = b.getAttribute("vhref");
    if (c.indexOf("fromDate") == -1) {
        c = c + "&fromDate=" + e
    } else {
        c = c.replace(/fromDate=[^&]*/g, "fromDate=" + e)
    }
    if (c.indexOf("toDate") == -1) {
        c = c + "&toDate=" + d
    } else {
        c = c.replace(/toDate=[^&]*/g, "toDate=" + d)
    }
    b.href = c
}
function checkHotels() {
    ScriptRequest.loadScript("/hotelHot.jsp?city=" + encodeURI($jsex.$("hSearchForm").toCity.value))
}

function onSummaryLoaded(k) {
    var h = document.getElementById("fromDate_hotel").value;
    var d = document.getElementById("toDate_hotel").value;
    var g = "fromDate=" + h + "&toDate=" + d;
    try {
        var j = "";
        var a = ["prices", "grades", "pois", "brands"];
        for (var b = 0; b < a.length; ++b) {
            var c = $jsex.$("dl" + a[b].charAt(0).toUpperCase() + a[b].substring(1));
            if (fillDd(c.getElementsByTagName("dd")[0], k[a[b]], k.cityUrl, g, j, b + 2)) {
                $jsex.removeClassName(c, "hidden")
            } else {
                $jsex.addClassName(c, "hidden")
            }
        }
        $jsex.$("hotelHotTable").style.display = "block";
        return true
    } catch(f) {
        return false
    }
}
function onNoSummaryLoaded() {
    try {
        $jsex.$("hotelHotTable").style.display = "none"
    } catch(a) {}
}
function fillDd(m, h, e, g, k, l) {
    var b = [],
    d = m.getAttribute("limit");
    if (d <= 0) {
        d = 5
    }
    if (!h || 0 == h.length) {
        m.innerHTML = "";
        return false
    } else {
        if (4 == l) {
            var j = 0;
            for (var f = 0; f < h.length && f < d; ++f) {
                j += h[f].count
            }
            if (0 == j) {
                d = parseInt(d) + 1;
                l = 7
            }
        }
        for (var f = 0; f < h.length && f < d; ++f) {
            var c = h[f];
            //var a = "/city/" + e + "/" + c.url + "#" + c.param + "&" + g + "&from=" + k + "IHot" + l + "." + (f + 1);
			var a;
			if(c.param == ""){
				a = "/Hotel/Hotel-List.asp?toCityPinYin=" + e.replace("_city","") + "&q=" + encodeURI(c.name) + "&" + g;
			}else{
				a = "/Hotel/Hotel-List.asp?toCityPinYin=" + e.replace("_city","") + "&" + c.param + "&" + g;
			}
            b.push("<span><a vhref=", a, " href=", a, ' target="_blank">' + c.name + "</a>");
            if (c.count > 0) {
                b.push("(" + c.count + "家)")
            }
            b.push("</span> ")
        }
        m.innerHTML = b.join("");
        return true
    }
}

