﻿var Source = "Domestic"; //国内票(Domestic)国际票(Inter)

//根据航程类型 显示不同类型的查询城市和查询时间
function changeFlyType(oInput) {
    var flyType = oInput.value;
    document.getElementById(Source + "HfFlyType").value = flyType; //存放选择的航段类型
    var liTransfer = document.getElementById(Source + "LiTransfer"); //中转城市li
    var labFirstDate = document.getElementById(Source + "LabFirstDate"); //一程时间li
    var liSecondDate = document.getElementById(Source + "LiSecondDate"); //二程时间li
    var labSecondDate = document.getElementById(Source + "LabSecondDate"); //二程时间显示名称的label

    if (flyType == 0) {//单程
        liTransfer.style.display = "none";
        liSecondDate.style.display = "none";
        labFirstDate.innerHTML = "出发时间：";
    }
    else if (flyType == 1) {//往返
        liTransfer.style.display = "none";
        liSecondDate.style.display = "";
        labFirstDate.innerHTML = "去程时间：";
        liSecondDate.style.display = "";
        labSecondDate.innerHTML = "返程时间：";
    }
    else { //多段
        liTransfer.style.display = "";
        liSecondDate.style.display = "";
        labFirstDate.innerHTML = "一程日期：";
        liSecondDate.style.display = "";
        labSecondDate.innerHTML = "二程日期：";
    }
}

//在查询按钮下方显示提示框(只显示3秒)
function ShowMsg(str, oMsg) {
    var ulMsg = document.getElementById(str + "UlMsg");
    var spanMst = document.getElementById(str + "SpanMsg");
    ulMsg.style.display = "";
    spanMst.innerHTML = oMsg;
    setTimeout(str + "UlMsg.style.display = \"none\"", 3000); //2秒钟自动隐藏 
}

//用于首页中国内国际机票查询的切换
function showAnother(str) {
    if (str == "Domestic") {
        $("DomesticDiv").style.display = "block";
        $("InternationalDiv").style.display = "none";
        $("DomesticLi").className = "CurrentTab";
        $("InterLi").className = "ProcessTab";
    }
    else if (str == "Inter") {
        $("InternationalDiv").style.display = "block";
        $("DomesticDiv").style.display = "none";
        $("InterLi").className = "CurrentTab";
        $("DomesticLi").className = "ProcessTab";
    }
    Source = str;
}

//在查询按钮下方持续显示提示框
function ShowMsgAllow(oMsg) {
    var divConsumeTime = document.getElementById(Source + "DivConsumeTime");
    var spanConsumeTime = document.getElementById(Source + "SpanConsumeTime");
    divConsumeTime.style.display = "";
    spanConsumeTime.innerHTML = oMsg;
}

//日期格式验证
function flightCheckDate(str) {
    var regStr = /^((?!0000)[0-9]{4}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)|(0[13578]|1[02])-31)|([0-9]{2}(0[48]|[2468][048]|[13579][26])|(0[48]|[2468][048]|[13579][26])00)-02-29)$/;
    return regStr.test(str);
}

//检查查询信息
function checkSearchInfo(oBtn) {
    var fromCity = document.getElementById(Source + "FromCity");
    var toCity = document.getElementById(Source + "ToCity");
    var transferCity = document.getElementById(Source + "TransferCity");
    var firstDate = document.getElementById(Source + "FirstDate");
    var secondDate = document.getElementById(Source + "SecondDate");
    var selAirCompany = document.getElementById(Source + "SelAirCompany");
    var flyType = document.getElementById(Source + "HfFlyType");
    if (fromCity.value == "" || fromCity.value == "中文/拼音/代码") {
        ShowMsg(Source, "出发城市不能为空");
        return;
    }
    if (toCity.value == "" || toCity.value == "中文/拼音/代码") {
        ShowMsg(Source, "到达城市不能为空");
        return;
    }
    var tempDt = new Date();
    var strToday = DateDemo(addDate(tempDt, 0)); // 今天日期

    if (flyType.value == 0) {//单程查询
        if (fromCity.value == toCity.value) {
            ShowMsg(Source, "出发城市和到达城市不能相同");
            return;
        }
        if (firstDate.value == "") {
            ShowMsg(Source, "起飞时间不能为空");
            firstDate.focus();
            return;
        }
        if (!flightCheckDate(firstDate.value)) {
            ShowMsg(Source, "起飞时间格式不正确");
            firstDate.focus();
            return;
        }
        if (dateDiff(firstDate.value, strToday) < 0) {
            ShowMsg(Source, "起飞时间不能早于当天");
            firstDate.focus();
            return;
        }
    }
    else if (flyType.value == 1) {//往返查询
        if (fromCity.value == toCity.value) {
            ShowMsg(Source, "出发城市和到达城市不能相同");
            return;
        }
        if (firstDate.value == "") {
            ShowMsg(Source, "去程时间不能为空");
            firstDate.focus();
            return;
        }
        if (secondDate.value == "") {
            ShowMsg(Source, "返程时间不能为空");
            secondDate.focus();
            return;
        }
        if (!flightCheckDate(firstDate.value)) {
            ShowMsg(Source, "去程时间格式不正确");
            firstDate.focus();
            return;
        }
        if (!flightCheckDate(secondDate.value)) {
            ShowMsg(Source, "返程时间格式不正确");
            secondDate.focus();
            return;
        }
        if (dateDiff(firstDate.value, secondDate.value) == 1) {
            ShowMsg(Source, "去程时间不能晚于返程日期");
            return;
        }
        if (dateDiff(firstDate.value, strToday) < 0) {
            ShowMsg(Source, "去程时间不能早于当天日期");
            return;
        }
        if (dateDiff(secondDate.value, strToday) < 0) {
            ShowMsg(Source, "返程时间不能早于当天日期");
            return;
        }
    } else if (flyType.value == 2) { //多段
        if (transferCity.value == "" || transferCity == "中文/拼音/代码") {
            ShowMsg(Source, "中转城市不能为空");
            return;
        }
        if (fromCity.value == transferCity.value) {
            ShowMsg(Source, "出发城市和中转城市不能相同");
            return;
        }
        if (toCity.value == transferCity.value) {
            ShowMsg(Source, "到达城市和中转城市不能相同");
            return;
        }
        if (firstDate.value == "") {
            ShowMsg(Source, "一程时间不能为空");
            firstDate.focus();
            return;
        }
        if (secondDate.value == "") {
            ShowMsg(Source, "二程时间不能为空");
            firstDate.focus();
            return;
        }
        if (dateDiff(firstDate.value, secondDate.value) == 1) {
            ShowMsg(Source, "二程时间不能早于一程日期");
            return;
        }
        if (dateDiff(firstDate.value, strToday) < 0) {
            ShowMsg(Source, "一程时间不能早于当天日期");
            return;
        }
        if (dateDiff(secondDate.value, strToday) < 0) {
            ShowMsg(Source, "二程时间不能早于当天日期");
            return;
        }
    }
    //数据验证完成后 提交到查询结果页面
    ShowProgressBarPage(40, "正在为您实时查询航班，请稍候...");
    var oForm = document.forms[0];
    oForm.method = "post";
    if (Source == 'Domestic')
        oForm.action = "/CommonPage/DomesticFlights.aspx?action=search";
    if (Source == 'Inter')
        oForm.action = "/CommonPage/InternationalFlights.aspx?action=search";
    oBtn.disabled = true;
    oForm.submit();
    if (document.getElementById(Source + "DivErrMsg"))
        document.getElementById(Source + "DivErrMsgInfo").style.display = "none";
    document.getElementById(Source + "BtnSearch").enableviewstate = false;
    ShowMsgAllow("");
}

//对查询出来的航班重新 排序========================================================start
function sortBySelItem(oSelect) {
    var oIndex = oSelect.id.split("-")[1];
    var sb = new StringBuilder("");
    var temDivs = document.getElementsByTagName("div");
    var tempAirDivs = new Array();

    //航空公司筛选
    var selectedEzm = "";
    var ezmSelect = document.getElementsByName("chkEzmSelect-" + oIndex);
    if (ezmSelect) {
        for (var p = 0; p < ezmSelect.length; p++) {
            if (ezmSelect[p].checked)
                selectedEzm += ezmSelect[p].value + ",";
        }
        if (selectedEzm != "")
            selectedEzm = "," + selectedEzm;
    }

    for (var j = 0; j < temDivs.length; j++) {
        if (temDivs[j].id.indexOf("divSortAirInfo-" + oIndex) != -1) {
            if (selectedEzm == "" || selectedEzm.indexOf("," + temDivs[j].getAttribute("sortAirCompany") + ",") != -1)
                temDivs[j].style.display = '';
            else
                temDivs[j].style.display = 'none';
            tempAirDivs.push(temDivs[j]);
        }
    }
    if (tempAirDivs.length > 0) { //如果有航班，排序
        var tempIntArr = new Array();
        for (var i = 0; i < tempAirDivs.length; i++) {
            tempIntArr[i] = new Array();
            if (oSelect.value == 0)  // 按价格排序
                tempIntArr[i].push(parseInt(tempAirDivs[i].getAttribute("sortPrice"), 10)); //自定义属性 sortPrice
            else if (oSelect.value == 1) //按时间
                tempIntArr[i].push(parseInt(tempAirDivs[i].getAttribute("sortStartTime"), 10)); //自定义属性 sortStartTime
            else if (oSelect.value == 2) //按航空公司(中文)排序
                tempIntArr[i].push(tempAirDivs[i].getAttribute("sortAirCompany")); //自定义属性 sortAirCompan++y

            tempIntArr[i].push(tempAirDivs[i].outerHTML); // 二维数组
        }
        if (oSelect.selectedIndex != 2) {
            bubbleSort(tempIntArr);
        }
        else { //按汉字排序
            var oLen = tempIntArr.length;
            for (var kk = 0; kk < oLen; kk++) {
                for (var jj = kk + 1; jj < oLen; jj++) {
                    if (String(tempIntArr[kk][0]).localeCompare(String(tempIntArr[jj][0])) > 0) {
                        var tmpArr = tempIntArr[kk];
                        tempIntArr[kk] = tempIntArr[jj];
                        tempIntArr[jj] = tmpArr;
                    }
                }
            }
        }
        for (var ii = 0; ii < tempIntArr.length; ii++) {
            sb.Append(tempIntArr[ii][1]);
        }

        $("divAv-" + oIndex).innerHTML = "";
        $("divAv-" + oIndex).innerHTML = sb.toString();
    }
}
//自定义冒泡排序
function bubbleSort(oArray) {
    for (var i = oArray.length; i > 0; i--) {
        for (var j = 0; j < i - 1; j++) {
            if (parseInt(oArray[j][0]) > parseInt(oArray[j + 1][0])) {
                var temp = oArray[j];
                oArray[j] = oArray[j + 1];
                oArray[j + 1] = temp;
            }
        }
    }
    return oArray;
}
//排序========================================================end

//显示退改签层=================================start
function showGaiQian(oSpan, oNum, ev) {
    closeGQDiv();
    showGaiQianDiv(ev);
    $("GQContent").innerHTML = "";
    $("GQContent").innerHTML = "数据获取中，请稍候...";
    var headTitle, sendStr, oAction;
    if (parseInt(oNum) == 0) {//pat查询价格
        oAction = "pat";
        sendStr = oSpan.id.split("-")[2].toString();
        headTitle = "【" + sendStr.split("/")[1] + "舱价格详细】";
        AjaxService.GetPat(sendStr, onSuccess, onFailed);
    }
    else if (parseInt(oNum) == 1) {//退改签规定
        oAction = "gaiQian";
        headTitle = "【退改签规定详细】";
        var airCompay = oSpan.id.split("-")[2].toString();
        var cabin = oSpan.id.split("-")[3].toString();
        AjaxService.GetCabinRemark(airCompay, cabin, onSuccess, onFailed);
    }
    else if (parseInt(oNum) == 2) {//经停说明
        oAction = "getHaltFlight";
        headTitle = "【经停说明】";
        var hangban = oSpan.id.split("-")[3].toString();
        var hangbanRiqi = oSpan.id.split("-")[4].toString() + "-" + oSpan.id.split("-")[5].toString() + "-" + oSpan.id.split("-")[6].toString();
        var from = oSpan.id.split("-")[7].toString();
        if (Source == "Inter")
            AjaxService.GetFfInfoByDsg(hangban, hangbanRiqi, onSuccess, onFailed);
        else
            AjaxService.GetFfInfo(hangban, hangbanRiqi, from, onSuccess, onFailed);
    }
    else if (parseInt(oNum) == 3) { //出票时间
        oAction = "getDzTime";
        headTitle = "【出票时间】";
        var argOtherPlat = oSpan.id.split("$")[4].toString();
        //AjaxService.GetDzTimeByOtherPlatCode(argOtherPlat, onSuccess, onFailed);
        var currentDzTime = "";
        if (argOtherPlat == "")
            currentDzTime = "暂无数据";
        else
            currentDzTime = argOtherPlat.replace(";", "<br />");
        $("GQContent").innerHTML = currentDzTime;
    }

    $("GQHeaderTitle").innerHTML = headTitle;
    //通过Ajax去获取相应数据
    function onSuccess(res) {
        if (parseInt(oNum) == 0) {//pat查询价格
            if (res.toString().substr(0, 5) == "error") {
                $("GQContent").innerHTML = "没有符合条件的运价，预定后可能无法出票";  //res.toString().substr(5, res.toString().length)
                return;
            }
            else {
                var searchresultpat = eval(res);
                var searchresult = "<table><tr><td>票面价</td><td>机建费</td><td>燃油费</td><td>总价</td></tr>";
                for (var s in searchresultpat) {
                    searchresult += "<tr><td>" + searchresultpat[s].Fare + "</td><td>" + searchresultpat[s].Tax + "</td><td>" + searchresultpat[s].Yq + "</td><td>" + searchresultpat[s].Total + "</td></tr>";
                }
                searchresult += "</table>";
                $("GQContent").innerHTML = searchresult;
            }
        }
        else if (parseInt(oNum) == 1) {//退改签规定
            $("GQContent").innerHTML = res;
        }
        else if (parseInt(oNum) == 2) {//经停说明
            if (res.toString().substr(0, 5) == "error") {
                $("GQContent").innerHTML = res.toString().substr(5, res.toString().length);
                return;
            }
            else {
                var searchresultpat = eval(res);
                var searchresult = "<table><tr><td>经停城市</td><td>到达时间</td><td>起飞时间</td></tr>";
                for (var s in searchresultpat) {
                    searchresult += "<tr><td>" + searchresultpat[s].Szm + "</td><td>" + searchresultpat[s].ArriveTime + "</td><td>" + searchresultpat[s].LeaveTime + "</td></tr>";
                }
                searchresult += "</table>";
                $("GQContent").innerHTML = searchresult;
            }
        }
        //        else if (parseInt(oNum) == 3) { //出票时间
        //            $("GQContent").innerHTML = res;
        //        }
    }
    function onFailed(res) {
        alert(res);
    }

}
//显示改签层
function showGaiQianDiv(ev) {
    var xy = getMouseCoordinate(ev);
    var xyArr = xy.split("-");
    var x = parseFloat(xyArr[0]);
    var y = parseFloat(xyArr[1]);
    $("GQLayer").style.display = "block";
    $("GQLayer").style.left = (x - 250) + "px";
    $("GQLayer").style.top = (y + 30) + "px";
    var docuTop = -5;
    if (window.event) {
        var docuTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
    }
    $("GQLayer").style.top = (y + docuTop) + "px";
}
//隐藏退改签层    
function closeGQDiv() {
    $("GQLayer").style.display = "none";
    $("GQHeaderTitle").innerHTML = "";
    $("GQContent").innerHTML = "";
}
//显示退改签层=================================end

//显示隐藏舱位
function showOtherCabins(oSpan) {
    var oIndex = oSpan.id.split("-")[1].toString();
    var num = oSpan.id.split("-")[2].toString();
    //var numOne = num.split("-")[0].toString();
    var uls = document.getElementsByTagName("ul");
    for (var i = 0; i < uls.length; i++) {
        var oUl = uls[i];
        if (oUl.id) {
            if (oUl.id.split("-")[2] == num && oUl.id.split("-")[1] == oIndex) {
                if (oUl.style.display == "none") {
                    oUl.style.display = "";
                    oSpan.innerHTML = "隐藏其他";
                }
                else {
                    oUl.style.display = "none";
                    oSpan.innerHTML = "所有舱位";
                }
                if (oUl.id.split("-").length == 5) {
                    oUl.style.display = "";
                }
            }
        }
    }
}

//预订
function bookingFlight(oBtn, subUrl) {
    var searchType = $("dFlyType").value; //查询类型
    var url = subUrl; //提交地址
    var oInput = document.getElementsByTagName("INPUT");
    var flightChecked = new Array(); //选中的航班
    for (var i = 0; i < oInput.length; i++) {
        if (oInput[i].type == "radio" && oInput[i].id.indexOf("checkCabin-") != -1 && oInput[i].checked == true)
            flightChecked.push(oInput[i].value);
    }
    if (flightChecked.length == 0) {
        alert("请先选择航班后再进行预订");
        return;
    }
    var checkedFlight = document.getElementById("hfCurrentFlights"); //选中的航班 多个以，隔开

    //公司限制起飞前x小时不能预订
    var advanceLimit = document.getElementById("advanceLimit").value;
    if (advanceLimit.length == 0)
        advanceLimit = 2;

    //单程
    if (searchType == "0") {
        var airInfo = flightChecked[0].split("#");
        var isAllowedToOrder = airInfo[airInfo.length - 1]; //是否允许预订
        if (isAllowedToOrder == 1) {
            var now = new Date(); //当前时间
            var leaveTime = new Date(airInfo[0].replace("-", "/").replace("-", "/") + " " + airInfo[2]); //出发时间
            if (leaveTime - now < Number(advanceLimit) * 60 * 60 * 1000) {
                alert("起飞前" + advanceLimit + "小时不允许订票");
                return;
            }
            checkedFlight.value = escape(flightChecked[0]);
        }
        else {
            alert("起飞前" + advanceLimit + "小时不允许订票");
            return;
        }
    }
    else if (searchType == "1") { //往返
        if (flightChecked.length != 2) {
            alert("请分别选择往返两个舱位");
            return;
        }

        var airInfo1 = flightChecked[0].split("#");
        var airInfo2 = flightChecked[1].split("#");
        if (airInfo1[airInfo1.length - 1] != 1 || airInfo2[airInfo2.length - 1] != 1) {
            alert("起飞前" + advanceLimit + "小时或者第二程起飞时间晚于第一程到达时间,不允许预订");
            return;
        }
        //************************************
        //在该处应该加入两个航班的时间比较
        CompareFlightTime(airInfo1[0], airInfo1[2], airInfo1[3], airInfo2[0], airInfo2[2]);
        //************************************
        if (airInfo1[5] != airInfo2[5]) {
            alert("往返预订必须是同一航空公司的航班，否则请按单程分别预订！");
            return;
        }
        checkedFlight.value = escape(flightChecked[0] + "," + flightChecked[1]);
    }
    else if (searchType == "2") { //多段
        if (flightChecked.length == 1) {//第一次查询 显示两断 以后的查询显示一段
            var airInfo = flightChecked[0].split("#");
            var isAllowedToOrder = airInfo[airInfo.length - 1];
            if (isAllowedToOrder != 1) {
                alert("起飞前" + advanceLimit + "小时或者第二程起飞时间晚于第一程到达时间,不允许预订");
                return;
            }
            checkedFlight.value = escape(flightChecked[0]);
        }
        else {
            var airInfo1 = flightChecked[0].split("#");
            var airInfo2 = flightChecked[1].split("#");

            if (airInfo1[airInfo1.length - 1] != 1 || airInfo2[airInfo2.length - 1] != 1) {
                alert("起飞前" + advanceLimit + "小时或者第二程起飞时间晚于第一程到达时间,不允许预订");
                return;
            }
            //************************************
            //在该处应该加入两个航班的时间比较
            CompareFlightTime(airInfo1[0], airInfo1[2], airInfo1[3], airInfo2[0], airInfo2[2]);
            //************************************
            if (airInfo1[5] != airInfo2[5]) {
                alert("多段预订必须是同一航空公司的航班，否则请按单程分别预订！");
                return;
            }
            checkedFlight.value = escape(flightChecked[0] + "," + flightChecked[1]);
        }
    }
    ShowProgressBarPage(40,"正在预订航班...");
    var form = document.forms[0];
    form.mothed = "post";
    form.action = url;
    oBtn.disabled = true;
    form.submit();
}

//比较两个航班的时间间隔是否合法
function CompareFlightTime(oLeaveDate1, oLeaveTime1, oArriveTime1, oLeaveDate2, oLeaveTime2) {
    var leaveTime1 = new Date(oLeaveDate1.replace("-", "/").replace("-", "/") + " " + oLeaveTime1); //一程出发时间
    var arriveTime1 = new Date(oLeaveDate1.replace("-", "/").replace("-", "/") + " " + oArriveTime1); //一程到达时间
    var leaveTime2 = new Date(oLeaveDate2.replace("-", "/").replace("-", "/") + " " + oLeaveTime2); //二程出发时间
    var now = new Date();
    var addHour = 0;
    if (leaveTime1 < now) {
        alert("第一程出发时间不能早于当前时间");
        return;
    }
    //当到达时间是第二天时
    if (leaveTime1 > leaveTime2) {
        addHour = 24;
    }
    if (leaveTime2 < now) {
        alert("第二程出发时间不能早于当前时间");
        return;
    }
    if (leaveTime2 - leaveTime1 < (2 + addHour) * (60 * 60 * 1000)) {
        alert("第二程出发时间必须至少比第一程到达时间晚2个小时");
        return;
    }
}

function searchByDate(oDate, oIndex) {
    ShowProgressBarPage(40, "正在为您实时查询航班，请稍候..."); //显示进度条
    var oForm = document.forms[0];
    if (Source == 'Domestic')
        oForm.action = "/CommonPage/DomesticFlights.aspx?action=search&newDate=" + oDate.toString() + "&oIndex=" + oIndex.toString();
    if (Source == 'Inter')
        oForm.action = "/CommonPage/InternationalFlights.aspx?action=search&newDate=" + oDate.toString() + "&oIndex=" + oIndex.toString();
    oForm.submit();
}


//多段查询中间页面 结束查询 进入预订页面
function multiOrder() {
    var form = document.forms[0];
    form.mothed = "post";
    if (Source == "Domestic")
        form.action = "Order.aspx";
    else if (Source == "Inter")
        form.action = "Order.aspx?orderSource=Inter";
    form.submit();
}
//多段查询中间页面 检查查询信息
function checkMultiSearchInfo() { 
    var fromCity = document.getElementById(Source + "FromCity");
    var toCity = document.getElementById(Source + "ToCity");
    var firstDate = document.getElementById(Source + "FirstDate");
    var lastDate = document.getElementById(Source + "HfLastDate"); //上已成出发时间

    if (fromCity.value == "" || fromCity.value == "中文/拼音/代码") {
        ShowMsg(Source,"出发城市不能为空");
        return;
    }
    if (toCity.value == "" || toCity.value == "中文/拼音/代码") {
        ShowMsg(Source, "到达城市不能为空");
        return;
    }
    if (fromCity.value == toCity.value) {
        ShowMsg(Source, "出发城市和到达城市不能相同");
        return;
    }
    var tempDt = new Date();
    var strToday = DateDemo(addDate(tempDt, 0)); // 今天日期

    if (firstDate.value == "") {
        ShowMsg(Source, "起飞时间不能为空");
        firstDate.focus();
        return;
    }
    if (dateDiff(firstDate.value, strToday) < 0) {
        ShowMsg(Source, "起飞时间不能早于当天");
        firstDate.focus();
        return;
    }
    if (dateDiff(firstDate.value, lastDate.value) < 0) {
        ShowMsg(Source, "出发日期不能早于上一程");
        return;
    }
    ShowProgressBarPage(40, "正在为您实时查询航班，请稍候..."); //显示进度条
    //数据验证完成后 提交到查询结果页面
    var oForm = document.forms[0];
    oForm.method = "post";
    if (Source == 'Domestic')
        oForm.action = "/CommonPage/DomesticFlights.aspx?action=search";
    if (Source == 'Inter')
        oForm.action = "/CommonPage/InternationalFlights.aspx?action=search";
    oForm.submit();
}

//显示直接预订按钮
function showQuikOrder(oChk) {
    var index = oChk.id.split("-")[1];
    var radios = document.getElementsByName("checkCabin-" + index);
    if (!radios) return;
    var lt = getControlCoordinateByControl(oChk).split("-");
    for (var i = 0; i < radios.length; i++) {
        var spanQuikOrder = document.getElementById(radios[i].id.replace("checkCabin", "spanQuikOrder"));
        if (!spanQuikOrder) continue;
        if (radios[i].checked) {
            spanQuikOrder.style.left = (parseInt(lt[0]) + parseInt(oChk.offsetWidth)) + "px";
            spanQuikOrder.style.top = lt[1] + "px";
            spanQuikOrder.style.display = "";
            spanQuikOrder.style.position = "absolute";
        }
        else
            spanQuikOrder.style.display = "none";
    }
}

//显示 && 隐藏 航空公司筛选浮动层
function showEzmSelect(oSpan) {
    var oIndex = oSpan.id.split("-")[1];
    var divEzmSelect = document.getElementById("divEzmSelect-" + oIndex);
    divEzmSelect.onmouseout = function() { hideEzmSelect(oSpan); };
    divEzmSelect.onmouseover = function() { showEzmSelect(oSpan); };
    if (!divEzmSelect) return;
    if (divEzmSelect.style.display == "")
        divEzmSelect.style.display = "none";
    else {
        var lt = getControlCoordinateByControl(oSpan).split("-");
        divEzmSelect.style.left = lt[0] + "px";
        divEzmSelect.className = "EzmSelectdiv";
        divEzmSelect.style.top = (parseInt(lt[1]) + parseInt(oSpan.offsetHeight)) + "px";
        divEzmSelect.style.position = "absolute";
        divEzmSelect.style.display = "";
    }
}
function hideEzmSelect(oSpan) {
    var oIndex = oSpan.id.split("-")[1];
    var divEzmSelect = document.getElementById("divEzmSelect-" + oIndex);
    divEzmSelect.style.display = "none";
}
//根据不同参数显示Terms页面信息
function ShowTerms(url) {
    var win_attr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,' + 'scrollbars=yes,resizable=yes,width= 640,height=500';
    //var url = '/CommonPage/ValidateET.aspx?ietNo=' + tkno + '&invoiceNo=' + ino + '&randEtn=' + rand + '&type=2';
    window.open(url, 'validate', win_attr);
}
