function d21_quickbook(e){var t=this;t.name="QuickBook",t.baseAvailabilityUrl=window.d21_ibe_api_host+"/calendar",t.baseToccAggregationUrl="/api/tocc/search/aggregate/",t.toccEntityParameter="?_aid="+(d21_app.widgetOptions.isGroupSDK?d21_app.widgetOptions.Group_Token:d21_app.widgetOptions.Property_Token),t.apiHostInfoUrl=d21_app.widgetUrl+t.baseToccAggregationUrl+"View.HostInfo",t.baseToccViewUrl="/api/tocc/view/",t.baseToccDataUrl="/api/tocc/data/",t.apiRoomUrl=d21_app.widgetUrl+t.baseToccViewUrl+"Entity.Room",t.options=d21_jq.extend({},e),t.var={adultPreselect:null,hasDateSelected:!1,currentSelectedCity:null,currentSelectedHotel:null,dependenciesHasLoaded:!1,isBookable:!1,userSelectedADate:!1,prevMonthHandler:null,nextRoomIndex:2,isInit:!1,picker:{arrival:null,departure:null},prevArrivalDate:moment(),arrivalDate:null,departureDate:null,fullsizeActive:!1,monthOffSet:0,availabilities:null,hasAvailabilities:!1,debugMode:!1,hotelList:[],cityList:[],maxAdults:10,minAdults:0,propertyType:null,radius:null,los:1,travelPurpose:null,rateCode:null,timepicker:null,hour:null,containerData:null},t.prop={roomCount:function(){return t.options.occupancy.room.length},adultCount:function(){var e=0;return d21_jq.each(t.options.occupancy.room,function(){e+=this.adult}),e},childCount:function(){var e=0;return d21_jq.each(t.options.occupancy.room,function(){e+=this.child.length}),e},pastDates:function(){var e=[],t=new Date,a=t;return a.setDate(t.getDate()-1),e.push({from:[0,0,0],to:a}),e},beginDate:function(){var e="";if("ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode||"ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode)now=new Date,e=now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();else if("ArrivalLos"==window.d21_app.widgetOptions.DisplayMode||"ArrivalLos"==window.d21_app.widgetOptions.DisplayMode){var a=new Date(t.prop.currentMonth()),i=new Date(a.getFullYear(),a.getMonth(),1);e=window.d21_app.fn.getWidget("Base").fn.helper.dateToIsoDatestring(i)}return e},endDate:function(){var e="";if("ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode||"ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode)now=new Date,tomorrow=new Date(now),tomorrow.setDate(now.getDate()+1),e=tomorrow.getFullYear()+"-"+(tomorrow.getMonth()+1)+"-"+tomorrow.getDate();else if("ArrivalLos"==window.d21_app.widgetOptions.DisplayMode||"ArrivalLos"==window.d21_app.widgetOptions.DisplayMode){var a=new Date(t.prop.currentMonth()),i=new Date(a.getFullYear(),a.getMonth()+1,0);e=window.d21_app.fn.getWidget("Base").fn.helper.dateToIsoDatestring(i)}return e},currentMonth:function(){var e=new Date,a=e;return a.setDate(1),a.setMonth(e.getMonth()+t.var.monthOffSet),a},occupancy:function(){var e="";return d21_jq.each(t.options.occupancy.room,function(){e+="&room=";for(var t=0;t",i+="",i+=""}},t.fn={start:function(e){t.options.occupancy.room[0].selector=".d21-roomItem-1",t.options.occupancy.room[0].changePersonCountAllowed=!0,t.var.los=t.options.los,t.var.adultPreselect=t.options.occupancy.room[0].adult;var a=d21_jq("#d21-quickbook"),i=d21_jq(a).attr("data-d21");void 0!=i&&(t.var.containerData=JSON.parse(i.replaceAll("'",'"')));var n=function(){t.fn.helper.getAggregation();t.fn.helper.getWidget();!function(){var e=d21_jq("head link").toArray(),a=null,i=function(t){e.forEach(function(e){d21_jq(e).attr("href").indexOf(t)>=0&&d21_jq(e).remove()})};if(t.var.containerData&&(a=t.var.containerData.hasHorizontalOrientation),null!=a){var n=d21_jq("head");d21_app.widgetOptions.hasHorizontalOrientation!=a&&(a?(i("d21.vertical.min.css"),n.prepend('')):(i("d21.horizontal.min.css"),n.prepend('')))}}(),window.d21LogTime("d21_widgets_quickbook_started")};a.length>0&&d21_jq(a).prop("class").indexOf("d21-rendered")<0&&(d21_jq(a).addClass("d21-rendered"),t.var.dependenciesHasLoaded?n():t.fn.handler.onLoadDependecies(function(){t.var.dependenciesHasLoaded=!0,n()}))},events:{bind:{all:function(){Object.keys(t.fn.events.bind).forEach(function(e){"all"!=e&&t.fn.events.bind[e]()})},calendarTrigger:function(){d21_jq(".picker__nav--next").unbind("click").bind("click",function(){t.fn.handler.onNextMonth()}),d21_jq(".picker__nav--prev").unbind("click").bind("click",function(e){var a=(new Date).getMonth();a=0){var a=JSON.parse(d21_jq(this).attr("data-tooltip")),i=t.options.fieldTexts.notavail;1==a.IsCta&&1==a.IsCtd?i="keine Anreise":1==a.IsCta?i="Anreise nicht möglich":1==a.IsCtd?i="Abreise nicht möglich":a.MinLos>t.var.los?i=d21_app.fn.getWidget("Base").fn.helper.textLengthOf(3,t.options.fieldTexts.atLeast)+". "+a.MinLos+" "+t.options.fieldTexts.guestNights:a.MaxLosinfo_outline'+i+"")}}else d21_jq(".d21-tooltip-box",this).show(),e<120?d21_jq(".d21-tooltip-box",this).css("right",0):d21_jq(".d21-tooltip-box",this).css("left",0)}).mouseleave(function(){d21_jq("#d21-quickbook .picker__box").css("padding-bottom","1px"),d21_jq(".d21-tooltip-box",this).hide()})},timePicker:function(){if(d21_app.widgetOptions.isTransitHotel){var e=d21_jq("#d21-quickbook #d21-time-container input").pickatime({interval:60,disable:[0,1,2,3,4,5],format:"HH:00",today:"",clear:"",close:"",onOpen:function(){t.var.hasDateSelected||(this.close(),t.var.picker.arrival.open(!1))},onSet:function(e){e.select&&(alert(e.select),d21_jq("#d21-quickbook #d21-time-input").removeClass("d21-warn"),t.var.hour=e.select/60,t.fn.helper.submitPulse())}});t.var.timepicker=e.pickatime("picker")}},datePicker:function(e){e=e||!1;var a=t.prop.pastDates(),i=function(e,i){var n=setInterval(function(){if(void 0!=d21_jq.fn.pickadate){clearInterval(n);var i=e||a,o=d21_jq("#d21-arrival-container .hasDatepicker").pickadate({format:"dd.mm.yyyy",onOpen:function(){if(t.fn.helper.adjustCalendar(),t.fn.helper.showOccupancyControll(!1),!d21_app.widgetOptions.isTransitHotel){var e=function(){"ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode&&"ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode||t.fn.helper.getAvailability("stay")};d21_app.widgetOptions.isGroupSDK?t.var.isInit||null==t.var.currentSelectedHotel||e():t.var.isInit||e()}},onSet:function(e){t.fn.handler.onChangeArrival(e),d21_app.widgetOptions.isTransitHotel&&t.fn.handler.onDatePicked(e.select)},onRender:function(){t.fn.helper.adjustCalendar(),d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.markDaysInCalendar():t.fn.helper.markDaysInCalendar(),t.fn.events.bind.higlightLosInCalendar()},today:"",clear:"",close:t.options.fieldTexts.close,firstDay:1});if(t.var.picker.arrival=o.pickadate("picker"),t.var.picker.arrival.set("disable",i),1==parseInt(window.d21_app.widgetOptions.DisplayMode)||"ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode){var r=t.var.picker.departure=d21_jq("#d21-departure-container .hasDatepicker").pickadate({format:"dd.mm.yyyy",onOpen:function(){t.fn.helper.adjustCalendar(),t.fn.helper.showOccupancyControll(!1)},onSet:function(e){t.fn.handler.onChangeDeparture(e)},onRender:function(){t.fn.helper.adjustCalendar(),t.fn.helper.markDaysInCalendar()},today:"",clear:"",close:""});t.var.picker.departure=r.pickadate("picker"),t.var.picker.departure.set("disable",i)}}},10)};if(e){var n=t.fn.helper.getRequestUrl();d21_app.fn.onWidgetCommand("Base",function(e){e.api.fn.get(n,function(e){var t=null;void 0!=e.Value.Properties?(d21_app.widgetOptions.currency=e.Value.Properties[0].Currency,t=e.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"]):t=e.Value[d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"];var n=[],o=[];d21_jq.each(t,function(){0==this.IsAvailable?n.push(new Date(this.Date)):o.push(new Date(this.Date))});var r=n.concat(a);i(r)})})}else i()},ibeFullsizeTrigger:function(){d21_jq(".d21-ibe-fullsize-trigger").click(function(e){e.preventDefault(),t.fn.handler.onSubmit(!d21_app.widgetOptions.isTransitHotel)})},submit:function(){d21_jq("#d21-submit-container input").unbind("click").bind("click",function(e){e.preventDefault(),t.var.debugMode||(t.var.hasDateSelected?t.fn.handler.onSubmit(!d21_app.widgetOptions.isTransitHotel):t.fn.handler.onNotBookable(this))})},hotelSelect:function(){d21_jq("#d21-quickbook #d21-hotelname-city-list > div").unbind("click").bind("click",function(){t.fn.handler.onHotelSelected(d21_jq(this).attr("data-value"),d21_jq(this).attr("data-city"))})},hotelListControll:function(){d21_jq("#d21-quickbook #d21-hotelname-city-input").unbind("focus").unbind("focusout"),d21_jq("#d21-quickbook #d21-hotelname-city-input").bind("focus",function(){d21_jq("#d21-quickbook #d21-hotelname-city-list").show(),t.fn.events.bind.hotelSelect()}).bind("focusout",function(){setTimeout(function(){d21_jq("#d21-quickbook #d21-hotelname-city-list").hide()},500)}),d21_jq("#d21-quickbook .removeText").unbind("click").bind("click",function(){t.fn.handler.onRemoveText(this)})},losChange:function(){d21_jq("#d21-quickbook #d21-los-container select").unbind("change").bind("change",function(){t.fn.handler.onChangeLos(d21_jq("option:selected",this).val())})},windowResize:function(){d21_jq(window).resize(function(){t.fn.helper.adjustCalendar(),t.fn.helper.adjustFields()})},quickBookTrigger:function(){t.options.isHidden&&(d21_jq("#d21-quickbook").addClass("d21-show-with-button"),d21_jq("#d21-toggle-quickbook").unbind("click").bind("click",function(){var e=d21_jq("form",d21_jq(this).closest("#d21-quickbook"));e.css("position","absolute"),e.fadeToggle()}))},focus:function(){d21_jq("d21-hotelname-city-container > input,#d21-los-container > select,#d21-arrival-container > input").unbind("focus").bind("focus",function(){"block"===d21_jq("#d21-quickbook #d21_tooltip").css("display")?t.fn.handler.onApplyOccupancy():t.fn.helper.showOccupancyControll(!1)})},higlightLosInCalendar:function(){if(!d21_app.widgetOptions.isTransitHotel){var e=[];d21_jq("#d21-arrival-input_table td").mouseover(function(){void 0!=d21_jq(this).attr("class")&&d21_jq(this).attr("class").indexOf("d21-avail")>=0&&(e=function(e){for(var a=[d21_jq(e)],i=0;i0?a.push(a[i].next()):a[i].closest("tr").next().length>0&&a.push(a[i].closest("tr").next().find("td").first());return a}(this)).forEach(function(e){d21_jq(e).addClass("d21-hover")})}).mouseleave(function(){e.forEach(function(e){d21_jq(e).removeClass("d21-hover")})})}},propertyTypeChange:function(){d21_jq("#d21-quickbook #d21-property-type-container select").unbind("change").bind("change",function(){t.fn.handler.onChangePropertyType(this)})},radiusChange:function(){d21_jq("#d21-quickbook #d21-radius-container select").unbind("change").bind("change",function(){t.fn.handler.onChangeRadius(this)})},travelPurposeChange:function(){d21_jq("#d21-quickbook #d21-travelpurpose-container select").unbind("change").bind("change",function(){t.fn.handler.onChangeTravelPurpose(this)})},rateCodeInput:function(){d21_jq("#d21-quickbook #d21-ratecode-container input").unbind("input").bind("input",function(){t.fn.handler.onRateCodeInput(this)})}}},handler:{onHotelSelected:function(e,a){var i=e;i=void 0==i||null==i?a:i,d21_jq("#d21-quickbook #d21-hotelname-city-input").val(i),t.fn.handler.onChangeHotelText(i),t.fn.helper.showSearchedHotel(i)},onDatePicked:function(e){if(e){e=moment(e).format("YYYY-MM-DD");var a=t.fn.helper.getRequestUrl(e,e);d21_app.fn.onWidgetCommand("Base",function(e){e.api.fn.get(a,function(e){t.var.availabilities=null;var a=function(){var e=[0,1,2,3,4,5];t.var.availabilities.forEach(function(t){t.IsAvailable||e.push(moment(t.Date).hour())}),t.var.timepicker.set("enable",!0),t.var.timepicker.set("disable",e)};e.Value.Properties?0!=e.Value.Properties.length&&(d21_app.widgetOptions.currency=e.Value.Properties[0].Currency,null!=e.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"]&&(t.var.availabilities=e.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"],a())):(t.var.availabilities=e.Value[d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"],a()),t.var.hasAvailabilities=t.var.availabilities.filter(function(e){return e.IsAvailable}).length>0})})}},onChangeTravelPurpose:function(e){t.var.travelPurpose="-1"!=d21_jq(e).val()?d21_jq(e).val():null},onRateCodeInput:function(e){t.var.rateCode=""!=d21_jq(e).val()?d21_jq(e).val():null},onChangeRadius:function(e){var a=d21_jq(e).val();"-1"!=a&&(t.var.radius=a)},onChangePropertyType:function(e){var a=d21_jq(e).val();"-1"!=a&&(t.var.propertyType=a)},onChangeAdultCount:function(e,a,i){var n=d21_jq("span",d21_jq(e.closest(".d21-plus-minus"))),o=d21_jq(e.closest(".d21-controller-container")),r=d21_jq(".d21-child-field span",o),d=t.fn.helper.getRoomIndexBySelector("."+d21_jq(o).closest("li").attr("class")),l=parseInt(n.text()),s=parseInt(r.text()),c=l+(isNaN(s)?0:s);a?(t.options.occupancy.room[d].changePersonCountAllowed=c+1=i,t.options.occupancy.room[d].changePersonCountAllowed&&(n.text((parseInt(n.text())-1).toString()),d21_jq(".d21-maxOccupancy",d21_jq(o).closest('li[class*="d21-roomItem-"]')).hide()))},onChangeChildCount:function(e,a,i){var n=d21_jq("span",d21_jq(e.closest(".d21-plus-minus"))),o=d21_jq(e.closest(".d21-controller-container")),r=d21_jq(".d21-adult-field span",o),d=t.fn.helper.getRoomIndexBySelector("."+d21_jq(o).closest("li").attr("class")),l=parseInt(n.text()),s=parseInt(r.text())+l;s>=0&&(a?(t.options.occupancy.room[d].changePersonCountAllowed=s+1<=t.var.maxAdults,t.options.occupancy.room[d].changePersonCountAllowed?s+1=i,t.options.occupancy.room[d].changePersonCountAllowed&&(n.text((parseInt(n.text())-1).toString()),d21_jq(".d21-maxOccupancy",d21_jq(o).closest('li[class*="d21-roomItem-"]')).hide())))},onChangeArrival:function(e){if("ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode&&"ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode||t.fn.events.bind.calendarTrigger(),null!=e.select){t.var.hasDateSelected=!0,t.var.arrivalDate=moment(e.select).format("YYYY-MM-DD"),"ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode&&"ArrivalLos"!=window.d21_app.widgetOptions.DisplayMode||(d21_app.widgetOptions.isTransitHotel||t.fn.helper.submitPulse(),t.var.userSelectedADate=!0);var a=d21_jq("#d21-arrival-container .hasDatepicker");switch(t.var.prevArrivalDate=moment(t.var.arrivalDate),t.var.arrivalDate=window.d21_app.fn.onWidgetCommand("Base",function(e){e.fn.helper.isoDatestringToDate(a.val(),!0)}),null!=t.var.availabilities&&(d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.setAvailabilityResult(t.var.availabilities.find(function(e){return e.Date==t.var.prevArrivalDate.format("YYYY-MM-DD")})):t.fn.helper.setAvailabilityResult(t.var.availabilities.find(function(e){return e.Date==t.var.prevArrivalDate.format("YYYY-MM-DD")}))),window.d21_app.widgetOptions.DisplayMode){case 1:t.var.picker.departure.open();var i=d21_jq("#d21-departure-container .hasDatepicker");if(t.var.departureDate=window.d21_app.fn.getWidget("Base").fn.helper.isoDatestringToDate(i.val(),!0),null==t.var.departureDate){(n=new Date(t.var.arrivalDate)).setDate(t.var.arrivalDate.getDate()+1),t.var.departureDate=n,t.var.picker.departure.set("select",t.var.departureDate)}if(t.var.arrivalDate>=t.var.departureDate){var n=new Date(t.var.arrivalDate);n.setDate(t.var.arrivalDate.getDate()+1),t.var.departureDate=n,t.var.picker.departure.set("select",t.var.departureDate),i.val(window.d21_app.fn.getWidget("Base").fn.helper.addZero(t.var.departureDate.getDate())+"."+window.d21_app.fn.getWidget("Base").fn.helper.addZero(t.var.departureDate.getMonth()+1)+"."+t.var.departureDate.getFullYear())}break;case 2:d21_jq("#d21-quickbook #d21-los-container select").select()}}else null!=t.var.availabilities&&(d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.setAvailabilityResult(t.var.availabilities.find(function(e){return e.Date==t.var.prevArrivalDate.format("YYYY-MM-DD")})):t.fn.helper.setAvailabilityResult(t.var.availabilities.find(function(e){return e.Date==t.var.prevArrivalDate.format("YYYY-MM-DD")})))},onChangeDeparture:function(e){if(null!=e.select&&(t.var.hasDateSelected=!0,1==parseInt(window.d21_app.widgetOptions.DisplayMode))){var a=d21_jq("#d21-arrival-container .hasDatepicker"),i=d21_jq("#d21-departure-container .hasDatepicker");if(t.var.arrivalDate=window.d21_app.fn.getWidget("Base").fn.helper.isoDatestringToDate(a.val(),!0),t.var.departureDate=window.d21_app.fn.getWidget("Base").fn.helper.isoDatestringToDate(i.val(),!0),null==t.var.arrivalDate){(n=new Date(t.var.departureDate)).setDate(t.var.departureDate.getDate()-1),t.var.arrivalDate=n,t.var.picker.arrival.set("select",t.var.arrivalDate)}if(t.var.departureDate<=t.var.arrivalDate){var n=new Date(t.var.departureDate);n.setDate(t.var.departureDate.getDate()-1),t.var.arrivalDate=n,t.var.picker.arrival.set("select",t.var.arrivalDate),t.var.arrivalDate=n,a.val(window.d21_app.fn.getWidget("Base").fn.helper.addZero(t.var.arrivalDate.getDate())+"."+window.d21_app.fn.getWidget("Base").fn.helper.addZero(t.var.arrivalDate.getMonth()+1)+"."+t.var.arrivalDate.getFullYear())}t.fn.helper.getAvailability("stay")}},onChangeLos:function(e){t.var.los=parseInt(e),d21_app.widgetOptions.isTransitHotel||t.var.picker.arrival.set("enable",!0),d21_app.widgetOptions.isGroupSDK&&null!=t.var.currentSelectedHotel?t.fn.helper.getAvailability("stay"):d21_app.widgetOptions.isGroupSDK||t.fn.helper.getAvailability("stay"),d21_app.widgetOptions.isTransitHotel||t.fn.helper.submitPulse()},onChangeSelectedHotel:function(){d21_jq("#d21-hotelname-city-input").unbind("input").bind("input",function(){var e=this.value;t.fn.handler.onChangeHotelText(e)})},onRenderedQuickbook:function(e,a){d21_jq(e).html(a),t.options.occupancy.room[0].child.forEach(function(e){t.fn.handler.onAddChild(document.querySelector(".d21-child-container i"),e)}),d21_app.fn.onWidgetCommand("Base",function(e){e.fn.helper.makeIconsCompatible()}),d21_app.widgetOptions.isGroupSDK?d21_jq(e).addClass("d21-isGroup"):d21_jq(e).addClass("d21-isNotGroup"),d21_app.widgetOptions.isGroupSDK&&(t.fn.helper.renderHotelDatalist(),t.fn.helper.renderPropertyType()),t.options.hasTravelingPrivateField&&d21_jq("#d21-quickbook #d21-travelpurpose-container").show(),setTimeout(function(){t.fn.helper.adjustFields(),t.fn.helper.adjustOccupancyHeight()},10),roomItem=d21_jq(".d21-controller-container",d21_jq("#d21-list-of-rooms ul li").first()).clone(),t.fn.events.bind.all(),t.fn.helper.addDebugModeClass(),setTimeout(function(){t.templates.room=d21_jq(".d21-controller-container",d21_jq("#d21-list-of-rooms li").first()).html()},1e3)},onApplyOccupancy:function(){var e=d21_jq("#d21_tooltip"),a=[];d21_jq.each(d21_jq("#d21-list-of-rooms li",e),function(e){var t=d21_jq(".d21-list-of-childs .D21-Age-Select",this),i=[];d21_jq.each(t,function(){i.push(d21_jq("select option:selected",this).val())});var n={selector:"."+d21_jq(this).attr("class"),adult:parseInt(d21_jq(".d21-adult-field .d21-plus-minus span",this).text()),child:i,changePersonCountAllowed:!0};a.push(n)}),t.options.occupancy.room=a,t.fn.helper.updateOccupancyInfo(),t.var.picker.arrival.set("select",t.var.picker.arrival.get("select").obj),d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.getAvailability("stay"):t.fn.helper.getAvailability("stay"),t.fn.helper.showOccupancyControll(!1)},onSubmit:function(e,a){if(e=e||!1,t.fn.helper.showOccupancyControll(!1),t.var.hasAvailabilities&&t.var.hour||e){if(null==a&&(a={arrival:t.var.picker.arrival.get("select","yyyy-mm-dd")+(d21_app.widgetOptions.isTransitHotel?"T"+(t.var.hour<=9?"0"+t.var.hour:t.var.hour)+":00":""),los:t.var.los,room:t.prop.occupancyArray()},null!=t.var.radius&&(a.geo_radius=t.var.radius),null!=t.var.propertyType&&(a.property_type=t.var.propertyType),null!=t.var.travelPurpose&&(a.is_private_traveling=t.var.travelPurpose),null!=t.var.rateCode&&(a.rate_code=t.var.rateCode),d21_app.widgetOptions.isGroupSDK))if(null!=t.var.currentSelectedHotel){var i=t.var.currentSelectedHotel.Property_id;a.property_id=i}else a.city=t.var.currentSelectedCity;d21_app.fn.onWidgetCommand("Ibe",function(e){e.fn.handler.onIbeOpen(a)})}else null==t.var.hour&&t.var.timepicker.open(!1)},onRemoveChild:function(e){d21_jq(".d21-list-of-childs .D21-Age-Select",d21_jq(e).closest(".d21-child-container")).last().remove()},onRemoveRoom:function(e){var a="."+d21_jq(e).closest("li").attr("class");d21_jq(e).closest("li").remove(),t.fn.helper.removeRoomBySelector(a),t.fn.helper.updateOccupancyHeadings();(0==d21_jq("#d21-list-of-rooms li").length?1:d21_jq("#d21-list-of-rooms li").length)<=d21_app.widgetOptions.roomLimit&&d21_jq("#d21-add-room").show()},onRemoveText:function(e){d21_jq("input",d21_jq(e).closest("div")).val(""),t.var.currentSelectedHotel=null,t.var.currentSelectedCity=null,t.fn.handler.onChangeHotelText(),d21_jq("#d21-quickbook #d21-radius-container").hide()},onAddRoom:function(){var e="",a=0==d21_jq("#d21-list-of-rooms li").length?1:d21_jq("#d21-list-of-rooms li").length+1;a<=d21_app.widgetOptions.roomLimit?(d21_jq("#d21-add-room").show(),t.options.occupancy.room.push({selector:".d21-roomItem-"+t.var.nextRoomIndex,adult:2,child:[],changePersonCountAllowed:!0}),t.options.occupancy.room.length,e+='
  • ',e+='
    ',e+="",e+='",e+="
    ",e+='
    ',e+=t.templates.room,e+="
    ",e+="
  • ",d21_jq("#d21-list-of-rooms ul").append(e),d21_jq("#d21_tooltip .d21-headline i").remove(),d21_jq("#d21_tooltip .d21-headline").append('delete'),t.fn.events.bind.occupancyControlls(),t.var.nextRoomIndex++,a+1>d21_app.widgetOptions.roomLimit&&d21_jq("#d21-add-room").hide()):d21_jq("#d21-add-room").hide()},onAddChild:function(e,a){var i=d21_jq(".d21-list-of-childs",d21_jq(e).closest(".d21-child-container")),n=d21_jq(".D21-Age-Select",i).length;i.append(t.templates.childAgeSelect(n,a))},afterGetAvailability:function(e,a){var i=[],n=[],o=new Date(t.prop.currentMonth()),r=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();if("ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode&&0!=t.var.availabilities.length&&t.fn.helper.setAvailabilityResult(t.var.availabilities),"ArrivalLos"==window.d21_app.widgetOptions.DisplayMode&&null!=t.var.availabilities)if(0!=t.var.availabilities.length)d21_jq.each(t.var.availabilities,function(){0==this.IsAvailable?i.push(new Date(this.Date)):n.push(new Date(this.Date))}),t.fn.helper.setAvailabilityResult(t.var.availabilities.find(function(e){return e.Date==t.var.prevArrivalDate.format("YYYY-MM-DD")}));else for(var d=1;d<=r;d++)i.push(new Date(o.getFullYear(),o.getMonth(),d));t.fn.helper.markDaysInCalendar(),t.var.picker.arrival.set("enable",!0),t.var.picker.arrival.set("disable",i.concat(t.prop.pastDates())),t.var.picker.arrival.render(!0),t.fn.events.bind.calendarTrigger()},onNextMonth:function(){t.var.monthOffSet++;var e=moment();e=e.add(t.var.monthOffSet,"month").startOf("month"),t.var.picker.arrival.set("select",[e.get("year"),e.get("month"),e.get("date")]),d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.getAvailability("next",!0):t.fn.helper.getAvailability("next",!0)},onPrevMonth:function(){t.var.monthOffSet--,d21_app.widgetOptions.isGroupSDK?null!=t.var.currentSelectedHotel&&t.fn.helper.getAvailability("prev",!0):t.fn.helper.getAvailability("prev",!0)},onNotBookable:function(){t.var.isBookable||t.var.picker.arrival.open(!1)},onLoadDependecies:function(e){d21_app.dependecies.pickadateLoaded?e&&e():(d21_app.dependecies.pickadateLoaded=!0,void 0!==window.d21&&void 0!==window.d21.version?d21_requirejs([d21_app.widgetUrl+"/bundle/js/pickadate/"+d21_app.widgetOptions.lang],function(){e&&e()}):basket.require({url:d21_app.widgetUrl+"/bundle/js/pickadate/"+d21_app.widgetOptions.lang,skipCache:!0}).then(function(){e&&e()}))},onChangeHotelText:function(e){e=e||"";var a=null;t.fn.helper.showSearchedHotel(e);var i=function(e,a){t.var.currentSelectedHotel=e,t.var.currentSelectedCity=a,t.fn.helper.unMarkDaysInCalendar(),d21_jq("#d21-avail-result-container").html(""),t.var.isInit=!1,null!=e?(d21_jq("#d21-arrival-input").val(t.var.picker.arrival.get("select","dd.mm.yyyy")),t.fn.helper.getAvailability("stay")):(t.var.picker.arrival.set("enable",!0),d21_jq("#d21-submit-container > input").removeClass("d21-pulse-btn"))};if(""!=e){if(function(){var t=!0;return d21_jq("#d21-hotelname-city-list > div").toArray().forEach(function(t){if(null==a){var i=void 0!=d21_jq(t).attr("data-value")?d21_jq(t).attr("data-value").toUpperCase():null,n=void 0!=d21_jq(t).attr("data-city")?d21_jq(t).attr("data-city").toUpperCase():null;null==i&&null!=n&&n.toUpperCase().indexOf(e.toUpperCase())>=0&&(a=n)}}),null!=a&&(t=!1),t}()){t.fn.helper.getHotelByName(e.replaceAll("'",'"'));i(t.fn.helper.getHotelByName(e.replaceAll("'",'"')),null),t.fn.helper.setMaxRoomOccupancy(),d21_jq("#d21-quickbook #d21-radius-container").hide()}else i(null,e),d21_jq("#d21-quickbook #d21-radius-container").show()}else t.fn.helper.setMaxRoomOccupancy(),d21_jq("#d21-avail-result-container").html("").removeClass("d21-avail")}},helper:{showOccupancyControll:function(e){var t=document.getElementById("d21_tooltip");t.style.display=e?"block":"none"},showLoadPanel:function(e){e?d21_jq("#d21-load-overlay").show():d21_jq("#d21-load-overlay").hide()},adjustFields:function(){var e=d21_jq("#d21-quickbook").width(),t=d21_jq("#d21-los-container,#d21-arrival-container,#d21-occupancy-container,#d21-submit-container,#d21-avail-result-container,#d21-hotelname-city-container"),a=d21_jq("#d21-los-container,#d21-arrival-container");e<=250&&d21_app.widgetOptions.hasHorizontalOrientation?(t.addClass("fullWidth"),a.removeClass("halfWidth")):(t.removeClass("fullWidth"),a.addClass("halfWidth"))},adjustCalendar:function(){var e=d21_jq(window).width(),t=d21_jq(".picker__holder").width(),a=d21_jq("#d21-quickbook").width();e-(d21_jq("#d21-quickbook").offset().left+a)-10<=t?d21_jq(".picker__holder").css("right",0):d21_jq(".picker__holder").css("right","initial")},adjustOccupancyHeight:function(e){d21_jq('#d21_tooltip li[class*="d21-roomItem-"]').toArray().forEach(function(e){var t=d21_jq("> .d21-headline",e).height(),a=d21_jq(".d21-child-container",e).height();d21_jq(e).height(t+a)})},markDaysInCalendar:function(){setTimeout(function(){if(t.var.isInit){var e=d21_jq(".picker__holder .picker__table tbody tr");d21_jq.each(e,function(e){var a=d21_jq("td",this);d21_jq.each(a,function(){var e=d21_jq("> div",this).attr("data-pick"),a=null;if(e&&(a=moment(parseInt(e))),a){var i=t.var.availabilities.filter(function(e){return e.Date==a.format("YYYY-MM-DD")}),n=null;if(i.length>0&&(n=i[0]),n){var o=parseInt(moment.duration(moment(n.Date).diff(moment())).asDays());n.IsAvailable&&o>=0?(d21_jq(this).addClass("d21-tooltip").addClass("d21-avail"),d21_jq(this).attr("data-tooltip",t.options.fieldTexts.avail)):n.HasRestrictions&&!n.Restrictions.IsCta&&!n.Restrictions.IsCtd&&o>=0?(d21_jq(this).addClass("d21-tooltip").addClass("d21-restricted"),d21_jq(this).attr("data-tooltip",JSON.stringify(n.Restrictions))):(d21_jq(this).addClass("d21-tooltip").addClass("d21-notAvail"),d21_jq(this).attr("d21-tooltip",t.options.fieldTexts.notavail))}}t.fn.events.bind.tooltip()})})}},500)},unMarkDaysInCalendar:function(){d21_jq(".picker__holder .picker__table tbody td").toArray().forEach(function(e,t){d21_jq(e).removeClass("d21-avail"),d21_jq(e).removeClass("d21-notAvail"),d21_jq(e).removeClass("d21-restricted")})},showSearchedHotel:function(e){d21_jq("#d21-hotelname-city-list > div").filter(function(){return d21_jq(this).html().toUpperCase().indexOf(e.toUpperCase())>=0}).show(),d21_jq("#d21-hotelname-city-list > div").filter(function(){return d21_jq(this).html().toUpperCase().indexOf(e.toUpperCase())<0}).hide()},getAvailability:function(e,a,i){if(!d21_app.widgetOptions.isTransitHotel){e=e||"next",a=a||!1;var n="";if("ArrivalDeparture"==window.d21_app.widgetOptions.DisplayMode){var o=new Date(t.var.picker.arrival.get("select","yyyy-mm-dd")).getTime(),r=new Date(t.var.picker.departure.get("select","yyyy-mm-dd")).getTime();t.var.los=(r-o)/864e5,n=t.fn.helper.getRequestUrl(t.var.picker.arrival.get("select","yyyy-mm-dd"),t.var.picker.arrival.get("select","yyyy-mm-dd"))}"ArrivalLos"==window.d21_app.widgetOptions.DisplayMode&&(n=t.fn.helper.getRequestUrl(t.prop.beginDate(),t.prop.endDate())),t.fn.helper.showLoadPanel(!0),d21_app.fn.onWidgetCommand("Base",function(o){o.api.fn.get(n,function(n){t.var.availabilities=null,null!=n.Value.Properties&&0!=n.Value.Properties.length&&(d21_app.widgetOptions.currency=n.Value.Properties[0].Currency,null!=n.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"]&&(t.var.availabilities=n.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"])),void 0==n.Value.Properties&&(t.var.availabilities=n.Value[d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"]),t.fn.handler.afterGetAvailability(e,a),t.fn.helper.showLoadPanel(!1),i&&i(),t.var.isInit||t.fn.helper.setFirstAvailableDate(),t.var.isInit=!0})})}},overrideDefaults:function(e,a){var i=d21_jq(e).attr("d21-horizontalorientation"),n=d21_jq(e).attr("d21-packagelink"),o="true"==d21_jq(e).attr("d21-debugmode"),r=d21_jq(e).attr("d21-rebookLink"),d=d21_jq(e).attr("d21-adultcount"),l=d21_jq(e).attr("d21-dayoffset"),s=d21_jq(e).attr("d21-los");void 0!==i&&(window.d21_app.widgets.config.QuickBook.HasHorizontalOrientation=i),void 0!==n&&(window.d21_app.widgets.config.QuickBook.HasPackageLink=n),void 0!==o&&(t.var.debugMode=o),void 0!==r&&(window.d21_app.widgets.config.QuickBook.HasRebookLink=r),void 0!==d&&(t.options.occupancy.room[0].adult=parseInt(d)),void 0!==l&&(window.d21_app.widgets.config.QuickBook.Preselect.DayOffset=l),void 0!==s&&(window.d21_app.widgets.config.QuickBook.Preselect.DayLOSOffset=s),a&&a()},getWidget:function(){var e=document.getElementById("d21-quickbook");null!=e&&t.fn.helper.overrideDefaults(e,function(){d21_app.fn.onWidgetCommand("Base",function(a){a.api.fn.get(window.d21_app.widgetUrl+"/GetHtml/quickbook/"+window.d21_app.widgetOptions.guid+"/"+d21_app.widgetOptions.lang+"?v3",function(a){t.fn.handler.onRenderedQuickbook(e,a)})})})},setFirstAvailableDate:function(){var e=null,a=moment().startOf("day");null!=t.var.availabilities&&t.var.availabilities.forEach(function(t){var i=moment(t.Date);t.IsAvailable&&null==e&&a<=i&&(e=t)}),null!=e&&t.fn.helper.setAvailabilityResult(e)},getRequestUrl:function(e,a){null==e&&null==a&&(e=t.prop.beginDate(),a=t.prop.endDate());var i=t.prop.occupancy(),n=t.baseAvailabilityUrl+"?begin="+e+(d21_app.widgetOptions.isTransitHotel?"T06:00":"")+"&end="+a+(d21_app.widgetOptions.isTransitHotel?"T23:00":"")+"&channel_legacy_token="+window.d21_app.widgetOptions.Channel_Token+"&room="+i+"&los="+t.var.los;return d21_app.widgetOptions.isTransitHotel&&(n+="&tick=0.01:00:00",n+="&result_mode=Aggregation"),window.d21_app.widgetOptions.isGroupSDK?(null!=t.var.currentSelectedHotel?n+="&property_id="+t.var.currentSelectedHotel.Property_id:n+="&group_token="+window.d21_app.widgetOptions.Group_Token,null!=t.var.currentSelectedCity&&(n+="&city="+t.var.currentSelectedCity)):n+="&property_token="+window.d21_app.widgetOptions.Property_Token,n},getRoomBySelector:function(e){var a=null;return d21_jq.each(t.options.occupancy.room,function(){this.selector==e&&(a=this)}),a},getRoomIndexBySelector:function(e){var a=null;return d21_jq.each(t.options.occupancy.room,function(t){this.selector==e&&(a=t)}),a},getHotelByName:function(e){e=e.replaceAll('"',"'");var a=null;return t.var.hotelList.forEach(function(t){t.Name.toLowerCase()==e.toLowerCase()&&(a=t)}),a},getAggregation:function(e){var a="?_aid=";null!=t.var.currentSelectedHotel?a+=t.var.currentSelectedHotel.Property_id:d21_app.widgetOptions.isGroupSDK?a+=d21_app.widgetOptions.Group_Token:a+=d21_app.widgetOptions.Property_Token,a+="&filter=_Culture eq 'de-DE'";var i=t.apiHostInfoUrl+a;d21_app.fn.onWidgetCommand("Base",function(e){e.api.fn.get(i,function(e){t.var.hotelList=e.Value.Properties,function(){var e={};t.var.hotelList.forEach(function(t){void 0==e[t.City]?(e[t.City]=[],e[t.City].push(t)):e[t.City].push(t)}),hotels=[],Object.keys(e).forEach(function(t,a){e[t].sort(function(e,t){return e.Namet.Name?1:0}),hotels=hotels.concat(e[t])}),t.var.hotelList=hotels}(),t.var.cityList=e.Value.Cities,t.var.minAdults=e.Value.Restrictions.MinOccupancy,t.var.maxAdults=e.Value.Restrictions.MaxOccupancy>0?e.Value.Restrictions.MaxOccupancy:10})})},removeRoomBySelector:function(e){var a=null;d21_jq.each(t.options.occupancy.room,function(t){this.selector==e&&(a=t)}),null!=a&&t.options.occupancy.room.splice(a,1)},setAvailabilityResult:function(e){if(t.options.hasMinPriceVisible){var a="",i=d21_jq("#d21-avail-result-container");null!=e&&(e.IsAvailable&&null!=e.TotalMin?(i.removeClass("d21-notAvail").addClass("d21-avail"),t.var.isBookable=!0,a="

    "+t.options.fieldTexts.total+''+e.TotalMin.toFixed(2)+" "+d21_app.widgetOptions.currency+"

    "):e.IsAvailable||(i.removeClass("d21-avail").addClass("d21-notAvail"),t.var.isBookable=!1,d21_jq("#d21-submit-container > input").removeClass("d21-pulse-btn"),a='

    '+t.options.fieldTexts.notavail+"

    "),d21_jq("#d21-avail-result-container").html(a).show(),e.IsAvailable?(d21_app.widgetOptions.isTransitHotel||t.fn.helper.submitPulse(),d21_app.widgetOptions.isTransitHotel||d21_jq("#d21-submit-container > input").click(function(){t.fn.handler.onSubmit(!d21_app.widgetOptions.isTransitHotel)})):d21_jq("#d21-submit-container > input").removeClass("d21-pulse-btn").unbind("click").bind("click",function(e){e.preventDefault(),d21_app.widgetOptions.isGroupSDK&&null==t.var.currentSelectedHotel?t.fn.handler.onSubmit(!d21_app.widgetOptions.isTransitHotel):t.fn.handler.onNotBookable()}))}},setMaxRoomOccupancy:function(e){t.fn.helper.getAggregation(),t.fn.helper.resetOccupancy()},resetOccupancy:function(){t.options.occupancy.room=[t.options.occupancy.room[0]],t.options.occupancy.room[0].child=[],t.options.occupancy.room[0].adult=t.var.adultPreselect,d21_jq(".d21-child-container .d21-child-field span",d21_jq(t.options.occupancy.room[0].selector)).text(0),d21_jq(".d21-adult-container .d21-adult-field span",d21_jq(t.options.occupancy.room[0].selector)).text(t.var.adultPreselect),d21_jq(".d21-child-container .d21-list-of-childs",d21_jq(t.options.occupancy.room[0].selector)).html(""),t.fn.helper.adjustOccupancyHeight(),d21_jq(".d21-maxOccupancy").hide(),t.fn.helper.updateOccupancyInfo()},hasAnyAvailableDate:function(e){var t=!0,a=[];return a=void 0!=e.Value.Properties?e.Value.Properties[0][d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"]:e.Value[d21_app.widgetOptions.isTransitHotel?"Ticks":"Days"],d21_jq.each(a,function(){if(!this.IsAvailable)return t=!1,!1}),t?d21_jq("#d21-quickbook .hasDatepicker").css("border-left","8px solid green"):d21_jq("#d21-quickbook .hasDatepicker").css("border-left","8px solid red"),t},updateOccupancyHeadings:function(){var e=d21_jq("#d21_tooltip #d21-list-of-rooms ul li");1==e.length?d21_jq(".d21-headline i",e[0]).hide():d21_jq(".d21-headline i",e[0]).show(),d21_jq.each(e,function(e){d21_jq(".d21-headline label",this).first().text(e+1+" "+t.options.fieldTexts.single.room)})},updateOccupancyInfo:function(){var e="";e+=t.prop.roomCount(),e+=" ",e+=1==t.prop.roomCount()?t.options.fieldTexts.single.room:t.options.fieldTexts.multi.room,e+=" / ",e+=t.prop.adultCount(),e+=" ",e+=1==t.prop.adultCount()?t.options.fieldTexts.single.adult.substring(0,3):t.options.fieldTexts.multi.adult.substring(0,3),e+=".",e+=" / ",e+=t.prop.childCount(),e+=" ",e+=1==t.prop.childCount()?t.options.fieldTexts.single.child:t.options.fieldTexts.multi.child,d21_jq("#d21-occupancy-container .tooltipster").val(e)},addDebugModeClass:function(){t.var.debugMode&&(d21_jq("#d21-quickbook, #d21-quickbook div, #d21-quickbook form, #d21-quickbook input, #d21-quickbook select").hover(function(e){e.stopPropagation(),d21_jq(this).addClass("d21-debugMode")}).mouseleave(function(){d21_jq(this).removeClass("d21-debugMode")}),d21_jq("#d21-quickbook, #d21-quickbook div, #d21-quickbook form, #d21-quickbook input, #d21-quickbook select").click(function(e){e.stopPropagation();var t="";t+="Tag Name: "+d21_jq(this).prop("tagName")+"\n",null!=d21_jq(this).attr("class")&&""!=d21_jq(this).attr("class").replace("d21-debugMode","").trim()&&(t+="klassen: "+d21_jq(this).attr("class").replace("d21-debugMode","")+"\n"),null!=d21_jq(this).attr("id")&&(t+="id: "+d21_jq(this).attr("id")+"\n"),alert(t)}))},submitPulse:function(){var e=d21_jq("#d21-submit-container input");e.removeClass("d21-pulse-btn"),setTimeout(function(){e.addClass("d21-pulse-btn")},10)},renderHotelDatalist:function(){var e=function(e,i,n){var o;o=n?'
    '+e.Name+"":'
    '+t.options.fieldTexts.accommodation+" "+t.options.fieldTexts.in+": "+e+"",a.append(o),n&&i==t.var.hotelList.length-1&&t.fn.handler.onChangeSelectedHotel()},a=d21_jq("#d21-quickbook #d21-hotelname-city-list"),i=setInterval(function(){if(t.var.hotelList.length>0&&(clearInterval(i),t.var.hotelList.forEach(function(t,a){e(t,a,!0)}),d21_app.widgetOptions.hasCities&&t.var.cityList.forEach(function(t,a){e(t,a,!1)}),t.var.containerData&&t.var.containerData.preselect_property_id)){var a=t.var.hotelList.filter(function(e){return e.Property_id==t.var.containerData.preselect_property_id}),n=null;a.length>0&&(n=a[0]),t.fn.handler.onHotelSelected(n.Name,null)}},50)},renderPropertyType:function(){var e=[];d21_app.fn.getWidget("Base").fn.helper.getHotels(function(a){var i=function(e,t){var a='";d21_jq("#d21-quickbook #d21-property-type-container select").append(a)};a.forEach(function(t,a){t.IsOnlineBookable&&e.indexOf(t.PropertyType)<0&&e.push(t.PropertyType)}),i(-1,t.options.fieldTexts.propertyType),e.forEach(function(e){i(e,e)})})}}}}d21_app.fn.register(new d21_quickbook(d21_app.d21_quickbook_options));d21_app.fn.onWidgetCommand('QuickBook', function(widget){ widget.fn.start(); });var d21_ibeController=function(){var e=this;e.name="Ibe",e.widget={html:""},e.fn={start:function(a){e.fn.events.bind(),d21_app.fn.onWidgetCommand("Base",function(e){var a=e.fn.helper.getUrlParam(),t=e.fn.helper.getParamByName(a,"d21_ibe_open"),r=e.fn.helper.getParamByName(a,"d21_ibe_package_id"),n=e.fn.helper.getParamByName(a,"d21_ibe_room_id"),d=e.fn.helper.getParamByName(a,"d21_ibe_arrival"),l=e.fn.helper.getParamByName(a,"d21_ibe_culture"),i=e.fn.helper.getParamByName(a,"d21_ibe_currency"),o=e.fn.helper.getParamByName(a,"d21_ibe_departure"),p=e.fn.helper.getParamByName(a,"d21_ibe_los"),u=e.fn.helper.getParamByName(a,"d21_ibe_ratecode"),c=e.fn.helper.getMultipleParamsByName(a,"d21_ibe_room"),s=e.fn.helper.getParamByName(a,"d21_meta_track_id"),f=e.fn.helper.getParamByName(a,"r");if(null!=t&&"true"==t.value||r||n||d||o||p||u||l||c||s){var m={};if(r&&(m.package_id=r.value),n&&(m.room_id=n.value),d&&(m.arrival=d.value),o&&(m.departure=o.value),p&&(m.los=p.value),u&&(m.ratecode=u.value),c&&(m.room=c),l&&(m.culture=l.value),i&&(m.currency=i.value),s&&(m.meta_track_id=s.value),f&&f.value){switch(f.value.replace("https:","").replace("http:","").replace(/\//gim,"")){case"google.de":case"www.google.de":m.meta_provider="GoogleHotelAds"}}d21_api.ibe.open(m)}})},events:{bind:function(){setTimeout(function(){var a=function(a,t){a.preventDefault();var r=e.fn.helper.getParam(a,t);e.fn.handler.onIbeOpen(r)};d21_jq(".d21-package").unbind("click").bind("click",function(e){return a(e,this),!1}),d21_jq(".d21-trigger-ibe").unbind("click").bind("click",function(e){return a(e,this),!1}),d21_jq("a[href*=d21_custom_api]").unbind("click").bind("click",function(e){e.preventDefault();var a=d21_jq(this).attr("href").split("#")[1];d21_app.fn.onWidgetCommand("Base",function(e){e.fn.handler.onAnchorCommand(a)})})},1e3)},onAnchorCommand:function(a){var t=null;if(a.indexOf("(")>=0){var r=a.substring(a.indexOf("("),a.length).replace("(","").replace(")","").replaceAll("'",'"');r.indexOf("{")<0&&(r="{"+r+"}"),t=JSON.parse(r),a=a.substring(0,a.indexOf("("))}switch(a){case"ibe.open":null==t?e.fn.handler.onIbeOpen():e.fn.handler.onIbeOpen(t)}},onPostMessage:function(e){switch(e.data.type){case"d21-ibe-close":d21_app.fn.onWidgetCommand("Base",function(e){e.fn.handler.onPopUpClose()});break;case"d21-ibe-height":d21_jq("#d21_ibe iframe").height(e.data.args.height+"px");break;case"d21-ibe-openModal":d21.modal.args=e.data.args,uglipop({class:"d21-modal",source:"html",content:''});break;case"d21-ibe-toggleNext":d21_jq("#d21-footer").removeClass("fadeOutDown"),d21_jq("#d21-footer").addClass("fadeInUp"),d21_jq("#d21-footer #d21-next").addClass("d21-animate-pulses");break;case"d21-next-iframe":var a=d21_jq('iframe[id="d21-frame"]').position();d21_jq("html, body").animate({scrollTop:e.data.args.top+a.top});break;case"d21-modal-loaded":document.getElementById("d21-modal").contentWindow.postMessage({type:"d21-parent-data",args:d21.modal.args},"//v4.ibe.dirs21.local/channels/hotel-zum-test")}}},handler:{onIbeOpen:function(e){var a=function(e,a){null!=a&&(t+=("?"==t?"":"&")+e+"="+a)},t="?";if(null!=e&&"object"==typeof e){var r=function(e){if(e.indexOf(".")>=0){var a=e.split(".");2==a[0].length&&(console.log("open IBE: wrong date format provided"),e="",e=a[2]+"-"+a[1]+"-"+a[0])}return e};if(t="?",void 0!==e.culture||void 0!==e.Culture?(void 0!==e.culture&&a("culture",e.culture),void 0!==e.Culture&&a("culture",e.Culture)):e.meta_track_id||a("culture",d21_app.widgetOptions.lang),e.arrival&&(e.arrival=r(e.arrival)),e.departure&&(e.departure=r(e.departure)),Object.keys(e).forEach(function(t){"room"!=t.toLowerCase()&&"culture"!=t.toLowerCase()&&a(t,e[t])}),void 0!=e.room){"string"==typeof e.room&&(e.room=JSON.parse(e.room));var n="";e.room.forEach(function(e,a){n+=(0==a?"room=":"&room=")+e}),t+=t.indexOf("?")>=0?"&"+n:"?"+n}}else a("culture",d21_app.widgetOptions.lang);var d="string"==typeof e?window.d21_app.ibeBaseUrl+"channels"+window.d21_app.widgetOptions.Directory+"?"+e:window.d21_app.ibeBaseUrl+"channels"+window.d21_app.widgetOptions.Directory+(null!=t?t:"");d21_app.fn.onWidgetCommand("Base",function(e){d21_app.widgets.GoogleAnalytics&&(d=d21_app.widgets.GoogleAnalytics.fn.decorateUrl(d)),e.fn.handler.onPopUpOpen('',"d21-ibe-fullsize",t)})}},helper:{getParam:function(e,a){null!=e&&e.preventDefault();var t,r=null;return null==d21_jq(a).attr("d21-data")&&null==d21_jq(a).attr("title")&&null==d21_jq(a).attr("data-d21")||(null!=d21_jq(a).attr("title")&&d21_jq(a).attr("title").indexOf("{")>=0&&(t=window.d21_app.fn.getWidget("Base").fn.helper.replaceAll("'",'"',d21_jq(a).attr("title"))),null!=d21_jq(a).attr("d21-data")&&(t=window.d21_app.fn.getWidget("Base").fn.helper.replaceAll("'",'"',d21_jq(a).attr("d21-data"))),null!=d21_jq(a).attr("data-d21")&&(t=window.d21_app.fn.getWidget("Base").fn.helper.replaceAll("'",'"',d21_jq(a).attr("data-d21"))),void 0!=t&&(r=JSON.parse(t))),r}}}};d21_app.fn.register(new d21_ibeController);d21_app.fn.onWidgetCommand('Ibe', function(widget){ widget.fn.start(); });function d21_customStyle(t){var e=this;e.name="CustomStyle",e.option=t,e.fn={start:function(){d21_app.fn.onWidgetCommand("GoogleAnalytics",function(t){});var t=document.createElement("style");t.rel="stylesheet",t.type="text/css",t.innerHTML=e.option.css,document.body.appendChild(t)}}}d21_app.fn.register(new d21_customStyle(d21_app.d21_CustomStyle_options));d21_app.fn.onWidgetCommand('CustomStyle', function(widget){ widget.fn.start(); });