﻿//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------ 地区选择框涉及的3个函数 ------ 开始 ------
function ShowDivArea(Self)
{
    var op = window.document.getElementById("DivArea");
    op.style.visibility = "visible";
    Self.style.color = "black";
    if (Self.value == "--请选择--") 
    {
        Self.value = "";
    }
    if (window.document.getElementById("DivSeatCount"))
    {
        window.document.getElementById("DivSeatCount").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivBothArea"))
    {
        window.document.getElementById("DivBothArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivQuotePrice"))
    {
        window.document.getElementById("DivQuotePrice").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivRent"))
    {
        window.document.getElementById("DivRent").style.visibility = "hidden";
    }
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "hidden";
    }
}
function HiddenDivArea()
{
    var op = window.document.getElementById("DivArea");
    op.style.visibility = "hidden";
    window.document.getElementById("TxtArea").style.color = "black";
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
function SetAreaValue()
{
    var op = window.document.getElementById("DivArea");
    op.style.visibility = "hidden";
    var Province = window.document.getElementById("DdlProvince").value;
    var City = window.document.getElementById("DdlCity").value;
    var County = window.document.getElementById("DdlCounty").value;
    
    var Area = County;
    if (Area == "" || Area == "不限")
    {
        Area = City;
    }
    if (Area == "" || Area == "不限")
    {
        Area = Province;
    }
    if (Area == "")
    {
        Area = "不限";
    }
    window.document.getElementById("TxtArea").value = Area;
    window.document.getElementById("TxtArea").style.color = "black";
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
//------------------------------------------------ 地区选择框涉及的3个函数 ------ 结束 ------


//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------ 座位数选择涉及的3个函数 ------ 开始 ------
function ShowDivSeatCount(Self)
{
    var op = window.document.getElementById("DivSeatCount");
    op.style.visibility = "visible";
    Self.style.color = "black";
    if (Self.value == "--请选择--") 
    {
        Self.value = "";
    }
    if (window.document.getElementById("DivArea"))
    {
        window.document.getElementById("DivArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivBothArea"))
    {
        window.document.getElementById("DivBothArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivQuotePrice"))
    {
        window.document.getElementById("DivQuotePrice").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivRent"))
    {
        window.document.getElementById("DivRent").style.visibility = "hidden";
    }
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
function HiddenDivSeatCount()
{
    var op = window.document.getElementById("DivSeatCount");
    op.style.visibility = "hidden";
    window.document.getElementById("TxtSeatCount").style.color = "black";
    
    var opSeatCount = window.document.getElementById("TxtSeatCount");
    if (opSeatCount.value == "")
    {
        opSeatCount.value = "--请选择--";
        opSeatCount.style.color = "DarkGray";
    }
}
function SetSeatCount()
{
    var op = window.document.getElementById("DivSeatCount");
    var rbtn0 = window.document.getElementById("RbtnSeatCount0");
    var rbtn1 = window.document.getElementById("RbtnSeatCount1");
    var rbtn2 = window.document.getElementById("RbtnSeatCount2");
    var SeatCountOnly = window.document.getElementById("TxtSeatCountOnly");
    var SeatCountStart = window.document.getElementById("TxtSeatCountStart");
    var SeatCountEnd = window.document.getElementById("TxtSeatCountEnd");
    op.style.visibility = "hidden";
    
    var SeatCount = "";
    if (rbtn0.checked)
    {
        SeatCount = "不限";
    }
    else if (rbtn1.checked)
    {
        if (isNaN(SeatCountOnly.value))
        {
            SeatCountOnly.value = "";
           SeatCount = ""; 
        }
        else
        {
            SeatCount = SeatCountOnly.value;
        }
    }
    else if (rbtn2.checked)
    {
        if (isNaN(SeatCountStart.value))
        {
            SeatCountStart.value = "";
        }
        if (isNaN(SeatCountEnd.value))
        {
            SeatCountEnd.value = "";
        }
        if (SeatCountStart.value != "" && SeatCountEnd.value != "")
        {
            SeatCount = SeatCountStart.value + "至" + SeatCountEnd.value;
        }
        else if (SeatCountStart.value != "")
        {
            SeatCount = SeatCountStart.value + "以上";
        }
        else if (SeatCountEnd.value != "")
        {
            SeatCount = SeatCountEnd.value + "以下";
        }
        else
        {
            SeatCount = "";
        }
    }
    if (SeatCount == "")
    {
        window.document.getElementById("TxtSeatCount").value = "--请选择--";
        window.document.getElementById("TxtSeatCount").style.color = "DarkGray";
    }
    else
    {
        window.document.getElementById("TxtSeatCount").value = SeatCount;
        window.document.getElementById("TxtSeatCount").style.color = "black";
    }
}
//------------------------------------------------ 座位数选择涉及的3个函数 ------ 结束 ------


//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------ 两端城市选择框涉及的3个函数 ------ 开始 ------
function ShowDivBothArea(Self)
{
    var op = window.document.getElementById("DivBothArea");
    op.style.visibility = "visible";
    Self.style.color = "black";
    if (Self.value == "--请选择--") 
    {
        Self.value = "";
    }
    if (window.document.getElementById("DivArea"))
    {
        window.document.getElementById("DivArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivSeatCount"))
    {
        window.document.getElementById("DivSeatCount").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivQuotePrice"))
    {
        window.document.getElementById("DivQuotePrice").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivRent"))
    {
        window.document.getElementById("DivRent").style.visibility = "hidden";
    }
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
function HiddenDivBothArea()
{
    var op = window.document.getElementById("DivBothArea");
    op.style.visibility = "hidden";
    window.document.getElementById("TxtAreaOfLine").style.color = "black";
}
function SetBothAreaValue()
{
    var op = window.document.getElementById("DivBothArea");
    op.style.visibility = "hidden";
    var StartProvince = window.document.getElementById("DdlStartProvince").value;
    var StartCity = window.document.getElementById("DdlStartCity").value;
    var StartCounty = window.document.getElementById("DdlStartCounty").value;
    var EndProvince = window.document.getElementById("DdlEndProvince").value;
    var EndCity = window.document.getElementById("DdlEndCity").value;
    var EndCounty = window.document.getElementById("DdlEndCounty").value;
    var EndAirdrome = window.document.getElementById("DdlEndAirdrome").value;
    
    var StartArea = StartCounty;
    if (StartArea == "" || StartArea == "不限")
    {
        StartArea = StartCity;
    }
    if (StartArea == "" || StartArea == "不限")
    {
        StartArea = StartProvince;
    }
    if (StartArea == "")
    {
        StartArea = "不限";
    }
    var EndArea = EndCounty;
    if (EndArea == "" || EndArea == "不限")
    {
        EndArea = EndCity;
    }
    if (EndArea == "" || EndArea == "不限")
    {
        EndArea = EndProvince;
    }
    if (EndArea == "")
    {
        EndArea = "不限";
    }
    var Area = "不限";
    if (StartArea != "不限" && EndArea != "不限")
    {
        Area = StartArea + "-" + EndArea;
    }
    else if (StartArea != "不限")
    {
        Area = StartArea;
    }
    else if (EndArea != "不限")
    {
        Area = EndArea;
    }
    if (EndAirdrome != "" && EndAirdrome != "不限")
    {
        Area = Area + "-" + EndAirdrome;
    }
    window.document.getElementById("TxtAreaOfLine").value = Area;
    window.document.getElementById("TxtAreaOfLine").style.color = "black";
}
//------------------------------------------------ 两端城市选择框涉及的3个函数 ------ 结束 ------


//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------ 线路模式报价选择涉及的3个函数 ------ 开始 ------
function ShowDivQuotePrice(Self)
{
    var op = window.document.getElementById("DivQuotePrice");
    op.style.visibility = "visible";
    Self.style.color = "black";
    if (Self.value == "--请选择--") 
    {
        Self.value = "";
    }
    if (window.document.getElementById("DivArea"))
    {
        window.document.getElementById("DivArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivSeatCount"))
    {
        window.document.getElementById("DivSeatCount").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivBothArea"))
    {
        window.document.getElementById("DivBothArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivRent"))
    {
        window.document.getElementById("DivRent").style.visibility = "hidden";
    }
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
function HiddenDivQuotePrice()
{
    var op = window.document.getElementById("DivQuotePrice");
    op.style.visibility = "hidden";
    window.document.getElementById("TxtQuotePrice").style.color = "black";
    
    var opQuotePrice = window.document.getElementById("TxtQuotePrice");
    if (opQuotePrice.value == "")
    {
        opQuotePrice.value = "--请选择--";
        opQuotePrice.style.color = "DarkGray";
    }
}
function SetQuotePrice()
{
    var op = window.document.getElementById("DivQuotePrice");
    var rbtn1 = window.document.getElementById("RbtnQuotePrice1");
    var rbtn2 = window.document.getElementById("RbtnQuotePrice2");
    var rbtn3 = window.document.getElementById("RbtnQuotePrice3");
    var QuotePrice1 = window.document.getElementById("TxtQuotePrice1");
    var QuotePrice2 = window.document.getElementById("TxtQuotePrice2");
    var QuotePrice3 = window.document.getElementById("TxtQuotePrice3");
    var QuotePrice4 = window.document.getElementById("TxtQuotePrice4");
    op.style.visibility = "hidden";
    
    var QuotePrice = "";
    if (rbtn1.checked)
    {
        if (isNaN(QuotePrice1.value) || QuotePrice1.value == "")
        {
            QuotePrice1.value = "";
            QuotePrice = ""; 
        }
        else
        {
            QuotePrice = QuotePrice1.value + "元以上";
        }
    }
    else if (rbtn2.checked)
    {
        if (isNaN(QuotePrice2.value) || QuotePrice2.value == "")
        {
            QuotePrice2.value = "";
            QuotePrice = ""; 
        }
        else
        {
            QuotePrice = QuotePrice2.value + "元以下";
        }
    }
    else if (rbtn3.checked)
    {
        if (isNaN(QuotePrice3.value))
        {
            QuotePrice3.value = "";
        }
        if (isNaN(QuotePrice4.value))
        {
            QuotePrice4.value = "";
        }
        if (QuotePrice3.value != "" && QuotePrice4.value != "")
        {
            if (QuotePrice3.value == QuotePrice4.value)
            {
                QuotePrice = QuotePrice3.value + "元";
            }
            else
            {
                QuotePrice = QuotePrice3.value + "至" + QuotePrice4.value + "元之间";
            }
        }
        else if (QuotePrice3.value != "")
        {
            QuotePrice = QuotePrice3.value + "元以上";
        }
        else if (QuotePrice4.value != "")
        {
            QuotePrice = QuotePrice4.value + "元以下";
        }
        else
        {
            QuotePrice = "";
        }
    }
    if (QuotePrice == "")
    {
        window.document.getElementById("TxtQuotePrice").value = "--请选择--";
        window.document.getElementById("TxtQuotePrice").style.color = "DarkGray";
    }
    else
    {
        window.document.getElementById("TxtQuotePrice").value = QuotePrice;
        window.document.getElementById("TxtQuotePrice").style.color = "black";
    }
}
//------------------------------------------------ 线路模式报价选择涉及的3个函数 ------ 结束 ------


//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------ 租用模式报价选择涉及的3个函数 ------ 开始 ------
function ShowDivRent(Self)
{
    var op = window.document.getElementById("DivRent");
    op.style.visibility = "visible";
    Self.style.color = "black";
    if (Self.value == "--请选择--") 
    {
        Self.value = "";
    }
    if (window.document.getElementById("DivArea"))
    {
        window.document.getElementById("DivArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivSeatCount"))
    {
        window.document.getElementById("DivSeatCount").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivBothArea"))
    {
        window.document.getElementById("DivBothArea").style.visibility = "hidden";
    }
    if (window.document.getElementById("DivQuotePrice"))
    {
        window.document.getElementById("DivQuotePrice").style.visibility = "hidden";
    }
    if (window.document.getElementById("DdlQuoteMode"))
    {
        window.document.getElementById("DdlQuoteMode").style.visibility = "";
    }
}
function HiddenDivRent()
{
    var op = window.document.getElementById("DivRent");
    op.style.visibility = "hidden";
    window.document.getElementById("TxtRent").style.color = "black";
    
    var opRent = window.document.getElementById("TxtRent");
    if (opRent.value == "")
    {
        opRent.value = "--请选择--";
        opRent.style.color = "DarkGray";
    }
}
function SetRent()
{
    var op = window.document.getElementById("DivRent");
    var rbtn1 = window.document.getElementById("RbtnRent1");
    var rbtn2 = window.document.getElementById("RbtnRent2");
    var rbtn3 = window.document.getElementById("RbtnRent3");
    var Rent1 = window.document.getElementById("TxtRent1");
    var Rent2 = window.document.getElementById("TxtRent2");
    var Rent3 = window.document.getElementById("TxtRent3");
    var Rent4 = window.document.getElementById("TxtRent4");
    op.style.visibility = "hidden";
    
    var Rent = "";
    if (rbtn1.checked)
    {
        if (isNaN(Rent1.value) || Rent1.value == "")
        {
            Rent1.value = "";
            Rent = ""; 
        }
        else
        {
            Rent = Rent1.value + "元以上";
        }
    }
    else if (rbtn2.checked)
    {
        if (isNaN(Rent2.value) || Rent2.value == "")
        {
            Rent2.value = "";
            Rent = ""; 
        }
        else
        {
            Rent = Rent2.value + "元以下";
        }
    }
    else if (rbtn3.checked)
    {
        if (isNaN(Rent3.value))
        {
            Rent3.value = "";
        }
        if (isNaN(Rent4.value))
        {
            Rent4.value = "";
        }
        if (Rent3.value != "" && Rent4.value != "")
        {
            if (Rent3.value == Rent4.value)
            {
                Rent = Rent3.value + "元";
            }
            else
            {
                Rent = Rent3.value + "至" + Rent4.value + "元之间";
            }
        }
        else if (Rent3.value != "")
        {
            Rent = Rent3.value + "元以上";
        }
        else if (Rent4.value != "")
        {
            Rent = Rent4.value + "元以下";
        }
        else
        {
            Rent = "";
        }
    }
    if (Rent == "")
    {
        window.document.getElementById("TxtRent").value = "--请选择--";
        window.document.getElementById("TxtRent").style.color = "DarkGray";
    }
    else
    {
        window.document.getElementById("TxtRent").value = Rent;
        window.document.getElementById("TxtRent").style.color = "black";
    }
}
//------------------------------------------------ 租用模式报价选择涉及的3个函数 ------ 结束 ------

