Object.create=function(b){function a(){}a.prototype=b;return new a();};function Validator(b,a){this.validationDoer=b;this.layerToValidate=a;this.validate=function(){if(typeof(this.layerToValidate)=="string"){$("#"+this.layerToValidate+" .validationError").hide();}return this.validationDoer();};this.isEmpty=function(c){return typeof(c)=="undefined"||c.length==0;
};this.isNumeric=function(c){if(c==null){return false;}if(!c.toString().match(/^[-]?\d*\.?\d*$/)){return false;}return true;};}function HotPadsBookingObject(){this.reservationDetails={checkInDate:hotpads.filter.lf.checkInDate,checkOutDate:hotpads.filter.lf.checkOutDate,numAdults:hotpads.filter.lf.numAdults,numChildren:hotpads.filter.lf.numChildren,numRooms:hotpads.filter.lf.numRooms};
this.reservationDetailsValidator=new Validator(function(){var a=[];return a;});this.dom={filterBarSynchronizedElements:{},pullReservationDetailsFromFilter:function(){var a=hotpads.filter.lf;hotpads.booking.reservationDetails.checkInDate=a.checkInDate;hotpads.booking.reservationDetails.checkOutDate=a.checkOutDate;
hotpads.booking.reservationDetails.numAdults=a.numAdults;hotpads.booking.reservationDetails.numChildren=a.numChildren;hotpads.booking.reservationDetails.numRooms=a.numRooms;hotpads.booking.dom.synchronizeReservationDetails(true);},setReservationDetails:function(b){var a=hotpads.filter.lf;a.checkInDate=b.checkInDate;
a.checkOutDate=b.checkOutDate;a.numAdults=b.numAdults;a.numChildren=b.numChildren;a.numRooms=b.numRooms;hotpads.filter.dispatch();hotpads.filter.sync();},synchronizeReservationDetails:function(a){if(a==null){a=false;}var c=typeof(frames["fullviewIframe"])=="undefined"||typeof(frames["fullviewIframe"].listingId)=="undefined"?window:frames["fullviewIframe"];
var d=function(f,e){$(c.document).find("."+e+"Synchronized:text").val(f);$(c.document).find("."+e+"Synchronized:not(:text)").text(f);};for(var b in hotpads.booking.reservationDetails){d(hotpads.booking.reservationDetails[b],b);}if(a&&typeof(c.apiImplementation)!="undefined"){hotpads.booking.getRatesForListing(c.listingId,c.apiImplementation);
c.hotpads.booking.reservationDetails=hotpads.booking.reservationDetails;}}};this.getRatesForListing=function(c,b){if(!this.isReservationStageValid()){throw {stage:"reservation",status:"invalid"};}var a=this.getReservationDetailsObject(c);if(typeof(hotpads.booking.bookingInterface)!="undefined"){hotpads.booking.bookingInterface.clearAndShowRateContainers();
b.getPriceQuote(a);}};this.getReservationDetailsObject=function(b){var a=Object.create(this.reservationDetails);a.listingId=b;return a;};this.isReservationStageValid=function(){var a=this.reservationDetailsValidator.validate();if(typeof(a)=="undefined"){return true;}if(a.length!=0){this.handleErrors(a);
return false;}return true;};this.handleErrors=function(b){if(typeof(b)=="undefined"){return true;}for(var a=0;a<b.length;a++){$("."+b[a].target+"ErrorMessage").text(b[a].text).show();}};}hotpads.booking=new HotPadsBookingObject();