function ValidateEmailOrPhoneNotEmpty(C,A){if(A.Value!==""){A.IsValid=true;return }var B=ValidatorGetValue(C.PhoneBoxId);if(B===""){A.IsValid=false;return }A.IsValid=true}Type.registerNamespace("VacationRoost.VR");VacationRoost.VR.ParseTextToDate=function(B){var A=null;if(B){A=Date.parseLocale(B,"d")}if(isNaN(A)){A=null}return A};VacationRoost.VR.GetFirstChildWithNodeName=function(B,C){for(var A=0;A<B.childNodes.length;A++){if(B.childNodes[A].nodeName==C){return B.childNodes[A]}}return null};VacationRoost.VR.SetCheckInOutCookie=function setCheckInOutCookie(A,B){document.cookie="checkin="+A+"; path=/";document.cookie="checkout="+B+"; path=/"};VacationRoost.VR.ClearDates=function clearDates(B,A){try{document.getElementById(B).value=""}catch(C){}try{document.getElementById(A).value=""}catch(C){}VacationRoost.VR.SetCheckInOutCookie("","")};VacationRoost.VR.SubmitDefaultSearch=function(A,B){var C=Page_ClientValidate("TravelDates");if(C){VacationRoost.VR.SetCheckInOutCookie(A.value,B.value);document.location.href="/lodging/search"}};VacationRoost.VR.SubmitDestinationSearch=function(A,B,D){var E=Page_ClientValidate("TravelDates");if(E){VacationRoost.VR.SetCheckInOutCookie(B.value,D.value);var C=A.options[A.selectedIndex].value;if(isNaN(parseInt(C))){if(C&&C!="all"){document.location.href="/search-results.aspx?destination="+C}else{document.location.href="/lodging/search"}}else{document.location.href="/search-results.aspx?N="+C}}};VacationRoost.VR.SubmitPropertySearch=function(E,B,G,D){if(Page_ClientValidate()){var A="",C="",F="";if(!D){D="search-results.aspx"}if(B){A=B.value}if(G){C=G.value}if(E&&E.value){F="Ntt="+escape(E.value)+"&Ntk=Property"}setCheckInOutCookie(A,C);document.location.href=D+"?"+F}};VacationRoost.VR.SetTravelDatesCookie=function(B,A){if(B&&A){document.cookie="checkin="+B.localeFormat("d")+"; path=/";document.cookie="checkout= "+A.localeFormat("d")+"; path=/"}else{document.cookie="checkin=; path=/";document.cookie="checkout=; path=/"}};if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
Type.registerNamespace("VacationRoost.VR");VacationRoost.VR.RateCalendar=function(A){VacationRoost.VR.RateCalendar.initializeBase(this,[A]);this._checkIn=null;this._checkOut=null};VacationRoost.VR.RateCalendar.prototype={initialize:function(){VacationRoost.VR.RateCalendar.callBaseMethod(this,"initialize");VacationRoost.VR.TravelDateSynchronizer.add(this)},_dateCellClickInternal:function(D){if(this._checkIn&&this._checkOut==null){var A=D.date;var B=this._checkIn;if(A>B){this._setTravelDates(B,A)}else{if(B.valueOf()==A.valueOf()){this.clearTravelDates()}else{this._setTravelDates(A,B)}}}else{if(D.date>this._checkIn&&D.date<this._checkOut){this.clearTravelDates()}else{if(this._checkIn&&this._checkOut&&this._checkAdjacent(this._checkOut,D.date)){if(this._checkIn>D.date){this._setTravelDates(D.date,this._checkOut)}else{if(this._checkOut<D.date){this._setTravelDates(this._checkIn,D.date)}else{this.clearTravelDates()}}}else{var C=this._cellProperties[D.date.localeFormat("d")];if(!C||!C.checkInDisabled){this._checkIn=D.date;this._checkOut=null;this._updateDayCells()}}}}},_checkAdjacent:function(D,C){var A=D.getDate()+1;var B=D.getDate()-1;if(A<=C||B>=C){return true}else{return false}},_getCellCssClass:function(A){if(A.date<this._earliestAllowedCheckIn){return"unavailable"}var B=A.checkInDisabled;var C=A.checkOutDisabled;if(this._checkIn&&this._checkOut){if(this._checkOut.valueOf()==A.date.valueOf()&&B&&!C){return"selected availableForCheckOut"}if(this._checkIn.valueOf()==A.date.valueOf()&&C&&!B){return"selected availableForCheckIn"}if(this._checkOut.valueOf()==A.date.valueOf()&&B&&C){return"conflicted"}if(this._checkIn.valueOf()<=A.date.valueOf()&&this._checkOut.valueOf()>A.date.valueOf()&&B){return"conflicted"}if(this._checkIn.valueOf()<=A.date.valueOf()&&this._checkOut.valueOf()>=A.date.valueOf()){return"selected"}}if(this._checkIn&&this._checkIn.valueOf()==A.date.valueOf()){if(this._checkIn.valueOf()==A.date.valueOf()&&C&&!B){return"selected availableForCheckIn"}return"selected"}if(B&&C){return"unavailable"}if(B){return"availableForCheckOut"}if(C){return"availableForCheckIn"}return""},add_travelDatesChanged:function(A){this.get_events().addHandler("travelDatesChanged",A)},remove_travelDatesChanged:function(A){this.get_events().removeHandler("travelDatesChanged",A)},raiseTravelDatesChanged:function(A){var B=this.get_events().getHandler("travelDatesChanged");if(B){B(this,A)}},setTravelDates:function(B,A){this._checkIn=B;this._checkOut=A;this._changeFirstDate(new Date(B.getFullYear(),B.getMonth(),1))},clearTravelDates:function(){this._checkIn=null;this._checkOut=null;this._updateDayCells()},_setTravelDates:function(C,A){this._checkIn=C;this._checkOut=A;this._updateDayCells();var B=new Sys.EventArgs();B.checkIn=C;B.checkOut=A;this.raiseTravelDatesChanged(B)},get_checkIn:function(){return this._checkIn},set_checkIn:function(A){this._checkIn=A},get_checkOut:function(){return this._checkOut},set_checkOut:function(A){this._checkOut=A},dispose:function(){VacationRoost.VR.RateCalendar.callBaseMethod(this,"dispose")}};VacationRoost.VR.RateCalendar.registerClass("VacationRoost.VR.RateCalendar",VacationRoost.Web.Common.CalendarBase);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
Type.registerNamespace("VacationRoost.Athena");VacationRoost.Athena.CalendarPair=function(){VacationRoost.Athena.CalendarPair.initializeBase(this);this._checkInBox=null;this._checkOutBox=null;this._clearDatesButton=null;this._checkInCalendar=null;this._checkOutCalendar=null;this._synchronizeDates=true;var A=new Date();A=new Date(A.getFullYear(),A.getMonth(),A.getDate());A.setDate(A.getDate()+2);this._earliestAllowedCheckIn=A;this._checkOutCalendarShowingDelegate=Function.createDelegate(this,this._checkOutCalendarShowingHandler);this._travelDatesChangedDelegate=Function.createDelegate(this,this._travelDatesChangedHandler);this._clearDatesClickDelegate=Function.createDelegate(this,this._clearDatesClickHandler)};VacationRoost.Athena.CalendarPair.prototype={initialize:function(){var B=this._checkInBox,D=this._checkOutBox,A=this._clearDatesButton,E,C;E=$(B).datepicker({dateFormat:"m/d/yy",minDate:this._earliestAllowedCheckIn,onSelect:this._travelDatesChangedDelegate});this._checkInCalendar=E;$(B).prev("img").click(function(){$(B).focus()});C=$(D).datepicker({dateFormat:"m/d/yy",beforeShow:this._checkOutCalendarShowingDelegate,onSelect:this._travelDatesChangedDelegate});this._checkOutCalendar=C;$(D).prev("img").click(function(){$(D).focus()});Sys.UI.DomEvent.addHandler(B,"change",this._travelDatesChangedDelegate);Sys.UI.DomEvent.addHandler(D,"change",this._travelDatesChangedDelegate);if(A){Sys.UI.DomEvent.addHandler(A,"click",this._clearDatesClickDelegate)}VacationRoost.Athena.CalendarPair.callBaseMethod(this,"initialize");if(this._synchronizeDates){VacationRoost.VR.TravelDateSynchronizer.add(this)}},add_travelDatesChanged:function(A){this.get_events().addHandler("travelDatesChanged",A)},remove_travelDatesChanged:function(A){this.get_events().removeHandler("travelDatesChanged",A)},raiseTravelDatesChanged:function(A){var B=this.get_events().getHandler("travelDatesChanged");if(B){B(this,A)}},_checkOutCalendarShowingHandler:function(){var E=this._checkInCalendar;var B=this._checkOutCalendar;var A=E.datepicker("getDate");if(A){var C=E.datepicker("getDate");C.setDate(A.getDate()+1);B.datepicker("option","minDate",C);var D=B.datepicker("getDate");if(D&&A>D){B.datepicker("setDate",null)}}},_travelDatesChangedHandler:function(){var C=VacationRoost.VR.ParseTextToDate(this._checkInBox.value),A=VacationRoost.VR.ParseTextToDate(this._checkOutBox.value);if(C&&A&&C<A){var B=new Sys.EventArgs();B.checkIn=C;B.checkOut=A;this.raiseTravelDatesChanged(B)}},setTravelDates:function(B,A){this._checkInBox.value=B.localeFormat("d");this._checkInCalendar.datepicker("setDate",B);this._checkOutBox.value=A.localeFormat("d");this._checkOutCalendar.datepicker("setDate",A)},clearTravelDates:function(){this._checkInBox.value="";this._checkOutBox.value=""},_clearDatesClickHandler:function(){this.clearTravelDates();var A=new Sys.EventArgs();A.checkIn=null;A.checkOut=null;this.raiseTravelDatesChanged(A)},get_checkInBox:function(){return this._checkInBox},set_checkInBox:function(A){this._checkInBox=A},get_checkOutBox:function(){return this._checkOutBox},set_checkOutBox:function(A){this._checkOutBox=A},get_synchronizeDates:function(){return this._synchronizeDates},set_synchronizeDates:function(A){this._synchronizeDates=A},get_clearDatesButton:function(){return this._clearDatesButton},set_clearDatesButton:function(A){this._clearDatesButton=A},get_earliestAllowedCheckIn:function(){return this._earliestAllowedCheckIn},set_earliestAllowedCheckIn:function(A){this._earliestAllowedCheckIn=A}};VacationRoost.Athena.CalendarPair.registerClass("VacationRoost.Athena.CalendarPair",Sys.Component);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("VacationRoost.VR");

VacationRoost.VR.BookNowButton = function(element) {
    VacationRoost.VR.BookNowButton.initializeBase(this, [element]);

    this._enabledCssClass = "bookNow";
    this._disabledCssClass = "";
    this._bookingUrl = null;
    this._checkInBox = null;
    this._checkOutBox = null;
    this._adultsDropDown = null;
    this._childrenDropDown = null;
    this._propertyId = null;
    this._bookNowUpdateImage = null;
    this._showLeadForm = false;
    this._enabled = true;

    this._clickDelegate = Function.createDelegate(this, this._clickHandler);
};

VacationRoost.VR.BookNowButton.prototype = {
    initialize: function () {
        var element = this.get_element();
        Sys.UI.DomEvent.addHandler(element, 'click', this._clickDelegate);

        VacationRoost.VR.BookNowButton.callBaseMethod(this, 'initialize');
        // this control requires a PropertyPageController
        VacationRoost.VR.PropertyPageController.registerBookNowButton(this);
    },

    update: function (view) {
        var element = this.get_element();
        if (view.IsButtonEnabled) {
            Sys.UI.DomElement.addCssClass(element, this._enabledCssClass);
            Sys.UI.DomElement.removeCssClass(element, this._disabledCssClass);
            this._enabled = true;
        }
        else {
            Sys.UI.DomElement.addCssClass(element, this._disabledCssClass);
            Sys.UI.DomElement.removeCssClass(element, this._enabledCssClass);
            this._enabled = false;
        }

        this._showLeadForm = view.ShowsLeadForm;
    },

    bookNow: function () {
        if (Page_ClientValidate("BookNow")) {
            var checkIn = VacationRoost.VR.ParseTextToDate(this._checkInBox.value),
                    checkOut = VacationRoost.VR.ParseTextToDate(this._checkOutBox.value),
                    adultsDropDown = this._adultsDropDown,
                    childrenDropDown = this._childrenDropDown,
                    propertyId = this._propertyId,
                    bookNowUpdateImage = this._bookNowUpdateImage;

            if (this._enabled) {
                if (this._showLeadForm || this._bookingUrl == null) {
                    var numAdults = parseInt(adultsDropDown.options[adultsDropDown.selectedIndex].value);
                    var numChildren = parseInt(childrenDropDown.options[childrenDropDown.selectedIndex].value);

                    var leadForm = this.get_leadForm();

                    if (typeof (leadForm.set_adults) == 'function') {
                        leadForm.set_adults(numAdults);
                    }

                    if (typeof (leadForm.set_children) == 'function') {
                        leadForm.set_children(numChildren);
                    }

                    if (this._showLeadForm) {
                        leadForm.open(true);
                    }
                    else if (this._bookingUrl == null) {
                        leadForm.open(false);
                    }
                }
                else {
                    bookNowUpdateImage.style.display = "";
                    this.get_element().style.display = "none";

                    var bookingUrl = this._getBookingUrl();

                    if (typeof (_gat) != 'undefined') {
                        bookingUrl = _gat._getTrackerByName('pageTracker')._getLinkerUrl(bookingUrl);
                    }

                    document.location.href = bookingUrl;
                }
            }
            else {
                VacationRoost.VR.PropertyPageController.showDateErrorPanels();
                VacationRoost.VR.PropertyPageController.showMessage({ Message: "Please select your dates of stay.", IsError: false });
            }
        }
    },

    _clickHandler: function () {
        this.bookNow();

        return false; //IE6 breaks if you leave this off
    },

    _getBookingUrl: function () {
        var checkIn = VacationRoost.VR.ParseTextToDate(this._checkInBox.value),
                checkOut = VacationRoost.VR.ParseTextToDate(this._checkOutBox.value),
                adultsDropDown = this._adultsDropDown,
                childrenDropDown = this._childrenDropDown;

        var numAdults = parseInt(adultsDropDown.options[adultsDropDown.selectedIndex].value);
        var numChildren = parseInt(childrenDropDown.options[childrenDropDown.selectedIndex].value);

        var bookingUrl = this._bookingUrl;
        bookingUrl += "&checkin=" + checkIn.localeFormat("d");
        bookingUrl += "&checkout=" + checkOut.localeFormat("d");
        bookingUrl += "&adults=" + numAdults;
        bookingUrl += "&children=" + numChildren;
        var emailId = this._getEmailId();
        if (emailId) {
            bookingUrl += "&EID=" + emailId;
        }

        return bookingUrl;
    },

    _getEmailId: function () {
        var nameEQ = "EID=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ')
                c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0)
                return c.substring(nameEQ.length, c.length);
        }
        return "";
    },

    get_enabled: function () {
        return this._enabled;
    },
    set_enabled: function (value) {
        this._enabled = value;
    },

    get_propertyId: function () {
        return this._propertyId;
    },
    set_propertyId: function (value) {
        this._propertyId = value;
    },

    get_bookNowUpdateImage: function () {
        return this._bookNowUpdateImage;
    },
    set_bookNowUpdateImage: function (value) {
        this._bookNowUpdateImage = value;
    },

    get_bookingUrl: function () {
        return this._bookingUrl;
    },
    set_bookingUrl: function (value) {
        this._bookingUrl = value;
    },

    get_leadForm: function () {
        return VacationRoost.VR.PropertyPageController.get_leadForm();
    },

    get_showLeadForm: function () {
        return this._showLeadForm;
    },
    set_showLeadForm: function (value) {
        this._showLeadForm = value;
    },

    get_checkInBox: function () {
        return this._checkInBox;
    },
    set_checkInBox: function (value) {
        this._checkInBox = value;
    },

    get_checkOutBox: function () {
        return this._checkOutBox;
    },
    set_checkOutBox: function (value) {
        this._checkOutBox = value;
    },

    get_adultsDropDown: function () {
        return this._adultsDropDown;
    },
    set_adultsDropDown: function (value) {
        this._adultsDropDown = value;
    },

    get_childrenDropDown: function () {
        return this._childrenDropDown;
    },
    set_childrenDropDown: function (value) {
        this._childrenDropDown = value;
    },

    dispose: function () {
        VacationRoost.VR.BookNowButton.callBaseMethod(this, 'dispose');
    }
};

VacationRoost.VR.BookNowButton.registerClass("VacationRoost.VR.BookNowButton", Sys.UI.Control);

if (typeof (Sys) !== "undefined") {
    Sys.Application.notifyScriptLoaded();
}
Type.registerNamespace("VacationRoost.Athena");VacationRoost.Athena.BookingOptionsButton=function(A){VacationRoost.Athena.BookingOptionsButton.initializeBase(this,[A]);this._menuElement=null;this._leadFormButton=null;this._shortListButton=null;this._rentalUnitId=null;this._checkIn=null;this._checkOut=null};VacationRoost.Athena.BookingOptionsButton.prototype={initialize:function(){VacationRoost.Athena.BookingOptionsButton.callBaseMethod(this,"initialize");$(this.get_element()).closest("div").hover(function(){$(this).find(".BookingOptionsList").stop(true,true).slideDown("normal")},function(){$(this).find(".BookingOptionsList").stop(true,true).slideUp("normal")});if(this._leadFormButton){$addHandler(this._leadFormButton,"click",Function.createDelegate(this,this._leadFormButtonClick))}if(this._shortListButton){$addHandler(this._shortListButton,"click",Function.createDelegate(this,this._shortListButtonClick))}VacationRoost.VR.TravelDateSynchronizer.add(this)},clearTravelDates:function(){this._checkIn=null;this._checkOut=null},setTravelDates:function(B,A){this._checkIn=B;this._checkOut=A},_mouseover:function(A){$(this._menuElement).slideDown("normal")},_mouseout:function(A){if(A.target.nodeName=="UL"){$(this._menuElement).slideUp("normal")}},_click:function(A){$(this._menuElement).slideDown("normal")},_leadFormButtonClick:function(A){VacationRoost.Athena.ModalLeadForm.set_googleTrackingPageName("/property-details-lead");VacationRoost.Athena.ModalLeadForm.open()},_shortListButtonClick:function(A){$(this._menuElement).slideUp("normal");VacationRoost.Athena.ShortListService.addAccommodation(this._rentalUnitId,$.cookie("checkin"),$.cookie("checkout"),Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodError))},_onMethodComplete:function(A,D,C){$(this._notificationElement).text("Property Added");var B=this;setTimeout(function(){$(B._notificationElement).fadeTo(800,0)},5000)},_onMethodError:function(A,C,B){alert(A.get_statusCode())},get_menuElement:function(){return this._menuElement},set_menuElement:function(A){this._menuElement=A},get_rentalUnitId:function(){return this._rentalUnitId},set_rentalUnitId:function(A){this._rentalUnitId=A},get_checkIn:function(){return this._checkIn},set_checkIn:function(A){this._checkIn=A},get_checkOut:function(){return this._checkOut},set_checkOut:function(A){this._checkOut=A},get_leadFormButton:function(){return this._leadFormButton},set_leadFormButton:function(A){this._leadFormButton=A},get_shortListButton:function(){return this._shortListButton},set_shortListButton:function(A){this._shortListButton=A},get_notificationElement:function(){return this._notificationElement},set_notificationElement:function(A){this._notificationElement=A},dispose:function(){VacationRoost.Athena.BookingOptionsButton.callBaseMethod(this,"dispose")}};VacationRoost.Athena.BookingOptionsButton.registerClass("VacationRoost.Athena.BookingOptionsButton",Sys.UI.Control);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
Type.registerNamespace("VacationRoost.VR");VacationRoost.VR.TravelDateValidationSummary=function(A){VacationRoost.VR.TravelDateValidationSummary.initializeBase(this,[A]);this._messageList=null};VacationRoost.VR.TravelDateValidationSummary.prototype={initialize:function(){var A=this.get_element();this._messageList=$("ul",A).get(0);this._conflictedDatesElement=$("li",this._messageList).get(0);VacationRoost.VR.TravelDateValidationSummary.callBaseMethod(this,"initialize");if(typeof (VacationRoost.VR.PropertyPageController)!=="undefined"){VacationRoost.VR.PropertyPageController.registerTravelDateValidationSummary(this)}},update:function(B){this.clearMessages();if(B.length==0){this.get_element().style.display="none"}else{for(var A=0;A<B.length;A++){this.appendMessage(B[A])}}},clearMessages:function(){var A=this._messageList;while(A.childNodes.length>0){A.removeChild(A.firstChild)}},appendMessage:function(B){var A=document.createElement("LI");A.appendChild(document.createTextNode(B.Message));if(!B.IsError){A.className="info"}this._messageList.appendChild(A);this.get_element().style.display=""},dispose:function(){VacationRoost.VR.TravelDateValidationSummary.callBaseMethod(this,"dispose")}};VacationRoost.VR.TravelDateValidationSummary.registerClass("VacationRoost.VR.TravelDateValidationSummary",Sys.UI.Control);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
Type.registerNamespace("VacationRoost.Athena");VacationRoost.Athena._MinNightMessage=function(){VacationRoost.Athena._MinNightMessage.initializeBase(this);this._minNightMessageUrl=null};VacationRoost.Athena._MinNightMessage.prototype={initialize:function(){VacationRoost.Athena._MinNightMessage.callBaseMethod(this,"initialize");VacationRoost.VR.PropertyPageController.registerMinNightMessage(this)},show:function(){VacationRoost.VR.ModalIFrame.show(this._minNightMessageUrl,280,400)},get_minNightMessageUrl:function(){return this._minNightMessageUrl},set_minNightMessageUrl:function(A){this._minNightMessageUrl=A},dispose:function(){VacationRoost.Athena._MinNightMessage.callBaseMethod(this,"dispose")}};VacationRoost.Athena._MinNightMessage.registerClass("VacationRoost.Athena._MinNightMessage",Sys.Component);VacationRoost.Athena.MinNightMessage=$create(VacationRoost.Athena._MinNightMessage);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};
