function ShowDialog(url) {
    var width = 772;
    var left = Math.round((screen.width - width) / 2);
    var height = screen.height - 100;
    theField = document.getElementById("dest");
    dialogWindow = window.open(url, "DATE", "dependent=yes, menubar=no, location=no, resizable=no, width=" +
                                            width + ", height=" + height + ", toolbar=no, scrollbars=yes, left=" + left + ", top=0");
}

function TransferValue(theValue) {
    if (theField != null)
        theField.value = theValue;
}

function Transfer(day) {
    theValue = day
    window.opener.TransferValue(theValue);
    window.close()
}

function ShowDialog2(theInput, url) {
    var y2,m2,d2;
    theField = eval("document.hotel." + theInput);
    if (theInput == "dateTo") {
        sep2 = document.online.dateFrom.value.split(".");
        d2 = sep2[0];
        m2 = sep2[1] - 1;
        y2 = sep2[2];
        if (y2 == "")
            y2 = new Date().getFullYear();
    }
    sep = theField.value.split(".");
    if (sep[2] == "")
        sep[2] = new Date().getFullYear();

    dialogWindow = window.open(url + "Y=" + sep[2] + "&M=" + (sep[1] - 1) + "&Y2=" + y2 + "&M2=" + m2 + "&D2=" + d2, "MyDialog",
            "dependent=yes, menubar=no, location=no, resizable=no, width=217, height=196, toolbar=no, scrollbars=no, left=100, top=100");
}

function view_childage(num) {
    value = eval("document.getElementById('room" + num + "').value");
    holder = eval("document.getElementById('room-holder" + num + "')");
    if (value == 'DBLCHD' || value == 'TWNCHD')
        holder.style.display = '';
    else
        holder.style.display = 'none';
}

function fnTrapKD(btn, event) {
    if (document.all) {
        if (event.keyCode == 13) {
            event.returnValue = false;
            event.cancel = true;
            btn.click();
        }
    }
    else if (document.getElementById) {
        if (event.which == 13) {
            event.returnValue = false;
            event.cancel = true;
            btn.click();
        }
    }
    else if (document.layers) {
        if (event.which == 13) {
            event.returnValue = false;
            event.cancel = true;
            btn.click();
        }
    }
}

function newFormWindow(newWindow, script, target) {
    if (newWindow == true) {
        var width = 773;
        var height = screen.height - 100;
        var left = Math.round((screen.width - width) / 2);
        var top = 0;
        var amadeusWindow = window.open("", target, "height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",resizable=yes,scrollbars=yes,status=yes");
        amadeusWindow.focus();
    }
    return true;
}


function ShowInfo(url) {
    var width = 772;
    var left = Math.round((screen.width - width) / 2);
    var height = screen.height - 100;
    dialogWindow = window.open(url, "HotelFound", "dependent=yes, menubar=no, location=no, resizable=no, width=" + width + ", height=" + height + ", toolbar=no, scrollbars=yes, left=" + left + ", top=0");
}

function returnBack(script, url, newWindow) {
    rodic = window.opener;
    if (newWindow == false || rodic == null)
        location.href = script;
    else {
        closedRodic = window.opener.closed;
        if (closedRodic == true) {
            width = screen.width - 10;
            height = screen.height - 190;
            window.open(url, "", "menubar=yes, location=yes, resizable=yes, width=" + width + ", height= " + height + ", toolbar=yes, scrollbars=yes, status=yes, left=0, top=0");
            window.close();
        }
        else {
            rodic.location.href = script;
            rodic.focus();
            window.close();
        }
    }
}

function view_last_arrival() {
    var state = document.getElementById("last_arrival_div").style.display;
    if (state == '')
        document.getElementById("last_arrival_div").style.display = 'none'
    else {
        document.getElementById("last_arrival_div").style.display = '';
    }
}

