﻿function AirPort() {
}
var Air = new AirPort();
AirPort.prototype.$ = function (id) {
    return document.getElementById(id);
}
AirPort.prototype.$$ = function (name) { return document.getElementsByName(name); }
AirPort.prototype.ShowXY = function () {
}
var framestatefocus = false;
AirPort.prototype.ShowTicketAirPortsCityFrame = function (box, valuehidden, frame) {
    var tcf = document.getElementById(frame);
    var twcf = eval("window.frames." + frame);
    twcf.CityBox = box;
    twcf.CityCodeHidden = valuehidden;
    twcf.firstvalue = "";
    twcf.firstcode = "";
    twcf.FrameLi = frame;
    twcf.b = "";
    var boxs = this.$(box);
    twcf.b = boxs.value;
    twcf.SetListInfo();
    tcf.onmouseover = function ()
    { framestatefocus = true; }
    tcf.onmouseout = function ()
    { framestatefocus = false; }
    this.SetOjbectWay(box, frame, 100);
    tcf.style.display = "block";
    framestatefocus = false;
}
AirPort.prototype.SetOjbectWay = function (a, b, widths) {
    var cf = this.$(b);
    var eT = 0, eL = 0, p = this.$(a);
    var sT = document.body.scrollTop, sL = document.body.scrollLeft;
    var eH = this.$(a).clientHeight, eW = this.$(a).clientWidth;
    while (p && p.tagName != "BODY") { eT += p.offsetTop; eL += p.offsetLeft; p = p.offsetParent; }

    cf.style.top = eT + eH + 1 + "px";
    cf.style.left = ((document.body.clientWidth - (eL - sL) >= widths) ? eL : eL + eW - widths) + "px";
}
AirPort.prototype.SelectTicketAirPortsCityCode = function (str, code, ct, hidds, fr) {
    var box = window.parent.document.getElementById(ct);
    var codes = window.parent.document.getElementById(hidds);
    box.value = str;
    codes.value = code;
    var frame = window.parent.document.getElementById(fr);
    frame.style.display = "none";
}
AirPort.prototype.HiddenTicketAirPortsCityFrame = function (box, valuehidden, frame) {
    var cf = document.getElementById(frame);
    var twcf = eval("window.frames." + frame);
    twcf.FrameLi = frame;

    if (cf != null) {
        if (!framestatefocus) {
            this.$(box).value = twcf.firstvalue;
            this.$(valuehidden).value = twcf.firstcode;
            cf.style.display = "none";
            twcf.firstvalue = "";
            twcf.firstcode = "";
            twcf.b = "";
        }
    }
}
AirPort.prototype.SetAirPortsFrameDefaultValue = function (box, frame) {
    var box = this.$(box);
    var twcf = eval("window.frames." + frame);
    twcf.FrameLi = frame;
    twcf.b = box.value;
    twcf.SetListInfo();
}
function hideCityList() {
    var cf = Air.$("TicketAirPorts");
    if (cf != null)
        cf.style.display = "none";

}

