if(document.getElementById('main_search_js')){
	var js_src=trim(document.getElementById('main_search_js').src);
	base_page=js_src.substring(js_src.indexOf('base_page')+10);
}

var citycodelistmore=new Array("PEK","SHA","CAN","SZX","CTU","XIY","HGH","HRB","WUH","CSX","TSN","SHE","CGQ","DLC","TAO","TNA","CGO","TYN","NKG","SJW","NGB","FOC","XMN","ZUH","HAK","KHN","HFE","NNG");
var citynamelistmore=new Array("北京","上海","广州","深圳","成都","西安","杭州","哈尔滨","武汉","长沙","天津","沈阳","长春","大连","青岛","济南","郑州","太原","南京","石家庄","宁波","福州","厦门","珠海","海口","南昌","合肥","南宁");
var cities={"a":[{"a":"\u963f\u514b\u82cf","b":"AKeSu","c":"AKU"},{"a":"\u963f\u52d2\u6cf0","b":"ALeTai","c":"AAT"},{"a":"\u5b89\u5eb7","b":"AnKang","c":"AKA"},{"a":"\u5b89\u5e86","b":"AnQing","c":"AQG"},{"a":"\u978d\u5c71","b":"AnShan","c":"AOG"},{"a":"\u5b89\u987a","b":"AnShun","c":"AVA"},{"a":"\u5b89\u9633","b":"AnYang","c":"AYN"}],"b":[{"a":"\u5305\u5934","b":"BaoTou","c":"BAV"},{"a":"\u5317\u6d77","b":"BeiHai","c":"BHY"},{"a":"\u5317\u4eac\u5357\u82d1","b":"BeiJingNanYuan","c":"NAY"},{"a":"\u5317\u4eac","b":"BeiJingShouDu","c":"PEK"},{"a":"\u868c\u57e0","b":"BengBu","c":"BFU"}],"c":[{"a":"\u957f\u6625","b":"ChangChun","c":"CGQ"},{"a":"\u5e38\u5fb7","b":"ChangDe","c":"CGD"},{"a":"\u660c\u90fd","b":"ChangDu","c":"BPX"},{"a":"\u957f\u6d77","b":"ChangHai","c":"CNI"},{"a":"\u957f\u6c99","b":"ChangSha","c":"CSX"},{"a":"\u957f\u6cbb","b":"ChangZhi","c":"CIH"},{"a":"\u5e38\u5dde","b":"ChangZhou","c":"CZX"},{"a":"\u671d\u9633","b":"ChaoYang","c":"CHG"},{"a":"\u627f\u5fb7","b":"ChengDe","c":"CEH"},{"a":"\u6210\u90fd","b":"ChengDu","c":"CTU"},{"a":"\u8d64\u5cf0","b":"ChiFeng","c":"CIF"},{"a":"\u91cd\u5e86","b":"ChongQing","c":"CKG"}],"d":[{"a":"\u5927\u7406","b":"DaLi","c":"DLU"},{"a":"\u5927\u8fde","b":"DaLian","c":"DLC"},{"a":"\u4e39\u4e1c","b":"DanDong","c":"DDG"},{"a":"\u5927\u540c","b":"DaTong","c":"DAT"},{"a":"\u8fbe\u53bf","b":"DaXian","c":"DAX"},{"a":"\u5927\u8db3","b":"DaZu","c":"DZU"},{"a":"\u8fea\u5e86","b":"DiQing","c":"DIG"},{"a":"\u4e1c\u839e","b":"DongGuan","c":"DGM"},{"a":"\u4e1c\u80dc","b":"DongSheng","c":"DSN"},{"a":"\u4e1c\u8425","b":"DongYing","c":"DOY"},{"a":"\u6566\u714c","b":"DunHuang","c":"DNH"}],"e":[{"a":"\u9102\u5c14\u591a\u65af","b":"EErDuoS","c":"DSN"},{"a":"\u6069\u65bd","b":"EnShi","c":"ENH"}],"f":[{"a":"\u4f5b\u5c71","b":"FoShan","c":"ZCP"},{"a":"\u961c\u9633","b":"FuYang","c":"FUG"},{"a":"\u5bcc\u8574","b":"FuYun","c":"FYN"},{"a":"\u798f\u5dde","b":"FuZhou","c":"FOC"}],"g":[{"a":"\u8d63\u5dde","b":"GanZhou","c":"KOW"},{"a":"\u683c\u5c14\u6728","b":"GeErMu","c":"GOQ"},{"a":"\u5e7f\u6c49","b":"GuangHan","c":"GHN"},{"a":"\u5e7f\u5143","b":"GuangYuan","c":"GYS"},{"a":"\u5e7f\u5dde","b":"GuangZhou","c":"CAN"},{"a":"\u6842\u6797","b":"GuiLin","c":"KWL"},{"a":"\u8d35\u9633","b":"GuiYang","c":"KWE"}],"h":[{"a":"\u54c8\u5c14\u6ee8","b":"HaErBin","c":"HRB"},{"a":"\u6d77\u53e3","b":"HaiKou","c":"HAK"},{"a":"\u6d77\u62c9\u5c14","b":"HaiLaEr","c":"HLD"},{"a":"\u54c8\u5bc6","b":"HaMi","c":"HMI"},{"a":"\u90af\u90f8","b":"HanDan","c":"HDG"},{"a":"\u676d\u5dde","b":"HangZhou","c":"HGH"},{"a":"\u6c49\u4e2d","b":"HanZhong","c":"HZG"},{"a":"\u5408\u80a5","b":"HeHei","c":"HFE"},{"a":"\u9ed1\u6cb3","b":"HeiHe","c":"HEK"},{"a":"\u8861\u9633","b":"HengYang","c":"HNY"},{"a":"\u548c\u7530","b":"HeTian","c":"HTN"},{"a":"\u6000\u5316","b":"HuaiHua","c":"HJJ"},{"a":"\u9ec4\u5c71","b":"huangshan","c":"TXN"},{"a":"\u9ec4\u5ca9","b":"HuangYan","c":"HYN"},{"a":"\u547c\u548c\u6d69\u7279","b":"HuHeHaoTe","c":"HET"},{"a":"\u5fbd\u5dde","b":"HuiZhou","c":"HUZ"}],"j":[{"a":"\u4f73\u6728\u65af","b":"JiaMuSi","c":"JMU"},{"a":"\u5409\u5b89","b":"JiAn","c":"KNC"},{"a":"\u5609\u5cea\u5173","b":"JiaYuGuan","c":"JGN"},{"a":"\u5409\u6797","b":"JiLin","c":"JIL"},{"a":"\u6d4e\u5357","b":"JiNan","c":"TNA"},{"a":"\u666f\u5fb7\u9547","b":"JingDeZhen","c":"JDZ"},{"a":"\u4e95\u5188\u5c71","b":"jingGangShan","c":"JGS"},{"a":"\u666f\u6d2a","b":"JingHong","c":"JHG"},{"a":"\u8346\u5dde","b":"JingZhou","c":"SHS"},{"a":"\u6d4e\u5b81","b":"JiNing","c":"JNG"},{"a":"\u00e6\u2122\u2039\u00e6\u00b1\u0178","b":"JinJiang","c":"JJN"},{"a":"\u9526\u5dde","b":"JinZhou","c":"JNZ"},{"a":"\u4e5d\u6c5f","b":"JiuJiang","c":"JIU"},{"a":"\u9152\u6cc9","b":"JiuQuan","c":"CHW"},{"a":"\u4e5d\u5be8\u6c9f","b":"JiuZhaiGou","c":"JZH"}],"k":[{"a":"\u5580\u4ec0","b":"KaShi","c":"KHG"},{"a":"\u514b\u62c9\u739b\u4f9d","b":"KeLaMaYi","c":"KRY"},{"a":"\u5e93\u8f66","b":"KuChe","c":"KCA"},{"a":"\u5e93\u5c14\u52d2","b":"KuErLe","c":"KRL"},{"a":"\u6606\u660e","b":"KunMing","c":"KMG"},{"a":"\u6606\u5c71","b":"KunShan","c":"KUS"}],"l":[{"a":"\u5170\u5dde","b":"LanZhou","c":"LHW"},{"a":"\u62c9\u8428","b":"LaSa","c":"LXA"},{"a":"\u8fde\u57ce","b":"LianCheng","c":"LCX"},{"a":"\u6881\u5e73","b":"LiangPing","c":"WXN"},{"a":"\u8fde\u4e91\u6e2f","b":"LianYunGang","c":"LYG"},{"a":"\u4e3d\u6c5f","b":"LiJiang","c":"LJG"},{"a":"\u4e34\u6ca7","b":"LinCang","c":"LNJ"},{"a":"\u6797\u897f","b":"LinXi","c":"LXI"},{"a":"\u4e34\u6c82","b":"LinYi","c":"LYI"},{"a":"\u6797\u829d","b":"LinZhi","c":"LZY"},{"a":"\u67f3\u5dde","b":"LiuZhou","c":"LZH"},{"a":"\u9f99\u5ca9","b":"LongYan","c":"LCX"},{"a":"\u7f57\u5b9a","b":"LuoDing","c":"LDG"},{"a":"\u6d1b\u9633","b":"LuoYang","c":"LYA"},{"a":"\u5e90\u5c71","b":"LuShan","c":"LUZ"},{"a":"\u6cf8\u5dde","b":"LuZhou","c":"LZO"}],"m":[{"a":"\u8292\u5e02","b":"MangShi","c":"LUM"},{"a":"\u6ee1\u6d32\u91cc","b":"ManZhouLi","c":"NZH"},{"a":"\u6885\u53bf","b":"MeiXian","c":"MXZ"},{"a":"\u7ef5\u9633","b":"MianYang","c":"MIG"},{"a":"\u7261\u4e39\u6c5f","b":"MuDanJiang","c":"MDG"}],"n":[{"a":"\u5357\u660c","b":"NanChang","c":"KHN"},{"a":"\u5357\u5145","b":"NanChong","c":"NAO"},{"a":"\u5357\u4eac","b":"NanJing","c":"NKG"},{"a":"\u5357\u5b81","b":"NanNing","c":"NNG"},{"a":"\u5357\u5e73","b":"NanPing","c":"WUS"},{"a":"\u5357\u901a","b":"NanTong","c":"NTG"},{"a":"\u5357\u9633","b":"NanYang","c":"NNY"},{"a":"\u5b81\u6ce2","b":"NingBo","c":"NGB"}],"p":[{"a":"\u6500\u679d\u82b1","b":"PanZhiHua","c":"PZI"},{"a":"\u666e\u6d31","b":"PuEr","c":"SYM"}],"q":[{"a":"\u4e14\u672b","b":"QeMo","c":"IQM"},{"a":"\u9752\u5c9b","b":"QingDao","c":"TAO"},{"a":"\u5e86\u9633","b":"QingYang","c":"IQN"},{"a":"\u79e6\u7687\u5c9b","b":"QinHuangDao","c":"SHP"},{"a":"\u9f50\u9f50\u54c8\u5c14","b":"QiQiHaEr","c":"NDG"},{"a":"\u6cc9\u5dde","b":"QuanZhou","c":"JJN"},{"a":"\u8862\u5dde","b":"QuZhou","c":"JUZ"}],"s":[{"a":"\u4e09\u4e9a","b":"SanYa","c":"SYX"},{"a":"\u4e0a\u6d77","b":"ShangHaiPuDong","c":"PVG"},{"a":"\u5c71\u6d77\u5173","b":"ShanHaiGuan","c":"SHP"},{"a":"\u912f\u5584","b":"ShanShan","c":"SSA"},{"a":"\u6c55\u5934","b":"ShanTou","c":"BSD"},{"a":"\u6c55\u5934","b":"ShanTou","c":"SWA"},{"a":"\u6c99\u5e02","b":"ShaShi","c":"SHS"},{"a":"\u6c88\u9633","b":"ShenYang","c":"SHE"},{"a":"\u6df1\u5733","b":"ShenZhen","c":"SZX"},{"a":"\u77f3\u5bb6\u5e84","b":"ShiJiaZhuang","c":"SJW"},{"a":"\u601d\u8305","b":"SiMao","c":"SYM"},{"a":"\u82cf\u5dde","b":"SuZhou","c":"SZV"}],"t":[{"a":"\u5854\u57ce","b":"TaCheng","c":"TCG"},{"a":"\u592a\u539f","b":"TaiYuan","c":"TYN"},{"a":"\u5929\u6d25","b":"TianJin","c":"TSN"},{"a":"\u901a\u5316","b":"TongHua","c":"TNH"},{"a":"\u901a\u8fbd","b":"TongLiao","c":"TGO"},{"a":"\u94dc\u4ec1","b":"TongRen","c":"TEN"}],"w":[{"a":"\u4e07\u5dde","b":"WanZhou","c":"WXN"},{"a":"\u6f4d\u574a","b":"WeiFang","c":"WEF"},{"a":"\u5a01\u6d77","b":"WeiHai","c":"WEH"},{"a":"\u6e29\u5dde","b":"WenZhou","c":"WNZ"},{"a":"\u4e4c\u6d77","b":"WuHai","c":"WUA"},{"a":"\u6b66\u6c49","b":"WuHan","c":"WUH"},{"a":"\u829c\u6e56","b":"WuHu","c":"ZSWU"},{"a":"\u4e4c\u5170\u6d69\u7279","b":"WuLanHaoTe","c":"HLH"},{"a":"\u4e4c\u9c81\u6728\u9f50","b":"WuLuMuQi","c":"URC"},{"a":"\u65e0\u9521","b":"WuXi","c":"WUX"},{"a":"\u6b66\u5937\u5c71","b":"WuYiShan","c":"WUS"},{"a":"\u68a7\u5dde","b":"WuZhou","c":"WUZ"}],"x":[{"a":"\u53a6\u95e8","b":"XiaMen","c":"XMN"},{"a":"\u897f\u5b89","b":"XiAn","c":"XIY"},{"a":"\u8944\u6a0a","b":"XiangFan","c":"XFN"},{"a":"\u897f\u660c","b":"XiChang","c":"XIC"},{"a":"\u5174\u57ce","b":"XingCheng","c":"XEN"},{"a":"\u5174\u5b81","b":"XingNing","c":"XIN"},{"a":"\u90a2\u53f0","b":"XingTai","c":"XNT"},{"a":"\u897f\u5b81","b":"XiNing","c":"XNN"},{"a":"\u897f\u53cc\u7248\u7eb3","b":"XiShuangBanNa","c":"JHG"},{"a":"\u9521\u6797\u6d69\u7279","b":"XLlinHaoTe","c":"XIL"},{"a":"\u5f90\u5dde","b":"XuZhou","c":"XUZ"}],"y":[{"a":"\u5ef6\u5b89","b":"YaNan","c":"ENY"},{"a":"\u76d0\u57ce","b":"YanCheng","c":"YNZ"},{"a":"\u5ef6\u5409","b":"YanJi","c":"YNJ"},{"a":"\u70df\u53f0","b":"YanTai","c":"YNT"},{"a":"\u5b9c\u5bbe","b":"YiBin","c":"YBP"},{"a":"\u5b9c\u660c","b":"YiChang","c":"YIH"},{"a":"\u4f9d\u5170","b":"YiLan","c":"ZYYL"},{"a":"\u94f6\u5ddd","b":"YinChuan","c":"INC"},{"a":"\u4f0a\u5b81","b":"YiNing","c":"YIN"},{"a":"\u4e49\u4e4c","b":"YiWu","c":"YIW"},{"a":"\u6c38\u5dde","b":"YongZhou","c":"LLF"},{"a":"\u5143\u8c0b","b":"YuanMou","c":"YUA"},{"a":"\u6986\u6797","b":"YuLin","c":"UYN"},{"a":"\u8fd0\u57ce","b":"YunCheng","c":"YCU"}],"z":[{"a":"\u5f20\u5bb6\u754c","b":"ZhangJiaJie","c":"DYG"},{"a":"\u6e5b\u6c5f","b":"ZhanJiang","c":"ZHA"},{"a":"\u8087\u5e86","b":"ZhaoQing","c":"ZHQ"},{"a":"\u662d\u901a","b":"ZhaoTong","c":"ZAT"},{"a":"\u90d1\u5dde","b":"ZhengZhou","c":"CGO"},{"a":"\u821f\u5c71","b":"ZhouShan","c":"HSN"},{"a":"\u73e0\u6d77","b":"ZhuHai","c":"ZUH"},{"a":"\u9075\u4e49","b":"ZunYi","c":"ZYI"}]}

function getspanLeft(x){var l=0;while(x){l+=x.offsetLeft;x=x.offsetParent;}return l;}
function gETop(x) {var t = 0;while(x) {t += x.offsetTop;x = x.offsetParent;} return t;}
function ltrim(s){ 
    return s.replace( /^\s*/,""); 
}
function rtrim(s){ 
    return s.replace( /\s*$/,""); 
} 
function trim(s){ 
    return ltrim(rtrim(s)); 
}   
 function checkForm(){
	if(document.ordernosearch.orderNo.value==""){
		alert("请输入订单号！");
		document.ordernosearch.orderNo.focus();
		return false;
	}
	if(document.ordernosearch.orderNo.value.length!=28){
		alert("订单号长度不对！");
		document.ordernosearch.orderNo.focus();
		return false;
	}
	if(document.ordernosearch.contentName.value == ""){
		alert("请输入订单联系人！");
		document.ordernosearch.contentName.focus();
		return false;
	}
	if(document.ordernosearch.checkCode.value == ""){
		alert("请输入验证码!");
		document.ordernosearch.checkCode.focus();
		return false;
	}
}   
function GetRadioValue(){
     var fly_types=document.getElementsByName('T');
       for(var i=0;i<fly_types.length;i++){
           if(fly_types[i].checked==true){
              T = fly_types[i].value;
              break;
           }
       }
       return T;
}
function check(){
	var T = GetRadioValue();
    if(document.getElementById('frmcity').value==''){
	alert('请填写出发城市');document.getElementById('frmcity').focus();
	return false;	
	}
    if(document.getElementById('tocity').value==''){
	alert('请填写到达城市');document.getElementById('tocity').focus();
	return false;	
	}
    if(document.getElementById('tocity').value==document.getElementById('frmcity').value){
	alert('出发城市和到达城市不能相同');document.getElementById('tocity').focus();
	return false;	
	}
	
    if(document.getElementById('i-date').value==''){
	alert('请填写出发日期');document.getElementById('i-date').click();
	return false;	
	}
    if(document.getElementById('i-rdate').value=='' && T == 2){
	alert('请填写返回日期');document.getElementById('i-rdate').click();
	return false;
	}
	return true;
	
}
////////////////////////////////////////////////////////////////


var KX = window.KX || {};
KX.Fp = KX.Fp || {};

KX.Fp.change = function(id,num) {//{{{
    var name = document.getElementById(id);
    var span = name.getElementsByTagName("span");
    for(var i=0;i<span.length;i++){
        span[i].className = "";
        $("#"+id+"_ul_"+i).hide();
    }
    span[num].className = "checked";
    $("#"+id+"_ul_"+num).show();
}//}}}


KX.Fp.switchoption = function(obj){ //{{{
    if(obj.value == 1 ){
        $("#fcdate").hide();
        KX.Fp.jipiaotype = 1;
    }
    else{
        $("#fcdate").show();
        KX.Fp.jipiaotype = 2;
    }
}//}}}

KX.Fp.kxchange = function(id,num) {//{{{
    var name = document.getElementById(id);
    var span = name.getElementsByTagName("span");
    for(var i=0;i<span.length;i++){
        span[i].className = "sp"+i;
        document.getElementById(id+"_ul_"+i).style.display = "none";
    }
    span[num].className = "sp"+num+num;
    document.getElementById(id+"_ul_"+num).style.display = "block";
}//}}}

KX.Fp.parseDate = function(s) {//{{{
    var reg = new RegExp("[^0-9-]","");
    if(s.search(reg)>=0){
        return today;
    }
    var ss=s.split("-");
    if(ss.length!=3){
        return today;
    }
    if(isNaN(ss[0])||isNaN(ss[1])||isNaN(ss[2])){
        return today;
    }
    return new Date(parseFloat(ss[0]),parseFloat(ss[1])-1,parseFloat(ss[2]));
}//}}}

KX.Fp.formatDate = function(d) {//{{{
    var year = d.getFullYear();
    var month = d.getMonth() + 1;
    var day = d.getDate();
    return year+"-"+(month>=10 ? month : ("0" + month))+"-"+(day>=10 ? day : ("0" + day));
}//}}}

KX.cookie = {//{{{
    get: function(n) {
        var v = '',
        c = ' ' + document.cookie + ';',
        s = c.indexOf((' ' + n + '='));
        if (s >= 0) {
            s += n.length + 2;
            v = unescape(c.substring(s, c.indexOf(';', s)));
        }
        return v;
    },
    set: function(n, v) {
        var a = arguments,
        al = a.length;
        document.cookie = n + "=" + v + ((al > 2 && a[2] != "") ? ";expires=" + (typeof(a[2]) == "object" ? a[2].toGMTString() : (new Date(a[2] * 1000)).toGMTString()) : "") + ";path=" + ((al > 3 && a[3] != "") ? a[3] : "/") + ";domain=" + ((al > 4 && a[4] != "") ? a[4]:"kuxun.cn");
    },
    checksub: function(sCookie, s) {
        var aParts = sCookie.split('&'),
        nParts = aParts.length,
        aKeyVal;
        if (nParts == 1) {
            return sCookie.indexOf(s);
        } else {
            for (var i = 0; i < nParts; i++) {
                aKeyVal = aParts[i].split('=');
                if (aKeyVal[0] == s) {
                    return i;
                }
            }
        }
        return - 1;
    },
    getsub: function(n, s) {
        var sCookie = this.get(n);
        var nExists = this.checksub(sCookie, s);
        if (nExists > -1) {
            return sCookie.split('&')[nExists].split('=')[1];
        } else if (sCookie.indexOf(s) > 0) {
            return sCookie.split('=')[1];
        }
        return '';
    },
    setsub: function(n, s, v) {
        var sCookie = this.get(n),
        a = arguments,
        al = a.length;
        var aParts = sCookie.split('&');
        var nExists = this.checksub(sCookie, s);
        if (sCookie == '') {
            sNewVal = (s + '=' + v).toString();
        } else {
            if (nExists == -1) {
                nExists = aParts.length;
            }
            aParts[nExists] = s + '=' + v;
            sNewVal = aParts.join('&');
        }
        return this.set(n, sNewVal, (a[3] || ''), (a[4] || '/'), (a[5] || ''));
    }
}//}}}


KX.Fp.open_hrc = function() {//{{{
    var q_hrc = document.getElementById("q_hrc");
    if(q_hrc && q_hrc.checked){
        var open_url = "http://hotel.kuxun.cn/go_hrc_search.php?sid=4&city="+encodeURIComponent($('#city').val())+"&d1="+$('#i-startdate').val()+"&d2="+$('#i-enddate').val()+"&q="+encodeURIComponent($('#input03').val());
        var win = window.open(open_url, 'newwin','width=800,height=600,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes');
        win.blur();
    }

}//}}}

KX.Fp.onSubmitHotel = function() {//{{{
    if(KX.Fp.check()){
        KX.Fp.open_hrc();
        return true;
    }else{
        return false;
    }
}//}}}

function oncal(inp){inp.style.color="";if(inp.value == "选填") inp.value = "";}

function calcallback(str, target) {//{{{
    target.value = str;
    if(target.getAttribute("id") == "i-startdate") {
        var dateArr = str.split('-');
        var date1 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        dateArr = document.getElementById("i-enddate").value.split('-');
        var date2 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        if(date1.getTime() > date2.getTime()) {
            date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate() + 3);
            document.getElementById("i-enddate").value = addPrefixZero(date1.getFullYear()) + "-" + addPrefixZero(date1.getMonth() + 1) + "-" + addPrefixZero(date1.getDate());
        }
    }
}//}}}

function calcallbackdj(str, target) {//{{{
    target.value = str;
    if(target.getAttribute("id") == "Date1") {
        var dateArr = str.split('-');
        var date1 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        dateArr = document.getElementById("Date2").value.split('-');
        var date2 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        if(date1.getTime() > date2.getTime()) {
            date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate() + 3);
            document.getElementById("Date2").value = addPrefixZero(date1.getFullYear()) + "-" + addPrefixZero(date1.getMonth() + 1) + "-" + addPrefixZero(date1.getDate());
        }
    }
}//}}}

function calcallbackjp(str, target) {
    target.value = str;
    if(target.getAttribute("id") == "i-date") {
        var dateArr = str.split('-');
        var date1 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        dateArr = document.getElementById("i-rdate").value.split('-');
        var date2 = new Date(parseInt(dateArr[0], 10), parseInt(dateArr[1], 10) - 1, parseInt(dateArr[2], 10));
        if(date1.getTime() > date2.getTime()) {
            date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate() + 3);
            document.getElementById("i-rdate").value = addPrefixZero(date1.getFullYear()) + "-" + addPrefixZero(date1.getMonth() + 1) + "-" + addPrefixZero(date1.getDate());
        }
       if(document.getElementById('T2').checked && document.getElementById('i-rdate').value.length==0)  document.getElementById('i-rdate').click();
    }
}

function addPrefixZero(num) {//{{{
    if(parseInt(num, 10) < 10) {
        return "0" + num.toString();
    } else {
        return num.toString(); 
    }
}//}}}



KX.Fp.o_sub = function(t,q) {//{{{
    var EE = encodeURIComponent || escape;
    var g_url="";
    if(q.length == 0){
        return false;
    }
    q = EE(q);

    if( t[0].checked )
        g_url="http://sodujia.kuxun.cn/s_Sight-" + q + ".html";
    else if( t[1].checked )
        g_url="http://sodujia.kuxun.cn/s_TravelNotes-" + q + ".html";
    else if( t[2].checked )
        g_url="http://sodujia.kuxun.cn/s_Faq-" + q + ".html";
    else if( t[3].checked )
        g_url = "http://sodujia.kuxun.cn/s_PicInfo-" + q + ".html";
    if(g_url != "")
        document.location.href = g_url;
    //window.open(g_url,"_blank");
    return false;
}//}}}

KX.Fp.onSubmitTravel = function() {//{{{
    KX.Fp.o_sub(this.S, this.q.value);
    if(window.event){
        event.returnValue=false;
    }
    return false;
}//}}}

KX.Fp.piaoOnlySearchForDestOrTrainline = function() {//{{{
    var form = document.spiao;
    var to = form.to;
    var tid = form.trainid;
    var opt_str = "选填";
    function isContentKey(kc) {return kc == 8 || kc == 32 || kc > 48;}
    var keydown_oldto = to.onkeydown;
    to.onkeydown=function(e){
        if(!e && window.event) e=window.event;
        if(keydown_oldto) keydown_oldto.call(this,e);
        if(isContentKey(e.keyCode)&&tid.value) tid.value='';
    };
    var keydown_oldtid = tid.onkeydown;
    tid.onkeydown=function(e){
        if(!e && window.event) e=window.event;
        if(keydown_oldtid) keydown_oldtid.call(this,e);
        if(isContentKey(e.keyCode)&&to.value) to.value = '';
    };
    // grey out input when blur
    $("#to, #trainid, #input03").focus(function(){
        if($(this).val() != opt_str){
            $(this).css({color:'#000'});
        }else{
            $(this).val('');
        }
    }).blur(function(){
        if($(this).val() == ''){
            $(this).val(opt_str);
            $(this).css({color:'#666'});
        }else{
            $(this).css({color:'#000'});
        }
    });
}//}}}

function piaoSearch(s) { //{{{
	var q = s.q;
	var t = s.T;
	if (!q || !t) return false;
	if (t.value == 'TicketSale' && !q.value) {
		alert('目的站或车次不能为空')
		return false;
	}
	kxalog('id=search/' + t.value, s);
	return true;
} //}}}

// fill dp {{{
function filldp() {
	var d=new Date();
	var hour = d.getHours();
	var ndays = hour < 19 ? 9 : 10;
	var ms = d.getTime();

	var optstr = "";
	for (var i=1; i<=ndays; i++) {
		d.setTime(ms + i*24*3600*1000);
		var y = d.getFullYear();
		var m = d.getMonth() + 1;
		if (m<10) m = '0' + m;
		var da = d.getDate();
		if (da<10) da = '0' + da;
		var dstr = y + '-' + m + '-' + da;
		optstr += ['<option value = "', dstr, '">', dstr, '</option>'].join('');
	}

	$('#dp').html(optstr);
}// }}}

KX.Fp.validDate = function(qdate) {//{{{
    var d=new Date();
    var now=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
    var diff=KX.Fp.compareDate(now,qdate,"-");
    if(diff > 30 || diff < 0){
        return false;
    }
    return true;
}//}}}

KX.Fp.compareDate = function(first,second,sign) {//{{{
    var fArray = first.split(sign);

    var sArray = second.split(sign);
    var fDate = new Date(fArray[0],fArray[1],fArray[2]);
    var sDate = new Date(sArray[0],sArray[1],sArray[2]);

    var t = Math.abs(fDate.getTime()-sDate.getTime());

    var days = t/(1000*60*60*24);
    return days;
}//}}}

/* calendar*///{{{
KX.Fp.showCalendar = function(sImg,bOpenBound,sFld1,sFld2,sCallback,d1) {
	var fld1,fld2;
	var cf=document.getElementById("CalFrame");
	var wcf=window.frames.CalFrame;
	if(d1 != null){
		wcf.date1 = document.getElementById(d1).value;
	}else{
		wcf.date1 = null;
	}
	var oImg=document.getElementById(sImg);
	if(!oImg){alert("控制对象不存在！");return;}
	if(!sFld1){alert("输入控件未指定！");return;}
	fld1=document.getElementById(sFld1);
	if(!fld1){alert("输入控件不存在！");return;}
	if(fld1.tagName!="INPUT"||fld1.type!="text"){alert("输入控件类型错误！");return;}
	if(sFld2)
	{
		fld2=document.getElementById(sFld2);
		if(!fld2){alert("参考控件不存在！");return;}
		if(fld2.tagName!="INPUT"||fld2.type!="text"){alert("参考控件类型错误！");return;}
	}
	if(!wcf.bCalLoaded){alert("日历未成功装载！请刷新页面！");return;}
	if(cf.style.display=="block"){cf.style.display="none";return;}
	
	var eT=0,eL=0,p=oImg;
	if(document.body.scrollTop!=0 || (document.documentElement.scrollTop==0 && document.documentElement.clientHeight==0))
	{
		var sT=document.body.scrollTop,sL=document.body.scrollLeft;
		var eH=oImg.clientHeight,eW=oImg.clientWidth;
		while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}
		cf.style.top=((document.body.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH:eT-cf.height) + "px";
		cf.style.left=((document.body.clientWidth-(eL-sL)>=cf.width)?eL:eL-cf.width) + "px";	
	}
	else
	{
		var sT=document.documentElement.scrollTop,sL=document.documentElement.scrollLeft;
		var eH=oImg.clientHeight,eW=oImg.clientWidth;
		while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}
		var ie = document.all;
		if(!ie){
		cf.style.top=((document.documentElement.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH:eT-cf.height) + "px";
		cf.style.left=((document.documentElement.clientWidth-(eL-sL)>=cf.width)?eL:eL-cf.width) + "px";	
		}else{
			var browser = navigator.appName;
			var b_version = navigator.appVersion; 
			var version = b_version.split(";"); 
			var trim_Version = version[1].replace(/[ ]/g, ""); 
			if(browser == "Microsoft Internet Explorer" && trim_Version == "MSIE7.0") { 
				cf.style.top = ((document.body.clientHeight - (eT - sT) - eH >= cf.height) ? eT + eH : eT - cf.height) + 4 + "px";
				cf.style.left = ((document.body.clientWidth - (eL - sL) >= cf.width) ? eL : eL + eW - cf.width) - 4 + "px";
			} else if(browser == "Microsoft Internet Explorer" && trim_Version == "MSIE6.0") {
				cf.style.top = ((document.body.clientHeight - (eT - sT) - eH >= cf.height) ? eT + eH : eT - cf.height) + 4 +"px";
				cf.style.left = ((document.body.clientWidth - (eL - sL) >= cf.width) ? eL : eL + eW - cf.width) - 4 + "px";
			}else{
				<!--添加修改 调整时间框的位置 ouyd -->		
				cf.style.top = ((document.body.clientHeight - (eT - sT) - eH >= cf.height) ? eT + eH : eT - cf.height) + 4 + "px";
				cf.style.left = ((document.body.clientWidth - (eL - sL) >= cf.width) ? eL : eL + eW - cf.width) - 4 + "px";			
			}
		}
	}	
	cf.style.display = "block";
	
	wcf.openbound=bOpenBound;
	wcf.fld1=fld1;
	wcf.fld2=fld2;
	wcf.callback=sCallback;
	wcf.initCalendar();
}

function hideCalendar()
{
	var cf=document.getElementById("CalFrame");
	cf.style.display="none";
}
/*}}}*/

KX.Fp.isEmpty = function(v) {
        return ((v == null) || (v.length == 0) || /^\s+$/.test(v));
};

KX.Fp.onSubmitXianlu3 = function(i,w) {
    
    var T = $("#T").val();
    var S = $.trim($("#searchWord").val());
    if (KX.Fp.isEmpty(S)) {
        $('#error').html('请输入关键字').css('color', '#FF6600');
        $('#searchWord').css('border', '1px solid #FF6600').focus().keyup(function() {
            if ($(this).val()) {
                $('#searchWord').css('border', '1px solid #8CB6E0');
                $('#error').html('').css('color', '#000');
            }
        });
        if(window.event){
            event.returnValue=false;
        }

        return false;
    }
    
    kxalog('id=home_search',3);

    document.location.href = 'http://dujia.kuxun.cn/s_' + T + '-' + encodeURIComponent(S) + '.html';
    if(window.event){
        event.returnValue=false;
    }
    return false;
};
KX.Fp.checkSubmit = function (i,n,w) {
    
    var FR = $.trim($('#From'+n).val());
    if (n == 2) {
        var D1 = $.trim($('#Date3').val());
        var D2 = $.trim($('#Date4').val());
    } else {
        var D1 = $.trim($('#Date1').val());
        var D2 = $.trim($('#Date2').val());
    }
    
    if (!FR) {
        $('#error'+n).html('请输入出发城市').css('color', '#FF6600');
        $('#From'+n).css('border', '1px solid #FF6600').focus().keyup(function() {
            if ($(this).val()) {
                $('#From'+n).css('border', '1px solid #8CB6E0');
                if (w == 'home') {
                    $('#error'+n).html('');
                } else {
                    $('#error'+n).html('出发城市').css('color', '#000');
                }
            }
        });
        return false;
    }
    
    var QU = $.trim($('#searchWord'+n).val());
    var URI = 'http://dujia.kuxun.cn/s_' + ($('#T'+n).val() == 'Fit' ? 'Fit_' : '') + EE(FR) + '-' + EE(QU);
    
    var queryString = new Array();
    
    if (D1 && D1 != Mj.kDDS) {
        queryString.push('Date1=' + D1);
    }
    if (D2 && D2 != Mj.kDDS) {
        queryString.push('Date2=' + D2);
    }
    
    var CAT = $.trim($('#dropfeature1').val());
    if (CAT && CAT != Mj.kRY) {
        queryString.push('Cat7=' + EE(CAT));
    }
    
    var OEM = $.trim($('#OEM'+n).val());
    var FID = $.trim($('#fromid'+n).val());
    if (OEM) {
        queryString.push('OEM=' + OEM);
    }
    if (FID) {
        queryString.push('fromid=' + FID);
    }
    
    if (typeof(kxalog) == "function" && typeof(i) != "object") {
        kxalog('id=' + PAGETYPE + '_search/' + w, i);
    }
    
    var Q = queryString.join('&');
    window.location.href = URI + (Q ? '?' + Q : '');
    return false;
};
/* -( Bootstrap )--------------------------------------------- */
// This is where everything explictly initialized and runs, put
// implicityly-running non-definition code here so we can 
// keep track of what's going on.

/* -( End )---------------------------------------------------- */
/*{{{
Modeline
vim:ft=javascript
vim:et sta sw=4
vim600:fdm=marker fdl=0 fdc=0
}}}*/
$(document).click(function(){
						   if($('#CalFrame').length>0) hideCalendar();
						   if($('#morecitydiv').length>0) hidemorecitydiv();
						   });


/**
* 调用方法：onClick="showAllCities(this.id,'',event,null,'left');" 
* 第一个参数是单击对象的id，第二个参数是当前的开始的字母，第三个是现场事件对象，第四个是需要赋值的div或者span,第五个是左上角定位或右上角定位
**/
var cities_index=new Array();
function findCityLetter(city){
	for(var oa in cities){
	   for(var i=0;i<cities[oa].length;i++){
		     if(city==cities[oa][i].a){
				return oa;
			 }
	   }
	}
	return "";
}
function showmorectiy2(input,alpha,e,result_id,pos_corner){
	 var e=e||window.event;
	 e.cancelBubble = true;
      $(document).click(function(){if($('#hot_cities_table').length>0) $('#hot_cities_table').remove();});
	  if($('#hot_cities_table').length>0) $('#hot_cities_table').remove();
	  var now_city='';
	
	   if((alpha.length==0) && typeof result_id!='undefined' && result_id!='null'){
		    now_city=$.trim($('#'+result_id).html());
		  for(var c in cities_index){
			 if(c==now_city){
			  	 alpha=cities_index[c];flag=true;
				 break;
			  }
		   }
		   if(!flag){
			  alpha=findCityLetter(v);
		   }
	    }else{
		   now_city=$.trim($('#'+input).val());
	    }
		
		
	  if(alpha.length==0 && $.trim($('#'+input).val()).length>0){
		   var v=$.trim($('#'+input).val()); 
		   now_city=v;
		  var flag=false;
		  for(var c in cities_index){
			if(c==v){
			  	 var alpha=cities_index[c];flag=true;
				 break;
			}
		  }
		  if(!flag){
			  var alpha=findCityLetter(v);
		  }
	  }
	  if(alpha.length==0){
		   var alpha='a';
	  }
 
          var tc=cities[alpha.toLowerCase()];
          var ts=new Array();
          ts.push('<table id="hot_cities_table" style="display:none;">');
		  ts.push('<tr><td class="title">请选择城市</td></tr>');
		  ts.push('<tr><td class="title_hotcities">&nbsp;&nbsp;<b>热门城市:</b>');
		  var h_c_a=new Array('深圳','北京','上海','广州','重庆','武汉','成都','西安');
		  for(var i=0;i<h_c_a.length;i++){
			 ts.push('<span onclick="setLastTab(\''+result_id+'\',\''+h_c_a[i]+'\');$(\'#hot_cities_table\').remove();">'+h_c_a[i]+'</span>');  
		  }
		  ts.push('</td></tr><tr><td id="hot_cities_title">'+getAllCitiesNav(input,alpha,result_id,pos_corner)+'</td></tr>');
          ts.push('<tr><td id="hot_cities_content">');
          ts.push('<table id="hot_cities_list">');
          if(!tc){//如果没有城市记录
            ts.push('<tr rowspan="3"><td colspan="6" class="hot_cities_none">没有相关城市信息</td></tr></table>');
                  $('body').append(ts.join(''));
             setAllCitiesStyle(input,alpha,result_id,pos_corner)
                 return;
          }
          for(var i=0,r=0,j=tc.length;i<j;i++){//以某一个字母开头的城市展示出来
            var o=tc[i];
                if(i%6==0){//每行展示6个
                  ts.push('</tr><tr>');
                  r++;//table's row行数
                }
                ts.push('<td class="hotcity');
                if(o.a==now_city){
                  ts.push(' cur_city ');
                }
                ts.push('" onclick="assignCity(\''+input+'\',\''+o.a+'\',this,\''+alpha+'\',\''+result_id+'\');event.cancelBubble = true;">'+o.a+'</td>');

          }//end for
          if(i%6==1) ts.push('<td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          if(i%6==2) ts.push('<td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          if(i%6==3) ts.push('<td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          if(i%6==4) ts.push('<td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          if(i%6==5) ts.push('<td >&nbsp;&nbsp;</td></tr>');

          if(r==1){
            ts.push('<tr><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
            ts.push('<tr><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          }else if(r==2){
            ts.push('<tr><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>');
          }
          ts.push('</table>');
          ts.push('</td></tr></table>');
          $('body').append(ts.join(''));
          $('#hot_cities_table').click(function(){return false;})
          $('td.hotcity',$('#hot_cities_list')).hover(function(){$(this).addClass('over');},function(){$(this).removeClass('over');})
          setAllCitiesStyle(input,alpha,result_id,pos_corner)

}

function assignCity(input,city,td_obj,alpha,result_id){
    if($(td_obj).length>0){
		$('td.cur_city',$('#hot_cities_list')).removeClass('cur_city');
		$(td_obj).addClass('cur_city');
	}
    cities_index[$(td_obj).text()]=alpha;
	if(result_id!=undefined && result_id!='undefined' && result_id!='null'){
		if(typeof setLastTab=='function') setLastTab(result_id,city);
	}else{
		$('#'+input).val(city);
	}
     $('#hot_cities_table').remove();
	
}
function setAllCitiesStyle(input,alpha,result_id,pos_corner){
          getAllCitiesNav(input,alpha,result_id);
          var p=$('#'+input).offset();
          var h=$('#'+input)[0].offsetHeight;
          var w=$('#'+input)[0].offsetWidth;
          var left=p.left;
          var tw=$('#hot_cities_table').outerWidth()
          var bw=$('body').outerWidth();
		  if(pos_corner=='right'){
		     $('#hot_cities_table').css({'left':(left-tw+w)+'px','top':(p.top+h)+'px','display':''});
			return false;
		  }
		  if(pos_corner=='left'){
          $('#hot_cities_table').css({'left':p.left+'px','top':(p.top+h)+'px','display':''});
			return false;
		  }
          if((bw-left)>tw ){
          $('#hot_cities_table').css({'left':p.left+'px','top':(p.top+h)+'px','display':''});
          }else{
           $('#hot_cities_table').css({'left':(left-tw+w)+'px','top':(p.top+h)+'px','display':''});
          }
}

function getAllCitiesNav(input,alpha,result_id,pos_corner){
  var str='';
      alpha=alpha.toUpperCase();
          for(var i=65;i<=90;i++){
          var a=String.fromCharCode(i);
            if(alpha==a){
                str+="<span class='hot_cities_nav' style='color:red;font-weight:bold;'>"+a+"</span>";
                }else{
            str+="<span class='hot_cities_nav'  onclick=\"showmorectiy2('"+input+"','"+a+"',event,'"+result_id+"','"+pos_corner+"');event.cancelBubble = true;\"  onmouseover='this.style.color=\"blue\";'  onmouseout='this.style.color=\"#000\"'>"+a+"</span>";
                }
          }
          return str;

}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function mainpricecity30(city){ 
var fromcity = $("#spanmorebtn1").html();
var tocity = $("#spanmorebtn2").html();
if(fromcity==tocity){
alert('出发城市与目的城市不能相同！');
return false;
}
	  var day = new Date();
	  var random_num = day.getTime()+Math.floor(Math.random()*100000);
	  $.ajax({
		 type: "GET",
		 url:  base_page+"/interface/ajax_ticket.php",
		 data: "act=openflashchart&fromcity=" + encodeURI(fromcity) + "&tocity=" + encodeURI(tocity) + "&random="+random_num,
		 success: function(msg){
		   $("#my_chart").html(msg);
		 }
	  });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var ajaxBox_offsetX = 0;
	var ajaxBox_offsetY = 0;
	if(typeof base_pages=='undefined' || typeof base_pages==null || base_pages=='') base_pages='/pages';
	var ajax_list_externalFile = base_pages+'/interface/ajax-list-countries.php';	// Path to external file
	var minimumLettersBeforeLookup = -1;	// Number of letters entered before a lookup is performed. ?????1
	
	var ajax_list_objects = new Array();
	var ajax_list_cachedLists = new Array();
	var ajax_list_activeInput = false;
	var ajax_list_activeItem;
	var ajax_list_optionDivFirstItem = false;
	var ajax_list_currentLetters = new Array();
	var ajax_optionDiv = false;
	var ajax_optionDiv_iframe = false;
	
	var css_selectedItem='optionSelected';
	var nav_items=new Array();

	var ajax_list_MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_MSIE=true;
	
	var currentListIndex = 0;
	
	function ajax_getTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null){
	  	returnValue += inputObj.offsetTop;
	  }
	  return returnValue;
	}
	function ajax_list_cancelEvent()
	{
		return false;
	}
	
	function ajax_getLeftPos(inputObj)
	{
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
	  
	  return returnValue;
	}
	
	function ajax_option_setValue(e,inputObj)
	{
				var str=$(inputObj).find('.py_city').html();
		  	$(ajax_list_activeInput).val(str);
		    ajax_options_hide();
	}
	
	function ajax_options_hide()
	{
		if(ajax_optionDiv)ajax_optionDiv.style.display='none';	
		if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='none';
	}
	function ajax_options_show()
	{
		if(ajax_optionDiv)ajax_optionDiv.style.display='block';	
		if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='block';
	}	

	function ajax_options_rollOverActiveItem(fromKeyBoard)
	{
		if(ajax_list_activeItem){ 
			$(ajax_list_activeItem).addClass(css_selectedItem);
		  //ajax_list_activeItem.className='';
		 }else{
		 	$('#'+ajax_list_optionDivFirstItem).addClass(css_selectedItem);
		 	ajax_list_activeItem=$('#'+ajax_list_optionDivFirstItem)[0];
		}
		
	}
	function handle_li_over(){
		//alert($('#plane_options').html());
		/**/
	//	alert('children:'+$('#plane_options li').length);
	    if($('#ajax_listOfOptions div').length-1>10){
		   $('#ajax_listOfOptions').css('paddingRight','20px');
		}else{
		   $('#ajax_listOfOptions').css('paddingRight','2px');
		}
		 
		$('#ajax_listOfOptions div').each(function(i){
			ajax_list_activeItem=null;
			
			if(this.id=='option_title') return;
		  $(this).mouseover(function(){
		  	$(this).addClass('optionSelected');
		  })
		  $(this).mouseout(function(){
		  	if(this!=ajax_list_activeItem)
		  	$(this).removeClass('optionSelected');
		  })
		  $(this).click(function(){
		  	var str=$(this).find('.py_city').html();
		  	$(ajax_list_activeInput).val(str);
		  	ajax_list_activeItem=this;
			  ajax_options_hide();
			  
			  if(ajax_list_activeInput.id=='frmcity'){
			    if($('#tocity').length>0 && $('#tocity').val().length==0)  
			       $('#tocity').focus();
			   }
			  if(ajax_list_activeInput.id=='tocity' ){
			    if($('#i-date').length>0 && $('#i-date').val().length==0){  
			       $('#i-date').click();
			     }
			   }
			   return false; 
			//alert('hid');
		  });
		})
		/**/
	}
	function ajax_option_list_buildList(letters,paramToExternalFile)
	{
		var  options_info=ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()];
		if(options_info.length<=0){
			ajax_options_hide();
			return;			
		}
		var tmp_str='<div id=\'option_title\' style=\'color:#666;\' >输入中文/拼音或↑↓选择</div>';
		var k=0;
		for(var p in options_info){
			  nav_items[p]=options_info[p];
		   	tmp='<div  id=\'plane_city'+k+'\'><span class="py">'+p+'</span><span class="py_city">'+options_info[p]+'</span></div>';
		   	if(k==0) ajax_list_optionDivFirstItem='plane_city'+k;
		   	tmp_str+=tmp;
		   	k++;
		}
	

	 $(ajax_optionDiv).html(tmp_str);
	  ajax_options_show();
	  
			if(ajax_list_MSIE){
				ajax_optionDiv_iframe.style.width = ajax_optionDiv.offsetWidth + 'px';
				ajax_optionDiv_iframe.style.height = ajax_optionDiv.offsetHeight + 'px';
			}else{
				ajax_optionDiv_iframe.style.width ='0px';
				ajax_optionDiv_iframe.style.height = '0px';
			}
    
	  //alert("3ajax_listOfOptions begin:"+$('#ajax_listOfOptions').html());
	  handle_li_over();
	}
	function ajax_option_resetSize(){
		
	}
	function ajax_option_list_showContent(responseText,inputObj,paramToExternalFile,whichIndex)
	{
		
		//if(whichIndex!=currentListIndex)return;
		var letters = inputObj.value;
		var content = responseText;
		content=content.replace(/^\s*/g,'').replace(/\s*$/g,'');
	    content=eval("("+content+")");
		ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()] = content;
		ajax_option_list_buildList(letters,paramToExternalFile);
		
	}
	
	function ajax_option_resize(inputObj)
	{
		ajax_optionDiv.style.top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px';
		ajax_optionDiv.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px';
		if(ajax_optionDiv_iframe){
			ajax_optionDiv_iframe.style.left = ajax_optionDiv.style.left;
			ajax_optionDiv_iframe.style.top = ajax_optionDiv.style.top;			
		}		
		
	}
	
	function ajax_showOptions(inputObj,paramToExternalFile,e)
	{
		//document.all.keyword.focus();
		if(e.keyCode==13 || e.keyCode==9){return;}
		if(e.keyCode==38 || e.keyCode==40){return;}
		if(inputObj.value.length>12){
		  	inputObj.value=inputObj.value.substr(0,12);
		}
	//	if( ajax_optionDiv && ajax_optionDiv.style.display!='none') inputObj.blur();
		ajax_list_activeInput = inputObj;
		if(!ajax_list_cachedLists[paramToExternalFile]) ajax_list_cachedLists[paramToExternalFile] = new Array();
		var r=Math.random(1000);
        // alert($('#ajax_listOfOptions').length);
		
		var id_str='ajax_listOfOptions';
		var id_iframe_str='ajax_listOfOptions_iframe';
		
		if($('#'+id_str).length>0){
		  ajax_optionDiv=$('#'+id_str)[0];
		  ajax_optionDiv_iframe=$('#'+id_iframe_str)[0];
		}
		
		if($('#'+id_str).length==0){
			ajax_optionDiv = document.createElement('DIV');
			ajax_optionDiv.id = id_str;
			
			document.body.appendChild(ajax_optionDiv);
			
				ajax_optionDiv_iframe = document.createElement('IFRAME');
				ajax_optionDiv_iframe.border='0';
				ajax_optionDiv_iframe.id = id_iframe_str;
			if(ajax_list_MSIE){
				ajax_optionDiv_iframe.style.width = ajax_optionDiv.offsetWidth + 'px';
				ajax_optionDiv_iframe.style.height = ajax_optionDiv.offsetHeight + 'px';
			}else{
				ajax_optionDiv_iframe.style.width ='0px';
				ajax_optionDiv_iframe.style.height = '0px';
			}
			document.body.appendChild(ajax_optionDiv_iframe);

			var oldonkeydown=document.body.onkeydown;
			if(typeof oldonkeydown!='function'){
				document.body.onkeydown=ajax_option_keyNavigation;
			}else{
					document.body.onkeydown=function(){
						oldonkeydown();
						ajax_option_keyNavigation() ;
					}
			}
			
			var oldonresize=document.body.onresize;
			if(typeof oldonresize!='function'){
				document.body.onresize=function() {ajax_option_resize(inputObj); };
			}else{
				document.body.onresize=function(){oldonresize();
				ajax_option_resize(inputObj) ;}
			}
				
		}
		
		if(inputObj.value.length<minimumLettersBeforeLookup){
			ajax_options_hide();
			return;
		}
		//alert(inputObj.offsetHeight + ajaxBox_offsetY);
		
		var top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 2 + 'px';
		var left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 0 + 'px';
		$(ajax_optionDiv).css({"top":top,"left":left});
		$(ajax_optionDiv_iframe).css({"top":top,"left":left});
		
		ajax_optionDiv.onselectstart =  ajax_list_cancelEvent;
		currentListIndex++;
		
		if(ajax_list_cachedLists[paramToExternalFile][inputObj.value.toLowerCase()]){
			ajax_option_list_buildList(inputObj.value,paramToExternalFile);			
		}else{
			var tmpIndex=currentListIndex;
			ajax_optionDiv.innerHTML = '';
			var param_letters = encodeURI(inputObj.value);
			
			var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + param_letters.replace(" ","+") ;
			$.post(url,function(msg){
			    ajax_option_list_showContent(msg,inputObj,paramToExternalFile,tmpIndex);
			})
		}
	}
	
	function ajax_option_keyNavigation(e)
	{

		if(document.all)e = event;
		
		if(!ajax_optionDiv)return;
		if(ajax_optionDiv.style.display=='none')return;
		
		
		if(e.keyCode==38){	// Up arrow
			if(!ajax_list_activeItem){
				ajax_options_rollOverActiveItem(true);
			}else if(ajax_list_activeItem && !ajax_list_activeItem.previousSibling){
				return;
			 }else{
				if(ajax_list_activeItem.previousSibling.id=='option_title') return;
				$(ajax_list_activeItem).removeClass(css_selectedItem);
				ajax_list_activeItem=ajax_list_activeItem.previousSibling;
				ajax_options_rollOverActiveItem(true);
			}
			
		}

		if(e.keyCode==40){	// Down arrow
			
			if(!ajax_list_activeItem){
				ajax_options_rollOverActiveItem(true);
			}else{
				//$('lele:'+$(ajax_list_activeItem).html()+'  <br>').prependTo('body');
				if(!ajax_list_activeItem.nextSibling)return;
				$(ajax_list_activeItem).removeClass(css_selectedItem);
				ajax_list_activeItem=ajax_list_activeItem.nextSibling;
				ajax_options_rollOverActiveItem(true);
			}
			
		}
		
		if(e.keyCode==13 || e.keyCode==9){	// Enter key or tab key
			if(ajax_list_activeItem && ajax_list_activeItem.className=='optionDivSelected')
			  ajax_option_setValue(false,ajax_list_activeItem);
			  
			if(e.keyCode==13){
				$(ajax_list_activeItem).click();
			  return false;
			} 
			else 
				return true;
		}
		return true;
	}
	
	
	document.documentElement.onclick = autoHideList;
	
	function autoHideList(e)
	{
		if(document.all)e = event;
		
		if (e.target) source = e.target;
			else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;		
		if(source.tagName.toLowerCase()!='input' && source.tagName.toLowerCase()!='textarea')ajax_options_hide();
		
	}
function noshow_back(){
document.getElementById('back_date1').style.display='none';
document.getElementById('back_date2').style.display='none';
document.getElementById('back_date3').style.display='none';
document.getElementById('back_date4').style.display='none';
}
function show_back(){
document.getElementById('back_date1').style.display='block';
document.getElementById('back_date2').style.display='block';
document.getElementById('back_date3').style.display='block';
document.getElementById('back_date4').style.display='block';
}
