$(document).ready(function(){planVacation_initializeChildCountChange();Sys.WebForms.PageRequestManager.getInstance().add_endRequest(planVacation_initializeChildCountChange);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);planVacation_loadForCheckinDate()});function endRequestHandler(){planVacation_destinationChange("afterPostBack")}function planVacation_initializeChildCountChange(){var a=$("[ID*=ddlChildCount]");planVacation_toggleChildAges(a.val())}function planVacation_initializeButtonToggling(){planVacation_hidePlanVacationButton();$("select,[type=text]",".vacationPlanner").not("[ID*=txtSearch]").change(function(){$("select,[type=text]",".vacationPlanner").unbind();planVacation_showPlanVacationButton();$(".hotelResultsContent").slideUp("slow")});$("[ID*=txtSearch]",".vacationPlanner").keypress(function(){$("select,[type=text]",".vacationPlanner").unbind();planVacation_showPlanVacationButton()})}function planVacation_loadForCheckinDate(){var b=$("[ID*=stepPlanner]"),c=$("[ID*=standardPlanner]"),a=$(".slimCalendar[ID*=clrCheckIn]"),d=new Date(slimCalendar_getValue(a)).format("M/dd/yyyy");b.length>0&&planVacation_stpLoadForCheckinDate(a,d);c.length>0&&planVacation_stdLoadForCheckinDate(a)}function planVacation_hideShowDateLabel(){if($(".slimCalendar").is(":hidden"))$("[ID*=lblSelectedDate]").text("");else $("[ID*=lblSelectedDate]").text($("[ID*=hdnSelectedDate]").val())}function planVacation_toggleChildAges(b){var a=$(".vacationPlanner_childAges_container"),c=$(".vacationPlanner_childAges_items_child",a),d=parseInt($("[ID*=hdnChildCount]").val());if(b==0){a.slideUp(500);c.hide()}else{c.slice(0,b).show();c.slice(b).hide();if(d==NaN||d==0)a.slideDown(500);else a.show()}$("[ID*=hdnChildCount]").val(b);planVacation_showPlanVacationButton()}function planVacation_updateCheckInDate(f,g){var c=$(".slimCalendar[ID*=clrCheckOut]");if(c.length>0){var e=planVacation_getNightCount(),d=new Date(slimCalendar_getValue(f)),b=new Date(slimCalendar_getValue(c)),a=new Date(g);planVacation_stdLoadForCheckinDate(f);if(a>=b){a.setDate(a.getDate()+e);slimCalendar_setValue(c,a.format("M/dd/yyyy"));$("[ID*=txtCheckOut]").val(a.format("M/dd/yyyy")).change()}else{e=planVacation_calculateNightCount(d,b);if(e==1){a.setDate(a.getDate()+2);slimCalendar_setValue(c,a.format("M/dd/yyyy"));$("[ID*=txtCheckOut]").val(a.format("M/dd/yyyy")).change();b=a}planVacation_resetNightCount(d,b)}delete d;delete b;delete a}}function planVacation_updateCheckOutDate(d,c){var b=new Date(slimCalendar_getValue($(".slimCalendar[ID*=clrCheckIn]"))),a=new Date(c);planVacation_resetNightCount(b,a);delete b;delete a}function planVacation_resetNightCount(b,a){planVacation_setNightCount(planVacation_calculateNightCount(b,a))}function planVacation_calculateNightCount(b,a){return Math.round((a.getTime()-b.getTime())/864e5)}function planVacation_stdLoadForCheckinDate(c){var b=new Date(slimCalendar_getValue(c)),k=b.getDate(),h=b.getMonth(),j=b.getFullYear(),a=new Date(slimCalendar_getMinimumValue(c)),i=a.getDate()+3,f=a.getMonth(),g=a.getFullYear(),e=$(".slimCalendar[ID*=clrCheckOut]"),d=new Date(b.valueOf()+1728e5);slimCalendar_setMinimumValue(e,d);delete a;if(j==g&&h==f&&k<i){$("[ID*=pnlMiddle]").css("display","none");$("[ID*=pnlBottom]").css("display","none");$("[ID*=pnlContactUs]").css("display","inline");$("#sortOptionsBox").hide();$(".bblHotelListings").css("display","none")}else{$("[ID*=pnlMiddle]").css("display","inline");$("[ID*=pnlBottom]").css("display","inline");$("[ID*=pnlContactUs]").css("display","none");$("#sortOptionsBox").show();$(".bblHotelListings").css("display","inline")}}function planVacation_destinationChange(a){$(".vacationPlanner_hasNonBookable").each(function(){var d=$("[ID*=ddlDestination]",this),c=$(".vacationPlanner_bookable",this),e=$("[ID*=hdnBookingPanels]").val(),b=$("option:selected",d).attr("Bookable");if(document.URL.search("GroupInformationRequest")==-1)if(a=="beforePostBack")planVacation_destChangeBeforePostBack(b,c,e);else planVacation_destChangeAfterPostBack(b,c)})}function planVacation_destChangeBeforePostBack(c,a,b){if(c=="True"){if(b!="1"){a.slideUp(0).slideDown(500);$("[ID*=hdnBookingPanels]").val("1")}}else if(b!="0"){a.slideDown(0).slideUp(500);$("[ID*=hdnBookingPanels]").val("0")}else a.slideUp(0)}function planVacation_destChangeAfterPostBack(b,a){if(b=="True")a.slideDown(0);else a.slideUp(0)}function planVacation_updateTravelDate(b,a){$("[ID*=hdnSelectedDate]").val(a);$("[ID$=lblSelectedDate]").text(a);planVacation_stpLoadForCheckinDate(b)}function planVacation_stpLoadForCheckinDate(a){var h=new Date(slimCalendar_getValue(a)),b=new Date(slimCalendar_getMinimumValue(a)),g=b.getDate()+3,e=b.getMonth(),f=b.getFullYear(),c=new Date(f,e,g);if(h.getTime()<c.getTime()){var d=c.format("M/dd/yyyy");slimCalendar_setValue(a,d);planVacation_minDateDialog(a,d)}}function planVacation_showPlanVacationButton(){$("[ID*=btnPlanVacation]:hidden").fadeIn(500)}function planVacation_hidePlanVacationButton(){$("[ID*=btnPlanVacation]:visible").hide()}function planVacation_dialog_display(c,b){var a=$("#vacationPlannerDialog");if(a.dialog("isOpen")==false)a.dialog("open");else a.dialog({resizable:false,modal:true,buttons:{Ok:function(){$(this).dialog("close")}}});$("#dialogBody").html(b);a.dialog("option","title",c)}function planVacation_error_display(b,a){$("#vacationPlannerError").append(a).dialog({resizable:false,modal:true,buttons:{Ok:function(){$(this).html("").dialog("close")}}}).dialog("option","title",b)}function planVacation_minDateDialog(d,a){var b=$("#minDateDialog"),c=$("[ID*=lblDialogTitle]").text();b.dialog({title:c,resizable:false,modal:true,closeOnEscape:false,buttons:{Ok:function(){$(this).dialog("close")}},beforeclose:function(){$("[ID*=hdnSelectedDate]").val(a);$("[ID*=lblSelectedDate]").text(a)}}).dialog("open")}function planVacation_getActionButton(){return $("[ID*=btnPlanVacation]")}function planVacation_getDestinationID(){return $("[ID*=ddlDestination]").val()}function planVacation_getCheckInDate(){return slimCalendar_getValue($(".slimCalendar[ID*=clrCheckIn]"))}function planVacation_getNightCount(){return parseInt($("[ID*=txtNightCount]").val())}function planVacation_setNightCount(a){if(a>21){planVacation_dialog_display($("[ID*=hdnNightCountMaxTitle]").val(),$("[ID*=nightCountMaxMessage]").html().replace("####",a));$("[ID*=pnlMiddle]").css("display","none");$("[ID*=pnlBottom]").css("display","none");$("[ID*=pnlContactUs]").css("display","inline");$("#sortOptionsBox").hide();hotelResults_collapse()}else{$("[ID*=pnlMiddle]").css("display","inline");$("[ID*=pnlBottom]").css("display","inline");$("[ID*=pnlContactUs]").css("display","none");$("#sortOptionsBox").show()}$("[ID*=txtNightCount]").val(a).change()}function planVacation_getAdultCount(){return $("[ID*=ddlAdultCount]").val()}function planVacation_getChildAges(){var a=$("[ID*=ddlChildAge]:visible"),b=new Array(a.length);if(b.length>0){var c=0;a.each(function(){if(c>=a.length)return false;b[c++]=$(this).val()})}return b}function planVacation_getSearchText(){return $("[ID*=txtSearch]").val()}$(document).ready(function(){slimCalendar_initialize();Sys.WebForms.PageRequestManager.getInstance().add_endRequest(slimCalendar_initialize);navigationMenu_initialize();Sys.WebForms.PageRequestManager.getInstance().add_endRequest(navigationMenu_initialize);animateStep_fade_initialize()})

