﻿function sameHeight() {
    var bookingDivHeight = window.document.getElementById("bookingDiv").offsetHeight;
    window.document.getElementById("bookingAppBG").style.height = bookingDivHeight + 'px';
}

function highlight(id) {
    document.getElementById(id).style.backgroundColor = "FCF7F1";
    document.body.style.cursor = "pointer";
}

function unhighlight(id) {
    document.getElementById(id).style.backgroundColor = "FFFFFF";
    document.body.style.cursor = "default";
}

function f_Insurance() {
    var w = window.open("http://" + location.host + "/VacationWizard/TravelProtectionPlan.aspx", "termswin", "width=700,height=500,scrollbars=yes,resizable=yes,location=no");
}
function f_Terms() {
    var w = window.open("http://" + location.host + "/VacationWizard/Terms.aspx", "termswin", "width=700,height=500,scrollbars=yes,resizable=yes,location=no");
}

function getClientId(controlId) {
    var count = document.forms[0].length;
    var i = 0;
    var aspControlId;
    for (i = 0; i < count; i++) {
        aspControlId = document.forms[0].elements[i].id;
        pos = aspControlId.indexOf(controlId);
        if (pos >= 0) alert(aspControlId);
    }
    return aspControlId;
}

// RadDatePicker //
function OnDateSelected(sender, e) {
    var aspControlId;
    var count = document.forms[0].length;
    var i = 0;
    for (i = 0; i < count; i++) {
        aspControlId = document.forms[0].elements[i].id;
        pos = aspControlId.indexOf("dnn_tbCheckOutDate");
        if (pos >= 0) break;
    }
    var datePicker2 = $find(aspControlId);
    var departDate = e.get_newDate();
    var returnDate = datePicker2.get_selectedDate();
    if (returnDate == null) {
        returnDate = departDate;
    }

    if (departDate != null) {
        if (returnDate == null || returnDate <= departDate) {
            returnDate.setDate(departDate.getDate() + 7);
            datePicker2.set_selectedDate(returnDate);
        }
    }
}

