function MarketingRakutenTracking(n,t,i,r){r==null&&(r={});var u=this;u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.globalCode=ko.observable(r.GlobalCode!=null?r.GlobalCode:null);u.trackingCode=ko.observable(r.TrackingCode!=null?r.TrackingCode:null);u.setupScript=function(){var f=document.location.protocol+"//tag.rmp.rakuten.com/124761.ct.js",n,r,t,i;window.rakutenDataLayer=!1;n=window.rakutenDataLayer||"DataLayer";window[n]||(window[n]={});window[n].events||(window[n].events={});window[n].events.SPIVersion=window[n].events.SPIVersion||"3.4.1";t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src=f;r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r);athena.isEmpty(u.trackingCode())||(i=document.createElement("script"),i.id="rakuten-js-tracking",i.innerHTML=u.trackingCode(),document.body.appendChild(i))};ko.applyBindings(u,document.getElementById(i));u.setupScript()}function MarketingEmarsysTracking(n,t,i,r){r==null&&(r={});var u=this;u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.merchantID=ko.observable(r.MerchantID!=null?r.MerchantID:null);u.cart=ko.observable(r.Cart!=null?r.Cart:[]);u.purchase=ko.observable(r.Purchase!=null?r.Purchase:null);u.productID=ko.observable(r.ProductID!=null?r.ProductID:null);u.customerEmail=ko.observable(r.CustomerEmail!=null?r.CustomerEmail:null);u.setupScript=function(){if($("#scarab-js-api").length==0){var n=document.createElement("script");n.id="scarab-js-api";n.onload=function(){u.setup()};n.src=`//cdn.scarabresearch.com/js/${u.merchantID()}/scarab-v2.js`;document.head.appendChild(n)}else u.setup()};u.setup=function(){athena.isEmpty(u.customerEmail())||ScarabQueue.push(["setEmail",u.customerEmail()]);athena.isEmpty(u.productID())||ScarabQueue.push(["view",u.productID()]);ScarabQueue.push(["cart",u.cart()]);u.purchase()!=null&&ScarabQueue.push(["purchase",u.purchase()]);ScarabQueue.push(["go"])};ko.applyBindings(u,document.getElementById(i));athena.isEmpty(u.merchantID())||u.setupScript()}function SimpleContactForm(n,t,i){var r=this;r.code=ko.observable(n);r.identifier=ko.observable(t);r.elementId=ko.observable(i);r.formValidator=ko.observable();r.Title=ko.observable();r.Name=ko.observable();r.FirstName=ko.observable().extend({minLength:1});r.LastName=ko.observable();r.Email=ko.observable();r.Telephone=ko.observable();r.BestTimeToCall=ko.observable();r.PostCode=ko.observable();r.GroupName=ko.observable();r.GroupSize=ko.observable();r.TeachersNo=ko.observable();r.StudentsNo=ko.observable();r.StudentsAgeMin=ko.observable();r.StudentsAgeMax=ko.observable();r.TourType=ko.observable();r.Destination=ko.observable();r.DepartureDate=ko.observable();r.Flexibility=ko.observable(!1);r.PreferredDepartureAirport=ko.observable();r.TourDuration=ko.observable();r.Budget=ko.observable();r.BoardType=ko.observable();r.CompanyAddress=ko.observable();r.EventName=ko.observable();r.EventOccurance=ko.observable();r.EventDates=ko.observable();r.VenueAddress=ko.observable();r.EventType=ko.observable();r.EventAttendingStaffVIP=ko.observable();r.NumberOfGuests=ko.observable();r.RateCardView=ko.observable();r.HowFindUs=ko.observable();r.Message=ko.observable(athena.GetUrlParameter("Message"));r.AllowMarketing=ko.observable(!1);r.send=function(){r.formValidator().validate()?(athena.StartLoader("Your request is being processed"),$.ajax(athena.BuildAjaxCommand(r.code(),r.identifier(),"send"),{type:"POST",data:"Title="+encodeURIComponent(r.Title())+"&Name="+encodeURIComponent(athena.isEmpty(r.Name())?r.FirstName()+" "+r.LastName():r.Name())+"&Email="+encodeURIComponent(r.Email())+"&Telephone="+encodeURIComponent(r.Telephone())+"&BestTimeToCall="+encodeURIComponent(r.BestTimeToCall())+"&PostCode="+encodeURIComponent(r.PostCode())+"&GroupName="+encodeURIComponent(r.GroupName())+"&GroupSize="+encodeURIComponent(r.GroupSize())+"&TeachersNo="+encodeURIComponent(r.TeachersNo())+"&StudentsNo="+encodeURIComponent(r.StudentsNo())+"&StudentsAgeMin="+encodeURIComponent(r.StudentsAgeMin())+"&StudentsAgeMax="+encodeURIComponent(r.StudentsAgeMax())+"&TourType="+encodeURIComponent(r.TourType())+"&Destination="+encodeURIComponent(r.Destination())+"&DepartureDate="+encodeURIComponent(r.DepartureDate())+"&Flexibility="+encodeURIComponent(r.Flexibility())+"&PreferredDepartureAirport="+encodeURIComponent(r.PreferredDepartureAirport())+"&TourDuration="+encodeURIComponent(r.TourDuration())+"&Budget="+encodeURIComponent(r.Budget())+"&BoardType="+encodeURIComponent(r.BoardType())+"&HowFindUs="+encodeURIComponent(r.HowFindUs())+"&CompanyAddress="+encodeURIComponent(r.CompanyAddress())+"&EventName="+encodeURIComponent(r.EventName())+"&EventOccurance="+encodeURIComponent(r.EventOccurance())+"&EventDates="+encodeURIComponent(r.EventDates())+"&VenueAddress="+encodeURIComponent(r.VenueAddress())+"&EventType="+encodeURIComponent(r.EventType())+"&EventAttendingStaffVIP="+encodeURIComponent(r.EventAttendingStaffVIP())+"&NumberOfGuests="+encodeURIComponent(r.NumberOfGuests())+"&RateCardView="+encodeURIComponent(r.RateCardView())+"&Message="+encodeURIComponent(r.Message())+"&AllowMarketing="+(r.AllowMarketing()?"true":"false"),success:function(n){athena.StopLoader();n.Success?(n.Result.Success&&n.Result.Url!=null&&(window.location=n.Result.Url),alertify.alert(n.Result.Message)):alertify.alert("Unfortunately your request could not be sent")},error:function(){athena.StopLoader();alertify.alert("Unfortunately your request could not be sent")}})):alertify.alert("Correct the highlighted issues before signing up")};r.reset=function(){r.Title("");r.Name("");r.FirstName("");r.LastName("");r.Email("");r.Telephone("");r.BestTimeToCall("");r.PostCode("");r.GroupName("");r.GroupSize("");r.TeachersNo("");r.StudentsNo("");r.StudentsAgeMin("");r.StudentsAgeMax("");r.TourType("");r.Destination("");r.DepartureDate("");r.Flexibility(!1);r.PreferredDepartureAirport("");r.TourDuration("");r.Budget("");r.BoardType("");r.HowFindUs("");r.Message("");r.AllowMarketing(!1)};ko.applyBindings(r,document.getElementById(i))}function CRMNewsletterSignupInline(n,t,i,r){r==null&&(r={});var u=this;u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.ShowPrivacyPolicyLink=ko.observable(r.ShowPrivacyPolicyLink!=null?r.ShowPrivacyPolicyLink:!1);u.PrivacyPolicyString=ko.observable(athena.isEmpty(r.PrivacyPolicyString)?"Privacy Policy":r.PrivacyPolicyString);u.PrivacyPolicyUrl=ko.observable(r.ShowPrivacyPolicyLink?r.PrivacyPolicyUrl:"");u.showThankyouPage=ko.observable(r.ShowThankyouPage||!1);u.thankyouPageUrl=ko.observable(r.ThankyouPageUrl||"");u.SignupButtonString=ko.observable(athena.isEmpty(r.SignupButtonString)?"Signup":r.SignupButtonString);u.name=ko.observable();u.email=ko.observable();u.formValidator=ko.observable();u.signup=function(){var t,n;if(u.formValidator().validate()){if(t=(u.name()+"").split(" "),t.length<=1){alertify.alert("Please enter your first name and last name");return}n=[];n.push("Name="+u.name());n.push("Email="+u.email());$.ajax(athena.BuildAjaxCommand(u.code(),u.identifier(),"signup"),{method:"POST",data:n.join("&"),success:function(n){if(athena.StopLoader(),n.Success)if(n.Result!=null&&n.Result.Created)alertify.success("You have been added to our newsletter"),u.showThankyouPage()&&(window.location=u.thankyouPageUrl()),u.name(""),u.email("");else{var t=n.Result!=null?n.Result.Message:"";athena.isEmpty(t)&&(t="Your details could not be updated");alertify.alert(t)}else alertify.alert("We could not currently sign you up, please try again later")},error:function(){athena.StopLoader();alertify.alert("Your details could not be updated")}})}else alertify.alert("Correct the highlighted issues before signing up")};ko.applyBindings(u,document.getElementById(i))}function ApolloSurveyCarousel(n,t,i,r){var u=this;u.DISPLAYMODE={Grid:0,Tiles:1};u.LOADINGSTATUS={NA:0,Loading:1,Loaded:2,Error:3};u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.columns=ko.observable(r.NumPerSlide||3);u.interval=ko.observable(r.Interval!=null?r.Interval:5);u.allowDynamic=ko.observable(r.AllowDynamic!=null?r.AllowDynamic:!1);u.customTags=ko.observableArray([]);u.channelName=ko.observable("SURVEYANSWERSETS");u.channel=null;u.results=ko.observableArray([]);u.maxItems=ko.observable(0);u.status=ko.observable(u.LOADINGSTATUS.NA);u.message=ko.observable();u.carouselInterval=ko.computed(function(){if(u.interval()==-1)return"false";var n=u.interval();return athena.isEmpty(u.interval())&&(n=5),n*1e3});u.columnSize=ko.computed(function(){var n=4;switch(u.columns()){case 1:n=12;break;case 2:n=6;break;case 3:n=4;break;case 4:n=3;break;case 6:n=2}return n});u.groupedResults=ko.computed(function(){var r=[],t=u.results(),f,n,i;if(t!=null&&t.length>0)for(f=Math.ceil(t.length/u.columns()),n=0;n<f;n++)i=t.slice(n*u.columns(),n*u.columns()+u.columns()),i!=null&&i.length>0&&r.push({Results:i});return r});u._totalResults=ko.computed(function(){return u.results()==null?0:u.results().length});u.load=function(){var i,n,r,t,f;if(u.status(u.LOADINGSTATUS.Loading),i="",n=u.customTags(),n!=null){for(r=[],t=0;t<n.length;t++)f=n[t],r.push(encodeURIComponent(f.Key)+"|"+encodeURIComponent(f.Value));i=r.join("~")}$.ajax(athena.BuildAjaxCommand(u.code(),u.identifier(),"load")+"&Tags="+i,{contentType:"application/json",success:function(n){n.Success?n.Result!=null?(u.status(u.LOADINGSTATUS.Loaded),u.results(n.Result),u.maxItems(n.Result.TotalCount)):(u.status(u.LOADINGSTATUS.Error),u.message("No results could be found")):(u.status(u.LOADINGSTATUS.Error),u.message("The results could not be loaded"))},error:function(){u.status(u.LOADINGSTATUS.Error);u.message("The results could not be loaded")}})};ko.applyBindings(u,document.getElementById(i));u.allowDynamic()?(u.channel=postal.channel(u.channelName()),u.channel.subscribe("tags.set",function(n){n!=null&&u.status()!=u.LOADINGSTATUS.Loaded&&n.TravelType=="Accommodation"&&(u.customTags(n.Tags),u.load())})):u.load()}function ApolloProductListingCarousel(n,t,i,r){var u=this;u._INTROMODE="intro";u.DISPLAYMODE={Grid:0,Tiles:1};u.LOADINGSTATUS={NA:0,Loading:1,Loaded:2,Error:3};u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.travelType=ko.observable(r.ProductType||"");u.columns=ko.observable(r.NumPerSlide||3);u.addSearchToUrl=ko.observable(r.AddSearchQuery||!0);u.nextUrl=ko.observable(r.NextUrl||"#");u.carouselTitle=ko.observable(r.Title||"");u.carouselCaption=ko.observable(r.Caption||"");u.showTotalItems=ko.observable(r.ShowTotalItems!=null?r.ShowTotalItems:!1);u.itemsLabel=ko.observable(r.ItemsLabel||"item");u.interval=ko.observable(r.Interval!=null?r.Interval:5);u.favouritedItems=ko.observableArray(r.FavouritedItems!=null?r.FavouritedItems:[]);u.allowWishlist=ko.observable(r.AllowWishlist!=null?r.AllowWishlist:!0);u.locationBase=ko.observable(r.LocationBase!=null?r.LocationBase:null);u.displayMode=ko.observable(u.DISPLAYMODE.Grid);u.results=ko.observableArray([]);u.maxItems=ko.observable(0);u.status=ko.observable(u.LOADINGSTATUS.NA);u.message=ko.observable();u.isFavourited=function(n){return $.inArray(n,u.favouritedItems())==-1?!1:!0};u.carouselInterval=ko.computed(function(){if(u.interval()==-1)return"false";var n=u.interval();return athena.isEmpty(u.interval())&&(n=5),n*1e3});u.columnSize=ko.computed(function(){var n=4;switch(u.columns()){case 1:n=12;break;case 2:n=6;break;case 3:n=4;break;case 4:n=3;break;case 6:n=2}return n});u.groupedResults=ko.computed(function(){var r=[],t=u.results(),f,n,i;if(t!=null&&t.length>0)for(f=Math.ceil(t.length/u.columns()),n=0;n<f;n++)i=t.slice(n*u.columns(),n*u.columns()+u.columns()),i!=null&&i.length>0&&r.push({Results:i});return r});u._totalResults=ko.computed(function(){return u.results()==null?0:u.results().length});u._generateUrl=function(n){return athena.CompileUrl(u.nextUrl(),{ProductCode:n.Code,Name:n.Name,ProductID:n.ID},null,{ProductID:"ProductCode"})};u._itemTitle=function(n){var r="",i,t;if(n!=null&&n.Accommodations()!=null&&n.Accommodations().length>0){for(i=[],t=0;t<n.Accommodations().length;t++)i.push(n.Accommodations()[t].AccommodationDetails.Name());r=i.join(",")}return r};u.productFromPriceWithFrom=function(n){var v,s,l,a;if(n!=null){if(n=ko.toJS(n),v=caboodle.ProductFromPrice(n,!0),athena.isEmpty(v)&&(u.travelType()=="Package"||u.travelType()=="Tour")){var c="",t=0,o="";if(n.ComponentDetails!=null&&n.ComponentDetails.length>0)for(s=0;s<n.ComponentDetails.length;s++){var i=null,y=[],p=[],r=ko.utils.arrayFirst(n.Components,function(t){return t.ComponentID==n.ComponentDetails[s].ID});if(r!=null&&(r.TravelType==1||r.TravelType=="Accommodation")&&r.Criteria!=null&&r.Criteria.length>0&&(l=ko.utils.arrayFirst(r.Criteria,function(n){return n.CriteriaType==3}),l!=null&&(y=(l.CriteriaValue+"").split(",")),a=ko.utils.arrayFirst(r.Criteria,function(n){return n.CriteriaType==2}),a!=null&&(p=(a.CriteriaValue+"").split(","))),i=caboodle.ProductCheapestPriceBand(n.ComponentDetails[s],y,p),i!=null&&(athena.isEmpty(c)&&(c=i.CurrencyCode),athena.isEmpty(o))){switch(i.ChargeBy){case 0:case 1:t+=i.Amount*n.Duration;o+="";break;default:t+=i.Amount}switch(i.ChargeOn){case 1:o+=" per person "}}}if(n.DealMarkUpType!=null){var f=0,h=athena.isEmpty(n.Duration)?1:n.Duration,w=n.DealMarkUpType,b=n.DealChargeBy,e=n.DealMarkUpAmount;if(w==0)switch(b){case 0:case 1:f=h*e;break;case 2:f=(h/7+1)*e;break;case 4:f=e}else if(w==1)switch(adjustmentChargeBy){case 0:case 1:f=t/100*e*h;break;case 2:f=t/100*e*(h/7+1);break;case 4:f=t/100*e}t+=f}return t>0?(o+="for "+n.Duration+" nights",'<small>from<\/small> <span class="c-base">'+athena.CurrencySymbol(c)+athena.Round(t,2).toFixed()+"<\/span><br /><small>"+o+"<\/small>"):""}return""}return!1};u.productFromPrice=function(n){var v,o,l,a;if(n!=null){if(n=ko.toJS(n),!athena.isEmpty(n.GuidePrice))return caboodle.FormatPrice(athena.isEmpty(n.GuidePriceCurrencyCode)?"GBP":n.GuidePriceCurrencyCode,n.GuidePrice);if(v=caboodle.ProductFromPrice(n,!0),athena.isEmpty(v)&&(u.travelType()=="Package"||u.travelType()=="Tour")){var c="",t=0,s="";if(n.ComponentDetails!=null&&n.ComponentDetails.length>0)for(o=0;o<n.ComponentDetails.length;o++){var i=null,y=[],p=[],r=ko.utils.arrayFirst(n.Components,function(t){return t.ComponentID==n.ComponentDetails[o].ID});if(r!=null&&(r.TravelType==1||r.TravelType=="Accommodation")&&r.Criteria!=null&&r.Criteria.length>0&&(l=ko.utils.arrayFirst(r.Criteria,function(n){return n.CriteriaType==3}),l!=null&&(y=(l.CriteriaValue+"").split(",")),a=ko.utils.arrayFirst(r.Criteria,function(n){return n.CriteriaType==2}),a!=null&&(p=(a.CriteriaValue+"").split(","))),i=caboodle.ProductCheapestPriceBand(n.ComponentDetails[o],y,p),i!=null&&(athena.isEmpty(c)&&(c=i.CurrencyCode),athena.isEmpty(s))){switch(i.ChargeBy){case 0:case 1:t+=i.Amount*n.Duration;s+="";break;default:t+=i.Amount}switch(i.ChargeOn){case 1:s+="pp"}}}if(n.DealMarkUpType!=null){var f=0,h=athena.isEmpty(n.Duration)?1:n.Duration,w=n.DealMarkUpType,b=n.DealChargeBy,e=n.DealMarkUpAmount;if(w==0)switch(b){case 0:case 1:f=h*e;break;case 2:f=(h/7+1)*e;break;case 4:f=e}else if(w==1)switch(adjustmentChargeBy){case 0:case 1:f=t/100*e*h;break;case 2:f=t/100*e*(h/7+1);break;case 4:f=t/100*e}t+=f}return t>0?caboodle.FormatPrice(c,t)+s:""}return""}return!1};u.featuresList=function(n){var i="",t=n,r;return t!=null&&(u.travelType()=="Package"&&t.ComponentDetails!=null&&t.ComponentDetails.length>0&&(r=ko.utils.arrayFirst(t.ComponentDetails,function(n){return n.TravelType=="Accommodation"||n.TravelType==1}),r!=null&&(i=athena.ListifyContent(caboodle.GetProductContent("Features",r.Articles)))),athena.isEmpty(i)&&(i=athena.ListifyContent(caboodle.GetProductContent("Features",t.Articles)))),i};u.hasPricingBands=function(n){var t,i,r;if(n!=null){if(n=ko.toJS(n),!athena.isEmpty(n.GuidePrice))return!0;if(t=caboodle.HasProductGotPricingBands(n),!t&&(u.travelType()=="Package"||u.travelType()=="Tour")&&(i=[],n.ComponentDetails!=null&&n.ComponentDetails.length>0)){for(r=0;r<n.ComponentDetails.length;r++)i.push(caboodle.HasProductGotPricingBands(n.ComponentDetails[r]));$.inArray(!1,i)&&i.length==n.ComponentDetails.length&&(t=!0)}return t}return!1};u.toggleWishlist=function(n){u.isFavourited(n.ID)?u.removeFromWishList(n):u.addToWishList(n)};u.removeFromWishList=function(n){$.ajax(athena.BuildAjaxCommand(u.code(),u.identifier(),"removeFromWishlist")+"&ProductCode="+n.ID,{method:"GET",success:function(t){t.Success?t.Result!=null&&t.Result.Removed==!0?u.favouritedItems.remove(n.ID):alertify.alert("The item could not be removed from your wish list"):alertify.alert("The item could not be removed from your wish list")},error:function(){alertify.alert("The item could not be removed from your wish list")}})};u.addToWishList=function(n){$.ajax(athena.BuildAjaxCommand(u.code(),u.identifier(),"addToWishlist"),{method:"POST",data:ko.toJSON(n),contentType:"application/json",success:function(t){t.Success?t.Result!=null&&t.Result.Added==!0?u.favouritedItems.push(n.ID):alertify.alert("The item could not be added to your wish list"):alertify.alert("The item could not be added to your wish list")},error:function(){alertify.alert("The item could not be added to your wish list")}})};u.getLocationDescription=function(n){var r="",t=ko.toJS(n),i;return t!=null&&(u.travelType()=="Package"&&t.ComponentDetails!=null&&t.ComponentDetails.length>0&&(i=ko.utils.arrayFirst(t.ComponentDetails,function(n){return n.TravelType=="Accommodation"||n.TravelType==1}),i==null||athena.isEmpty(i.LocationDescription)||(r=i.Name+", "+i.LocationDescription)),athena.isEmpty(r)&&t.Location!=null&&(r=t.Location.Description)),r};u.imageUrls=function(n){var t=[],i=caboodle.GetProductMediaFailSafe([41,40,39,13],n.Media),r,u;if(i!=null&&i.length>0)for(r=0;r<i.length;r++)u=caboodle.ProductImageUrlSize(i[r].Url),t.push(u);return athena.isEmpty(t)&&t.push("http://via.placeholder.com/350x175?text=Placeholder"),t};u.load=function(){$.ajax(athena.BuildAjaxCommand(u.code(),u.identifier(),"load"),{beforeSend:function(){setTimeout(function(){u.status()!=u.LOADINGSTATUS.Loaded&&u.status(u.LOADINGSTATUS.Loading)},800)},complete:function(){u.status(u.LOADINGSTATUS.Loaded)},contentType:"application/json",success:function(n){if(n.Success)if(n.Result!=null){if(u.status(u.LOADINGSTATUS.Loaded),n.Result.Items!=null&&n.Result.Items.length>0)for(var t=0;t<n.Result.Items.length;t++)n.Result.Items[t]._showAdvancedInfo=ko.observable(!1);u.results(n.Result.Items);u.maxItems(n.Result.TotalCount)}else u.status(u.LOADINGSTATUS.Error),u.message("No results could be found");else u.status(u.LOADINGSTATUS.Error),u.message("The results could not be loaded")},error:function(){u.status(u.LOADINGSTATUS.Error);u.message("The results could not be loaded")}})};ko.applyBindings(u,document.getElementById(i));u.load()}function ApolloRailandAccommodationSearch(n,t,i,r){var u,e,h,c;if(r==null&&(r={}),u=this,u.code=ko.observable(n),u.identifier=ko.observable(t),u.elementId=ko.observable(i),u.channelName=ko.observable("AttractionAccommodation"),u.channel=postal.channel(u.channelName()),u.expanded=ko.observable(r.Expanded===!1?!1:!0),u.resultsPage=ko.observable(r.NextUrl||"#"),u.searchMessage=ko.observable(r.SearchMessage||"We're searching for the best price for your train and hotel together"),u.showMoreAnchor=ko.observable(r.ShowMoreAnchor),u.showWidget=ko.observable(r.VisibleOnStartup!=null?r.VisibleOnStartup:!0),u.maxRooms=ko.observable(r.MaxRooms||9),u.canHide=ko.observable(!u.showWidget()),u.toLocationLabel=ko.observable(r.ToLocationLabel||"Where do you want to go?"),u.fromStationLabel=ko.observable(r.FromStationLabel||"Where are you coming from?"),u.defaultLocation=ko.observable(r.DefaultLocation||""),u.defaultDaysAhead=ko.observable(1),u.defaultMaxRooms=ko.observable(3),u.numNights=ko.observable(r.Duration||1),u.numNights.subscribe(function(n){n!=null&&u.trainReturnDate(u.trainDepartureDate().clone().add(n,"days"))}),u.locations=ko.observable(r.Locations),u.showInfants=ko.observable(r.ShowInfants!=null?r.ShowInfants:!0),u.locationName=ko.observable(r.LocationName||null),u.locationId=ko.observable(athena.GetUrlParameter("location")||null),u.locationContext=ko.observable(r.LocationContext||"ResortCode"),u.destination=ko.observable(),u.destination.subscribe(function(n){n!=null&&(u.locationName(n.Name),u.locationId(n.ID))}),u.earliestDate=ko.observable(r.EarliestDate?moment.utc(r.EarliestDate,"YYYYMMDD[T]HH:mm:ss"):moment.utc().add(u.defaultDaysAhead()+1,"day")),u.fromDate=ko.observable(r.DateFrom?moment.utc(r.DateFrom,"YYYYMMDD[T]HH:mm:ss"):moment.utc().add(u.defaultDaysAhead()+1,"day")),u.fromDate.subscribe(function(n){n!=null&&u.trainDepartureDate(n.clone())}),u.selectedRail=ko.observable(),u.numAdults=ko.observable(athena.isEmpty(athena.GetUrlParameter("numAdults"))?r.Corporate===!0?r.Customers.length:2:athena.GetUrlParameter("numAdults")),u.numChildren=ko.observable(athena.isEmpty(athena.GetUrlParameter("numChildren"))?0:athena.GetUrlParameter("numChildren")),u.numInfants=ko.observable(athena.isEmpty(athena.GetUrlParameter("numInfants"))?0:athena.GetUrlParameter("numInfants")),u.trainDepartureDate=ko.observable(moment.utc().add(u.defaultDaysAhead(),"days")),u.trainDepartureDateChoice=ko.observable(0),u.trainDepartureTimeHours=ko.observable(8),u.trainDepartureTimeMins=ko.observable(0),u.trainReturnDate=ko.observable(moment.utc().add(u.defaultDaysAhead()+1,"days")),u.trainReturnDateChoice=ko.observable(0),u.trainReturnTimeHours=ko.observable(17),u.trainReturnTimeMins=ko.observable(0),u.trainDeparture=ko.observable(),u.trainDestination=ko.observable(),u.trainMode=ko.observable("return"),!athena.isEmpty(athena.GetUrlParameter("journeys"))){var o="return",s=athena.GetUrlParameter("journeys").split("|"),f=s[0].split("-");u.trainDepartureDate(moment(f[2]));u.trainDepartureTimeHours(u.trainDepartureDate().hours());u.trainDepartureTimeMins(u.trainDepartureDate().minutes());u.trainDepartureDateChoice(f[3]);s.length==2?(e=s[1].split("-"),moment(e[2]).isAfter(moment("00010101T1200"))?(u.trainReturnDate(moment(e[2])),u.trainReturnTimeHours(u.trainReturnDate().hours()),u.trainReturnTimeMins(u.trainReturnDate().minutes()),u.trainReturnDateChoice(e[3])):o="openreturn"):o="single";athena.isEmpty(athena.GetUrlParameter("stations"))||(h=athena.GetUrlParameter("stations").split("|"),u.trainDeparture({Code:f[0],Title:h[0]}),u.trainDestination({Code:f[1],Title:h[1]}));u.trainMode(o)}u.trainRailcards=ko.observableArray([""]);athena.isEmpty(athena.GetUrlParameter("railcards"))||u.trainRailcards(athena.GetUrlParameter("railcards").split("|"));u.trainDepartureDate.subscribe(function(n){n!=null&&u.trainReturnDate(n.clone().add(u.numNights(),"days"))});u.matchStationsUrl=function(){return athena.BuildAjaxCommand(u.code(),u.identifier(),"station")};u.matchLocationUrl=function(){return athena.BuildAjaxCommand(u.code(),u.identifier(),"location")};u._searchSuggestion=function(n){var t="<h6>"+n.Title;return t+="<br />",t+='<i class="fa fa-train"><\/i>',t+="<small>"+n.Subtitle+"<\/small>",t+"<\/h6>"};u.rooms=ko.observableArray([]);u.numRooms=ko.computed(function(){return u.rooms()!=null?u.rooms().length:0});u.removeRoom=function(n){u.rooms.remove(n)};u.starRatings=ko.observableArray([1,2,3,4,5]);u.toggleAdvancedOptionsDisplay=function(){u.showAdvancedOptions()?u.showAdvancedOptions(!1):u.showAdvancedOptions(!0)};u.createRoom=function(n,t,i,r){var u;if(n=n||0,t=t||0,i=i||0,r=r||[],r.length==0&&t+i>0){if(t>0)for(u=0;u<t;u++)r.push(8);if(i>0)for(u=0;u<i;u++)r.push(1)}return{NumAdults:ko.observable(n),NumChildren:ko.observable(t),NumInfants:ko.observable(i),ChildAges:ko.observableArray(r)}};u.search=function(){var t=[],i,r,n,o,s,f,l,a;if(u.rooms().length<=0&&t.push("At least one room must be selected"),u.trainDeparture()==null&&t.push("Please select your origin station from the 'Where are you coming from ?' list below."),u.locationId()==null&&t.push("You must select where you want to go"),t.length>0){i="Please check the following before proceeding...:<br />";i+=t.join("<br />");alertify.alert(i);return}athena.StartLoader(u.searchMessage());r=[];u.numAdults(0);u.numChildren(0);u.numInfants(0);for(n of u.rooms())o=n.ChildAges().length==0?"":n.ChildAges().join(","),r.push(n.NumAdults()+"-"+n.NumChildren()+"-"+n.NumInfants()+"-"+o),u.numAdults(u.numAdults()+parseInt(n.NumAdults())),u.numChildren(u.numChildren()+parseInt(n.NumChildren())),u.numInfants(u.numInfants()+parseInt(n.NumInfants()));s=r.join("|");f=ko.utils.arrayFirst(u.locations(),function(n){return n.LocationID==u.locationId()});u.numAdults()==0&&u.numAdults(1);var e=[],v=u.trainDeparture().Title,h=u.trainDeparture().Code,y=f.RailStationName,c=f.RailStationCode;e.push(h+"-"+c+"-"+u.trainDepartureDate().format("YYYYMMDD")+"T0930-0");e.push(c+"-"+h+"-"+u.trainReturnDate().format("YYYYMMDD")+"T1430-0");l=e.join("|");a=athena.AppendQuery(u.resultsPage(),"type=rail&dateFrom="+u.fromDate().format("YYYYMMDD")+"&nights="+u.numNights()+"&rooms="+s+"&numAdults="+u.numAdults()+"&numChildren="+u.numChildren()+"&numInfants="+u.numInfants()+"&location="+u.locationId()+"&locationName="+u.locationName()+"&railcards=&journeys="+l+"&stations="+v+"|"+y);window.location=a};u.setRoomChildAges=function(n){var i=parseInt(n.NumChildren())+parseInt(n.NumInfants()),r=n.ChildAges().length,t;if(i!=r)if(i>r)for(t=0;t<i-r;t++)n.ChildAges.push(8);else for(t=r;t>i;t--)n.ChildAges.pop()};u.setup=function(){var i=[],f,n,t;if(r.Rooms!=null&&r.Rooms.length>0){f=r.Rooms||[];for(n of f)i.push(u.createRoom(n.NumAdults,n.NumChildren,n.NumInfants,n.ChildAges))}else i.push(u.createRoom(2,0,0));u.rooms(i);u.channel.publish("dates.loaded",{});athena.isEmpty(u.defaultLocation())||u.locations()==null||(t=ko.utils.arrayFirst(u.locations(),function(n){return n.Name==u.defaultLocation()}),t!=null&&(u.locationId(t.LocationID),u.locationName(t.Name)))};ko.applyBindings(u,document.getElementById(i));u.setup();c=u.channel.subscribe("dates.show",function(){u.showWidget(!0);$("html, body").animate({scrollTop:$("#combo-dates-anchor").offset().top-150},"slow")})}function ApolloAttractionandAccommodationSearch(n,t,i,r){r==null&&(r={});var u=this;u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.resultsPage=ko.observable(r.NextUrl||"#");u.detailsPage=ko.observable(r.DetailsUrl||"#");u.selectedAttraction=ko.observable();u.expanded=ko.observable(r.Expanded===!1?!1:!0);u.searchType=ko.observable("item");u.attractions=ko.observableArray(r.Attractions||{});u.numTickets=ko.observable(2);u.ticketType=ko.observable(r.TicketType||"Performance");u.ticketLabel=ko.observable(u.ticketType()=="Performance"?"Show":u.ticketType());u.searchByDateMessage=ko.observable(r.SearchByDateMessage||"Finding attractions");u.searchByAttractionMessage=ko.observable(r.SearchByAttractionMessage||"Finding available dates");u.autoSelectRail=ko.observable(r.AutoSelectRail!=null?r.AutoSelectRail:!1);u.maxRooms=ko.observable(r.MaxRooms||9);u.ticketDate=ko.observable(r.DateFrom?moment.utc(r.DateFrom,"YYYYMMDD[T]HH:mm:ss"):moment.utc().add(u.defaultDaysAhead(),"day"));u.attractionChanged=function(){u.search()};u.search=function(){var f,t,n,i,r,e;u.searchType()=="date"?athena.StartLoader(u.searchByDateMessage()):athena.StartLoader(u.searchByAttractionMessage());f=u.numTickets()+"-0-0";t=u.detailsPage();u.searchType()=="date"&&(t=u.resultsPage());n=u.selectedAttraction()==null?"":u.selectedAttraction();i="";n!=""&&(i=ko.utils.arrayFirst(u.attractions(),function(t){return t.ID==n}).Code.replace(caboodle.PROVIDERS.Ingresso+"_",""));r="";u.autoSelectRail()&&(r="&autoSelectRail=true");e=athena.AppendQuery(t,"type="+u.ticketType()+"&ProductCode="+n+"&ComponentCode="+i+"&date="+u.ticketDate().format("YYYYMMDD")+"&tickets="+u.numTickets()+"&dateFrom="+u.ticketDate().format("YYYYMMDD")+"&nights=1&rooms="+f+r);window.location=e};u.setup=function(){};ko.applyBindings(u,document.getElementById(i));u.setup()}function ApolloSearchBox(n,t,i,r){r==null&&(r={});var u=this;u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.channelName=ko.observable("Search");u.channel=postal.channel(u.channelName());u.searchBoxLabel=ko.observable(r.SearchText||"Where do you want to go?");u.dateRangeText=ko.observable(r.DateRangeText||"When (Month)");u.showDates=ko.observable(r.ShowDates||!1);u.defaultDaysAhead=ko.observable(r.DefaultDaysAhead||3);u.defaultDays=ko.observable(r.DefaultDays||3);u.packageURL=ko.observable(r.PackageURL);u.searchResultsUrl=ko.observable(r.SearchResultsUrl);u.currentUrl=ko.observable(window.location.pathname);u.searchQuery=ko.observable();u.searchText=ko.observable();u.filters=ko.observableArray([]);u.attributes=ko.observableArray([]);u.priceRanges=ko.observableArray([]);u.priceStats=ko.observableArray([]);u.position=ko.observable("");u.locationType=ko.observable("");u.showFilters=ko.observable(!1);u.showMonths=ko.observable(!0);u.isSetup=ko.observable(!1);u.selectedFilters=ko.observableArray([]);u.availableMonths=ko.observableArray([]);u.selectedMonth=ko.observable();u.geoLatitude=ko.observable();u.geoLongitude=ko.observable();u.geoError=ko.observable();u.geoSearching=ko.observable(!1);u.datesLiveSearchHandler=function(){u._dateSearch()};u.checkInDate=athena.isEmpty(athena.GetUrlParameter("from"))?ko.observable(moment.utc().add(u.defaultDaysAhead(),"day")):ko.observable(new moment.utc(athena.GetUrlParameter("from")));u.checkOutDate=athena.isEmpty(athena.GetUrlParameter("from"))?ko.observable(moment.utc().add(u.defaultDaysAhead()+u.defaultDays(),"day")):ko.observable(new moment.utc(athena.GetUrlParameter("to")));u.dateFormat=r.DateFormat;u.searchInputId=ko.observable(u.identifier()+"_SearchBox");u.searchBoxFocusLabel=ko.observable("Start typing...");u.selectedTypeaheadText=ko.observable();u.selectedTypeaheadOption=ko.observable();u.typeaheadUrl=ko.computed(function(){return console.log(athena.BuildAjaxCommand(u.code(),u.identifier(),"typeahead")+"&geolat="+u.geoLatitude()+"&geolong="+u.geoLongitude()),athena.BuildAjaxCommand(u.code(),u.identifier(),"typeahead")+"&geolat="+u.geoLatitude()+"&geolong="+u.geoLongitude()});u.typeaheadLocationUrl=ko.computed(function(){return console.log(athena.BuildAjaxCommand(u.code(),u.identifier(),"typeahead")+"&geolat="+u.geoLatitude()+"&geolong="+u.geoLongitude()),athena.BuildAjaxCommand(u.code(),u.identifier(),"typeaheadlocation")+"&geolat="+u.geoLatitude()+"&geolong="+u.geoLongitude()});u.typeaheadSuggestion=function(n){var t="";if(n!=null)switch(n.DataType){case"NearMe":t+='<div class="row"><div class="col-xs-1 hidden-sm hidden-xs"><i class="fa fa-map-marker" aria-hidden="true"><\/i><\/div>';t+='<div class="col-xs-8 hidden-sm hidden-xs"><b><i>Near Me<\/i><\/b> - '+n.Title+"<\/div>";t+='<div class="col-xs-12 visible-sm visible-xs"><b><i>Near Me<\/i><\/b> - '+n.Title+"<\/div>";t+='<div class="col-xs-3 hidden-sm hidden-xs"><\/div><\/div>';break;case"Anywhere":t+='<div class="row"><div class="col-xs-1 hidden-sm hidden-xs"><i class="fa fa-map-marker" aria-hidden="true"><\/i><\/div>';t+='<div class="col-xs-8 hidden-sm hidden-xs"><b>Anywhere<\/b><\/div>';t+='<div class="col-xs-12 visible-sm visible-xs"><b>Anywhere<\/b><\/div>';t+='<div class="col-xs-3 hidden-sm hidden-xs"><\/div><\/div>';break;case"Location":t+='<div class="row"><div class="col-xs-1 hidden-sm hidden-xs"><i class="fa fa-map-marker" aria-hidden="true"><\/i><\/div>';t+='<div class="col-xs-8 hidden-sm hidden-xs"><b>'+n.Title+"<\/b><\/div>";t+='<div class="col-xs-12 visible-sm visible-xs"><b>'+n.Title+"<\/b><\/div>";t+='<div class="col-xs-3 hidden-sm hidden-xs"><\/div><\/div>';break;default:t='<div class="row"><div class="col-xs-1 hidden-sm hidden-xs"><i class="fa fa-suitcase" aria-hidden="true"><\/i><\/div>';t+='<div class="col-xs-8 hidden-sm hidden-xs"><b>'+n.Title+"<\/b><br />"+n.Summary+"<\/div>";t+='<div class="col-xs-12 visible-sm visible-xs"><b>'+n.Title+"<\/b><br />"+n.Summary+"<\/div>";t+=n.Thumbnails!=null&&n.Thumbnails.length>0?'<div class="col-xs-3 hidden-sm hidden-xs"><img width="100" height="65" src="'+n.Thumbnails[0]+'" /><\/div><\/div>':'<div class="col-xs-3 hidden-sm hidden-xs"><\/div><\/div>'}return t};u.getCurrentPosition=function(){navigator.geolocation?navigator.geolocation.getCurrentPosition(u.showPosition,u.showError):(u.geoError("The Browser Does not Support Geolocation"),alertify.alert("Unable to access your current location. Please try a different search."),u.geoSearching(!1))};u.showPosition=function(n){u.geoLatitude(n.coords.latitude);u.geoLongitude(n.coords.longitude);u.geoSearching()&&(u.position(u.geoLatitude()+","+u.geoLongitude()),u._search(),u.geoSearching(!1))};u.showError=function(n){n.PERMISSION_DENIED&&(u.geoError("The User has denied the request for Geolocation."),alertify.alert("Cannot perform a Near Me search as the request for your location was denied."),u.geoSearching(!1))};u.buildMonths=function(){for(var f=["January","February","March","April","May","June","July","August","September","October","November","December"],i=new Date,n=i.getMonth(),t=i.getFullYear(),r=0;r<12;r++)u.availableMonths.push({Value:t+"-"+(n+1).toString().padStart(2,"0")+"-01",Text:f[n]+" "+t}),n++,n>11&&(n=0,t++)};u.replaceURLFields=function(n,t){return n=n.replace("{Code}",t.Code),n=n.replace("{Id}",t.Id),n.replace("{Title}",athena.CreateFriendlySlug(t.Title))};u.getLocationType=function(n){var t="",i;return n.includes("Type:")&&(i=n.indexOf("Type:")+5,t=n.substring(i,n.indexOf(",",i))),console.log("type = "+t),t};u._monthSearch=function(){u._search()};u._dateSearch=function(){u._search()};u._textSearch=function(){u.position("");typeof u.searchQuery()=="object"?u.searchText(u.searchQuery().Title):u.searchText(u.searchQuery());u._search()};u._search=function(){var n,t;if(athena.isEmpty(u.searchResultsUrl())||u.searchResultsUrl()==u.currentUrl()){if(u.isSetup()){u.channel.publish("search.reset",{});u.channel.publish("search.resetlocation",{});u.selectedFilters([]);t=u.searchText();t=="Anywhere"&&(t="",u.locationType("Anywhere"));var i="",r="",f="";u.showMonths()?f=u.selectedMonth():(i=u.checkInDate().format("YYYY-MM-DD"),r=u.checkOutDate().format("YYYY-MM-DD"));u.channel.publish("search.filters.clear",{});u.channel.publish("search.request",{Text:t,LatLng:u.position(),Filters:"",Attributes:"",Month:f,DateFrom:i,DateTo:r,LocationType:u.locationType()})}}else n=athena.AppendQuery(u.searchResultsUrl(),"search=true"),athena.isEmpty(u.searchText())||(n+="&q="+encodeURIComponent(u.searchText())),athena.isEmpty(u.position())||(n+="&pos="+encodeURIComponent(u.position()),n+=typeof u.searchQuery()=="object"?"&loc="+encodeURIComponent(u.searchQuery().Title):"&loc="+encodeURIComponent(u.searchQuery()),u.locationType()=="Region"&&(n+="&hd=true")),athena.isEmpty(u.selectedMonth())||(n+="&month="+encodeURIComponent(u.selectedMonth())),u.showMonths()||(n+="&from="+encodeURIComponent(u.checkInDate().format("YYYY-MM-DD"))),u.showMonths()||(n+="&to="+encodeURIComponent(u.checkOutDate().format("YYYY-MM-DD"))),window.location=n};u._selectSearchOption=function(n){if(u.searchText(""),u.channel.publish("search.reset",{}),n!=null)switch(n.DataType){case"NearMe":u.geoSearching(!0);u.getCurrentPosition();break;case"Anywhere":u.searchQuery("");u.searchText("");u.position("");u._search();break;case"Location":u.position(n.LatLng);u.locationType(u.getLocationType(n.Tags));u._search();break;default:var t=u.replaceURLFields(u.packageURL(),n);window.open(t,"_blank");return}};u.searchBoxFocus=function(n,t){t.target.placeholder=u.searchBoxFocusLabel()};u.searchBoxBlur=function(n,t){t.target.placeholder="Anywhere..."};u.setup=function(){u.buildMonths();athena.isEmpty(athena.GetUrlParameter("search"))?u.isSetup(!0):(athena.isEmpty(athena.GetUrlParameter("q"))||(u.searchQuery(decodeURIComponent(athena.GetUrlParameter("q"))),u.searchText(u.searchQuery())),athena.isEmpty(athena.GetUrlParameter("pos"))||(u.position(decodeURIComponent(athena.GetUrlParameter("pos"))),u.searchQuery(decodeURIComponent(athena.GetUrlParameter("loc")))),athena.isEmpty(athena.GetUrlParameter("hd"))||athena.GetUrlParameter("hd")=="true"&&u.locationType("Region"),u.selectedMonth(athena.GetUrlParameter("month")),athena.isEmpty(athena.GetUrlParameter("from"))||u.showMonths(!1),u.isSetup(!0),u._search())};ko.applyBindings(u,document.getElementById(i));u.setup()}function ApolloDistributorOffers(n,t,i,r){r==null&&(r={});var u=this;u.LOADINGSTATUS={NA:0,Loading:1,Loaded:2,Error:3};u.OFFERTYPE={All:"ALL",Component:"COMPONENT",Custom:"CUSTOM"};u.code=ko.observable(n);u.identifier=ko.observable(t);u.elementId=ko.observable(i);u.status=ko.observable(u.LOADINGSTATUS.Loaded);u.distributor=ko.observable(r.Distributor||null);u.distributorOffers=ko.observable(r.DistributorOffers||[]);u.offerType=ko.observable(r.OfferType||u.OFFERTYPE.ALL);u.offerTravelTypes=ko.observable(r.OfferTravelTypes||[]);u.contentHeaders=ko.observable(r.ContentHeaders||"");u.mediaCategory=ko.observable(r.MediaCategories||[38,41,13]);u.carouselInterval=ko.observable(r.CarouselInterval==-1?"false":r.CarouselInterval*1e3);u.componentNextUrl=function(n){var t=athena.GetEnumDisplay(caboodle.TRAVELTYPE,n).toUpperCase();switch(t){default:nextUrl="";break;case"PACKAGE":nextUrl=r.PackageNextUrl;break;case"TOUR":nextUrl=r.TourNextUrl;break;case"ACCOMMODATION":nextUrl=r.AccommodationNextUrl;break;case"ATTRACTION":nextUrl=r.AttractionNextUrl;break;case"PRODUCT":nextUrl=r.ProductNextUrl;break;case"CYCLEHIRE":nextUrl=r.CycleHireNextUrl;break;case"RAIL":nextUrl=r.RailNextUrl}return nextUrl};u._generateUrl=function(n){return n.Component!=null&&n.ComponentTravelType!=null?athena.CompileUrl(u.componentNextUrl(n.ComponentTravelType),{ProductCode:n.Component.Code,Name:n.Component.Name,ProductID:n.Component.ID},null,{ProductID:"ProductCode"}):null};u.getCssClasses=function(n){var t=[];return n.Component==null?t.push("offer-custom"):(t.push("offer-component"),t.push("type-"+athena.GetEnumDisplay(caboodle.TRAVELTYPE,n.ComponentTravelType).replaceAll(" ","-").toLowerCase())),t.push("order-"+n.Order),t.join(" ")};u.processedDistributorOffers=ko.pureComputed(function(){for(var n,f,t=[],r=u.distributorOffers(),i=0;i<r.length;i++)n=r[i],n.Articles!=null&&(n._backgroundImageLink=caboodle.GetProductContent("_BackgroundImageLink",n.Articles,null)),u.offerType()==u.OFFERTYPE.All?t.push(n):u.offerType()==u.OFFERTYPE.Component&&n.ComponentID!=null?athena.isEmpty(u.offerTravelTypes())?t.push(n):(f=athena.GetEnumDisplay(caboodle.TRAVELTYPE,n.ComponentTravelType).toUpperCase(),u.offerTravelTypes().indexOf(f)>-1&&t.push(n)):u.offerType()==u.OFFERTYPE.Custom&&n.ComponentID==null&&t.push(n);return t});u.getMedia=function(n){if(n!=null){if(n.Media!=null&&n.Media.length>0)return n.Media[0].Url;if(n.Component!=null&&!athena.isEmpty(u.mediaCategory())){if(n.Component.Media!=null&&n.Component.Media.length>0)return caboodle.GetProductMainImage(u.mediaCategory(),n.Component.Media);if(n.Component.ComponentDetails!=null&&n.Component.ComponentDetails.length>0){var t=null;return $.each(n.Component.ComponentDetails,function(n,i){return t=caboodle.GetProductMainImage(u.mediaCategory(),i.Media),athena.isEmpty(t)?void 0:!1}),t}}}return null};u.getDescription=function(n){var t=null,i;return n!=null&&(!athena.isEmpty(u.contentHeaders())&&n.Component!=null&&n.Component.Articles!=null&&n.Component.Articles.length>0?(i=caboodle.GetSearchTagValue(u.contentHeaders(),athena.GetEnumDisplay(caboodle.TRAVELTYPE,n.ComponentTravelType)),athena.isEmpty(i)||(t=caboodle.GetProductContent(i,n.Component.Articles))):t=n.Description),t};u.productFromPrice=function(n,t){var v,o,l,a;if(n!=null){if(t=athena.GetEnumDisplay(caboodle.TRAVELTYPE,t),n=ko.toJS(n),!athena.isEmpty(n.GuidePrice))return caboodle.FormatPrice(athena.isEmpty(n.GuidePriceCurrencyCode)?"GBP":n.GuidePriceCurrencyCode,n.GuidePrice);if(v=caboodle.ProductFromPrice(n,!0),athena.isEmpty(v)&&(t=="PACKAGE"||t=="TOUR")){var c="",i=0,s="";if(n.ComponentDetails!=null&&n.ComponentDetails.length>0)for(o=0;o<n.ComponentDetails.length;o++){var r=null,y=[],p=[],u=ko.utils.arrayFirst(n.Components,function(t){return t.ComponentID==n.ComponentDetails[o].ID});if(u!=null&&(u.TravelType==1||u.TravelType=="ACCOMMODATION")&&u.Criteria!=null&&u.Criteria.length>0&&(l=ko.utils.arrayFirst(u.Criteria,function(n){return n.CriteriaType==3}),l!=null&&(y=(l.CriteriaValue+"").split(",")),a=ko.utils.arrayFirst(u.Criteria,function(n){return n.CriteriaType==2}),a!=null&&(p=(a.CriteriaValue+"").split(","))),r=caboodle.ProductCheapestPriceBand(n.ComponentDetails[o],y,p),r!=null&&(athena.isEmpty(c)&&(c=r.CurrencyCode),athena.isEmpty(s))){switch(r.ChargeBy){case 0:case 1:i+=r.Amount*n.Duration;s+="";break;default:i+=r.Amount}switch(r.ChargeOn){case 1:s+="pp"}}}if(n.DealMarkUpType!=null){var f=0,h=athena.isEmpty(n.Duration)?1:n.Duration,w=n.DealMarkUpType,b=n.DealChargeBy,e=n.DealMarkUpAmount;if(w==0)switch(b){case 0:case 1:f=h*e;break;case 2:f=(h/7+1)*e;break;case 4:f=e}else if(w==1)switch(adjustmentChargeBy){case 0:case 1:f=i/100*e*h;break;case 2:f=i/100*e*(h/7+1);break;case 4:f=i/100*e}i+=f}return i>0?caboodle.FormatPrice(c,i)+s:""}return""}return!1};u.hasPricingBands=function(n,t){var i,r,u;if(n!=null){if(t=athena.GetEnumDisplay(caboodle.TRAVELTYPE,t),n=ko.toJS(n),!athena.isEmpty(n.GuidePrice))return!0;if(i=caboodle.HasProductGotPricingBands(n),!i&&(t=="PACKAGE"||t=="TOUR")&&(r=[],n.ComponentDetails!=null&&n.ComponentDetails.length>0)){for(u=0;u<n.ComponentDetails.length;u++)r.push(caboodle.HasProductGotPricingBands(n.ComponentDetails[u]));$.inArray(!1,r)&&r.length==n.ComponentDetails.length&&(i=!0)}return i}return!1};ko.applyBindings(u,document.getElementById(i))}(function(n){typeof define=="function"&&define.amd&&define.amd.jQuery?define(["jquery"],n):typeof module!="undefined"&&module.exports?n(require("jquery")):n(jQuery)})(function(n){"use strict";function ft(t){return t&&t.allowPageScroll===undefined&&(t.swipe!==undefined||t.swipeStatus!==undefined)&&(t.allowPageScroll=o),t.click!==undefined&&t.tap===undefined&&(t.tap=t.click),t||(t={}),t=n.extend({},n.fn.swipe.defaults,t),this.each(function(){var r=n(this),i=r.data(c);i||(i=new et(this,t),r.data(c,i))})}function et(ft,et){function tr(t){var r,f,u,e;if(!pu())return n(t.target).closest(et.excludedElements,ot).length>0?void 0:(r=t.originalEvent?t.originalEvent:t,r.pointerType&&r.pointerType=="mouse"&&et.fallbackToMouseEvents==!1)?void 0:(u=r.touches,e=u?u[0]:r,st=rt,u?ct=u.length:et.preventDefaultEvents!==!1&&t.preventDefault(),at=0,vt=null,yt=null,kt=null,lt=0,dt=0,gt=0,pt=1,bt=0,ci=ku(),dr(),wi(0,e),!u||ct===et.fingers||et.fingers===a||vi()?(gi=ti(),ct==2&&(wi(1,u[1]),dt=gt=hr(ht[0].start,ht[1].start)),(et.swipeStatus||et.pinchStatus)&&(f=wt(r,st))):f=!1,f===!1)?(st=i,wt(r,st),f):(et.hold&&(ei=setTimeout(n.proxy(function(){ot.trigger("hold",[r.target]);et.hold&&(f=et.hold.call(ot,r,r.target))},this),et.longTapThreshold)),pi(!0),null)}function ir(n){var f=n.originalEvent?n.originalEvent:n,e,h;if(st!==t&&st!==i&&!yi()){var o,r=f.touches,c=r?r[0]:f,u=gr(c);li=ti();r&&(ct=r.length);et.hold&&clearTimeout(ei);st=s;ct==2&&(dt==0?(wi(1,r[1]),dt=gt=hr(ht[0].start,ht[1].start)):(gr(r[1]),gt=hr(ht[0].end,ht[1].end),kt=gu(ht[0].end,ht[1].end)),pt=du(dt,gt),bt=Math.abs(dt-gt));ct===et.fingers||et.fingers===a||!r||vi()?(vt=iu(u.start,u.end),yt=iu(u.last,u.end),uu(n,yt),at=nf(u.start,u.end),lt=tu(),bu(vt,at),o=wt(f,st),(!et.triggerOnTouchEnd||et.triggerOnTouchLeave)&&(e=!0,et.triggerOnTouchLeave&&(h=rf(this),e=uf(u.end,h)),!et.triggerOnTouchEnd&&e?st=fr(s):et.triggerOnTouchLeave&&!e&&(st=fr(t)),(st==i||st==t)&&wt(f,st))):(st=i,wt(f,st));o===!1&&(st=i,wt(f,st))}}function rr(n){var r=n.originalEvent?n.originalEvent:n,u=r.touches;if(u){if(u.length&&!yi())return yu(r),!0;if(u.length&&yi())return!0}return yi()&&(ct=nr),li=ti(),lt=tu(),or()||!er()?(st=i,wt(r,st)):et.triggerOnTouchEnd||et.triggerOnTouchEnd===!1&&st===s?(et.preventDefaultEvents!==!1&&n.cancelable!==!1&&n.preventDefault(),st=t,wt(r,st)):!et.triggerOnTouchEnd&&br()?(st=t,ui(r,st,w)):st===s&&(st=i,wt(r,st)),pi(!1),null}function ri(){ct=0;li=0;gi=0;dt=0;gt=0;pt=1;dr();pi(!1)}function ur(n){var i=n.originalEvent?n.originalEvent:n;et.triggerOnTouchLeave&&(st=fr(t),wt(i,st))}function cr(){ot.off(si,tr);ot.off(hi,ri);ot.off(ki,ir);ot.off(di,rr);ii&&ot.off(ii,ur);pi(!1)}function fr(n){var r=n,f=lr(),u=er(),e=or();return!f||e?r=i:u&&n==s&&(!et.triggerOnTouchEnd||et.triggerOnTouchLeave)?r=t:!u&&n==t&&et.triggerOnTouchLeave&&(r=i),r}function wt(n,r){var u,f=n.touches;return(eu()||yr())&&(u=ui(n,r,g)),(fu()||vi())&&u!==!1&&(u=ui(n,r,nt)),au()&&u!==!1?u=ui(n,r,tt):vu()&&u!==!1?u=ui(n,r,it):lu()&&u!==!1&&(u=ui(n,r,w)),r===i&&ri(n),r===t&&(f?f.length||ri(n):ri(n)),u}function ui(o,s,h){var c;if(h==g){if(ot.trigger("swipeStatus",[s,vt||null,at||0,lt||0,ct,ht,yt]),et.swipeStatus&&(c=et.swipeStatus.call(ot,o,s,vt||null,at||0,lt||0,ct,ht,yt),c===!1))return!1;if(s==t&&vr()){if(clearTimeout(fi),clearTimeout(ei),ot.trigger("swipe",[vt,at,lt,ct,ht,yt]),et.swipe&&(c=et.swipe.call(ot,o,vt,at,lt,ct,ht,yt),c===!1))return!1;switch(vt){case r:ot.trigger("swipeLeft",[vt,at,lt,ct,ht,yt]);et.swipeLeft&&(c=et.swipeLeft.call(ot,o,vt,at,lt,ct,ht,yt));break;case u:ot.trigger("swipeRight",[vt,at,lt,ct,ht,yt]);et.swipeRight&&(c=et.swipeRight.call(ot,o,vt,at,lt,ct,ht,yt));break;case f:ot.trigger("swipeUp",[vt,at,lt,ct,ht,yt]);et.swipeUp&&(c=et.swipeUp.call(ot,o,vt,at,lt,ct,ht,yt));break;case e:ot.trigger("swipeDown",[vt,at,lt,ct,ht,yt]);et.swipeDown&&(c=et.swipeDown.call(ot,o,vt,at,lt,ct,ht,yt))}}}if(h==nt){if(ot.trigger("pinchStatus",[s,kt||null,bt||0,lt||0,ct,pt,ht]),et.pinchStatus&&(c=et.pinchStatus.call(ot,o,s,kt||null,bt||0,lt||0,ct,pt,ht),c===!1))return!1;if(s==t&&ar())switch(kt){case y:ot.trigger("pinchIn",[kt||null,bt||0,lt||0,ct,pt,ht]);et.pinchIn&&(c=et.pinchIn.call(ot,o,kt||null,bt||0,lt||0,ct,pt,ht));break;case p:ot.trigger("pinchOut",[kt||null,bt||0,lt||0,ct,pt,ht]);et.pinchOut&&(c=et.pinchOut.call(ot,o,kt||null,bt||0,lt||0,ct,pt,ht))}}return h==w?(s===i||s===t)&&(clearTimeout(fi),clearTimeout(ei),sr()&&!su()?(ni=ti(),fi=setTimeout(n.proxy(function(){ni=null;ot.trigger("tap",[o.target]);et.tap&&(c=et.tap.call(ot,o,o.target))},this),et.doubleTapThreshold)):(ni=null,ot.trigger("tap",[o.target]),et.tap&&(c=et.tap.call(ot,o,o.target)))):h==tt?(s===i||s===t)&&(clearTimeout(fi),clearTimeout(ei),ni=null,ot.trigger("doubletap",[o.target]),et.doubleTap&&(c=et.doubleTap.call(ot,o,o.target))):h==it&&(s===i||s===t)&&(clearTimeout(fi),ni=null,ot.trigger("longtap",[o.target]),et.longTap&&(c=et.longTap.call(ot,o,o.target))),c}function er(){var n=!0;return et.threshold!==null&&(n=at>=et.threshold),n}function or(){var n=!1;return et.cancelThreshold!==null&&vt!==null&&(n=nu(vt)-at>=et.cancelThreshold),n}function ru(){return et.pinchThreshold!==null?bt>=et.pinchThreshold:!0}function lr(){return et.maxTimeThreshold?lt>=et.maxTimeThreshold?!1:!0:!0}function uu(n,t){if(et.preventDefaultEvents!==!1)if(et.allowPageScroll===o)n.preventDefault();else{var i=et.allowPageScroll===d;switch(t){case r:(et.swipeLeft&&i||!i&&et.allowPageScroll!=b)&&n.preventDefault();break;case u:(et.swipeRight&&i||!i&&et.allowPageScroll!=b)&&n.preventDefault();break;case f:(et.swipeUp&&i||!i&&et.allowPageScroll!=k)&&n.preventDefault();break;case e:(et.swipeDown&&i||!i&&et.allowPageScroll!=k)&&n.preventDefault()}}}function ar(){var n=pr(),t=wr(),i=ru();return n&&t&&i}function vi(){return!!(et.pinchStatus||et.pinchIn||et.pinchOut)}function fu(){return!!(ar()&&vi())}function vr(){var n=lr(),t=er(),i=pr(),r=wr(),u=or();return!u&&r&&i&&t&&n}function yr(){return!!(et.swipe||et.swipeStatus||et.swipeLeft||et.swipeRight||et.swipeUp||et.swipeDown)}function eu(){return!!(vr()&&yr())}function pr(){return ct===et.fingers||et.fingers===a||!l}function wr(){return ht[0].end.x!==0}function br(){return!!et.tap}function sr(){return!!et.doubleTap}function ou(){return!!et.longTap}function kr(){if(ni==null)return!1;var n=ti();return sr()&&n-ni<=et.doubleTapThreshold}function su(){return kr()}function hu(){return(ct===1||!l)&&(isNaN(at)||at<et.threshold)}function cu(){return lt>et.longTapThreshold&&at<ut}function lu(){return!!(hu()&&br())}function au(){return!!(kr()&&sr())}function vu(){return!!(cu()&&ou())}function yu(n){ai=ti();nr=n.touches.length+1}function dr(){ai=0;nr=0}function yi(){var n=!1,t;return ai&&(t=ti()-ai,t<=et.fingerReleaseThreshold&&(n=!0)),n}function pu(){return!!(ot.data(c+"_intouch")===!0)}function pi(n){if(ot){if(n===!0){ot.on(ki,ir);ot.on(di,rr);if(ii)ot.on(ii,ur)}else ot.off(ki,ir,!1),ot.off(di,rr,!1),ii&&ot.off(ii,ur,!1);ot.data(c+"_intouch",n===!0)}}function wi(n,t){var i={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return i.start.x=i.last.x=i.end.x=t.pageX||t.clientX,i.start.y=i.last.y=i.end.y=t.pageY||t.clientY,ht[n]=i,i}function gr(n){var i=n.identifier!==undefined?n.identifier:0,t=wu(i);return t===null&&(t=wi(i,n)),t.last.x=t.end.x,t.last.y=t.end.y,t.end.x=n.pageX||n.clientX,t.end.y=n.pageY||n.clientY,t}function wu(n){return ht[n]||null}function bu(n,t){n!=o&&(t=Math.max(t,nu(n)),ci[n].distance=t)}function nu(n){return ci[n]?ci[n].distance:undefined}function ku(){var n={};return n[r]=bi(r),n[u]=bi(u),n[f]=bi(f),n[e]=bi(e),n}function bi(n){return{direction:n,distance:0}}function tu(){return li-gi}function hr(n,t){var i=Math.abs(n.x-t.x),r=Math.abs(n.y-t.y);return Math.round(Math.sqrt(i*i+r*r))}function du(n,t){var i=t/n*1;return i.toFixed(2)}function gu(){return pt<1?p:y}function nf(n,t){return Math.round(Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)))}function tf(n,t){var r=n.x-t.x,u=t.y-n.y,f=Math.atan2(u,r),i=Math.round(f*180/Math.PI);return i<0&&(i=360-Math.abs(i)),i}function iu(n,t){if(ff(n,t))return o;var i=tf(n,t);return i<=45&&i>=0?r:i<=360&&i>=315?r:i>=135&&i<=225?u:i>45&&i<135?e:f}function ti(){var n=new Date;return n.getTime()}function rf(t){t=n(t);var i=t.offset();return{left:i.left,right:i.left+t.outerWidth(),top:i.top,bottom:i.top+t.outerHeight()}}function uf(n,t){return n.x>t.left&&n.x<t.right&&n.y>t.top&&n.y<t.bottom}function ff(n,t){return n.x==t.x&&n.y==t.y}var et=n.extend({},et),oi=l||h||!et.fallbackToMouseEvents,si=oi?h?v?"MSPointerDown":"pointerdown":"touchstart":"mousedown",ki=oi?h?v?"MSPointerMove":"pointermove":"touchmove":"mousemove",di=oi?h?v?"MSPointerUp":"pointerup":"touchend":"mouseup",ii=oi?h?"mouseleave":null:"mouseleave",hi=h?v?"MSPointerCancel":"pointercancel":"touchcancel",at=0,vt=null,yt=null,lt=0,dt=0,gt=0,pt=1,bt=0,kt=0,ci=null,ot=n(ft),st="start",ct=0,ht={},gi=0,li=0,ai=0,nr=0,ni=0,fi=null,ei=null;try{ot.on(si,tr);ot.on(hi,ri)}catch(ef){n.error("events not supported "+si+","+hi+" on jQuery.swipe")}this.enable=function(){this.disable();ot.on(si,tr);ot.on(hi,ri);return ot};this.disable=function(){return cr(),ot};this.destroy=function(){cr();ot.data(c,null);ot=null};this.option=function(t,i){if(typeof t=="object")et=n.extend(et,t);else if(et[t]!==undefined){if(i===undefined)return et[t];et[t]=i}else if(t)n.error("Option "+t+" does not exist on jQuery.swipe.options");else return et;return null}}var r="left",u="right",f="up",e="down",y="in",p="out",o="none",d="auto",g="swipe",nt="pinch",w="tap",tt="doubletap",it="longtap",b="horizontal",k="vertical",a="all",ut=10,rt="start",s="move",t="end",i="cancel",l="ontouchstart"in window,v=window.navigator.msPointerEnabled&&!window.PointerEvent&&!l,h=(window.PointerEvent||window.navigator.msPointerEnabled)&&!l,c="TouchSwipe";n.fn.swipe=function(t){var r=n(this),i=r.data(c);if(i&&typeof t=="string"){if(i[t])return i[t].apply(i,Array.prototype.slice.call(arguments,1));n.error("Method "+t+" does not exist on jQuery.swipe")}else if(i&&typeof t=="object")i.option.apply(i,arguments);else if(!i&&(typeof t=="object"||!t))return ft.apply(this,arguments);return r};n.fn.swipe.version="1.6.18";n.fn.swipe.defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:!0,triggerOnTouchLeave:!1,allowPageScroll:"auto",fallbackToMouseEvents:!0,excludedElements:".noSwipe",preventDefaultEvents:!0};n.fn.swipe.phases={PHASE_START:rt,PHASE_MOVE:s,PHASE_END:t,PHASE_CANCEL:i};n.fn.swipe.directions={LEFT:r,RIGHT:u,UP:f,DOWN:e,IN:y,OUT:p};n.fn.swipe.pageScroll={NONE:o,HORIZONTAL:b,VERTICAL:k,AUTO:d};n.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:a}})