function OnLoad() { $(".RoomCount").change(function () { var b = "oldSelectedIndex", a = this, roomCount = SnTUtils.Parser.TryParseIntNullable($(a).val()), oldSelectedIndex = $(a).data(b); if (roomCount != null) { $(a).data(b, a.selectedIndex); DisplayRooms() } else { try { var code = $(a).val(); eval(code) } catch (e) { SnTUtils.HandleException(e, "ddlRoomCountHandler") } if (oldSelectedIndex) a.selectedIndex = oldSelectedIndex; else a.selectedIndex = 0 } }); DisplayRooms(); $(".ChildrenCount").change(function () { DisplayChildrenDropDowns(this) }) } function DisplayChildrenDropDowns(d) { var g = "#Room_Header .selection-additional span", e = "#ChildrenAgeRoom_", b = "id", f = $(d).val(), a = $(d).attr(b).substr($(d).attr(b).lastIndexOf("_") + 1); $(e + a).find(".ChildrenAge").each(function () { var d = $(this).attr(b).substr($(this).attr(b).lastIndexOf("_") + 1), c = $("#divChildren_" + d + "_Room_" + a); if (d <= f) c.show(); else c.hide(); $(this).change(function () { InsertTooltipWarning(this) }) }); if (f == 0) { DropDownChildrensDesecectAll(a); $(e + a).hide() } else $(e + a).show(); BindCangeEventToCallInsertTooltipWarning(); CallInsertTooltipWarning(1); var c = 0; $(".ChildrenCount").each(function () { var a = SnTUtils.Parser.TryParseInt($(this).val()); if (a > c) c = a }); if (c == 0) $(g).fadeTo(1, .01); else $(g).fadeTo(1, .01).slice(1, c + 1).fadeTo(1, 1) } function BindCangeEventToCallInsertTooltipWarning() { var a = "a[id*='LnkChangeSearch']"; $(a).length > 0 && $(a).click(function () { CallInsertTooltipWarning(1) }); $("select[id$='_cboArrivalD'], NaNNaNNaNNaNNaNNaN").change(function () { CallInsertTooltipWarning(1) }) } function CallInsertTooltipWarning(a) { setTimeout(function () { var a = $("select[id$='Room_1_Children_1']"); a.length > 0 && InsertTooltipWarning(a) }, a) } function GetToolTipMessge() { var a = ""; if (!_cbxObjectTypeAppartment || _cbxObjectTypeAppartment.length == 0 || _cbxObjectTypeAppartment && _cbxObjectTypeAppartment.length && !_cbxObjectTypeAppartment[0].checked) a = window._childrenTooltipMessage ? window._childrenTooltipMessage : ""; return a } function InsertTooltipWarning() { $("#divToolTipMessge").hide() } function AppendQueryString(e) { var a = GetHref(e), d = GetArrivalDate(), b = GetDepatureDate(), c = GetObjectId(); a += c != "" ? "?objectId=" + c : "?"; a += d != "" ? "&arrival=" + d : ""; a += b != "" ? "&departure=" + b : ""; e.attr("href", a) } function GetArrivalDate() { var b = $("select[id$='_cboArrivalD']").val(), a = $("select[id$='_cboArrivalMY']").val(), c = ""; if (b != undefined && b != "" && a != undefined && a != "") c = b + "." + a.replace("-", "."); return c } function GetDepatureDate() { var b = $("select[id$='_cboDepartureD']").val(), a = $("select[id$='_cboDepartureMY']").val(), c = ""; if (b != undefined && b != "" && a != undefined && a != "") c = b + "." + a.replace("-", "."); return c } function GetObjectId() { var a = $("select[id$='selHotel']"); if (a.length == 0) a = $("select[id$='selFacilities']"); if (a.length == 0) a = $("select[id$='AccommodationObjects']"); var b = a.length > 0 ? $(a).val() : window._objectId != undefined ? window._objectId : ""; if (b.indexOf("_") != -1) b = b.substr(b.indexOf("_") + 1); return b } function GetHref(b) { var a = $(b).data("href"); if (a == undefined || a == null) { var c = GetToolTipMessge().toLowerCase(), a = c.substr(c.lastIndexOf('href="') + 6); a = a.replace(a.substr(a.indexOf('"')), ""); a = window.location.protocol + "//" + window.location.host + "/" + a; $(b).data("href", a) } return a } function DropDownChildrensDesecectAll(a) { $("#ChildrenAgeRoom_" + a).find(".ChildrenAge").each(function () { $(this).val("-1") }) } function DisplayRooms() { var a = $(".RoomCount").val(); $(".room").each(function () { var b = this, c = $(b).attr("id").substr($(b).attr("id").lastIndexOf("_") + 1); if (c <= a) { $(b).show(); var d = $(b).find(".ChildrenCount"); DisplayChildrenDropDowns(d); var e = $(b).find("select[id*='AdultCount_Room_" + c + "']"); $(e).unbind("change").change(function () { InsertTooltipWarning($("select[id$='Room_" + c + "_Children_1']")) }) } else { $(b).hide(); $("#ChildrenAgeRoom_" + c).hide() } }) } function IsValid() { var a = true, b = $(".RoomCount").val(); $(".room").each(function () { var c = "id", d = $(this).attr(c).substr($(this).attr(c).lastIndexOf("_") + 1); if (d <= b) { var e = $(this).find(".ChildrenCount").val(); $("#ChildrenAgeRoom_" + d).find(".ChildrenAge").each(function () { var b = $(this).attr(c).substr($(this).attr(c).lastIndexOf("_") + 1); if (b <= e && this.selectedIndex == 0) a = false }) } }); if (a) { if ($.browser && !$.browser.msie) a = validateDates() } else alert(window._validationChildrenAgesErrorMessage); if (document.all) event.returnValue = a; return a } function ResetSearchForm(j, h, i, e, g, f) { var c = "", b = '