PageSourceSearch

https://www.cityexperiences.com/wp-content/themes/cityExperiences/assets/js/hb_custom_tour.js?ver=1

js cityexperiences.com collected 2026-10-09 23:02:21 UTC 270,265 bytes, 5,542 lines download raw bytes

1var specialWalksURL = [
2	'/niagara/skylon-tower-niagara-power-station-tour/',
3	'/niagara/niagara-falls-evening-tour/',
4	'/niagara/first-on-the-boat-niagara-falls-tour/'
5];
6
7var specialignoreURL = [
8	'/london/superblue-london/',
9	'/london/superblue-london',
10	'/london/superblue-london-botanical-drawing-with-laxmi-hussain/',
11	'/london/superblue-london-botanical-drawing-with-laxmi-hussain',
12	'/london/superblue-london-build-your-own-mp3-with-tigris',
13	'/london/superblue-london-build-your-own-mp3-with-tigris/',
14	'/london/ual-superblue-london-curator-tour',
15	'/london/ual-superblue-london-curator-tour/',
16	'/miami/superblue-miami',
17	'/miami/superblue-miami/',
18	'/miami/superblue-miami-american-express-exclusive',
19	'/miami/superblue-miami-american-express-exclusive/',
20	'/new-york/jean-michel-basquiat-king-pleasure',
21	'/new-york/jean-michel-basquiat-king-pleasure/',
22	'/miami/75-minute-skyline-cruise',
23	'/miami/75-minute-skyline-cruise/',
24	'/miami/commuter-service',
25	'/miami/commuter-service/',
26	'/miami/water-taxi-hop-on-hop-off',
27	'/miami/water-taxi-hop-on-hop-off/',
28	'/miami/weekend-brunch-cruise',
29	'/miami/weekend-brunch-cruise/',
30	'/miami/commuter-books/',
31	'/miami/commuter-books',
32	'/miami/halloween-bash/',
33	'/miami/halloween-bash',
34	'/miami/sailing-with-santa',
35	'/miami/sailing-with-santa/',
36	'/miami/ring-in-the-new-year',
37	'/miami/ring-in-the-new-year/',
38	'/miami/poseidon-private-excursion/',
39	'/miami/poseidon-private-excursion',
40	'/seattle/seattle-dinner-cruise/',
41	'/seattle/seattle-dinner-cruise',
42	'/seattle/weekend-brunch-cruises/',
43	'/seattle/weekend-brunch-cruises',
44	'/seattle/fathers-day-bbq-cruise/',
45	'/seattle/fathers-day-bbq-cruise',
46	'/seattle/fourth-of-july-fireworks-cruise/',
47	'/seattle/fourth-of-july-fireworks-cruise',
48	'/seattle/sunday-supper-cruises/',
49	'/seattle/sunday-supper-cruises',
50	'/washington-dc/georgetown-heritage-canal-boat-tour/',
51	'/washington-dc/georgetown-heritage-canal-boat-tour',
52	'/new-orleans/small-airboat-swamp-adventure-tour/',
53	'/new-orleans/small-airboat-swamp-adventure-tour',
54	'/new-orleans/new-orleans-craft-cocktail-walking-tour/',
55	'/new-orleans/new-orleans-craft-cocktail-walking-tour',
56	'/new-orleans/ghosts-spirits-walking-tour/',
57	'/new-orleans/ghosts-spirits-walking-tour',
58	'/new-orleans/oak-alley-plantation-swamp-tour/',
59	'/new-orleans/oak-alley-plantation-swamp-tour',
60	'/new-orleans/large-airboat-swamp-adventure-tour',
61	'/new-orleans/large-airboat-swamp-adventure-tour/',
62	'/new-orleans/swamp-bayou-tour/',
63	'/new-orleans/swamp-bayou-tour',
64	'/new-orleans/airboat-adventures-self-drive-swamp-tour/',
65	'/new-orleans/airboat-adventures-self-drive-swamp-tour',
66	'/new-orleans/whitney-plantation-tour/',
67	'/new-orleans/whitney-plantation-tour',
68	'/new-orleans/oak-alley-plantation-tour/',
69	'/new-orleans/oak-alley-plantation-tour',
70	'/new-orleans/new-orleans-city-cemetery-tour/',
71	'/new-orleans/new-orleans-city-cemetery-tour',
72	'/new-orleans/sunday-jazz-cruise-aboard-the-riverboat-city-of-new-orleans/',
73	'/new-orleans/sunday-jazz-cruise-aboard-the-riverboat-city-of-new-orleans',
74	'/new-orleans/evening-jazz-cruise-aboard-the-riverboat-city-of-new-orleans/',
75	'/new-orleans/evening-jazz-cruise-aboard-the-riverboat-city-of-new-orleans',
76	'/new-orleans/daytime-jazz-cruise-aboard-the-riverboat-city-of-new-orleans',
77	'/new-orleans/daytime-jazz-cruise-aboard-the-riverboat-city-of-new-orleans/',
78	'/chicago/chicago-navy-pier-centennial-wheel/',
79	'/chicago/chicago-navy-pier-centennial-wheel',
80	'/chicago/slow-and-low/',
81	'/chicago/slow-and-low',
82	'/chicago/vip-private-gondola-buy-out-centennial-wheel/',
83	'/chicago/vip-private-gondola-buy-out-centennial-wheel',
84	'/miami/christmas-in-july/',
85	'/miami/christmas-in-july',
86	'/marina-del-rey/city-cruises/family-style-dinner-to-go/',
87	'/miami/miami-sunset-cruise/',
88	'/miami/miami-sunset-cruise',
89	'/miami/miami-hurricane-jetboat-adventure/',
90	'/seattle/seafair-bbq-cruise/',
91	'/seattle/seattle-sky-view-observatory-admission-ticket/',
92	'/washington-dc/washington-dc-electric-cart-tour/',
93	'/washington-dc/washington-dc-electric-cart-tour',
94	'/pensacola/downtown-sunset-cruise/',
95	'/pensacola/downtown-sunset-cruise',
96	'/pensacola/beachside-sunset-cruise/',
97	'/pensacola/beachside-sunset-cruise',
98	'/pensacola/bands-on-the-beach/',
99	'/pensacola/bands-on-the-beach',
100	'/st-petersburg/cross-bay-ferry/',
101	'/st-petersburg/cross-bay-ferry',
102	'/pensacola/downtown-pensacola-fort-pickens-pensacola-beach/',
103	'/pensacola/downtown-pensacola-fort-pickens-pensacola-beach',
104	'/pensacola/blue-angels-practice-cruise/',
105	'/pensacola/blue-angels-practice-cruise',
106	'/pensacola/fireworks-viewing-cruise/',
107	'/pensacola/fireworks-viewing-cruise',
108	'/new-orleans/new-orleans-beyond-the-flood-walls/',
109	'/new-orleans/new-orleans-beyond-the-flood-walls'
110	
111];
112
113var brandTagLink = [];
114brandTagLink['City Cruises'] = '/city-cruises/';
115brandTagLink['City Cruises UK'] = '/uk/city-cruises/';
116brandTagLink['City Cruises Canada'] = '/canada/city-cruises/';
117brandTagLink['Alcatraz City Cruises'] = '/san-francisco/city-cruises/alcatraz/';
118brandTagLink['Statue City Cruises'] = '/new-york/city-cruises/statue/';
119brandTagLink['Niagara City Cruises'] = '/niagara-ca/city-cruises/niagara/';
120brandTagLink['Walks'] = '/walks/';
121brandTagLink['Devour Tours'] = '/devour-tours/';
122brandTagLink['City Experiences'] = '/';
123brandTagLink['City Experiences Partner'] = '';
124brandTagLink['Essential Collection'] = '/search-results/?page=1&query=&country=&city=&categoryTheme=Essential%20Collection&audience=&durationTiming=&webCategoriesMain=&priceMin=&priceMax=&dateMin=&dateMax=';
125brandTagLink['City Ferry'] = '/search-results/?page=1&query=&country=&city=&categoryTheme=Ferries&audience=&durationTiming=&webCategoriesMain=&priceMin=&priceMax=&dateMin=&dateMax=';
126brandTagLink['Venture Ashore'] = '';
127brandTagLink['Boston Harbor'] = '/city-cruises/';
128
129var brandImgSrc = [];
130brandImgSrc['City Cruises'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Logo-RGB-Horizontal-FullColor.png';
131brandImgSrc['City Cruises UK'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Logo-RGB-Horizontal-FullColor.png';
132brandImgSrc['City Cruises Canada'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Logo-RGB-Horizontal-FullColor.png';
133brandImgSrc['Alcatraz City Cruises'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Alcatraz-Logo-RGB-Horizontal-FullColor.png';
134brandImgSrc['Statue City Cruises'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Statue-Logo-RGB-Horizontal-FullColor.png';
135brandImgSrc['Niagara City Cruises'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-Niagara-Logo-RGB-Horizontal-FullColor.png';
136brandImgSrc['Walks'] = 'https://assets.cityexperiences.com/wp-content/uploads/2022/10/WALKS_LOGO_HORIZONTAL_RGB_FULL-COLOR_NO-ENDORSE-1.png';
137brandImgSrc['Devour Tours'] = 'https://assets.cityexperiences.com/wp-content/uploads/2022/10/DEVOUR_LOGO_HORIZONTAL_RGB_FULL-COLOR_NO-ENDORSE.png';
138brandImgSrc['City Experiences'] = '';
139brandImgSrc['City Experiences Partner'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/09/Partner.png';
140brandImgSrc['Essential Collection'] = 'https://assets.cityexperiences.com/wp-content/uploads/2022/10/VENTURE-ASHORE_RGB_FULLCOLOR_HORIZONTAL.png';
141brandImgSrc['City Ferry'] = 'https://assets.cityexperiences.com/wp-content/uploads/2022/10/CF-Logo-RGB-Horizontal-FullColor.png';
142brandImgSrc['Boston Harbor'] = 'https://assets.cityexperiences.com/wp-content/uploads/2023/02/CC-BostonHarbor-Logo-RGB-Horizontal-FullColor-2.png';
143
144var couponCodeTag = [
145	'save 20% with code: dad20',
146	'national cherry blossom festival: march 20 - april 16',
147	'save on same-day round trips',
148	'new dining menu',
149	'save 20% with code easter20',
150	'15% off with code: tj15',
151	'20% off with code: july4',
152	'use code: july4'
153];
154
155var couponCodeTooltip = [
156	'Click Code To Copy',
157	'Click to view cruises',
158	'Mon-Wed',
159	"View Menu",
160	'* Terms and Condition apply',
161	'Mon-Thurs in May. Click code to copy.',
162	'Valid for 4th of July weekend only. Click code to copy',
163	'Click code to copy -- Valid for 6/30-7/4 dates, Terms & Conditions apply.'
164];
165
166var couponCodeLink = [
167	'',
168	'/washington-dc/city-cruises/potomac-river/sightseeing-tours/cherry-blossoms-cruises/',
169	"",
170	"",
171	'',
172	''
173];
174
175var ukProps = ['hblonco', 'hbyork', 'hbpoole'];
176
177function populateStars(obj, val) {
178	obj.star_1 = val === 0 ? 'far fa-star' : val < 1 ? 'fas fa-star-half-alt' : 'fas fa-star';
179	obj.star_2 = val <= 1 ? 'far fa-star' : val > 1 && val < 2 ? 'fas fa-star-half-alt' : 'fas fa-star';
180	obj.star_3 = val <= 2 ? 'far fa-star' : val > 2 && val < 3 ? 'fas fa-star-half-alt' : 'fas fa-star';
181	obj.star_4 = val <= 3 ? 'far fa-star' : val > 3 && val < 4 ? 'fas fa-star-half-alt' : 'fas fa-star';
182	obj.star_5 = val <= 4 ? 'far fa-star' : val > 4 && val < 5 ? 'fas fa-star-half-alt' : 'fas fa-star';
183}
184
185function updateRecentlyViewedCookie(myObj) {
186	var currentRecentlyViewedCookie = JSON.parse(getCookie('recently_viewed') || '[]');
187	var newViewedTour = {
188		//tour_name: myObj.title,
189		//tour_city: myObj.tour_city,
190		//tour_state: myObj.tour_state_full,
191		//display_price_only: myObj.settings.displayPriceOnly,
192		//discounted_display_price: parseFloat(myObj.settings.discountedDisplayPrice) || 0,
193		//has_discounted_price : (parseFloat(myObj.settings.discountedDisplayPrice) || 0) === 0 ? false : true,
194		//tour_permalink: myObj.permalink,
195		//tour_image: myObj.media.images.length ? myObj.media.images[0].url : '',
196		tour_property_id: myObj.propertyId,
197		tour_booking_type_id: myObj.bookingTypeId,
198	}
199	currentRecentlyViewedCookie.unshift(newViewedTour);
200	if(currentRecentlyViewedCookie.length >= 2) {
201		//console.log('currentRecentlyViewedCookie-2more');
202		for(var i = currentRecentlyViewedCookie.length - 1; i >= 1; i--) {
203			if(currentRecentlyViewedCookie[i].tour_property_id === myObj.propertyId && currentRecentlyViewedCookie[i].tour_booking_type_id === myObj.bookingTypeId) {
204				currentRecentlyViewedCookie.splice(i, 1);
205			}
206		}
207	}
208	currentRecentlyViewedCookie = currentRecentlyViewedCookie.slice(0, 4);
209	setCookie('recently_viewed', JSON.stringify(currentRecentlyViewedCookie), 7);
210	//console.log('currentRecentlyViewedCookie', {currentRecentlyViewedCookie, newViewedTour, myObj});
211	
212}
213
214function populateTour(tour, lang, settings, isExperience, isWalks, isHideMap) {
215    var tourObj = {};
216    var thisLang = lang === undefined ? 'en' : lang;
217	var thisSettings = settings === undefined ? { } : settings;
218	var thisIsExperience = isExperience === undefined ? false : isExperience;
219	var thisIsWalks = isWalks === undefined ? false : isWalks;
220	var thisIsHideMap = isHideMap === undefined ? false : isHideMap;
221	//console.log('thisSettings', thisSettings);
222    //console.log('thisLangthisLang',thisLang);
223    if(tour.unavailable.length) {
224        tourObj = tour.unavailable[0];
225        var localizedEnLang = tourObj.localizedInfo['en'] || {};
226        var localizedLang = tourObj.localizedInfo[thisLang] || localizedEnLang;
227        //console.log('localizedLanglocalizedLang',{localizedLang,localizedEnLang});
228
229		tourObj.permalink = tourObj.settings['permalink-cityexperiences'] || tourObj.permalink;
230        tourObj.title = localizedLang.title || localizedEnLang.title || 'No Title';
231		tourObj.sanitizedTitle = tourObj.title;
232		tourObj.sanitizedTitle = tourObj.title.replace(/&/g, '%26');
233        tourObj.overview = localizedLang.description || localizedEnLang.description || "";
234		tourObj.short_description = localizedLang.shortDescription || localizedEnLang.shortDescription || "";
235        tourObj.whatUget = localizedLang.whatYouGet || localizedEnLang.whatYouGet || "";
236        tourObj.schedule = localizedLang.schedule || localizedEnLang.schedule || "";
237        tourObj.whereToMeet = localizedLang.whereToMeet || localizedEnLang.whereToMeet || "";
238        tourObj.dressCode = localizedLang.dressCode || localizedEnLang.dressCode || "";
239		tourObj.offers = localizedLang.offers || localizedEnLang.offers || "";
240		tourObj.upgradesAvailabale = localizedLang.upgradesAvailabale || localizedEnLang.upgradesAvailabale || "";
241		tourObj.additionalInfo = localizedLang.additionalInfo || localizedEnLang.additionalInfo || "";
242		tourObj.cancellationPolicy = tourObj.settings.freeCancellationMessage || "";
243
244		tourObj.exclusions = localizedLang.exclusions || '';
245		tourObj.exclusions = isJson(tourObj.exclusions) ? jsonToListHTML(tourObj.exclusions) : tourObj.exclusions;
246		tourObj.has_exclusions = tourObj.exclusions.length > 0 ? true : false;
247
248		// if (tourObj.settings.productPageNotificationBanner) {
249		// 		tourObj.has_product_page_notification_banner = tourObj.settings.productPageNotificationBanner.length ? true : false;
250		// 	} else {
251		// 		tourObj.has_product_page_notification_banner = false;
252		// 	}
253
254		if (tourObj.settings.productPageNotificationBanner) {
255			const hasBannerContent = tourObj.settings.productPageNotificationBanner.length > 0;
256			const validityTimestamp = tourObj.settings.productPageNotificationBannerValidity;
257			
258			const isValidDate = !validityTimestamp || Date.now() < parseInt(validityTimestamp, 10) * 1000;
259			
260			tourObj.has_product_page_notification_banner = hasBannerContent && isValidDate;
261		} else {
262			tourObj.has_product_page_notification_banner = false;
263		}
264		  
265
266        tourObj.has_whatUget = tourObj.whatUget.length ? true : false;
267        tourObj.has_schedule = tourObj.schedule.length ? true : false;
268        tourObj.has_whereToMeet = tourObj.whereToMeet.length ? true : false;
269        tourObj.has_dressCode = tourObj.dressCode.length ? true : false;
270		tourObj.has_offers = tourObj.offers.length ? true : false;
271		tourObj.has_upgradesAvailabale = tourObj.upgradesAvailabale.length ? true : false;
272		tourObj.has_additionalInfo = tourObj.additionalInfo.length ? true : false;
273		tourObj.has_discountPct = (tourObj.discountPct !== undefined && tourObj.discountPct !== null && tourObj.discountPct !== 0);
274		tourObj.has_free_cancellation_message = tourObj.cancellationPolicy.length ? true : false;
275
276		
277        tourObj.video = (tourObj.media.videos.length ? tourObj.media.videos[0].url : '');
278        tourObj.has_video = (tourObj.media.videos.length ? true : false);
279        tourObj.address = (tourObj.settings['address.formatted'] || '');
280        tourObj.additional_assets = [];
281        tourObj.additional_assets_no_map = [];
282        tourObj.lat = tourObj.settings['address.latitude'];
283        tourObj.lon = tourObj.settings['address.longitude'];
284		tourObj.tour_city = tourObj.settings.locationTagCityName || tourObj.settings['address.tourCity'] || tourObj.settings.activityCity || tourObj.city || '';		
285		tourObj.tour_country_abv = tourObj.settings['address.tourCountry'] || '';
286		tourObj.tour_state = tourObj.settings['address.tourState'] || '';
287		tourObj.tour_state_full = tourObj.settings.locationTagStateName || (tourObj.tour_state.length ? usState[tourObj.tour_state.toLowerCase()] : '');
288		tourObj.tour_country = tourObj.settings.locationTagCountryName || countryCode[tourObj.tour_country_abv] || '';
289		tourObj.has_state_name = (tourObj.tour_state_full || '').length > 0;
290		tourObj.has_country_name = tourObj.tour_country.length > 0;
291		tourObj.is_california_tour = (tourObj?.has_state_name && tourObj?.tour_state_full === "California");
292		tourObj.is_canada_tour = (tourObj?.has_country_name && tourObj?.tour_country === "Canada");
293        tourObj.has_main_image = false;
294		tourObj.has_short_description = tourObj.short_description.length > 0;
295		
296		//tourObj.duration = getDurationStr(parseInt(tourObj.settings.duration));
297		tourObj.durationTiming = tourObj.settings.durationTiming;
298		tourObj.duration = getDurationStr2(parseInt(tourObj.settings.duration));
299		tourObj.duration = tourObj.duration.length === 0 && tourObj.durationTiming.length ? tourObj.durationTiming : tourObj.duration;
300		
301		tourObj.has_duration = tourObj.duration.length > 0;
302		tourObj.departureTime = tourObj.settings.departureTime || '';
303		tourObj.has_departureTime = tourObj.departureTime.length > 0;
304		tourObj.has_departure_duration_time = tourObj.has_duration || tourObj.has_departureTime;
305
306		tourObj.departurePoint = tourObj.settings.departurePoint || '';
307		tourObj.has_departurePoint = tourObj.departurePoint.length > 0;
308		tourObj.returnDetails = tourObj.settings.returnDetails || '';
309		tourObj.has_returnDetails = tourObj.returnDetails.length > 0;
310		tourObj.guideRatio = tourObj.settings.guideRatio || '';
311		tourObj.has_guideRatio = tourObj.guideRatio.length > 0;
312		
313		var activity_level = ['Easy: minimal walking or activity','Light: some walking with potential steps at a casual pace','Moderate: walking up to 2km (may involve steps and inclines) or moderate physical activity','Strenuous: walking above 2km (with steps & inclines) or semi-difficult physical activity','Hard: challenging physical activity'];
314		var activity_level_short = ['Easy','Light','Moderate','Strenuous','Hard'];
315		var walkingFullImg = '<img src="https://assets.ventureashore.com/wp-content/uploads/2021/08/walk-icon-on-1.png" />';
316		var walkingEmptyImg = '<img src="https://assets.ventureashore.com/wp-content/uploads/2021/08/walk-icon-off-1.png" />';
317		tourObj.activity_level = parseInt(tourObj.settings.activityLevel || 0);
318		tourObj.has_activity_level = tourObj.activity_level > 0;
319		tourObj.activity_text = tourObj.has_activity_level ? tourObj.activity_level + ' - ' + activity_level[tourObj.activity_level-1] : '';
320		tourObj.activity_text_short = tourObj.has_activity_level ? tourObj.activity_level + ' - ' + activity_level_short[tourObj.activity_level-1] : '';
321		tourObj.activity_level_1 = tourObj.activity_level >
321= 1 ? walkingFullImg : walkingEmptyImg;
322		tourObj.activity_level_2 = tourObj.activity_level >= 2 ? walkingFullImg : walkingEmptyImg;
323		tourObj.activity_level_3 = tourObj.activity_level >= 3 ? walkingFullImg : walkingEmptyImg;
324		tourObj.activity_level_4 = tourObj.activity_level >= 4 ? walkingFullImg : walkingEmptyImg;
325		tourObj.activity_level_5 = tourObj.activity_level >= 5 ? walkingFullImg : walkingEmptyImg;
326		
327		tourObj.lat = tourObj.settings['address.latitude'];
328		tourObj.lon = tourObj.settings['address.longitude'];
329		tourObj.has_map = !tourObj.lat ? false : true;
330		//tourObj.map_iframe = '<img src="https://maps.googleapis.com/maps/api/staticmap?center='+tourObj.lat+','+tourObj.lon+'&zoom=17&size=300x209 &maptype=roadmap&markers=label:O%7C'+tourObj.lat+','+tourObj.lon+'&key=AIzaSyDaG6EWyqEXQfW5NSsSgrcTGJLZ4YW7jYo" width="100%" />';
331		//tourObj.map_iframe = '<iframe src="https://www.google.com/maps/embed/v1/view?key=AIzaSyBL-6gXit75MYB5P8rzrI5UaMDvnOtOfUw&center='+tourObj.lat+','+tourObj.lon+'&zoom=15&maptype=roadmap" width="100%" height="100%" allowfullscreen="" /></iframe>';
332// 		tourObj.map_iframe = (tourObj.settings.locationPinPoint||'').length > 0 ? tourObj.settings.locationPinPoint : '<iframe src="https://www.google.com/maps/embed/v1/view?key=AIzaSyBL-6gXit75MYB5P8rzrI5UaMDvnOtOfUw&center='+tourObj.lat+','+tourObj.lon+'&zoom=15&maptype=roadmap" width="100%" height="100%" allowfullscreen="" /></iframe>';
333		
334		tourObj.map_iframe = '<iframe src="https://www.google.com/maps/embed/v1/view?key=AIzaSyBL-6gXit75MYB5P8rzrI5UaMDvnOtOfUw&center='+tourObj.lat+','+tourObj.lon+'&zoom=15&maptype=roadmap" width="100%" height="100%" allowfullscreen="" /></iframe>';
335		
336		tourObj.map_iframe_link = 'http://maps.google.com/?q='+tourObj.lat+','+tourObj.lon;
337		
338		
339		tourObj.is_experiences_tour = tourObj.city.indexOf('experiences ') === 0;
340		tourObj.is_walks_tour = tourObj.city.indexOf('walks ') === 0 || specialWalksURL.includes(location.pathname);
341		tourObj.is_ignore_tour = specialignoreURL.includes(location.pathname);
342		tourObj.is_devours_tour = tourObj.city.indexOf('devour - ') === 0;
343		tourObj.is_alcatraz_tour = tourObj.city.indexOf('alcatraz - ') === 0;
344		tourObj.is_niagara_tour = tourObj.city === 'niagara';
345		tourObj.is_statue_tour = tourObj.city === 'new york statue';
346		tourObj.has_brand_info = tourObj.is_experiences_tour ? false : true;
347		tourObj.city_cruises_country = tourObj.settings.locationTagCountryName === 'United States' ? 'US' : ( tourObj.settings.locationTagCountryName === 'United Kingdom' ? 'UK' : ( tourObj.settings.locationTagCountryName === 'Canada' ? 'Canada' : '' ) );
348		if (tourObj.settings.tags) {
349			
350			tourObj.is_holiday_tour = 
351				tourObj.settings.tags.includes('Holiday & Festive Cruises') || 
352				tourObj.settings.tags.includes('City Cruises Live') ||
353				window.location.href.includes('dine-out') || 
354				window.location.href.includes('restaurant-week');
355
356			if (tourObj.is_holiday_tour) {
357				tourObj.is_ta_holiday_tour = window.location.href.includes('memorial-day') || window.location.href.includes('labor-day') ? true : false;
358			} else {
359				tourObj.is_ta_holiday_tour = false;	
360			}	
361			//tourObj.is_no_ta_holiday_tour = !tourObj.settings.tags.includes("Father's Day") || !tourObj.settings.tags.includes("Mother's Day") || !tourObj.settings.tags.includes('Easter') || !tourObj.settings.tags.includes('Easter') ? true : false;
362		} else {
363			tourObj.is_no_ta_holiday_tour = false;
364		}
365		tourObj.is_partner_tour = tourObj.settings.brandTag === 'City Experiences Partner' ? true : false;
366		
367		tourObj.has_coupon_code = false;
368		tourObj.coupon_code_text = '';
369		tourObj.isolatedCouponCode = '';
370
371		
372		
373		//console.log("test obj", tourObj);
374		tourObj.categoriesArr = tourObj.categories !== null && tourObj.categories !== undefined ? tourObj.categories.replaceAll(' ,', ',').replaceAll(', ', ',').split(',') : [];
375		//tourObj.categoriesArr = tourObj.categories !== null ? tourObj.categories.replaceAll(' ,', ',').replaceAll(', ', ',').split(',') : [];
376		tourObj.coupon_code_tooltip = '';
377		tourObj.coupon_code_has_link = false;
378		tourObj.coupon_code_link = '/';
379		for(var j = 0; j < tourObj.categoriesArr.length; j++) {
380			if(tourObj.categoriesArr[j].indexOf('couponcode ') === 0) {
381				tourObj.has_coupon_code = true;
382				tourObj.coupon_code_text = tourObj.categoriesArr[j].replace('couponcode ', '');
383				var foundIdx = couponCodeTag.indexOf(tourObj.coupon_code_text);
384				if(foundIdx >= 0) {
385					tourObj.coupon_code_tooltip = couponCodeTooltip[foundIdx] || '';
386					if (tourObj.coupon_code_tooltip !== '') {
387						tourObj.has_coupon_code_tooltip = true;
388					} else {
389						tourObj.has_coupon_code_tooltip = false;
390					}					  
391					tourObj.coupon_code_link = couponCodeLink[foundIdx] || '';
392					tourObj.coupon_code_has_link = tourObj.coupon_code_link.length;
393				}
394				let codeIndex = tourObj.coupon_code_text.indexOf(":");  // Find the index of the first colon in the coupon code tag
395				tourObj.isolatedCouponCode = tourObj.coupon_code_text.substring(codeIndex + 1).trim();  // Extract the text following the colon and remove any leading or trailing whitespace
396			}
397		}
398		
399		//if(getUrlParam('csc', 0) === '1') {
400			tourObj.has_coupon_savings = (tourObj.applicableSpecialCoupons || []).length > 0;
401			tourObj.coupon_savings_code_text = (tourObj.applicableSpecialCoupons || []).length > 0 ? tourObj.applicableSpecialCoupons[0].specialCouponName : '';
402			tourObj.coupon_savings_code = (tourObj.applicableSpecialCoupons || []).length > 0 ? tourObj.applicableSpecialCoupons[0].specialCouponCode : '';
403			tourObj.coupon_savings_tooltip = '';
404			if (tourObj.applicableSpecialCoupons && tourObj.applicableSpecialCoupons.length > 0) {
405				if (tourObj.applicableSpecialCoupons[0].settings && tourObj.applicableSpecialCoupons[0].settings.length > 0) {
406					tourObj.coupon_savings_tooltip = tourObj.applicableSpecialCoupons[0].settings[0].value;
407				}
408			}
409			tourObj.has_coupon_saving_code = tourObj.coupon_savings_code && tourObj.coupon_savings_code.length > 0;
410			tourObj.has_coupon_saving_code_tooltip = tourObj.coupon_savings_tooltip && tourObj.coupon_savings_tooltip.length > 0;
411		//}
412
413		if (tourObj.applicableSpecialCoupons && tourObj.applicableSpecialCoupons.length > 0) {
414				//const tagBackgroundColorObject = tourObj.applicableSpecialCoupons[0].settings.find( (setting) => setting.id === "tagColor");
415				//const tagTextColorObject = tourObj.applicableSpecialCoupons[0].settings.find(setting => setting.id === "tagTextColor");
416				/*if (tagBackgroundColorObject) {
417					const tagBackgroundColorValue = tagBackgroundColorObject.value;
418					const tagTextColorValue = tagTextColorObject.value;
419					tourObj.has_custom_tag_color = true;
420					tourObj.custom_tag_color = tagBackgroundColorValue;
421					tourObj.custom_tag_text_color = tagTextColorValue;
422				} else {
423					tourObj.has_custom_tag_color = false;
424				}*/
425				//tourObj.custom_tag_text_color = (tourObj.applicableSpecialCoupons || []).length > 0 ? tourObj.applicableSpecialCoupons[0].settings.tagTextColor : '';
426				//tourObj.has_custom_tag_color = (tourObj.custom_tag_color || []).length > 0;
427				const tagBackgroundColorValue = tourObj.applicableSpecialCoupons[0].settings['tagColor'] !== undefined ? tourObj.applicableSpecialCoupons[0].settings['tagColor'] : (tourObj.applicableSpecialCoupons[0].settings.find( (setting) => setting.id === "tagColor") ? tourObj.applicableSpecialCoupons[0].settings.find( (setting) => setting.id === "tagColor").value : '');
428				const tagTextColorValue = tourObj.applicableSpecialCoupons[0].settings['tagTextColor'] !== undefined ? tourObj.applicableSpecialCoupons[0].settings['tagTextColor'] : ( tourObj.applicableSpecialCoupons[0].settings.find(setting => setting.id === "tagTextColor") ? tourObj.applicableSpecialCoupons[0].settings.find(setting => setting.id === "tagTextColor").value : '');
429				if (tagBackgroundColorValue && tagTextColorValue && tagBackgroundColorValue.length && tagTextColorValue.length) {
430					tourObj.has_custom_tag_color = true;
431					tourObj.custom_tag_color = tagBackgroundColorValue;
432					tourObj.custom_tag_text_color = tagTextColorValue;
433				} else {
434					tourObj.has_custom_tag_color = false;
435				}
436			//console.log('look-here', {tourObj,tagBackgroundColorValue,tagTextColorValue});
437		}
438		
439		tourObj.has_double_rewards = (tourObj.applicableDoubleRewards || []).length > 0;
440		
441		tourObj.has_last_minute_deal = tourObj.categoriesArr.includes('last minute deals tag');
442		tourObj.has_save_now = tourObj.categoriesArr.includes('save now tag');
443		tourObj.has_new_tour = tourObj.categoriesArr.includes('new tour tag');
444		tourObj.has_featured_experience = tourObj.categoriesArr.includes('featured experience tag');
445		tourObj.has_thirty_percent_off = tourObj.categoriesArr.includes('thirty percent off tag');		
446		tourObj.has_discounted_price = tourObj.settings.discountedDisplayPrice !== undefined && tourObj.settings.discountedDisplayPrice !== '0';
447		tourObj.default_currency = (thisSettings.override_currency_to||'').length > 0 ? thisSettings.override_currency_to : (tourObj.propertySettings.defaultCurrency || '');
448		tourObj.default_currency_sign = tourObj.default_currency.length ? globalCurrency[tourObj.default_currency] : '';
449
450
451		
452
453
454		
455		tourObj.show_likely_sellout = tourObj.availabilityPct < (tourObj.settings.min_likely_sellout || 0) ? true : false;
456		tourObj.show_recent_bookings = !tourObj.show_likely_sellout && (tourObj.settings.min_recent_booking || 10) <= tourObj.numberOfOrders ? true : false;
457		
458		tourObj.has_recent_orders = false;
459		var limitRecentBooking = thisSettings.limit_recent_booking || 20;
460		var recent_bookings_translated = jQuery('.translation-wrapper .lang-recent-bookings').html();
461		if(tourObj.numberOfOrders !== null && tourObj.numberOfOrders >= limitRecentBooking) {
462			tourObj.has_recent_orders = true;
463			tourObj.recent_orders_text = tourObj.numberOfOrders + ' ' + recent_bookings_translated;
464		}
465		
466		tourObj.has_likely_sellout = false;
467		tourObj.availabilityPct = tourObj.availabilityPct || 1;
468		var limitAvailablePct = thisSettings.limit_available_pct || 0.2;
469		if(tourObj.availabilityPct <= limitAvailablePct) {
470			tourObj.has_likely_sellout = true;
471			tourObj.likely_sellout_text = 'Likely to Sell Out';
472		}
473		
474		tourObj.has_recent_orders = tourObj.has_likely_sellout ? false : tourObj.has_recent_orders;
475		
476		/*tourObj.has_additional_fees_messaging = !!tourObj.settings.showFeesAddedMessage;
477		if (tourObj.settings.displayPriceFeePercentage != null && tourObj.settings.displayPriceFeePercentage > 0) {
478			// Round up the displayPriceFeePercentage to the nearest whole number
479			tourObj.priceFeePercentage = Math.ceil(tourObj.settings.displayPriceFeePercentage);
480		} else {
481			tourObj.has_additional_fees_messaging = false
482		}
483
484		tourObj.has_inclusive_fees_messaging = !!tourObj.settings.displayPriceInclusiveOfFees;*/
485
486
487		if (tourObj.settings.showFeesAddedMessage === "true") {
488			if (tourObj.settings.displayPriceFeePercentage != null) {
489				// Convert displayPriceFeePercentage to a number if it's a string
490				let feePercentage = Number(tourObj.settings.displayPriceFeePercentage);
491				if (!isNaN(feePercentage) && feePercentage > 0) {
492					tourObj.has_additional_fees_messaging = true;
493					// Round up the displayPriceFeePercentage to the nearest whole number
494					tourObj.priceFeePercentage = Math.ceil(feePercentage);
495				} else {
496					tourObj.has_additional_fees_messaging = false;
497					// Handle the case where displayPriceFeePercentage is not a valid number
498					//console.error('displayPriceFeePercentage is not a valid number');
499				}
500			}
501		} else {
502			tourObj.has_additional_fees_messaging = false;
503		}
504
505		if (tourObj.settings.displayPriceInclusiveOfFees === "true") {
506			tourObj.has_inclusive_fees_messaging = true;
507		} else {
508			tourObj.has_inclusive_fees_messaging = false;
509		}
510
511		if (tourObj.settings.shouldDisplayPriceWithTaxesAndFees === "true") {
512			tourObj.has_inclusive_fees_and_taxes_messaging = true;
513			tourObj.has_additional_fees_messaging = false;
514			tourObj.has_inclusive_fees_messaging = false;
515		} else {
516			tourObj.has_inclusive_fees_and_taxes_messaging = false;
517		}
518
519
520				
521		if(tourObj.is_ignore_tour) {
522			tourObj.brand_link = '';
523			tourObj.brand_name = '';
524		} else if(tourObj.is_walks_tour) {
525			tourObj.brand_link = '/walks/';
526			tourObj.brand_name = 'Walks';
527		} else if(tourObj.is_devours_tour) {
528			tourObj.brand_link = '/devour-tours/';
529			tourObj.brand_name = 'Devour Tours';
530		} else if(tourObj.is_alcatraz_tour) {
531			tourObj.brand_link = '/san-francisco/city-cruises/alcatraz/';
532			tourObj.brand_name = 'Alcatraz City Cruises';
533		} else if(tourObj.is_alcatraz_tour) {
534			tourObj.brand_link = '/san-francisco/city-cruises/alcatraz/';
535			tourObj.brand_name = 'Alcatraz City Cruises';
536		} else if(tourObj.is_niagara_tour) {
537			tourObj.brand_link = '/niagara-ca/city-cruises/niagara/';
538			tourObj.brand_name = 'Niagara City Cruises';
539		}  else if(tourObj.is_statue_tour) {
540			tourObj.brand_link = '/new-york/city-cruises/statue/';
541			tourObj.brand_name = 'Statue City Cruises';
542		} else {
543			if(tourObj.city_cruises_country === 'UK') {
544				tourObj.brand_link = '/uk/city-cruises/';
545			} else if(tourObj.city_cruises_country === 'Canada') {
546				tourObj.brand_link = '/canada/city-cruises/';
547			} else {
548				tourObj.brand_link = '/city-cruises/';
549			}
550			//tourObj.brand_name = 'City Cruises' + ' ' + tourObj.city_cruises_country;
551			tourObj.brand_name = 'City Cruises';
552		}
553
554		//This is used for adding "Cruise times may slightly vary" copy to the Schedule section of all CC US tours, except for Chicago because they've already manually added this to their tour pages in anchor. We're also not adding it to NY, NJ, and Philadelphia tours.
555			tourObj.is_cc_us_tour = (tourObj.brand_name === 'City Cruises' && tourObj.city_cruises_country === 'US') && 
556									!['chicago', 'new jersey', 'new york', 'new york statue', 'philadelphia'].includes(tourObj.city.toLowerCase());
557		//End code
558		
559		thisSettings.is_override_brand_tag = thisSettings.is_override_brand_tag || false;
560		tourObj.anchor_brand_name = thisSettings.is_override_brand_tag ? (thisSettings.override_brand_tag || '') : (tourObj.settings.brandTag || '');
561		tourObj.anchor_brand_link = brandTagLink[tourObj.anchor_brand_name];
562		tourObj.anchor_brand_src = brandImgSrc[tourObj.anchor_brand_name];
563		tourObj.has_brand_src = tourObj.anchor_brand_src !== undefined && tourObj.anchor_brand_src.length > 0;
564		tourObj.has_anchor_brand_link = tourObj.anchor_brand_link !== undefined && tourObj.anchor_brand_link.length;
565		tourObj.has_anchor_brand_name = tourObj.anchor_brand_name.length && tourObj.anchor_brand_link !== undefined;
566		if (tourObj.has_anchor_brand_name) {
567			if (tourObj.anchor_brand_name === "City Experiences Partner") {
568				tourObj.is_cex_partner = true;
569			} else {
570				tourObj.is_cex_partner = false;
571			}
572		}
573				
574		//tourObj.has_anchor_brand_name = false;
575		tourObj.has_brand_info = false;
576
577		tourObj.review = (tourObj.settings.review || "");
578        tourObj.has_review = tourObj.review.length ? true : false;
579		tourObj.has_review = (thisSettings.force_review_off || false) ? false : tourObj.has_review;
580		//console.log('thisSettings', thisSettings.force_review_off);
581		
582        var mainImageIndex = 0;
583        tourObj.has_main_image = false;
584        if(tourObj.media.images.length > mainImageIndex) {
585            tourObj.main_image_url = tourObj.media.images[mainImageIndex].url;
586            tourObj.main_image_index = mainImageIndex + 1;
587            tourObj.has_main_image = true;
588			mainImageIndex++;
589        }
590
591        tourObj.max_image_assets = tourObj.media.images.length;
592		tourObj.additional_assets = jQuery.extend(true, [], tourObj.media.images);
593		tourObj.additional_assets.shift();
594
595		tourObj.all_media_images = [];
596		tourObj.all_media_images_count = tourObj.media.images.length;
597		//console.log('tourObj.media.images',tourObj.media.images);
598		for(var idx1 = 0; idx1 < tourObj.media.images.length; idx1++) {
599			var thisImg = tourObj.media.images[idx1];
600			var thisIdx = idx1 + 1;
601			var thisActive = thisIdx === 1;
602			var nextIdx = idx1 + 2 <= tourObj.all_media_images_count ? idx1 + 2 : 1;
603			var prevIdx = thisIdx === 1 ? tourObj.media.images.length : thisIdx - 1;
604			var imgNum = thisIdx + ' / ' + tourObj.all_media_images_count;
605			var imgSrc = thisImg.url;
606			tourObj.all_media_images.push({active: thisActive, idx: thisIdx, img_num: imgNum, img_src: imgSrc, next: nextIdx, prev: prevIdx });
607		}
608		
609		tourObj.menu_download_pdf = '/pdf/';
610		tourObj.has_menu = tourObj.menuId && tourObj.menuId.length ? true : false;
611		tourObj.has_download_menu = tourObj.has_menu;
612		tourObj.tourMenus = [];
613		tourObj.tourMenusV2 = [];
614		if(tourObj.has_menu) {
615			var menuPckg = { menuTitle: "", "groupMenu": [], "menuId": "", "menuType": "" };
616			var groupMenuIndex = 0;
617			var thisMenuType = '';
618			var thisIsWineList = false;
619			for(var tmIdx=0; tmIdx < tourObj.menus.length; tmIdx++) {
620				menuPckg.active = (tmIdx == 0 ? 'active' : '');
621				var thisTourMenuObj = tourObj.menus[tmIdx];
622				//console.log('thisTourMenuObj',thisTourMenuObj);
623				//console.log('thisTourMenuObj',!thisTourMenuObj);
624				if(thisTourMenuObj !== null) {
625					menuPckg.menuTitle = !menuPckg.menuTitle.length && !tourObj.menus ? tourObj.menus[tmIdx].menuTitle : menuPckg.menuTitle;
626					menuPckg.menuType = !tourObj.menus ? tourObj.menus[tmIdx].menuType : '';
627					menuPckg.menuId = !tourObj.menus ? tourObj.menus[tmIdx].menuId : '';
628					for(var itemIdx=0; itemIdx < tourObj.menus[tmIdx].menuItem.length; itemIdx++) {
629						var thisMenuItem = { };
630						thisMenuItem.chefDeCuisine = tourObj.menus[tmIdx].chefDeCuisine;
631						thisMenuItem.has_chefDeCuisine = thisMenuItem.chefDeCuisine === null || thisMenuItem.chefDeCuisine === undefined ? false : true;
632						thisMenuItem.has_disclaimer = true;
633						thisMenuItem.disclaimer = '';
634						thisMenuItem.type = tourObj.menus[tmIdx].menuItem[itemIdx].type;
635						thisMenuItem.is_enhancement = thisMenuItem.type === 'Enhancements';
636						thisMenuItem.is_winelist = thisMenuItem.type === 'Dessert Wine' || thisMenuItem.type === 'Sparkling' || thisMenuItem.type === 'Red Wine' || thisMenuItem.type === 'White Wine' || thisMenuItem.type === 'Wine' || thisMenuItem.type === 'Beverage' || thisMenuItem.type === 'Specialty Cocktails' || thisMenuItem.type === 'Spirits' || thisMenuItem.type === 'Non - Alcoholic Beverage' ? true : false;
637						thisMenuItem.is_cocktails = thisMenuItem.type === 'Specialty Cocktails' ? true : false;
638						thisMenuItem.subItem = tourObj.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
639						thisMenuItem.title = tourObj.menus[tmIdx].menuItem[itemIdx].translations.en.title;
640						thisMenuItem.description = tourObj.menus[tmIdx].menuItem[itemIdx].translations.en.description;
641						thisMenuItem.clean_desc = thisMenuItem.description ? thisMenuItem.description.replace(/<p>/gi, '<span>').replace(/<\/p>/gi, '</span>').replace(/<(?!\/?(h3|h4|i|br|strong|em|span)\b)[^>]+>/gi, "") : '';
642						var thisDietary = tourObj.menus[tmIdx].menuItem[itemIdx].menuItemDietary || [];
643						var thisDietaryCode = [];
644						for(var dietIdx=0; dietIdx < thisDietary.length; dietIdx++) {
645							thisDietary[dietIdx] = thisDietary[dietIdx].replace(" ", "-");
646							thisDietaryCode[dietIdx] = thisDietary[dietIdx] === 'Gluten-Free' ? 'G*' : (thisDietary[dietIdx] === 'Nuts' ? 'N' : (thisDietary[dietIdx] === 'Vegan' ? 'VG' : (thisDietary[dietIdx] === 'Vegetarian' ? 'V' : '')));
647						}
648						thisMenuItem.dietary = thisDietary;
649						thisMenuItem.dietaryCode = thisDietaryCode;
650						thisMenuItem.has_dietary = thisDietary.length > 0;
651						thisMenuItem.show_type = false;
652						thisMenuItem.has_subItem = (!thisMenuItem.subItem || 0 === thisMenuItem.subItem.length ? false : true);
653						if(thisMenuType == thisMenuItem.type || (thisMenuItem.is_winelist && thisIsWineList == thisMenuItem.is_winelist)) {
654							menuPckg.groupMenu[menuPckg.groupMenu.length-1]['tab_items'].push(thisMenuItem);
655						} else {
656							thisIsWineList = thisMenuItem.is_winelist;
657							thisMenuItem.show_type = true;
658							menuPckg.groupMenu[groupMenuIndex] = { "tab_name": thisIsWineList ? menuPckg.menuType : thisMenuItem.type, "sub_text": thisMenuItem.subItem, "tab_id": menuPckg.menuId+'-'+groupMenuIndex, "active": groupMenuIndex == 0 ? 'active' : '', "has_chefDeCuisine": thisMenuItem.has_chefDeCuisine, "chefDeCuisine": thisMenuItem.chefDeCuisine, "is_wine_menu": thisIsWineList || thisMenuItem.is_cocktails, "tab_items": [] };
659							menuPckg.groupMenu[groupMenuIndex]['tab_items'].push(thisMenuItem);
660							groupMenuIndex = menuPckg.groupMenu.length;
661							thisMenuType = thisMenuItem.type;
662						}
663					}
664				}
665			}
666			tourObj.tourMenusV2 = menuPckg;
667			for(var tmIdx=0; tmIdx < tourObj.menus.length; tmIdx++) {
668				var menuPckg = { };
669				//console.log('tourObj.menus.length',tourObj.menus);
670				var thisTourMenuObj = tourObj.menus[tmIdx];
671				if(thisTourMenuObj !== null) {
672					menuPckg.menuId = tourObj.menus[tmIdx].menuId;
673					menuPckg.menuTitle = tourObj.menus[tmIdx].menuTitle;
674					menuPckg.menuType = tourObj.menus[tmIdx].menuType;
675					menuPckg.chefDeCuisine = tourObj.menus[tmIdx].chefDeCuisine;
676					menuPckg.has_chefDeCuisine = menuPckg.chefDeCuisine === null || menuPckg.chefDeCuisine === undefined ? false : true;
677					var defaultDisclaimer = '<strong>DISCLAIMER -</strong> Before placing your order, please inform your server if a person in your party has a food allergy. Consuming raw or undercooked meats, poultry, seafood, shellfish or eggs may increase our risk of food-borne illness, especially if you have a medical condition. Menus subject to change..';
678					menuPckg.disclaimer = tourObj.menus[tmIdx].settings.disclaimer || defaultDisclaimer;
679					menuPckg.has_disclaimer = menuPckg.disclaimer === null ? false : true;
680					menuPckg.show_title = menuPckg.menuType == 'Wine' ? false : true;
681					//menuPckg.is_wine_menu = menuPckg.menuType == 'Wine' ? true : false;
682					menuPckg.is_wine_menu = (menuPckg.menuType == 'DRINKS' || menuPckg.menuType == 'BEVERAGES') ? true : false;
683					menuPckg.active = (tmIdx == 0 ? 'active' : '');
684					var thisMenuType = '';
685					menuPckg.groupMenu = [];
686					var groupMenuIndex = 0;
687					for(var itemIdx=0; itemIdx < tourObj.menus[tmIdx].menuItem.length; itemIdx++) {
688						var thisMenuItem = { };
689						thisMenuItem.type = tourObj.menus[tmIdx].menuItem[itemIdx].type;
690						thisMenuItem.is_enhancement = thisMenuItem.type === 'Enhancements';
691						thisMenuItem.is_winelist = thisMenuItem.type === 'Dessert Wine' || thisMenuItem.type === 'Sparkling' || thisMenuItem.type === 'Sparkling Wine' || thisMenuItem.type === 'Beer' || thisMenuItem.type === 'Red Wine' || thisMenuItem.type === 'White Wine' || thisMenuItem.type === 'Wine' || thisMenuItem.type === 'Beverage' || thisMenuItem.type === 'Specialty Cocktails' || thisMenuItem.type === 'Spirits' || thisMenuItem.type === 'Non - Alcoholic Beverage'  ? true : false;
692						thisMenuItem.subItem = tourObj.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
693						thisMenuItem.subItem = tourObj.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
694						thisMenuItem.title = tourObj.menus[tmIdx].menuItem[itemIdx].translations.en.title;
695						thisMenuItem.description = tourObj.menus[tmIdx].menuItem[itemIdx].translations.en.description;
696						thisMenuItem.clean_desc = thisMenuItem.description ? thisMenuItem.description.replace(/<p>/gi, '<span>').replace(/<\/p>/gi, '</span>').replace(/<(?!\/?(h3|h4|i|br|strong|em|span)\b)[^>]+>/gi, "") : '';
697						var thisDietary = tourObj.menus[tmIdx].menuItem[itemIdx].menuItemDietary || [];
698						var thisDietaryCode = [];
699						for(var dietIdx=0; dietIdx < thisDietary.length; dietIdx++) {
700							thisDietary[dietIdx] = thisDietary[dietIdx].replace(" ", "-");
701							thisDietaryCode[dietIdx] = thisDietary[dietIdx] === 'Gluten-Free' ? 'G*' : (thisDietary[dietIdx] === 'Nuts' ? 'N' : (thisDietary[dietIdx] === 'Vegan' ? 'VG' : (thisDietary[dietIdx] === 'Vegetarian' ? 'V' : '')));
702						}
703						thisMenuItem.dietary = thisDietary;
704						thisMenuItem.dietaryCode = thisDietaryCode;
705						thisMenuItem.has_dietary = thisDietary.length > 0;
706						thisMenuItem.show_type = false;
707						thisMenuItem.has_subItem = (!thisMenuItem.subItem || 0 === thisMenuItem.subItem.length ? false : true);
708						if(thisMenuType == thisMenuItem.type) {
709							menuPckg.groupMenu[menuPckg.groupMenu.length-1].push(thisMenuItem);
710						} else {
711							thisMenuItem.show_type = true;
712							menuPckg.groupMenu[groupMenuIndex] = [];
713							menuPckg.groupMenu[groupMenuIndex].push(thisMenuItem);
714							groupMenuIndex = menuPckg.groupMenu.length;
715							thisMenuType = thisMenuItem.type;
716						}
717					}
718					tourObj.tourMenus.push(menuPckg);
719				}
720			}
721		}
722		tourObj.is_single_menu = tourObj.tourMenus.length <= 1 ? true : false;
723		//console.log('tourObj', tourObj);
724
725		if(thisIsExperience) {
726			tourObj.tour_state = tourObj.settings.activityState;
727			tourObj.tour_state_name = tourObj.settings.activityStateName;
728			tourObj.tour_country = tourObj.settings.activityCountry;
729			tourObj.highlights = tourObj.localizedInfo.en.shortDescription;
730			tourObj.has_highlights = (tourObj.highlights || '').replace(/(<([^>]+)>)/ig,"").length ? true : false;
731			
732			tourObj.reviewCount = parseInt(tourObj.settings.reviewCount);
733			tourObj.reviewCountStr = tourObj.reviewCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
734			tourObj.reviewCountWithS = tourObj.reviewCount > 1 ? 's' : '';
735			tourObj.rating = parseFloat(tourObj.settings.rating);
736			tourObj.ratingStr = roundedToFixed(tourObj.rating, 1);
737			tourObj.inclusions = tourObj.localizedInfo.en.whatYouGet || '';
738			tourObj.has_inclusions = tourObj.inclusions.length > 0 ? true : false;
739			tourObj.exclusions = tourObj.localizedInfo.en.exclusions || '';
740			tourObj.exclusions = isJson(tourObj.exclusions) ? jsonToListHTML(tourObj.exclusions) : tourObj.exclusions;
741			tourObj.has_exclusions = tourObj.exclusions.length > 0 ? true : false;
742			tourObj.essentialInfo = tourObj.localizedInfo.en.dressCode;
743			tourObj.reviews = tourObj.settings.reviews !== undefined ? JSON.parse(tourObj.settings.reviews) : [];
744			tourObj.reviews = !tourObj.reviews ? [] : tourObj.reviews.slice(0,10);
745			tourObj.has_exp_reviews = false && tourObj.reviews.length > 0;		// force to false to hide review
746			tourObj.departurePoint = tourObj.settings.departurePoint || '';
747			tourObj.has_departurePoint = tourObj.departurePoint.length > 0;
748			tourObj.duration = getDurationStr(parseInt(tourObj.settings.duration));
749			tourObj.has_duration = tourObj.duration.length > 0;
750			tourObj.departureTime = tourObj.settings.departureTime || '';
751			tourObj.has_departureTime = tourObj.departureTime.length > 0;
752			tourObj.returnDetails = tourObj.settings.returnDetails || '';
753			tourObj.has_returnDetails = tourObj.returnDetails.length > 0;
754			tourObj.has_whereToMeet = tourObj.has_departurePoint || tourObj.has_duration || tourObj.has_departureTime || tourObj.has_details;
755			tourObj.departureTimeLabel = tourObj.settings.showDepartureTimeAsLabel === 'true' ? 'Departure Time' : 'Hours of Operation';
756			tourObj.itinerarySchedule = tourObj.settings.itinerarySchedule || '';
757			tourObj.has_itinerarySchedule = tourObj.itinerarySchedule.length > 0;
758			tourObj.pdfUrl = tourObj.settings.pdfUrl || '';
759			tourObj.has_pdfURL = tourObj.pdfUrl.length > 0 ? true : false;
760			tourObj.pdfUrl_prefix = 'https://prodv3-hornblower-assets.s3.us-west-2.amazonaws.com/';
761			for(var revIdx=0; revIdx < tourObj.reviews.length; revIdx++) {
762				var revDate = tourObj.reviews[revIdx].publishedDate.split('-');
763				tourObj.reviews[revIdx].dateStr = month3Str[revDate[1]] + ' ' + revDate[0];
764				populateStars(tourObj.reviews[revIdx], tourObj.reviews[revIdx].rating);
765			}
766			try {
767				var expUtag = { 
768					supplier_id: myObj.settings.supplierCode, 
769					supplier_name: myObj.settings.supplierName,
770					supplier_country: myObj.settings.supplierCountry,
771					supplier_city: myObj.city,
772					supplier_location_id: myObj.settings.supplierDestinationId,
773					supplier_currency: 'USD',
774					supplier_connection: 'API',
775					supplier_connectivity_partner: myObj.propertyId,
776					supplier_status: 'Active',
777					supplier_state: myObj.settings.supplierState,
778					product_title: myObj.localizedInfo.en.title,
779					hbx_product_id: myObj.bookingTypeId,
780					product_country: myObj.settings.activityCountry,
781					product_city: myObj.settings.activityCity,
782					product_location_id: myObj.settings.primaryDestinationId,
783					cancellation_policy: myObj.settings.termsAndConditions,
784					cut_off: myObj.settings.duration,
785					product_status : 'Active',
786					product_retail_rate: myObj.settings.displayPrice,
787					product_reference_code: myObj.settings.activityCode,
788					general_category: myObj.categories,
789					general_languages: myObj.localizedInfo.locale,
790				}
791				utag.link(expUtag);
792			}
793			catch(err) {
794				console.log('utag not defined');
795			}
796		}
797
798	}
799    return tourObj;
800}
801
802function translatedTourTitles(myObj) {
803	myObj.settings.is_custom_label_dress_code = myObj.settings.is_custom_label_dress_code || false;
804	myObj.translated_title = {
805		overview: 'Overview',
806		includes: 'Includes',
807		excludes: 'Excludes',
808		schedule: 'Schedule',
809		where_to_meet: 'Where to Meet',
810		dress_code: 'Dress Code',
811		duration_of: 'Duration of',
812		maximum_abbreviation: 'Max',
813		view_dining_menu: 'View Dining Menu',
814		highlights: 'Highlights',
815		essential_info: 'Additional Information',
816		departure_point_entrance: 'Departure Point/Entrance',
817		departure_time: 'Departure Time',
818		why_take_this_tour: 'Why take this tour?',
819		know_before_you_book: 'Important Information',
820		whats_included: 'What\'s Included',
821		meeting_point: 'Meeting Point',
822		end_point: 'End Point',
823		about_this_experience: 'About this Experience',
824		extras_upgrades: 'Extras/Upgrades',
825		additional_info: 'Additional Info',
826		likely_to_sell_out: 'Likely to Sell Out',
827		double_reward_points: '2X Reward Points',
828		complimentary_souvenir: 'Complimentary Souvenir',
829		recyclable_mist_poncho: 'Recyclable mist poncho',
830		booking_widget_from: 'From',
831		booking_widget_check_availability: 'Check Availability',
832		read_more: '...Read More',
833		show_less: ' Show Less',
834		reviews: 'Reviews',
835		related_tours: 'Related Tours',
836		upgrade_experience: 'Upgrade Experience',
837		faqs: 'FAQs',
838		book_now: 'Book Now',
839		packages: 'Packages',
840		essential_information: 'Essential Info',
841		extras_and_upgrades: 'Extras & Upgrades',
842		inclusions: 'Inclusions',
843		use_dress_code: 'Dress Code',
844		package_deal_available: 'Package Deal Available',
845		cancellation_ticket_assurance: 'Free Cancellation with Ticket Assurance',
846		free_cancellation: 'Free Cancellation',
847		cancellation_policy: 'Cancellation Policy',
848		two_hours_advance: 'Up to 2 hours in advance',
849		twentyfour_hours_advance: 'Up to 24 hours in advance',
850		learn_more: 'Learn More',
851		group_rates_available: 'Group Rates Available',
852		group_special_rates: 'Special rates for groups of 20 or more',
853		start_planning: 'Start Planning',
854		unforgettable_experience: 'Unforgettable Experiences',
855		iconic_experiences: 'Iconic and one-of-a-kind experiences',
856		expert_tour_guides: 'Expert Tour Guides',
857		local_and_friendly: 'Local, friendly and experts on the city they love',
858		special_access_tour: 'Special Access Tour',
859		liberty_ellis_island: 'Admission to the grounds of Liberty Island and Ellis Island',
860		sightseeing_adventure: 'A Sightseeing Adventure',
861		see_alcatraz: 'See Alcatraz, the Golden Gate Bridge, Fort Point, and more!',
862		admission_alcatraz: 'Admission to Alcatraz Island included',
863		book_with_confidence: 'Book with Confidence',
864		book_securely: 'Book Securely',
865		pay_with_affirm: 'Pay Over Time with Affirm',
866		pay_over_time_affirm: 'For orders over $50, pay over time in four installments.',
867		we_use_ssl_encryption: 'Book Securely',
868		customer_support: 'Customer Support',
869		having_trouble: 'Having trouble? We\'re here to help. Call, chat, or email us.',
870		flexible_booking: 'Flexible Booking',
871		manage_your_booking_change_easily: 'Manage your booking and make changes easily right from your account. Available on most experiences.',
872		ticket_assurance: 'Ticket Assurance',
873		reschedule_refund_reservation: 'Reschedule or refund your reservation up to 2 hours prior to boarding time with Ticket Assurance.  Not available on select experiences including special events, holidays or partner tours.',
874		save_by_bundling: 'Save Up to 20% by Bundling!',
875		view_package: 'View Package',
876		onboard_ticket_purchases: 'Ticket purchases can only be made onboard.',
877		tour_itinerary: 'Tour Itinerary',
878		bogo_headline: 'Buy One, Get One Free Ticket!',
879		bogo_description: 'Restricted to Bay Area residents on select dates. Add a pair of tickets to cart to receive BOGO. Discount will apply at checkout.',
880		additional_fees: 'fees',
881		additional_fees_included: 'All admin and port fees included',
882		additional_fees_and_taxes_included: 'All admin and port fees included'
883	};
884	if(myObj.settings.is_custom_label_dress_code) {
885		myObj.translated_title.dress_code = myObj.settings.custom_label_dress_code || myObj.translated_title.dress_code;
886	}
887	myObj.translated_title.overview = jQuery('.translation-wrapper .lang-overview').html();
888	myObj.translated_title.includes = jQuery('.translation-wrapper .lang-includes').html();
889	myObj.translated_title.excludes = jQuery('.translation-wrapper .lang-excludes').html();
890	myObj.translated_title.offers = jQuery('.translation-wrapper .lang-offers').html();
891	myObj.translated_title.schedule = jQuery('.translation-wrapper .lang-schedule').html();
892	myObj.translated_title.where_to_meet = jQuery('.translation-wrapper .lang-where-to-meet').html();
893	myObj.translated_title.duration_of = jQuery('.translation-wrapper .lang-duration').html();
894	myObj.translated_title.maximum_abbreviation = jQuery('.translation-wrapper .lang-maximum-abbreviation').html();
895	myObj.translated_title.view_dining_menu = jQuery('.translation-wrapper .lang-view-dining-menu').html();
896	myObj.translated_title.highlights = jQuery('.translation-wrapper .lang-highlights').html();
897	myObj.translated_title.essential_info = jQuery('.translation-wrapper .lang-essential-info').html();
898	myObj.translated_title.departure_point_entrance = jQuery('.translation-wrapper .lang-departure-point-entrance').html();
899	myObj.translated_title.departure_time = jQuery('.translation-wrapper .lang-departure-time').html();
900	myObj.departureTimeLabel = jQuery('.translation-wrapper .lang-departure-time').html();
901	myObj.translated_title.why_take_this_tour = jQuery('.translation-wrapper .lang-why-take-this-tour').html();
902	myObj.translated_title.know_before_you_book = jQuery('.translation-wrapper .lang-know-before-you-book').html();
903	myObj.translated_title.whats_included = jQuery('.translation-wrapper .lang-whats-included').html();
904	myObj.translated_title.meeting_point = jQuery('.translation-wrapper .lang-meeting-point').html();
905	myObj.translated_title.end_point = jQuery('.translation-wrapper .lang-end-point').html();
906	myObj.translated_title.featured_experience = jQuery('.translation-wrapper .lang-featured-experience').html();
907	myObj.translated_title.recent_bookings = jQuery('.translation-wrapper .lang-recent-bookings').html();
908	myObj.translated_title.share_this = jQuery('.translation-wrapper .lang-share-this').html();
909	myObj.translated_title.check_availability = jQuery('.translation-wrapper .lang-check-availability').html();
910	myObj.translated_title.last_minute_deals = jQuery('.translation-wrapper .lang-last-minute-deals').html();
911	myObj.translated_title.save_now = jQuery('.translation-wrapper .lang-save-now').html();
912	myObj.translated_title.new_tour = jQuery('.translation-wrapper .lang-new-tour').html();
913	myObj.translated_title.about_this_experience = jQuery('.translation-wrapper .lang-about-this-experience').html();
914	myObj.translated_title.extras_upgrades = jQuery('.translation-wrapper .lang-extras-upgrades').html();
915	myObj.translated_title.additional_info = jQuery('.translation-wrapper .lang-additional-info').html();
916	myObj.translated_title.likely_to_sell_out = jQuery('.translation-wrapper .lang-likely-to-sell-out').html();
917	myObj.translated_title.double_reward_points = jQuery('.translation-wrapper .lang-double-reward-points').html();
918	myObj.translated_title.complimentary_souvenir = jQuery('.translation-wrapper .lang-complimentary-souvenir').html();
919	myObj.translated_title.recyclable_mist_poncho = jQuery('.translation-wrapper .lang-recyclable-poncho').html();
920	myObj.translated_title.booking_widget_from = jQuery('.translation-wrapper .lang-booking-widget-from').html();
921	myObj.translated_title.booking_widget_check_availability = jQuery('.translation-wrapper .lang-booking-widget-check-availability').html();
922	myObj.translated_title.read_more = jQuery('.translation-wrapper .lang-read-more').html();
923	myObj.translated_title.show_less = jQuery('.translation-wrapper .lang-show-less').html();
924	myObj.translated_title.reviews = jQuery('.translation-wrapper .lang-reviews').html();
925	myObj.translated_title.related_tours = jQuery('.translation-wrapper .lang-related-tours').html();
926	myObj.translated_title.upgrade_experience = jQuery('.translation-wrapper .lang-upgrade-experience').html();
927	myObj.translated_title.faqs = jQuery('.translation-wrapper .lang-faqs').html();
928	myObj.translated_title.book_now = jQuery('.translation-wrapper .lang-book-now').html();
929	myObj.translated_title.packages = jQuery('.translation-wrapper .lang-packages').html();
930	myObj.translated_title.essential_information = jQuery('.translation-wrapper .lang-essential-information').html();
931	myObj.translated_title.cancellation_policy = jQuery('.translation-wrapper .lang-cancellation-policy').html();
932	myObj.translated_title.extras_and_upgrades = jQuery('.translation-wrapper .lang-extras-and-upgrades').html();
933	myObj.translated_title.inclusions = jQuery('.translation-wrapper .lang-inclusions').html();
934	myObj.translated_title.use_dress_code = jQuery('.translation-wrapper .lang-dress-code').html();
935	myObj.translated_title.package_deal_available = jQuery('.translation-wrapper .lang-package-deal-available').html();
936	myObj.translated_title.cancellation_ticket_assurance = jQuery('.translation-wrapper .lang-cancellation-ticket-assurance').html();
937	myObj.translated_title.free_cancellation = jQuery('.translation-wrapper .lang-free-cancellation').html();
938	myObj.translated_title.two_hours_advance = jQuery('.translation-wrapper .lang-two-hours-advance').html();
939	myObj.translated_title.twentyfour_hours_advance = jQuery('.translation-wrapper .lang-twentyfour
939-hours-advance').html();
940	myObj.translated_title.learn_more = jQuery('.translation-wrapper .lang-learn-more').html();
941	myObj.translated_title.group_rates_available = jQuery('.translation-wrapper .lang-group-rates-available').html();
942	myObj.translated_title.group_special_rates = jQuery('.translation-wrapper .lang-group-special-rates').html();
943	myObj.translated_title.start_planning = jQuery('.translation-wrapper .lang-start-planning').html();
944	myObj.translated_title.unforgettable_experience = jQuery('.translation-wrapper .lang-unforgettable-experience').html();
945	myObj.translated_title.iconic_experiences = jQuery('.translation-wrapper .lang-iconic-experiences').html();
946	myObj.translated_title.expert_tour_guides = jQuery('.translation-wrapper .lang-expert-tour-guides').html();
947	myObj.translated_title.local_and_friendly = jQuery('.translation-wrapper .lang-local-and-friendly').html();
948	myObj.translated_title.special_access_tour = jQuery('.translation-wrapper .lang-special-access-tour').html();
949	myObj.translated_title.liberty_ellis_island = jQuery('.translation-wrapper .lang-liberty-ellis-island').html();
950	myObj.translated_title.sightseeing_adventure = jQuery('.translation-wrapper .lang-sightseeing-adventure').html();
951	myObj.translated_title.see_alcatraz = jQuery('.translation-wrapper .lang-see-alcatraz').html();
952	myObj.translated_title.admission_alcatraz = jQuery('.translation-wrapper .lang-admission-alcatraz').html();
953	myObj.translated_title.book_with_confidence = jQuery('.translation-wrapper .lang-book-with-confidence').html();
954	myObj.translated_title.book_securely = jQuery('.translation-wrapper .lang-book-securely').html();
955	myObj.translated_title.pay_with_affirm = jQuery('.translation-wrapper .lang-pay-with-affirm').html();
956	myObj.translated_title.pay_over_time_affirm = jQuery('.translation-wrapper .lang-pay-over-time-affirm').html();
957	myObj.translated_title.we_use_ssl_encryption = jQuery('.translation-wrapper .lang-we-use-ssl-encryption').html();
958	myObj.translated_title.customer_support = jQuery('.translation-wrapper .lang-customer-support').html();
959	myObj.translated_title.having_trouble = jQuery('.translation-wrapper .lang-having-trouble-here-to-help').html();
960	myObj.translated_title.flexible_booking = jQuery('.translation-wrapper .lang-flexible-booking').html();
961	myObj.translated_title.manage_your_booking_change_easily = jQuery('.translation-wrapper .lang-manage-your-booking-change-easily').html();
962	myObj.translated_title.ticket_assurance = jQuery('.translation-wrapper .lang-ticket-assurance').html();
963	myObj.translated_title.reschedule_refund_reservation = jQuery('.translation-wrapper .lang-reschedule-refund-reservation').html();
964	myObj.translated_title.save_by_bundling = jQuery('.translation-wrapper .lang-save-by-bundling').html();
965	myObj.translated_title.view_package = jQuery('.translation-wrapper .lang-view-package').html();
966	myObj.translated_title.onboard_ticket_purchases = jQuery('.translation-wrapper .lang-onboard-ticket-purchases').html();
967	myObj.translated_title.tour_itinerary = jQuery('.translation-wrapper .lang-tour-itinerary').html();
968	myObj.translated_title.bogo_headline = jQuery('.translation-wrapper .lang-bogo-headline').html();
969	myObj.translated_title.bogo_description = jQuery('.translation-wrapper .lang-bogo-description').html();
970	myObj.translated_title.alcatraz_sold_out_usp_headline = jQuery('.translation-wrapper .lang-alcatraz-sold-out-headline').html();
971	myObj.translated_title.alcatraz_sold_out_usp_description = jQuery('.translation-wrapper .lang-alcatraz-sold-out-description').html();
972	myObj.translated_title.alcatraz_bay_discovery_usp_headline = jQuery('.translation-wrapper .lang-alcatraz-bay-discovery-headline').html();
973	myObj.translated_title.alcatraz_bay_discovery_usp_description = jQuery('.translation-wrapper .lang-alcatraz-bay-discovery-description').html();
974	myObj.translated_title.berkeley_nearby_options_usp_headline = jQuery('.translation-wrapper .lang-berkeley-nearby-options-usp-headline').html();
975	myObj.translated_title.berkeley_nearby_options_usp_description = jQuery('.translation-wrapper .lang-berkeley-nearby-options-usp-description').html();
976	myObj.translated_title.additional_fees = jQuery('.translation-wrapper .lang-additional-fees').html();
977	myObj.translated_title.additional_fees_included = jQuery('.translation-wrapper .lang-additional-fees-included').html();
978	myObj.translated_title.additional_fees_and_taxes_included = jQuery('.translation-wrapper .lang-additional-fees-and-taxes-included').html();
979	
980	if(myObj.translated_title.dress_code === 'Essential Info') {
981		myObj.translated_title.dress_code = jQuery('.translation-wrapper .lang-essential-info').html();
982	} else {
983		myObj.translated_title.dress_code = jQuery('.translation-wrapper .lang-dress-code').html();
984	}
985	
986	
987	
988	if ( myObj.duration === 'Less than an hour' ) {
989		myObj.duration = jQuery('.translation-wrapper .lang-less-than-an-hour').html();
990	} else if ( myObj.duration === 'A few hours' ) {
991		myObj.duration = jQuery('.translation-wrapper .lang-a-few-hours').html();
992	}
992 else if(myObj.duration === '3.5 hours') {
993		myObj.duration = jQuery('.translation-wrapper .lang-3-half-hours').html();
994	} else if (myObj.duration === 'One hour' ) {
995		myObj.duration = jQuery('.translation-wrapper .lang-one-hour').html();
996	} else if (myObj.duration.indexOf('hours') > 0 ) {
997		myObj.duration = myObj.duration.replace('hours', jQuery('.translation-wrapper .lang-hours').html());
998	} else if (myObj.duration === '5 hours') {
999		myObj.duration = jQuery('.translation-wrapper .lang-5-hours').html();
1000	} else if (myObj.duration === '4 hours') {
1001		myObj.duration = jQuery('.translation-wrapper .lang-4-hours').html();
1002	} else if(myObj.duration === '3 hours') {
1003		myObj.duration = jQuery('.translation-wrapper .lang-3-hours').html();
1004	}
1005	
1006	
1007}
1008
1009function getDurationStr2(mins) {
1010	var days = 0;
1011	var hours = 0;
1012	if(parseInt(mins / 1440)) {
1013		days = parseInt(mins / 1440);
1014		mins = mins % 1440;
1015	}
1016	if(parseInt(mins / 60)) {
1017		hours = parseInt(mins / 60);
1018		mins = mins % 60;
1019	}
1020	var decimalMin = parseFloat(mins / 60);
1021	if(mins > 0) {
1022		hours += decimalMin;
1023	}
1024	hours = hours.toFixed(2); // Limit decimal to 2 places
1025	var hourString = hours === '1' ? ' hour' : ' hours';
1026	return (days > 0 ? days + ' days ' : '') + (hours > 0 ? hours + hourString : '');
1027}
1028
1029function loadInhouseShareV2(myObj) {
1030	//console.log('loadInhouseShareV2', myObj);
1031	var shareImg = myObj.assetURL + '600x315/'  + myObj.main_image_url;
1032	var shareTitle = decodeURIComponent(myObj.title);
1033	jQuery('head').append('<meta property="og:image" content="'+shareImg+'" />');
1034	jQuery('#my-inhouse-buttons a').on('click', function(e) {
1035		var foundShareLink = false;
1036		var shareLink = '';
1037		var shareUrl = decodeURIComponent(location.href);
1038		if(jQuery(this).hasClass('fb')) {
1039			foundShareLink = true;
1040			shareLink = 'https://www.facebook.com/sharer/sharer.php?u=' + shareUrl;
1041		} else if(jQuery(this).hasClass('tw')) {
1042			foundShareLink = true;
1043			shareLink = 'https://twitter.com/intent/tweet?text='+shareTitle+'&url=' + shareUrl;
1044		} else if(jQuery(this).hasClass('pi')) {
1045			foundShareLink = true;
1046			shareLink = 'https://www.pinterest.com/pin-builder/?description='+shareTitle+'&media='+shareImg+'&url=' + shareUrl;
1047		} else if(jQuery(this).hasClass('in')) {
1048			foundShareLink = true;
1049			shareLink = 'https://www.linkedin.com/sharing/share-offsite/?url=' + shareUrl;
1050		}
1051		if(foundShareLink) {
1052			window.open ( shareLink, 'inhouseshare', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=800,height=600' );
1053		}
1054		e.preventDefault();
1055	});
1056}
1057
1058function switchToCheckoutNow(isCheckoutMode) {
1059    if(isCheckoutMode) {
1060        jQuery('a.checkout-now-link').removeClass('hide');
1061        jQuery('a.check-availability-link').addClass('hide');
1062    }
1063}
1064
1065
1066var loadSdkV2Interval;
1067var loadedSdkV2Interval = false;
1068
1069function launch_sdkv2IntervalUp(myObj) {
1070	clearInterval(loadSdkV2Interval);
1071	loadedSdkV2Interval = true;
1072	if(jQuery('#hb-commerce-sdk-root').html().length === 0) {
1073		launch_sdkv2(myObj);
1074	}
1075}
1076
1077function prep_launch_sdkv2(myObj) {
1078	//console.log('prep_launch_sdkv2', myObj);
1079	jQuery('a.ce-book-now-action').on('click', function(e) {
1080		e.preventDefault();
1081		goToAnchor('#cart-container');
1082		jQuery('#cart-container').removeClass('make-height-0px');
1083		console.log('loadSdkV2Interval', loadedSdkV2Interval);
1084		if(!loadedSdkV2Interval) {
1085			loadedSdkV2Interval = true;
1086			clearInterval(loadSdkV2Interval);
1087			launch_sdkv2(myObj);
1088		}
1089	});
1090
1091	if(!(myObj.settings.load_sdk_on_click || false)) {
1092		loadedSdkV2Interval = true;
1093		launch_sdkv2(myObj);
1094	} else {
1095		loadSdkV2Interval = setInterval(launch_sdkv2IntervalUp, 7000, myObj);
1096	}
1097}
1098
1099function launch_sdkv2(myObj) {
1100	myObj.curLang = getPageTranslation();
1101	myObj.checkoutLang = myObj.curLang;
1102	var curSettings = myObj.settings;
1103	myObj.settings = jQuery.extend( myObj.tourSdk.unavailable[0].settings, curSettings);
1104	myObj.chatkey = getUrlParam('chatkey', '');
1105	myObj.settings.enableQuickAddInRecommendedTours = myObj.settings.enableQuickAddInRecommendedTours || true;
1106	if(myObj.settings.specialDayEvent === "false") {
1107		myObj.settings.specialDayEvent = false;
1108	}
1109	myObj.inlineStyles = {
1110		'.CalendarDay__similar_exp_dot': {
1111			'color': '#5C7EC2 !important',
1112			'border': 'unset !important',
1113			'fontSize': '10px !important'
1114		},
1115		'.CalendarDay__similar_exp_dot_selected': {
1116			'color': '#fff !important',
1117			'border': 'unset !important',
1118			'fontSize': '10px !important'
1119		},
1120		'.CalendarDay__special_digit': {
1121			'color': '#999999 !important',
1122			'fontWeight': '400 !important'
1123		},
1124		'.CalendarDay__blocked_calendar .CalendarDigit': {
1125			'color': '#999999 !important'
1126		}
1127	}
1128	myObj.flagStruct = {
1129		cartMode: myObj.settings.cartMode,
1130		showCheckoutBtnNextToAddToCart: myObj.settings.showCheckoutBtnNextToAddToCart || false,
1131		preselectionMode: myObj.settings.preselectionMode,
1132		viewCheckoutV2: true,
1133		viaEmail: myObj.viaEmail || false,
1134		viaPhone: myObj.viaPhone || false,
1135		showViewCartOnPostAddToCart: myObj.settings.showViewCartOnPostAddToCart || true,
1136		singleFormCheckout: myObj.settings.singleFormCheckout || false,
1137		singleFormCheckoutV3: myObj.singleFormCheckoutV3,
1138		singleFormCheckoutV3Collapse: myObj.settings.singleFormCheckoutV3Collapse,
1139		cartCheckout: {
1140			showRecommendedTours: myObj.settings.show_recommended_tours,
1141			enableQuickAddInRecommendedTours: myObj.settings.enableQuickAddInRecommendedTours,
1142			enableComboTicketUpsell: myObj.settings.enableComboTicketUpsell,
1143		},
1144		oneTrustCookiesCheckEnabled: myObj.oneTrustCookiesCheckEnabled || false,
1145		singleFormCheckoutV3: true,
1146		optimizedTimeSlots: myObj.settings.optimizedTimeSlots || false,
1147		specialDayEvent: myObj.settings.specialDayEvent || false,
1148		specialDayEventId: myObj.settings.specialDayEventId || null,
1149		showAttendeesInCheckout: myObj.settings.showAttendeesInCheckout || false,
1150		chatkey: myObj.chatkey,
1151	};
1152	if(myObj.cartMode) {
1153		myObj.checkoutStr = myObj.checkoutPrefix + myObj.settings.checkout_domain_url + myObj.settings.prepend_checkout_url + myObj.settings.checkout_path_url;
1154	} else {
1155		myObj.checkoutStr = myObj.checkoutPrefix + myObj.settings.checkout_domain_url + myObj.settings.prepend_checkout_url + myObj.settings.checkout_path_url + '?cart=0&bookingTypeId='+myObj.booking_type_id+'&propertyID='+myObj.property_id+'&preselection=';
1156	}
1157	
1158	//myObj.settings.override_currency_to = myObj.settings.override_currency_to || undefined;
1159	//var singleFormCheckoutV3 = myObj.settings.go_to_cart_after_add || myObj.singleFormCheckoutV3 || false;
1160	console.log('launch_sdkv2', myObj);
1161    jQuery('#hb-commerce-sdk-root').html('');
1162	HBCommerce.launch({
1163        propertyId: myObj.property_id,
1164        locale: myObj.checkoutLang,
1165        bookingTypeId: myObj.booking_type_id,
1166        theme: 'cityexperiences',
1167        costRateId: myObj.settings.cost_rate,
1168        flags: myObj.flagStruct,
1169        departureStop: myObj.urlDeparture,
1170        destinationStop: myObj.urlDestination,
1171        departure: myObj.urlDeparture,
1172        destination: myObj.urlDestination,
1173        currency: myObj.settings.override_currency_to,
1174        selectedDate: myObj.urlDate,
1175        selectedTimedTicketTypeId: myObj.urlTimeId,
1176		inlineStyles: myObj.inlineStyles,
1177        onPreselectionComplete: function (event) {
1178            console.log('onPreselectionComplete', event);
1179            var payload = Object.assign({}, event, { costRateId: myObj.settings.cost_rate })
1180            var preselection = encodeURIComponent(JSON.stringify(payload));
1181            window.location = myObj.checkoutStr + preselection;
1182        },
1183		onVwoEvent: function(event) {
1184			console.log('vwo event', { event: JSON.stringify(event) });
1185			const { eventName, data } = (event || {}).payload || {};
1186			console.log('triggering vwo event for', eventName, data);
1187			window.VWO = window.VWO || [];
1188			VWO.event = VWO.event || function () {VWO.push(['event'].concat([].slice.call(arguments)))};
1189		
1190			VWO.event(eventName, data);
1191		},
1192        onCartChange: function(event) {
1193            console.log('onCartChange-launch_sdkv2',event);
1194            var widgetTopOffset = jQuery("#hb-commerce-sdk-root").offset().top;
1195            var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1196            stickyHeaderOffset = 0;
1197            jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset - stickyHeaderOffset } );
1198            var rerenderSdk = (((event || {}).payload || {}).continueShopping || false);
1199            isCheckoutMode = true;
1200            switchToCheckoutNow(isCheckoutMode);
1201            if(rerenderSdk) {
1202                //launch_sdk(myObj);
1203                var redirectURL = window.location.pathname.split('/');
1204                if(redirectURL.length > 2) {
1205                    redirectURL.splice(redirectURL.length - 2, 1);
1206                    //console.log('redirectURL',redirectURL.join('/'));
1207                    window.location.href = redirectURL.join('/');
1208                }
1209            } else {
1210                var cartItems = (((event || {}).payload || {}).cartItems || []);
1211                var totalItemsInCart = cartItems.length;
1212                anchorCartChange(totalItemsInCart);
1213            }
1214			const redirectToCheckout = (((event || {}).payload || {}).redirectToCheckout || false);
1215
1216			if(singleFormCheckoutV3) {
1217				window.location.href = redirectToCheckout ? '/checkout/?cart=1' : '/cart/?added=1';
1218			}			
1219        },
1220        onStageChange: function(event) {
1221            //console.log('onStageChange', event);
1222            try {
1223                if (event && event.payload && event.payload.position && event.payload.position.top) {
1224                    var widgetTopOffset = jQuery("#hb-commerce-sdk-root").offset().top;
1225                    var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1226                    stickyHeaderOffset = 0;
1227                    jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
1228                }
1229            } catch (err) {
1230                console.log("Commerce:onStageChange:error", err);
1231            }
1232        },
1233        onViewCart: function(event) {
1234            //console.log('onViewCart');
1235            // navigate to cart-checkout page url
1236            var sfcParam = '';
1237            if(myObj.settings.singleFormCheckout) {
1238                sfcParam = '&singleFormCheckout=1';
1239            }
1240            if(myObj.settings.showViewCartOnPostAddToCart && viewOnly) {
1241                //console.log('viewOnly', event.payload, viewOnly);
1242                //jQuery('.shopping-cart-wrapper').addClass('open');
1243                //jQuery('body').addClass('overflow-hidden');
1244                //jQuery('#hb-shopping-cart').html('');
1245                //openShoppingCartDrawer();
1246                location.href = '/cart/';
1247            } else {
1248                window.location = myObj.checkoutStr + '?cart=1' + sfcParam;
1249            }
1250        },
1251        onQuickAddToCart: function(evt) {
1252            //console.log('onQuickAddToCart');
1253            var addCartProp = evt.payload || {};
1254            //console.log('onQuickAddToCart', addCartProp);
1255            jQuery('.calendar-drawer-wrapper').addClass('open');
1256            var orderId = addCartProp.cartOrderIdToEdit || null;
1257            addToCartDrawer(addCartProp.propertyId, addCartProp.bookingTypeId, orderId);
1258
1259        },
1260    }, "hb-commerce-sdk-root").then(function (instance) {
1261        _HBCOMMERCEINSTANCE_ = instance;
1262        //console.log('returning', instance);
1263        //jQuery('#hb-commerce-sdk-root').html('');
1264    }).catch(function (err) {
1265        console.log("Error launching commerce sdk", err);
1266    });
1267}
1268
1269var tourInlineStyles = {
1270	".CalendarDay__selected": {
1271		"background": "#146FF8 !important"
1272	},
1273	".quantityIconStyle, .enhancementCircleInside": {
1274		"color": "#146FF8 !important"
1275	},
1276	".timeSlotStyle": {
1277		"backgroundColor": "#146FF8 !important"
1278	},
1279	".addAndContinue": {
1280		"backgroundColor": "#146FF8 !important"
1281	},
1282	".joinWaitList": {
1283		"backgroundColor": "#146FF8 !important"
1284	},
1285	".enhancementCircleIcon, .newCalendarDaySelected, .addToCartBtnNew": {
1286		"backgroundColor": "#146FF8 !important"
1287	},
1288	".newCalendarDaySelected": {
1289		"color": "#ffffff !important",
1290		"background": "#146FF8 !important",
1291		"padding": "4px 0 0 0 !important"
1292	}
1293}
1294
1295function launch_sdk(myObj) {
1296    myObj.settings.override_currency_to = myObj.settings.override_currency_to || undefined;
1297	console.log('launch_sdk-hb-custom-js11', myObj);
1298	//myObj.urlDate = (myObj.settings.force_selected_date || '').length ? myObj.settings.force_selected_date : myObj.urlDate;
1299	var singleFormCheckoutV3 = myObj.settings.go_to_cart_after_add || myObj.singleFormCheckoutV3 || false;
1300	//myObj.flagStruct.useNewCalendarDefaultInCheckout = true;
1301
1302	myObj.inlineStyles = {
1303		'.CalendarDay__similar_exp_dot': {
1304			'color': '#5C7EC2 !important',
1305			'border': 'unset !important',
1306			'fontSize': '10px !important'
1307		},
1308		'.CalendarDay__similar_exp_dot_selected': {
1309			'color': '#fff !important',
1310			'border': 'unset !important',
1311			'fontSize': '10px !important'
1312		},
1313		'.CalendarDay__special_digit': {
1314			'color': '#999999 !important',
1315			'fontWeight': '400 !important'
1316		},
1317		'.CalendarDay__blocked_calendar .CalendarDigit': {
1318			'color': '#999999 !important'
1319		}
1320	}
1321	
1322    jQuery('#hb-commerce-sdk-root').html('');
1323    HBCommerce.launch({
1324        propertyId: myObj.property_id,
1325        locale: myObj.checkoutLang,
1326        bookingTypeId: myObj.booking_type_id,
1327        theme: 'cityexperiences',
1328        costRateId: myObj.settings.cost_rate,
1329		useFrontendV2: getUrlParam('mck', '') === '1' ? '1' : ( (myObj.useFrontendV2 ? '1' : (myObj.settings.useFrontendV2 || '')) ),
1330		hideInitialSkeleton: getUrlParam('mck', '') === '1' ? '1' : ( (myObj.useFrontendV2 ? '1' : (myObj.settings.useFrontendV2 || '')) ),
1331        flags: myObj.flagStruct,
1332		translations: myObj.translations,
1333        departureStop: myObj.urlDeparture,
1334        destinationStop: myObj.urlDestination,
1335        departure: myObj.urlDeparture,
1336        destination: myObj.urlDestination,
1337        currency: myObj.settings.override_currency_to,
1338        selectedDate: myObj.urlDate,
1339        selectedTimedTicketTypeId: myObj.urlTimeId,
1340		ticketSelection: myObj.ticketSelection,
1341		inlineStyles: myObj.inlineStyles,
1342        onPreselectionComplete: function (event) {
1343            console.log('onPreselectionComplete', event);
1344            var payload = Object.assign({}, event, { costRateId: myObj.settings.cost_rate })
1345            var preselection = encodeURIComponent(JSON.stringify(payload));
1346			if(myObj.settings.replacePreselection || false) {
1347				var preselection = JSON.stringify(payload).replaceAll('"', 'dbqt').replaceAll('{', 'opcb').replaceAll('}', 'clcb');
1348				//preselection = newPreselection;
1349				console.log('preselection-new3', preselection);
1350				console.log('myObj.checkoutStr', myObj.checkoutStr);
1351				//this is pending
1352			}
1353			window.location = myObj.checkoutStr + preselection;
1354        },
1355		onVwoEvent: function(event) {
1356			console.log('receiving vwo event', { event: JSON.stringify(event) });
1357			const { eventName, data } = (event || {}).payload || {};
1358			localStorage.setItem('toTriggerVwoEvent', JSON.stringify({ eventName, data }));
1359			
1360			//console.log('triggering vwo event for', eventName, data);
1361			//window.VWO = window.VWO || [];
1362			//VWO.event = VWO.event || function () {VWO.push(['event'].concat([].slice.call(arguments)))};
1363			//VWO.event(eventName, data);
1364		},
1365        onCartChange: function(event) {
1366            //console.log('onCartChange',event);
1367            var widgetTopOffset = jQuery("#hb-commerce-sdk-root").offset().top;
1368            var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1369            stickyHeaderOffset = 0;
1370            jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset - stickyHeaderOffset } );
1371            var rerenderSdk = (((event || {}).payload || {}).continueShopping || false);
1372            isCheckoutMode = true;
1373            switchToCheckoutNow(isCheckoutMode);
1374			console.log('rerenderSdk',rerenderSdk);
1375            if(rerenderSdk) {
1376                //launch_sdk(myObj);
1377                var redirectURL = window.location.pathname.split('/');
1378				console.log('rerenderSdk',redirectURL);
1379                if(redirectURL.length > 2) {
1380                    redirectURL.splice(redirectURL.length - 2, 1);
1381                    //console.log('redirectURL',redirectURL.join('/'));
1382                    window.location.href = redirectURL.join('/');
1383                }
1384            } else {
1385                var cartItems = (((event || {}).payload || {}).cartItems || []);
1386                var totalItemsInCart = cartItems.length;
1387                anchorCartChange(totalItemsInCart);
1388            }
1389			if(singleFormCheckoutV3) {
1390				console.log('receiving vwo event from onCartChange function', { event: JSON.stringify(event) });
1391				const data = (event || {}).payload?.vwo?.payload || {}; // Safely access event.payload.vwo.payload
1392				const eventName = 'addToCartSdk'; // Set your custom event name
1393				localStorage.setItem('onCartChangeTriggerVwoEvent', JSON.stringify({ eventName, data }));
1394
1395				const redirectToCheckout = (((event || {}).payload || {}).redirectToCheckout || false);
1396				const toPath = redirectToCheckout ? '/checkout/?cart=1' : ( !(myObj.settings.is_devshop || false) ? '/cart/?added=1' : myObj.settings.devshop_shopping_cart_url + '?added=1');
1397				window.location.href = toPath;
1398			}
1399        },
1400        onStageChange: function(event) {
1401            //console.log('onStageChange', event);
1402            try {
1403                if (event && event.payload && event.payload.position && event.payload.position.top) {
1404                    var widgetTopOffset = jQuery("#hb-commerce-sdk-root").offset().top;
1405                    var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1406                    stickyHeaderOffset = 0;
1407                    jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
1408                }
1409            } catch (err) {
1410                console.log("Commerce:onStageChange:error", err);
1411            }
1412        },
1413        onViewCart: function(event) {
1414            //console.log('onViewCart');
1415            // navigate to cart-checkout page url
1416            var sfcParam = '';
1417            if(myObj.settings.singleFormCheckout) {
1418                sfcParam = '&singleFormCheckout=1';
1419            }
1420            var viewOnly = event.payload.viewOnly || false;
1421            if(myObj.settings.showViewCartOnPostAddToCart && viewOnly) {
1422                //console.log('viewOnly', event.payload, viewOnly);
1423                //jQuery('.shopping-cart-wrapper').addClass('open');
1424                //jQuery('body').addClass('overflow-hidden');
1425                //jQuery('#hb-shopping-cart').html('');
1426                //openShoppingCartDrawer();
1427                location.href = '/cart/';
1428            } else {
1429                window.location = myObj.checkoutStr + '?cart=1' + sfcParam;
1430            }
1431        },
1432        onQuickAddToCart: function(evt) {
1433            console.log('onQuickAddToCart-1', evt.payload.permalink);
1434            var addCartProp = evt.payload || {};
1435            //console.log('onQuickAddToCart', addCartProp);
1436            if( false && getUrlParam('other','') !== '1' && !myObj.settings.openOtherAvailableExperiencesInSameWindow ) {
1437				jQuery('.calendar-drawer-wrapper').addClass('open');
1438				var orderId = addCartProp.cartOrderIdToEdit || null;
1439				addToCartDrawer(addCartProp.propertyId, addCartProp.bookingTypeId, orderId, {}, addCartProp.selectedDate);
1440			} else {
1441				location.href = (evt.payload.permalink || '').length > 0 ? evt.payload.permalink : location.href;
1442			}
1443        },
1444		onContinueToCheckout: function(event) {
1445			console.log('onContinueToCheckout', event);
1446			window.location.href = '/checkout/';
1447		},
1448    }, "hb-commerce-sdk-root").then(function (instance) {
1449        _HBCOMMERCEINSTANCE_ = instance;
1450        //console.log('returning', instance);
1451        //jQuery('#hb-commerce-sdk-root').html('');
1452    }).catch(function (err) {
1453        console.log("Error launching commerce sdk", err);
1454    });
1455
1456
1457    window.addEventListener("scroll", function(event) {
1458        var top = this.scrollY,
1459            left =this.scrollX;
1460        var topOffsetVal = parseInt(window.innerHeight / 2);
1461        var bottomOffsetVal = parseInt(window.innerHeight / 2);
1462        var tourCalTop = jQuery('#hb-commerce-sdk-root').offset().top - topOffsetVal;
1463        var tourCalBottom = tourCalTop + jQuery('#hb-commerce-sdk-root').height();
1464        if(top > tourCalTop && top < tourCalBottom) {
1465            if(myObj.isCheckoutMode) {
1466                jQuery('a.checkout-now-link').addClass('collapse');
1467            } else {
1468                jQuery('a.check-availability-link').addClass('collapse');
1469            }
1470        } else {
1471            if(myObj.isCheckoutMode) {
1472                jQuery('a.checkout-now-link').removeClass('collapse');
1473            } else {
1474                jQuery('a.check-availability-link').removeClass('collapse');
1475            }
1476        }
1477        //if()
1478        //console.log('top', top, tourCalTop, tourCalBottom, topOffsetVal, bottomOffsetVal);
1479    }, false);
1480    jQuery('a.checkout-now-link').on('click', function(e) {
1481        e.preventDefault();
1482        var sfcParam1 = '';
1483        if(myObj.settings.singleFormCheckout) {
1484            sfcParam1 = '&singleFormCheckout=1';
1485        }
1486        window.location = myObj.checkoutStr + '?cart=1' + sfcParam1;
1487    });
1488}
1489
1490function launch_sdk_allOptions(myObj) {
1491    myObj.settings.override_currency_to = myObj.settings.override_currency_to || undefined;
1492	console.log('launch_sdk-hb-custom-js-all-options', myObj);
1493	var singleFormCheckoutV3 = myObj.settings.go_to_cart_after_add || myObj.singleFormCheckoutV3 || false;
1494	myObj.allOptionsPage = myObj.settings.allOptionsPage || false;
1495	if(myObj.allOptionsPage) {
1496		myObj.allOptionsTickets = parseInt(getUrlParam('allOptionsTickets', 0));
1497		//myObj.allOptionsChild = parseInt(getUrlParam('allOptionsChild', 0));
1498		myObj.allOptionsDate = decodeURIComponent(getUrlParam('allOptionsDate', ''));
1499		myObj.allOptionsProps = {
1500			"enableAllOptions": true,
1501			"date": myObj.allOptionsDate,
1502			"tickets": myObj.allOptionsTickets,
1503			//"enableCalendar": true,
1504			//"enableTicketSelection": true,
1505			//"child": myObj.allOptionsChild
1506		}
1507	} else {
1508		myObj.allOptionsProps = {}
1509	}
1510
1511	myObj.settings.singleFormCheckout = myObj.singleFormCheckoutV3 ? false : myObj.settings.singleFormCheckout;
1512	myObj.settings.singleFormCheckoutV3Collapse = myObj.singleFormCheckoutV3;
1513	myObj.similarExperiencesV2 = true;
1514	//myObj.lowestFare = parseInt(getUrlParam('lowestFare', 0)) === 1 ? true : false;
1515	//myObj.showLowestFareLink = parseInt(getUrlParam('showLowestFareLink', 0)) === 1 ? true : false;
1516	//myObj.lowestFareCompareOnDisplayPrice = parseInt(getUrlParam('lowestFareCompareOnDisplayPrice', 0)) === 1 ? false : true;
1517	const lowestFareQueryParam = parseInt(getUrlParam('lowestFareForUpcomingEventDays', null)) || (myObj.settings.lowestFareForUpcomingEventDays || 90);
1518	myObj.lowestFareForUpcomingEventDays = lowestFareQueryParam;
1519	myObj.syncDisplayPrice = parseInt(getUrlParam('syncDisplayPrice', 0)) === 1 ? true : false;
1520	myObj.checkoutCalendarLayoutVersion = parseInt(getUrlParam('checkoutCalendarLayoutVersion', 0)) === 1 ? 2 : false;
1521	myObj.showPriceInCalendarForSources = parseInt(getUrlParam('showPriceInCalendarForSources', 0)) === 1 ? "web" : false;
1522	myObj.showCorrespondingTours = parseInt(getUrlParam('showCorrespondingTours', 0)) === 1 ? true : false;
1523	myObj.calendarLoaderTillFinalCalendar = parseInt(getUrlParam('calendarLoaderTillFinalCalendar', 0)) === 1 ? true : false;
1524	myObj.forceHideRedirectToSpecialEventPage = myObj.settings.forceHideRedirectToSpecialEventPage || false;
1525	//myObj.lowestFareForUpcomingEventDays = parseInt(getUrlParam('lowestFareForUpcomingEventDays', 0)) === 45 ? 45 : null;
1526	myObj.openViewMoreByDefault = myObj.settings.openViewMoreByDefault || false;
1527	myObj.addToCartMobileV2 = true;
1528	if(!myObj.settings.hide_affirm_module) {
1529		//affirm.ui.refresh();
1530	}
1531	myObj.chatkey = getUrlParam('chatkey', '');
1532	
1533	getOneTrustSettings(myObj);
1534
1535	if(myObj.settings.specialDayEvent === "false") {
1536		myObj.settings.specialDayEvent = false;
1537	}
1538
1539
1540	myObj.flagStruct = {
1541		cartMode: myObj.cartMode,
1542		showCheckoutBtnNextToAddToCart: myObj.settings.showCheckoutBtnNextToAddToCart,
1543		preselectionMode: myObj.preselectionMode,
1544		viewCheckoutV2: true,
1545		viaEmail: myObj.viaEmail,
1546		viaPhone: myObj.viaPhone,
1547		showViewCartOnPostAddToCart: myObj.settings.showViewCartOnPostAddToCart,
1548		singleFormCheckout: myObj.settings.singleFormCheckout,
1549		singleFormCheckoutV3: myObj.singleFormCheckoutV3,
1550		singleFormCheckoutV3Collapse: myObj.settings.singleFormCheckoutV3Collapse,
1551		cartCheckout: {
1552			showRecommendedTours: myObj.settings.show_recommended_tours,
1553			enableQuickAddInRecommendedTours: myObj.settings.enableQuickAddInRecommendedTours,
1554			enableComboTicketUpsell: myObj.settings.enableComboTicketUpsell,
1555		},
1556		oneTrustCookiesCheckEnabled: myObj.oneTrustCookiesCheckEnabled || false,
1557		singleFormCheckoutV3: true,
1558		optimizedTimeSlots: myObj.settings.optimizedTimeSlots || false,
1559		specialDayEvent: myObj.settings.specialDayEvent || false,
1560		specialDayEventId: myObj.settings.specialDayEventId || null,
1561		specialDayEventBookingTypeId: myObj.settings.specialDayEventBookingTypeId || null,
1562		showAttendeesInCheckout: myObj.settings.showAttendeesInCheckout || false,
1563		chatkey: myObj.chatkey,
1564		similarExperiencesV2: myObj.similarExperiencesV2,
1565		lowestFare: true,
1566		showLowestFareLink: true,
1567		lowestFareForUpcomingEventDays: myObj.lowestFareForUpcomingEventDays,
1568		lowestFareCompareOnDisplayPrice: true,
1569		addToCartMobileV2: myObj.addToCartMobileV2,
1570		syncDisplayPrice: myObj.syncDisplayPrice,
1571		checkoutCalendarLayoutVersion: myObj.checkoutCalendarLayoutVersion,
1572		showPriceInCalendarForSources: myObj.showPriceInCalendarForSources,
1573		handleMultiTabsAddToCart: true,
1574		openViewMoreByDefault: myObj.openViewMoreByDefault,
1575		showHistoricalTrendsFlag: myObj.settings.showHistoricalTrendsFlag || false,
1576		showCorrespondingTours: myObj.showCorrespondingTours,
1577		enableBestAvailableTimeSlot: myObj.settings.enableBestAvailableTimeSlot || false,
1578		hideAddAndContinueInCheckout: true,
1579		calendarLoaderTillFinalCalendar: myObj.calendarLoaderTillFinalCalendar,
1580		forceHideRedirectToSpecialEventPage: myObj.forceHideRedirectToSpecialEventPage,
1581		allOptions: myObj.allOptionsProps,
1582		changeCalendarLayoutV6Flag: true,
1583		specialRequestV2: true
1584	};
1585	var sdk_placeholder_id = 'hb-commerce-sdk-root-' + myObj.sdkContainer;
1586	var sdk_static_tour_info = 'single-tour-wrapper-' + myObj.sdkContainer;
1587	
1588	// Scope to the current instance container
1589	var container = document.getElementById(sdk_static_tour_info);
1590
1591	// Select all .all-options-single-tour-btn i elements within this container
1592	var buttonSpinners = container.querySelectorAll('.all-options-single-tour-btn i');
1593	buttonSpinners.forEach(function(buttonSpinner) {
1594		buttonSpinner.style.display = 'inherit';
1595	});
1596
1597	var tourAvailButtons = container.querySelectorAll('.all-options-single-tour-btn');
1598	// Select all .single-tour-avail elements within this container
1599	var tourAvailElements = container.querySelectorAll('.single-tour-avail');
1600	tourAvailElements.forEach(function(tourAvailElement) {
1601		tourAvailElement.textContent = "Checking Availability ";
1602	});
1603
1604	var singleTourButtons = document.querySelectorAll('.all-options-single-tour-btn');
1605	singleTourButtons.forEach(function(singleTourButton) {
1606		singleTourButton.disabled = true;
1607	});
1608
1609	var singleTourPrices = container.querySelectorAll('.single-tour-display-price-amount');
1610	singleTourPrices.forEach(function(singleTourPrice) {
1611		singleTourPrice.textContent = "";
1612	});
1613
1614	var singleTourPricesContainers = container.querySelectorAll('.single-tour-display-price');
1615	singleTourPricesContainers.forEach(function(singleTourPricesContainer) {
1616		singleTourPricesContainer.classList.add('d-none');
1617	});
1618
1619	var availableTimesContainers = container.querySelectorAll('.available-tour-times');
1620	availableTimesContainers.forEach(function(availableTimesContainer) {
1621		availableTimesContainer.classList.add('d-none');
1622	});
1623
1624	var availableTimes = container.querySelectorAll('.available-times');
1625	availableTimes.forEach(function(availableTime) {
1626		availableTimes.textContent = "";
1627	});
1628	
1629    
1630	jQuery('#' + sdk_placeholder_id).html('');
1631    HBCommerce.launch({
1632        propertyId: myObj.property_id,
1633        locale: myObj.checkoutLang,
1634        bookingTypeId: myObj.booking_type_id,
1635        theme: 'cityexperiences',
1636        costRateId: myObj.settings.cost_rate,
1637        flags: myObj.flagStruct,
1638		translations: myObj.translations,
1639        departureStop: myObj.urlDeparture,
1640        destinationStop: myObj.urlDestination,
1641        departure: myObj.urlDeparture,
1642        destination: myObj.urlDestination,
1643        currency: myObj.settings.override_currency_to,
1644        selectedDate: myObj.urlDate,
1645        selectedTimedTicketTypeId: myObj.urlTimeId,
1646		onFetchOptionTourAvailability: function (event) {
1647			console.log('onFetchOptionTourAvailability', event);
1648			
1649			// Retrieve the the availability of each tour from the payload
1650			var isAvailable = event.payload.isAvailable;
1651			
1652			// Retrieve the the price of each tour from the payload
1653			var fromPrice = event.payload.fromPrice;
1654
1655
1656			// Retrieve the the times of each tour from the payload
1657			var availableTimeSlots = event.payload.availableTimeSlots;
1658			function convertTo12HourFormat(time) {
1659				// Split the time into hours and minutes
1660				var [hours, minutes, seconds] = time.split(":");
1661				hours = parseInt(hours, 10);
1662				// Determine AM or PM suffix
1663				var ampm = hours >= 12 ? "PM" : "AM";
1664				// Convert hours from 24-hour to 12-hour format
1665				hours = hours % 12;
1666				hours = hours ? hours : 12; // Handle 0 as 12 for 12 AM and 12 PM
1667				// Return formatted time without seconds and with AM/PM
1668				return `${hours}:${minutes} ${ampm}`;
1669			}
1670			function compareTimes(time1, time2) {
1671				var [hours1, minutes1, seconds1] = time1.split(":");
1672				var [hours2, minutes2, seconds2] = time2.split(":");
1673				
1674				hours1 = parseInt(hours1, 10);
1675				hours2 = parseInt(hours2, 10);
1676				
1677				// Compare AM/PM status
1678				var isPM1 = hours1 >= 12;
1679				var isPM2 = hours2 >= 12;
1680				
1681				if (isPM1 && !isPM2) return 1;
1682				if (!isPM1 && isPM2) return -1;
1683				
1684				// Compare times within the same AM/PM status
1685				if (hours1 != hours2) return hours1 - hours2;
1686				return minutes1 - minutes2;
1687			}
1688			// Sort times by comparing their values and AM/PM status
1689			var sortedTimeSlots = availableTimeSlots.sort(compareTimes);
1690			// Convert each sorted time slot to the desired format
1691			var formattedTimeSlots = sortedTimeSlots.map(convertTo12HourFormat);
1692			// Join the formatted time slots into a comma-separated string
1693			var timeSlotsString = formattedTimeSlots.join(", ");
1694			//console.log(timeSlotsString); // Output: "8:30 AM, 9:45 AM"
1695
1696
1697
1698			if (container) {
1699				// Update the text content for each element
1700				tourAvailButtons.forEach(function(tourAvailButton) {
1701					tourAvailElements.forEach(function(tourAvailElement) {
1702						if (isAvailable) {
1703							tourAvailElement.textContent = "Book Now";
1704							tourAvailButton.disabled = false;
1705							container.classList.remove('unavailable-tour');
1706							container.classList.add('availability-fetched');
1707							//console.log('tour is available', isAvailable);
1708						} else {
1709							tourAvailElement.textContent = "Date Unavailable - Check Other Dates";
1710							//tourAvailButton.classList.add('sold-out-button');
1711							tourAvailButton.disabled = false;
1712							container.classList.add('unavailable-tour', 'availability-fetched');
1713							//console.log('tour is sold out', isAvailable);
1714						}
1715						// Hide all spinner icons
1716						buttonSpinners.forEach(function(buttonSpinner) {
1717							buttonSpinner.style.display = 'none';
1718						});
1719					});
1720				});
1721				singleTourPrices.forEach(function(singleTourPrice) {
1722					if (fromPrice) {
1723						singleTourPrice.textContent = ("Starting from " + fromPrice);
1724						singleTourPricesContainers.forEach(function(singleTourPricesContainer) {
1725							singleTourPricesContainer.classList.remove('d-none');
1726						});
1727					}
1728				});
1729				availableTimes.forEach(function(availableTime) {
1730					if (timeSlotsString) {
1731						availableTime.textContent = timeSlotsString;
1732						availableTimesContainers.forEach(function(availableTimesContainer) {
1733							availableTimesContainer.classList.remove('d-none');
1734						});
1735					}
1736				});
1737			}
1738		},
1739        onPreselectionComplete: function (event) {
1740            console.log('onPreselectionComplete', event);
1741            var payload = Object.assign({}, event, { costRateId: myObj.settings.cost_rate })
1742            var preselection = encodeURIComponent(JSON.stringify(payload));
1743            window.location = myObj.checkoutStr + preselection;
1744        },
1745		onVwoEvent: function(event) {
1746			console.log('vwo event', { event: JSON.stringify(event) });
1747			const { eventName, data } = (event || {}).payload || {};
1748			console.log('triggering vwo event for', eventName, data);
1749			window.VWO = window.VWO || [];
1750			VWO.event = VWO.event || function () {VWO.push(['event'].concat([].slice.call(arguments)))};
1751		
1752			VWO.event(eventName, data);
1753		},
1754        onCartChange: function(event) {
1755            console.log('onCartChange',event);
1756            var widgetTopOffset = jQuery("#cart-container").offset().top;
1757            var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1758            stickyHeaderOffset = 0;
1759            jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset - stickyHeaderOffset } );
1760            var rerenderSdk = (((event || {}).payload || {}).continueShopping || false);
1761            isCheckoutMode = true;
1762            switchToCheckoutNow(isCheckoutMode);
1763            if(rerenderSdk) {
1764                //launch_sdk(myObj);
1765                var redirectURL = window.location.pathname.split('/');
1766                if(redirectURL.length > 2) {
1767                    redirectURL.splice(redirectURL.length - 2, 1);
1768                    //console.log('redirectURL',redirectURL.join('/'));
1769                    window.location.href = redirectURL.join('/');
1770                }
1771            } else {
1772                var cartItems = (((event || {}).payload || {}).cartItems || []);
1773                var totalItemsInCart = cartItems.length;
1774                anchorCartChange(totalItemsInCart);
1775            }
1776			const redirectToCheckout = (((event || {}).payload || {}).redirectToCheckout || false);
1777
1778			if(singleFormCheckoutV3) {
1779				window.location.href = redirectToCheckout ? '/checkout/?cart=1' : '/cart/?added=1';
1780			}
1781        },
1782        onStageChange: function(event) {
1783            //console.log('onStageChange', event);
1784            try {
1785                if (event && event.payload && event.payload.position && event.payload.position.top) {
1786                    var widgetTopOffset = jQuery("#cart-container").offset().top;
1787                    var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1788                    stickyHeaderOffset = 0;
1789                    jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
1790                }
1791            } catch (err) {
1792                console.log("Commerce:onStageChange:error", err);
1793            }
1794        },
1795        onViewCart: function(event) {
1796            //console.log('onViewCart');
1797            // navigate to cart-checkout page url
1798            var sfcParam = '';
1799            if(myObj.settings.singleFormCheckout) {
1800                sfcParam = '&singleFormCheckout=1';
1801            }
1802            var viewOnly = event.payload.viewOnly || false;
1803            if(myObj.settings.showViewCartOnPostAddToCart && viewOnly) {
1804                //console.log('viewOnly', event.payload, viewOnly);
1805                //jQuery('.shopping-cart-wrapper').addClass('open');
1806                //jQuery('body').addClass('overflow-hidden');
1807                //jQuery('#hb-shopping-cart').html('');
1808                //openShoppingCartDrawer();
1809                location.href = '/cart/';
1810            } else {
1811                window.location = myObj.checkoutStr + '?cart=1' + sfcParam;
1812            }
1813        },
1814        onQuickAddToCart: function(evt) {
1815            //console.log('onQuickAddToCart');
1816            var addCartProp = evt.payload || {};
1817            //console.log('onQuickAddToCart', addCartProp);
1818            jQuery('.calendar-drawer-wrapper').addClass('open');
1819            var orderId = addCartProp.cartOrderIdToEdit || null;
1820            addToCartDrawer(addCartProp.propertyId, addCartProp.bookingTypeId, orderId, {}, addCartProp.selectedDate);
1821
1822        },
1823    }, sdk_placeholder_id).then(function (instance) {
1824        _HBCOMMERCEINSTANCE_ = instance;
1825        //console.log('returning', instance);
1826        //jQuery('#hb-commerce-sdk-root').html('');
1827    }).catch(function (err) {
1828        console.log("Error launching commerce sdk", err);
1829    });
1830
1831	
1832	
1833
1834
1835    window.addEventListener("scroll", function(event) {
1836        var top = this.scrollY,
1837            left =this.scrollX;
1838        var topOffsetVal = parseInt(window.innerHeight / 2);
1839        var bottomOffsetVal = parseInt(window.innerHeight / 2);
1840        var tourCalTop = jQuery('#cart-container').offset().top - topOffsetVal;
1841        var tourCalBottom = tourCalTop + jQuery('#cart-container').height();
1842        if(top > tourCalTop && top < tourCalBottom) {
1843            if(myObj.isCheckoutMode) {
1844                jQuery('a.checkout-now-link').addClass('collapse');
1845            } else {
1846                jQuery('a.check-availability-link').addClass('collapse');
1847            }
1848        } else {
1849            if(myObj.isCheckoutMode) {
1850                jQuery('a.checkout-now-link').removeClass('collapse');
1851            } else {
1852                jQuery('a.check-availability-link').removeClass('collapse');
1853            }
1854        }
1855        //if()
1856        //console.log('top', top, tourCalTop, tourCalBottom, topOffsetVal, bottomOffsetVal);
1857    }, false);
1858    jQuery('a.checkout-now-link').on('click', function(e) {
1859        e.preventDefault();
1860        var sfcParam1 = '';
1861        if(myObj.settings.singleFormCheckout) {
1862            sfcParam1 = '&singleFormCheckout=1';
1863        }
1864        window.location = myObj.checkoutStr + '?cart=1' + sfcParam1;
1865    });
1866}
1867
1868function launch_sdk_combo(myObj, comboObj, passedDate = '') {
1869    myObj.settings.override_currency_to = myObj.settings.override_currency_to || undefined;
1870	var singleFormCheckoutV3 = myObj.settings.go_to_cart_after_add || myObj.singleFormCheckoutV3 || false;
1871    jQuery('#'+comboObj.combo_div_id).html('');
1872    console.log('launching-sdk-combo2',{myObj,comboObj});
1873	if(passedDate.length) {
1874		var thisComboDate = new Date(passedDate);
1875		myObj.comboSelectedDate = ('0' + (thisComboDate.getMonth() + 1)).slice(-2) + '/' + ('0' + thisComboDate.getDate()).slice(-2) + '/' + thisComboDate.getFullYear();
1876	} else {
1877		for(var i = 0; i <  ((myObj.settings || []).combo_deal_properties || []).length; i++) {
1878			var thisCombo = myObj.settings.combo_deal_properties[i];
1879			if(thisCombo.combo_added_to_cart && thisCombo.combo_date_time.length) {
1880				var thisComboDate = new Date(thisCombo.combo_date_time);
1881				myObj.comboSelectedDate = ('0' + (thisComboDate.getMonth() + 1)).slice(-2) + '/' + ('0' + thisComboDate.getDate()).slice(-2) + '/' + thisComboDate.getFullYear();
1882			}
1883		}
1884	}
1885    HBCommerce.launch({
1886        propertyId: comboObj.combo_property_id,
1887        locale: myObj.checkoutLang,
1888        translations: {
1889            addToCartCta: 'Continue',
1890        },
1891        bookingTypeId: comboObj.combo_booking_id,
1892        theme: 'cityexperiences',
1893        costRateId: myObj.settings.cost_rate,
1894        flags: myObj.flagStruct,
1895        departureStop: myObj.urlDeparture,
1896        destinationStop: myObj.urlDestination,
1897        departure: myObj.urlDeparture,
1898        destination: myObj.urlDestination,
1899        currency: myObj.settings.override_currency_to,
1900        //currency: getCurrentCurrency(),
1901        //selectedDate: myObj.urlDate,
1902        selectedDate: myObj.comboSelectedDate,
1903        selectedTimedTicketTypeId: myObj.urlTimeId,
1904        onPreselectionComplete: function (event) {
1905            var payload = Object.assign({}, event, { costRateId: myObj.settings.cost_rate })
1906            var preselection = encodeURIComponent(JSON.stringify(payload));
1907            window.location = myObj.checkoutStr + preselection;
1908        },
1909        onCartChange: function(event) {
1910            var rerenderSdk = (((event || {}).payload || {}).continueShopping || false);
1911            if(myObj.settings.is_combo_deal) {
1912                console.log('onCartChange');
1913                var thisPropId = jQuery('.combo-wrapper .each-combo.open .each-combo-title').attr('prop-id');
1914                var thisBookId = jQuery('.combo-wrapper .each-combo.open .each-combo-title').attr('book-id');
1915                var thisPropBookId = thisPropId + '_' + thisBookId;
1916                //var cartItem = ((event || {}).payload || {}).cartItems || [];
1917                //var orderId = cartItem.length ? cartItem[0].orderId : '';
1918                //var orderId = cartItem.length ? getCorrespondOrderId(thisPropId, thisBookId, cartItem) : '';
1919                var itemOrder = getItemInCart(thisPropId, thisBookId);
1920                var orderId = itemOrder.orderId || '';
1921                var dateTime = itemOrder.tourDateTimeFormatted || '';
1922				console.log('itemOrder', itemOrder)
1923                jQuery('.combo-wrapper .each-combo[prop-book-id='+thisPropBookId+']').removeClass('open');
1924                jQuery('.combo-wrapper .each-combo .each-combo-title[prop-book-id='+thisPropBookId+']').addClass('disabled');
1925                jQuery('.combo-wrapper .each-combo .each-combo-title[prop-book-id='+thisPropBookId+'] .combo-icons .added-to-cart').removeClass('hide');
1926                jQuery('.combo-wrapper .each-combo .each-combo-title[prop-book-id='+thisPropBookId+'] .combo-icons .edit-the-cart').removeClass('hide');
1927                jQuery('.combo-wrapper .each-combo .each-combo-title[prop-book-id='+thisPropBookId+'] .edit-combo-cart').attr('order-id', orderId);
1928                jQuery('.combo-wrapper .each-combo .each-combo-title[prop-book-id='+thisPropBookId+'] .combo-tour-date').html(dateTime);
1929
1930                if(jQuery('.combo-wrapper .each-combo .each-combo-title:not(.disabled)').length) {
1931                    var nextPropBookId = jQuery('.combo-wrapper .each-combo .each-combo-title:not(.disabled)').attr('prop-book-id');
1932                    var nextPropIdx = parseInt(jQuery('.combo-wrapper .each-combo .each-combo-title:not(.disabled)').attr('prop-idx'));
1933                    //console.log('nextPropIdx',nextPropIdx);
1934                    jQuery('.combo-wrapper .each-combo[prop-book-id='+nextPropBookId+']').addClass('open');
1935                    launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[nextPropIdx], dateTime);
1936                } else {
1937					if(singleFormCheckoutV3) {
1938						window.location.href = '/cart/?addedcombo=1';
1939						if(myObj.settings.is_combo_deal) {
1940							var comboBookId = [];
1941							for(var i=0; i < myObj.settings.combo_deal_properties.length; i++) {
1942								comboBookId.push(myObj.settings.combo_deal_properties[i].combo_booking_id);
1943							}
1944							var comboData = JSON.stringify({ tourName: myObj.localizedInfo.en.title, tourImage: myObj.media.images[0].url, booking_ids: comboBookId.join(',') });
1945							setCookie("last_visit_combo", comboData, 1);
1946						}
1947					} else {
1948						jQuery('.combo-complete .btn').removeClass('in-progress');
1949						jQuery('.combo-complete .btn').removeClass('disabled');
1950					}
1951                }
1952                goToAnchor('#comboWrapperTour');
1953                //console.log('combo-deal-event', event)
1954            }
1955			//console.log('done-combo-update-cart', rerenderSdk);
1956            if(rerenderSdk) {
1957                //launch_sdk(myObj);
1958                var redirectURL = window.location.pathname.split('/');
1959                if(redirectURL.length > 2) {
1960                    redirectURL.splice(redirectURL.length - 2, 1);
1961                    //console.log('redirectURL',redirectURL.join('/'));
1962                    window.location.href = redirectURL.join('/');
1963                }
1964            } else {
1965                var cartItems = (((event || {}).payload || {}).cartItems || []);
1966                var totalItemsInCart = cartItems.length;
1967				//console.log('updating-cart', {cartItems, totalItemsInCart});
1968                anchorCartChange(totalItemsInCart);
1969            }
1970        },
1971        onStageChange: function(event) {
1972            try {
1973                if (event && event.payload && event.payload.position && event.payload.position.top) {
1974                    var widgetTopOffset = jQuery('#'+comboObj.combo_div_id).offset().top;
1975                    var stickyHeaderOffset = document.getElementById('masthead').offsetHeight;
1976                    jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
1977                }
1978            } catch (err) {
1979                console.log("Commerce:onStageChange:error", err);
1980            }
1981        },
1982        onViewCart: function(event) {
1983            // navigate to cart-checkout page url
1984            var sfcParam = '';
1985            if(myObj.settings.singleFormCheckout) {
1986                sfcParam = '&singleFormCheckout=1';
1987            }
1988            window.location = myObj.checkoutStr + '?cart=1' + sfcParam;
1989        }
1990    }, comboObj.combo_div_id).then(function (instance) {
1991        _HBCOMMERCEINSTANCE_ = instance;
1992    }).catch(function (err) {
1993        console.log("Error launching commerce sdk", err);
1994    });
1995}
1996
1997
1998var loadRelatedSdkInterval;
1999
2000function prePreDisplayRelatedList(myObj, relatedData) {
2001	clearInterval(loadRelatedSdkInterval);
2002	//myObj.use_algolia_recommended_tours = getUrlParam('addAlgoliaRecommendations', 0) === '1';
2003	//console.log('prePreDisplayRelatedList', myObj );
2004	if(myObj.settings.use_algolia_recommended_tours && (myObj.algoliaRecommendedTours || []).length) {
2005		var relatedTours = { available: [], unavailable: myObj.algoliaRecommendedTours };
2006		//myObj.has_algolia_recommended_tours = true;
2007		//console.log('prePreDisplayRelatedList', relatedTours);
2008		preDisplayRelatedList(myObj, relatedTours);
2009	} else {
2010			//console.log('prePreDisplayRelatedList3', myObj.settings.use_related_tour_settings, ((myObj.relatedTours || []).unavailable || []).length );
2011		if( ( !myObj.settings.use_related_tour_settings && (myObj.relatedTours || []).unavailable || []).length ) {
2012			//console.log('still-bad');
2013			preDisplayRelatedList(myObj, myObj.relatedTours);
2014		} else {
2015			console.log('back-to-future');
2016			if(myObj.gql !== undefined) {
2017				myObj.gql.searchTours(relatedData).then(function(relatedTours) {
2018					//console.log('prePreDisplayRelatedList1', myObj, relatedTours);
2019					preDisplayRelatedList(myObj, relatedTours);
2020				}).catch(console.log);
2021			} else {
2022				HBCommerce
2023					.graphql({ sdkSrc: myObj.sdkSrc })
2024					.then(function(gql) {
2025					gql.searchTours(relatedData).then(function(relatedTours) {
2026						myObj.gql = gql;
2027						//console.log('prePreDisplayRelatedList2', {myObj,relatedTours});
2028						preDisplayRelatedList(myObj, relatedTours);
2029					}).catch(console.log);
2030				})
2031					.catch(function(error) {
2032					//Handle error
2033				});	
2034			}
2035		}
2036	}
2037}
2038
2039function preDisplayRelatedList(myObj, relatedTours) {
2040	var listRelatedTour = jQuery.extend(true, [], relatedTours);
2041	myObj.exclude_added_shopping_cart = true;
2042	if(myObj.settings.related_tour_settings.use_weight_sorted) {
2043		listRelatedTour = tourSortedByWeight(jQuery.extend(true, [], listRelatedTour), myObj.settings.related_tour_settings.weight_sorted_desc);
2044	}
2045	if(myObj.settings.related_tour_settings.grouped_events) {
2046		listRelatedTour = tourGrouped(jQuery.extend(true, [], listRelatedTour));
2047	}
2048	if(myObj.settings.related_tour_settings.order_by_date) {
2049		listRelatedTour = tourSortedByDate(jQuery.extend(true, [], listRelatedTour), myObj.settings.related_tour_settings.date_sorted_asc);
2050	}
2051	//console.log('before populatetours', {myObj,listRelatedTour});
2052	if(myObj.settings.use_algolia_recommended_tours && (myObj.algoliaRecommendedTours || []).length ) {
2053		myObj.settings.has_algolia_recommended_tours = true;
2054		myObj.listing = myObj.algoliaRecommendedTours;
2055		myObj = jQuery.extend( myObj, populateTours(listRelatedTour, 0, myObj.settings.related_tour_settings.include_availability, 0, myObj.max_show_onload, myObj, myObj.curLang) );
2056		displayRelatedList(myObj);
2057	} else {
2058		myObj.settings.has_algolia_recommended_tours = false;
2059		myObj = jQuery.extend( myObj, populateTours(listRelatedTour, 0, myObj.settings.related_tour_settings.include_availability, 0, myObj.max_show_onload, myObj, myObj.curLang) );
2060		if(myObj.settings.related_tour_settings.max_show_list > 0) {
2061			myObj.listing = myObj.listing.slice(0, myObj.settings.max_show_list);
2062		}
2063
2064		if(myObj.settings.related_tour_settings.use_additional_search_term.length && myObj.listing.length < myObj.settings.related_tour_settings.min_number_required) {
2065			gql.searchTours({ searchTerm: myObj.settings.related_tour_settings.use_additional_search_term, propertyId: myObj.settings.related_tour_settings.property_id, city: myObj.settings.related_tour_settings.search_city, crossSellCities: myObj.settings.related_tour_settings.additionalCitiesArr, siteId: myObj.settings.related_tour_settings.site_id,  includeAvailability: myObj.settings.related_tour_settings.include_availability })
2066				.then(function(additionalTours) {
2067				//console.log('additionalTours',additionalTours);
2068				var listAdditionalTours = jQuery.extend(true, [], additionalTours);
2069				var needRemainingTour = myObj.settings.related_tour_settings.min_number_required - myObj.listing.length;
2070				var excludeIDs = [];
2071				excludeIDs.push(myObj.tourId);
2072				for(var i=0; i < myObj.listing.length; i++) {
2073					excludeIDs.push(myObj.listing[i].tourId);
2074				}
2075				var excludeObj = [];
2076				excludeObj.exclude_list = excludeIDs.join(',');
2077				//console.log('excludeObj',excludeObj);
2078				if(myObj.settings.related_tour_settings.use_weight_sorted) {
2079					listAdditionalTours = tourSortedByWeight(jQuery.extend(true, [], listAdditionalTours), myObj.settings.related_tour_settings.weight_sorted_desc);
2080				}
2081				//console.log('related populatetours');
2082				var tmp = populateTours(listAdditionalTours, 0, false, 0, 0, excludeObj);
2083				//myObj.listing = myObj.listing.concat(tmp.listing && tmp.listing.slice(0,myObj.settings.related_tour_settings.min_number_required - myObj.listing.length));
2084				myObj.listing = myObj.listing.concat(tmp.listing);
2085				//console.log('tmp-listing',tmp.listing);
2086				displayRelatedList(myObj);
2087			})
2088				.catch(console.log);
2089		} else {
2090			displayRelatedList(myObj);
2091		}		
2092	}
2093}
2094
2095function displayRelatedList(myObj) {
2096    //console.log('displayRelatedList',myObj);
2097	myObj.settings.thumbor_filters = '320x200/';
2098    myObj.relatedTourHTML = Mustache.to_html(myObj.related_product_template_html, myObj );
2099    jQuery('.hbg-display-tour.' + myObj.element_first + ' .ce-related-tour-wrapper' ).append(myObj.relatedTourHTML);
2100    jQuery('.hbg-display-tour.' + myObj.element_first + ' .ce-related-tour-wrapper .slick-listing').slick({
2101        slidesToShow: 4,
2102        slidesToScroll: 4,
2103        centerPadding: '15px',
2104        speed: 1000,
2105        infinite: false,
2106        responsive: [
2107            {
2108                breakpoint: 1181,
2109                settings: {
2110                    slidesToShow: 3,
2111                    slidesToScroll: 3
2112                }
2113            },
2114            {
2115                breakpoint: 992,
2116                settings: {
2117                    slidesToShow: 2,
2118                    slidesToScroll: 2
2119                }
2120            },
2121            {
2122                breakpoint: 768,
2123                settings: "unslick"
2124				// settings: {
2125                //     slidesToShow: 1,
2126                //     slidesToScroll: 1,
2127                //     arrows: false,
2128                // }
2129            }
2130        ]
2131    });
2132    //if(myObj.settings.show_nav) {
2133        //build_nav_script_js(myObj.element_id+'_Related', '.hbg-display-tour.' + myObj.element_first + ' .ce-related-tour-wrapper .module-content-inner');
2134    //}
2135}
2136
2137var loadTourCalSdkInterval;
2138var loadTourReviewSdkInterval;
2139
2140function loadTourCalSdk(myObj) {
2141	console.log('loadTourCalSdk');
2142	launch_sdk(myObj);
2143	clearInterval(loadTourCalSdkInterval);
2144}
2145
2146function loadTourReviewSdk(myObj) {
2147	if(jQuery('.tour-review-wrapper').length) {
2148		jQuery('.tour-review-wrapper').append(myObj.review_delay)
2149	}
2150	clearInterval(loadTourReviewSdkInterval);
2151}
2152
2153function preRenderTourPageSDK(myObj) {
2154	//console.log('preRenderTourPageSDK-iamhere', myObj);
2155	//myObj.HBCommerce = HBCommerce;
2156	if(myObj.tourSdk !== undefined) {
2157		//console.log('no-need-hbcommerce');
2158		renderTourPageSDK(myObj);
2159	} else {
2160		console.log('need-hbcommerce');
2161		//myObj.HBCommerce = HBCommerce;
2162		HBCommerce
2163		  .graphql({ sdkSrc: myObj.sdkSrc })
2164		  .then(function(gql) {
2165			gql.searchTours({ propertyId: myObj.property_id, bookingType: myObj.booking_type_id_content, includeAvailability: false, includeMenu: true, showPrivateTours: true, includeLocationTags: true, includeRecentBookings: true, includeLikelyToSellOut: true, addApplicableSpecialCoupons: true })
2166			  .then(function(tour) {
2167				myObj.gql = gql;
2168				myObj.tourSdk = tour;
2169				renderTourPageSDK(myObj);
2170			})
2171			.catch(console.log);
2172		  })
2173		  .catch(function(error) {
2174			//Handle error
2175		  });	
2176	}
2177}
2178
2179function populateTourV2(tour, lang, settings, isExperience, isWalks, isHideMap) {
2180	
2181}
2182
2183function renderingTourAffirmV2() {
2184	if(typeof affirm.ui.refresh === 'function') {
2185		affirm.ui.refresh();
2186		clearInterval(renderTourAffirmInterval);
2187		//renderTourAffirmInterval = setInterval(renderingTourAffirmV2, 500);
2188	}
2189}
2190
2191var renderTourAffirmInterval;
2192
2193function renderTourPageV2SDK(myObj) {
2194	console.log('renderTourPageV2SDK', myObj);
2195	var curSettings = myObj.settings;
2196	myObj = jQuery.extend( myObj, populateTour(myObj.tourSdk, myObj.curLang, myObj.settings, myObj.settings.is_experiences, myObj.settings.is_walks, myObj.settings.is_hide_map) );
2197	myObj.settings = jQuery.extend( myObj.settings, curSettings);
2198	myObj.cartMode = myObj.settings.cartMode;
2199	myObj.preselectionMode = !myObj.cartMode;
2200	myObj.settings.is_combo_deal = myObj.settings.is_combo_deal || false;
2201	myObj.settings.enableQuickAddInRecommendedTours = myObj.settings.enableQuickAddInRecommendedTours || true;
2202	myObj.has_video = isLoadMobile ? false : myObj.has_video;
2203	myObj.additional_assets.length = myObj.additional_assets.length > 9 ? 9 : myObj.additional_assets.length;
2204	if(isLoadMobile) {
2205		myObj.additional_assets.length = myObj.additional_assets.length > 3 ? 3 : myObj.additional_assets.length;
2206	}
2207
2208	var numberPattern = /[\d|.]+/g;
2209	myObj.settings.displayPriceOnly = ((myObj.settings.displayPrice || '').match(numberPattern)||[])[0] || 0;
2210	myObj.settings.displayPriceSign = (myObj.settings.displayPrice || '').replace(myObj.settings.displayPriceOnly, '');				
2211	myObj.settings.displayPriceCurrency = myObj.settings.displayPriceSign.length ? ( productCurrency[myObj.settings.displayPriceSign] || '' ) : productCurrency[myObj.propertySettings.defaultCurrency];
2212	if(!propNotUseCeiling.includes(myObj.property_id)) {
2213		myObj.settings.displayPriceOnly = Math.ceil(myObj.settings.displayPriceOnly);
2214		myObj.settings.discountedDisplayPrice = Math.ceil(myObj.settings.discountedDisplayPrice);
2215	}
2216	myObj.affirm_price = myObj.has_discounted_price ? parseFloat(myObj.settings.discountedDisplayPrice) * 100 : parseFloat(myObj.settings.displayPriceOnly) * 100;
2217	
2218	var page_type = window.location.pathname.match('/city-cruises/') !== null ? 'cc' : 'non-cc';
2219// 	postToTealiumAfterloaded('view', {
2220// 		"tealium_event": "page_view",
2221// 		"page_category": "Product Page",
2222// 		"page_name": myObj.locationTags.city || myObj.tour_city || myObj.city || "unknown city",
2223// 		"page_type": page_type,
2224// 		"product_category": myObj.anchor_brand_name,
2225// 		"product_id": myObj.bookingTypeId || 0,
2226// 		"product_name": myObj.title || "",
2227// 		"product_port_city": myObj.locationTags.city || myObj.tour_city || myObj.city || "unknown city",
2228// 		"product_price": myObj.settings.displayPriceOnly || 0,
2229// 		"product_currency": myObj.settings.displayPriceCurrency,
2230// 		"property_id": myObj.propertyId,
2231// 		"url": window.location.href,
2232// 	});
2233
2234	updateRecentlyViewedCookie(myObj);
2235	myObj.settings.singleFormCheckout = myObj.singleFormCheckoutV3 ? false : myObj.settings.singleFormCheckout;
2236	myObj.settings.singleFormCheckoutV3Collapse = myObj.singleFormCheckoutV3;
2237	
2238	//myObj.affirm_price = 5000;
2239	myObj.settings.hide_affirm_module = myObj.affirm_price < 5000;
2240	if(myObj.affirm_price >= 5000) {
2241		 _affirm_config = {
2242		   public_api_key: "UOIRDUWY13VBR9Q1",
2243		   script: "https://cdn1.affirm.com/js/v2/affirm.js"
2244		 };
2245		 (function(l,g,m,e,a,f,b){var d,c=l[m]||{},h=document.createElement(f),n=document.getElementsByTagName(f)[0],k=function(a,b,c){return function(){a[b]._.push([c,arguments])}};c[e]=k(c,e,"set");d=c[e];c[a]={};c[a]._=[];d._=[];c[a][b]=k(c,a,b);a=0;for(b="set add save post open empty reset on off trigger ready setProduct".split(" ");a<b.length;a++)d[b[a]]=k(c,e,b[a]);a=0;for(b=["get","token","url","items"];a<b.length;a++)d[b[a]]=function(){};h.async=!0;h.src=g[f];n.parentNode.insertBefore(h,n);delete g[f];d(g);l[m]=c})(window,_affirm_config,"affirm","checkout","ui","script","ready");
2246		if(typeof affirm.ui.refresh === 'undefined') {
2247			renderTourAffirmInterval = setInterval(renderingTourAffirmV2, 1000);
2248		} else {
2249			affirm.ui.refresh();
2250		}
2251	}
2252
2253	getOneTrustSettings(myObj);
2254	myObj.flagStruct = {
2255		cartMode: myObj.cartMode,
2256		showCheckoutBtnNextToAddToCart: myObj.settings.showCheckoutBtnNextToAddToCart,
2257		preselectionMode: myObj.preselectionMode,
2258		viewCheckoutV2: true,
2259		viaEmail: myObj.viaEmail,
2260		viaPhone: myObj.viaPhone,
2261		showViewCartOnPostAddToCart: myObj.settings.showViewCartOnPostAddToCart,
2262		singleFormCheckout: myObj.settings.singleFormCheckout,
2263		singleFormCheckoutV3: myObj.singleFormCheckoutV3,
2264		singleFormCheckoutV3Collapse: myObj.settings.singleFormCheckoutV3Collapse,
2265		cartCheckout: {
2266			showRecommendedTours: myObj.settings.show_recommended_tours,
2267			enableQuickAddInRecommendedTours: myObj.settings.enableQuickAddInRecommendedTours,
2268			enableComboTicketUpsell: myObj.settings.enableComboTicketUpsell,
2269		},
2270		oneTrustCookiesCheckEnabled: myObj.oneTrustCookiesCheckEnabled || false,
2271		singleFormCheckoutV3: true,
2272		handleMultiTabsAddToCart: true,
2273	};
2274
2275	if(hidePhoneForBrands.includes(myObj.brand_name)) {
2276		jQuery('li.nav-phone-number').addClass('hide');
2277	}
2278	if(myObj.settings.is_experiences) {
2279		var convertedSlugCity = ( (myObj.settings.activityCity || '').trim() || myObj.city || '').replace(/\. /g, '-').replace(/ /g,'-').toLowerCase();
2280		myObj.breadcrumbs = '<a href="/experiences/" role="home" class="breadcrumb-link">Home</a>';
2281		if(myObj.exp_cities[convertedSlugCity] !== undefined){
2282			myObj.breadcrumbs += ' / <a href="/experiences/">'+myObj.exp_cities[convertedSlugCity].country+'</a> ';		
2283			myObj.breadcrumbs += ' / <a href="/experiences/search-result/?country='+myObj.exp_cities[convertedSlugCity].countryslug+'&state='+myObj.exp_cities[convertedSlugCity].stateslug+'&city='+myObj.exp_cities[convertedSlugCity].cityurl+'">'+myObj.exp_cities[convertedSlugCity].state+'</a> ';
2284			myObj.breadcrumbs += ' / <a href="/experiences/search-result/?country='+myObj.exp_cities[convertedSlugCity].countryslug+'&state='+myObj.exp_cities[convertedSlugCity].stateslug+'&city='+myObj.exp_cities[convertedSlugCity].cityurl+'">'+myObj.exp_cities[convertedSlugCity].city+'</a> ';
2285		}
2286	}
2287	if(myObj.settings.is_combo_deal && (myObj.settings.combo_deal_properties || []).length) {
2288		myObj.all_tour_added = true;
2289		myObj.open_tour = false;
2290		var foundItTour = false;
2291		for(var idx = 0; idx < myObj.settings.combo_deal_properties.length; idx++) {
2292			myObj.settings.combo_deal_properties[idx].idx = idx;
2293			myObj.settings.combo_deal_properties[idx].combo_prop_book_id = myObj.settings.combo_deal_properties[idx].combo_property_id + '.' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
2294			myObj.settings.combo_deal_properties[idx].combo_prop_book_id2 = myObj.settings.combo_deal_properties[idx].combo_property_id + '_' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
2295			myObj.settings.combo_deal_properties[idx].combo_prop_book_class = myObj.settings.combo_deal_properties[idx].combo_property_id + '-' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
2296			var itemInCart = getItemInCart(myObj.settings.combo_deal_properties[idx].combo_property_id, myObj.settings.combo_deal_properties[idx].combo_booking_id);
2297			myObj.settings.combo_deal_properties[idx].combo_order_id = Object.keys(itemInCart).length === 0 ? '' : (itemInCart.orderId || '');
2298			myObj.settings.combo_deal_properties[idx].combo_date_time = Object.keys(itemInCart).length === 0 ? '' : (itemInCart.tourDateTimeFormatted || '');
2299			myObj.settings.combo_deal_properties[idx].combo_added_to_cart = myObj.settings.combo_deal_properties[idx].combo_order_id.length > 0;
2300			if(!foundItTour && !myObj.settings.combo_deal_properties[idx].combo_added_to_cart) {
2301				myObj.settings.combo_deal_properties[idx].combo_open_class = 'open';
2302				foundItTour = true;
2303			}
2304			myObj.all_tour_added = myObj.settings.combo_deal_properties[idx].combo_added_to_cart ? myObj.all_tour_added : false;
2305		}
2306	}
2307
2308	myObj.has_download_menu = myObj.has_download_menu || false;
2309	translatedTourTitles(myObj);
2310	//console.log('translatedTourTitles', myObj)
2311	if(myObj.settings.show_combo_packages && (myObj.combo_package_list.listing||[]).length) {
2312		for(var i = 0; i < myObj.combo_package_list.listing.length; i++) {
2313			for(var j = 0; j < myObj.combo_package_list.listing[i].tour.length; j++) {
2314				myObj.combo_package_list.listing[i].tour[j].selected = myObj.combo_package_list.listing[i].tour[j].tour_booking_type_id === myObj.bookingTypeId;
2315				myObj.combo_package_list.listing[i].tour[j].has_brand_info = (myObj.combo_package_list.listing[i].tour[j].tour_brand_tag ||'').length > 0;
2316				myObj.combo_package_list.listing[i].tour[j].anchor_brand_src = myObj.combo_package_list.listing[i].tour[j].has_brand_info ? brandImgSrc[myObj.combo_package_list.listing[i].tour[j].tour_brand_tag] : '';
2317			}
2318		}
2319	} else {
2320		myObj.settings.show_combo_packages = false;
2321	}
2322	
2323	myObj.settings.secondReview = myObj.settings.secondReview || '';
2324	myObj.has_second_review = myObj.settings.secondReview.length > 0;
2325
2326	myObj.headerHTML = Mustache.to_html(myObj.product_header_template_html, myObj );
2327	myObj.assetsHTML = Mustache.to_html(myObj.product_assets_template_html, myObj );
2328	myObj.assetsCheckHTML = Mustache.to_html(myObj.product_assets_check_template_html, myObj );
2329	if(myObj.cartMode) {
2330		
2331		if(myObj.settings.is_default_template) {
2332			myObj.detailsOverviewHTML = Mustache.to_html(myObj.product_details_overview_cart_template_html, myObj );
2333			myObj.detailsAboutHTML = Mustache.to_html(myObj.product_details_about_cart_template_html, myObj );
2334			myObj.detailsExtraHTML = Mustache.to_html(myObj.product_details_extra_cart_template_html, myObj );
2335			myObj.detailsAdditionalHTML = Mustache.to_html(myObj.product_details_additional_cart_template_html, myObj );
2336			myObj.detailsScheduleHTML = Mustache.to_html(myObj.product_details_schedule_cart_template_html, myObj );
2337			myObj.detailsWhereHTML = Mustache.to_html(myObj.product_details_where_cart_template_html, myObj );			
2338		} else {
2339			myObj.detailsHTML = Mustache.to_html(myObj.product_details_cart_template_html, myObj );
2340		}
2341	} else {
2342		myObj.detailsHTML = Mustache.to_html(myObj.product_details_template_html, myObj );
2343	}
2344	myObj.bundleHTML = Mustache.to_html(myObj.product_bundle_cart_template_html, myObj );
2345	myObj.reviewHTML = Mustache.to_html(myObj.product_review_cart_template_html, myObj );
2346	myObj.checkHTML = Mustache.to_html(myObj.product_assets_check_template_html, myObj );
2347	//renderTourPageV2SDK
2348	myObj.use_promise = false;
2349	if(myObj.template_name === 'ce20v2r2') {
2350		jQuery(	'.hbgv2-tour-header .loading-event').addClass('hide');
2351		jQuery(	'.hbgv2-tour-header').append(myObj.headerHTML);
2352		loadInhouseShareV2(myObj);
2353		jQuery('.header-reviews').html(myObj.settings.secondReview);
2354		jQuery('.header-reviews:not(.no-full-reviews)').click(function() {
2355			jQuery('html, body').animate({
2356				scrollTop: jQuery('#full-reviews').offset().top - 100
2357			}, 1000);
2358		});
2359		if(myObj.has_second_review && myObj.review.indexOf('EmbedSocialHashtagScript') < 0) {
2360			(function(d, s, id) { var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/cdn/ht.js"; d.getElementsByTagName("head")[0].appendChild(js); }(document, "script", "EmbedSocialHashtagScript"));
2361		}
2362		window.addEventListener('scroll', function() {
2363			var bookingWidget = document.getElementById('book-now-widget');
2364			var fullBookingWidget = document.getElementById('hb-commerce-sdk-root');
2365			var navbarDesktop = document.getElementById('product-navbar-desktop');
2366			var navbarMobile = document.getElementById('product-navbar-mobile');
2367			var floatingProductCta = document.getElementById('floating-product-cta');
2368			var bookingWidgetRect = bookingWidget.getBoundingClientRect();
2369			var fullBookingWidgetRect = fullBookingWidget.getBoundingClientRect();
2370			var isFullyOutOfViewport = (bookingWidgetRect.bottom <= 0 || bookingWidgetRect.top >= window.innerHeight) && (fullBookingWidgetRect.bottom <= 0 || fullBookingWidgetRect.top >= window.innerHeight);
2371
2372			if (isFullyOutOfViewport) {
2373				navbarMobile.style.opacity = '1';
2374				navbarDesktop.style.opacity = '1';
2375				floatingProductCta.style.opacity = '1';
2376			} else {
2377				navbarMobile.style.opacity = '0';
2378				navbarDesktop.style.opacity = '0';
2379				floatingProductCta.style.opacity = '0';
2380			}
2381		});
2382		jQuery(	'.hbgv2-tour-check .loading-event').addClass('hide');
2383		jQuery(	'.hbgv2-tour-check').append(myObj.checkHTML);
2384		if(myObj.has_video) {
2385			var embedCode = myObj.video;
2386			var videoIdRegex = /embed\/([^"?]+)/;
2387			var match = embedCode.match(videoIdRegex);
2388			if (match && match.length > 1) {
2389				var videoId = match[1];
2390				//console.log(videoId);
2391				var newSrc = 'https://i3.ytimg.com/vi/' + videoId + '/hqdefault.jpg'; // Replace with your new source URL
2392				jQuery('.tour-video-thumbnail img').attr('src', newSrc);
2393			} else {
2394				jQuery('.tour-video-thumbnail img').attr('src', 'https://assets.cityexperiences.com/wp-content/uploads/2023/06/vimeo-video-thumbnail.jpg');
2395			}
2396			renderTourVideoInterval = setInterval(renderingTourVideoV2, 5000, myObj.video);
2397		}
2398		jQuery('a.ce-package-deal-action').on('click', function(e) {
2399			e.preventDefault();
2400			goToAnchor('#tourComboPackages');
2401
2402		});
2403		jQuery('a.ce-book-now-action').on('click', function(e) {
2404			e.preventDefault();
2405			jQuery('#cart-container').removeClass('hide');
2406			jQuery('#cart-container').removeClass('make-height-0px');
2407			goToAnchor('#cart-container');
2408			if(myObj.settings.is_combo_deal) {
2409				var foundIt = false;
2410				for(var j = 0; j < myObj.settings.combo_deal_properties.length; j++) {
2411					if(!foundIt && !myObj.settings.combo_deal_properties[j].combo_added_to_cart) {
2412						launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[j]);
2413						foundIt = true;
2414					}
2415				}
2416				if(!foundIt) {
2417					jQuery('.combo-complete .btn').removeClass('in-progress');
2418					jQuery('.combo-complete .btn').removeClass('disabled');
2419				}
2420				jQuery('.each-combo-title').on('click', function(e) {
2421					e.preventDefault();
2422					var propBookId = jQuery(this).attr('prop-book-id');
2423					var thisIdx = parseInt(jQuery(this).attr('prop-idx'));
2424					if(!jQuery(this).parent().hasClass('open') && !jQuery(this).hasClass('disabled')) {
2425						jQuery('.combo-wrapper .each-combo').removeClass('open');
2426						jQuery(this).parent().addClass('open');
2427						launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[thisIdx]);
2428						goToAnchor('#comboWrapperTour');
2429					}
2430					event.stopPropagation();
2431				});
2432				jQuery('a.edit-combo-cart').on('click', function(e) {
2433					e.preventDefault();
2434					var propId = jQuery(this).attr('property-id') || '';
2435					var bookId = jQuery(this).attr('booking-id') || '';
2436					var orderId = jQuery(this).attr('order-id') || '';
2437					jQuery('.calendar-drawer-wrapper').addClass('open');
2438					//console.log('edit-combo-cart', propId, bookId, orderId);
2439					addToCartDrawer(propId, bookId, orderId)
2440				});
2441			} else {
2442				if(!jQuery('#hb-commerce-sdk-root').html().length) {
2443					launch_sdk(myObj);
2444				}
2445			}
2446		});
2447		jQuery(	'.hbgv2-tour-detail .loading-event').addClass('hide');
2448		jQuery( '.hbgv2-tour-detail-overview' ).append(myObj.detailsOverviewHTML);
2449		jQuery( '.hbgv2-tour-detail-about' ).append(myObj.detailsAboutHTML);
2450		jQuery( '.hbgv2-tour-detail-extra' ).append(myObj.detailsExtraHTML);
2451		jQuery( '.hbgv2-tour-detail-additional' ).append(myObj.detailsAdditionalHTML);
2452		jQuery( '.hbgv2-tour-detail-schedule' ).append(myObj.detailsScheduleHTML);
2453		jQuery( '.hbgv2-tour-detail-where' ).append(myObj.detailsWhereHTML);
2454		jQuery(	'.hbgv2-tour-bundle .loading-event').addClass('hide');
2455		jQuery( '.hbgv2-tour-bundle' ).append(myObj.bundleHTML);
2456		if(jQuery('.tour-combo-list-wrapper').length) {
2457			jQuery('.tour-combo-list-wrapper').slick({
2458				infinite: false,
2459				slidesToShow: 2,
2460				slidesToScroll: 2,
2461				dots: true,
2462				responsive: [
2463					{
2464						breakpoint: 767,
2465						settings: {
2466							slidesToShow: 1,
2467							slidesToScroll: 1,
2468						}
2469					}
2470				]
2471			});
2472		}
2473		if(myObj.settings.use_algolia_recommended_tours && myObj.algoliaRecommendedTours.length) {
2474			myObj.listing = myObj.algoliaRecommendedTours;
2475			myObj.settings.thumbor_filters = '320x200/';
2476			for(var item in myObj.settings.related_tour_settings) {
2477				myObj.settings[item] = myObj.settings.related_tour_settings[item];
2478			}
2479			myObj.relatedTourHTML = Mustache.to_html(myObj.related_product_template_html, myObj );
2480			jQuery(	'.hbgv2-tour-related .loading-event').addClass('hide');
2481			jQuery( '.hbgv2-tour-related' ).append(myObj.relatedTourHTML);
2482			jQuery( '.hbgv2-tour-related .slick-listing').slick({
2483				slidesToShow: 4,
2484				slidesToScroll: 4,
2485				centerPadding: '15px',
2486				speed: 1000,
2487				infinite: false,
2488				responsive: [
2489					{
2490						breakpoint: 1181,
2491						settings: {
2492							slidesToShow: 3,
2493							slidesToScroll: 3
2494						}
2495					},
2496					{
2497						breakpoint: 992,
2498						settings: {
2499							slidesToShow: 2,
2500							slidesToScroll: 2
2501						}
2502					},
2503					{
2504						breakpoint: 768,
2505						settings: "unslick"
2506					}
2507				]
2508			});
2509		}
2510	} else if(!myObj.use_promise) {
2511		renderTourHeaderV2(myObj);
2512		renderTourAssetsV2(myObj);
2513		renderTourDetailV2(myObj);
2514		renderTourBundleV2(myObj);
2515		renderTourReviewV2(myObj);
2516		renderTourRelatedV2(myObj);
2517		afterRenderingTourPageV2();
2518	} else {
2519		Promise.all([
2520			renderTourHeaderV2(myObj),
2521			renderTourAssetsV2(myObj),
2522			renderTourDetailV2(myObj),
2523			renderTourBundleV2(myObj),
2524			renderTourReviewV2(myObj),
2525			renderTourRelatedV2(myObj),
2526		]).then(function(result) {
2527			console.log('promise-finished',result);
2528			afterRenderingTourPageV2();
2529			//customModificationTourPageV2();
2530			/*if(myObj.settings.has_check_availability) {
2531				addOnClickAnchorCheckAvailability(myObj, HBCommerce);
2532			}
2533			jQuery('.data-from-anchor a').on('click', function(e) {
2534				e.preventDefault();
2535				window.open(jQuery(this).attr('href'));
2536			});
2537
2538			jQuery('a.ce-package-deal-action').on('click', function(e) {
2539				e.preventDefault();
2540				goToAnchor('#tourComboPackages');
2541
2542			});
2543			addOnClickAnchor(myObj.element_id);*/
2544		}).catch((err) => console.log(err))
2545	}
2546	
2547}
2548
2549function afterRenderingTourPageV2() {
2550    window.addEventListener('scroll', function() {
2551        var bookingWidget = document.getElementById('book-now-widget');
2552        var fullBookingWidget = document.getElementById('hb-commerce-sdk-root');
2553        var navbarDesktop = document.getElementById('product-navbar-desktop');
2554        var navbarMobile = document.getElementById('product-navbar-mobile');
2555		var floatingProductCta = document.getElementById('floating-product-cta');
2556        var bookingWidgetRect = bookingWidget.getBoundingClientRect();
2557        var fullBookingWidgetRect = fullBookingWidget.getBoundingClientRect();
2558        var isFullyOutOfViewport = (bookingWidgetRect.bottom <= 0 || bookingWidgetRect.top >= window.innerHeight) && (fullBookingWidgetRect.bottom <= 0 || fullBookingWidgetRect.top >= window.innerHeight);
2559
2560        if (isFullyOutOfViewport) {
2561            navbarMobile.style.opacity = '1';
2562            navbarDesktop.style.opacity = '1';
2563			floatingProductCta.style.opacity = '1';
2564        } else {
2565            navbarMobile.style.opacity = '0';
2566            navbarDesktop.style.opacity = '0';
2567			floatingProductCta.style.opacity = '0';
2568        }
2569    });
2570	
2571}
2572
2573function renderingTourSecondReviewV2(myObj) {
2574	console.log('second-review-render');
2575	jQuery('.header-reviews').html(myObj.settings.secondReview);
2576	jQuery('.header-reviews:not(.no-full-reviews)').click(function() {
2577		jQuery('html, body').animate({
2578			scrollTop: jQuery('#full-reviews').offset().top - 100
2579		}, 1000);
2580	});
2581	if(myObj.has_second_review && myObj.review.indexOf('EmbedSocialHashtagScript') < 0) {
2582		(function(d, s, id) { var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/cdn/ht.js"; d.getElementsByTagName("head")[0].appendChild(js); }(document, "script", "EmbedSocialHashtagScript"));
2583	}
2584	clearInterval(renderTourReviewSecondInterval);
2585}
2586
2587var renderTourReviewSecondInterval;
2588
2589function renderingTourHeaderV2(myObj) {
2590	//jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-header .loading-event' ).fadeOut( 'slow', function() { 
2591		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-header .loading-event' ).attr('style','display:none;');
2592		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-header' ).append(myObj.headerHTML);
2593		loadInhouseShareV2(myObj);
2594		if(myObj.has_second_review) {
2595			console.log('second-review-start');
2596			renderTourReviewSecondInterval = setInterval(renderingTourSecondReviewV2, 5000, myObj)
2597		}
2598	//});
2599}
2600
2601function renderTourHeaderV2(myObj) {
2602	if(!myObj.use_promise) {
2603		renderingTourHeaderV2(myObj);
2604	} else {
2605		return new Promise(function(resolve) { 
2606			renderingTourHeaderV2(myObj);
2607			resolve(console.log('promise-header-resolved'));
2608		});
2609	}
2610}
2611
2612function renderingTourVideoV2(vid) {
2613	jQuery('.asset-item.video-asset').html(vid);
2614	clearInterval(renderTourVideoInterval);
2615}
2616
2617var renderTourVideoInterval;
2618
2619function renderingTourAssetsV2(myObj) {
2620	//jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-assets .loading-event' ).fadeOut( 'slow', function() { 
2621		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-assets .loading-event' ).attr('style','display:none;');
2622		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-assets' ).append(myObj.assetsHTML);
2623
2624		if(myObj.has_video) {
2625			var embedCode = myObj.video;
2626			var videoIdRegex = /embed\/([^"?]+)/;
2627			var match = embedCode.match(videoIdRegex);
2628			if (match && match.length > 1) {
2629				var videoId = match[1];
2630				//console.log(videoId);
2631				var newSrc = 'https://i3.ytimg.com/vi/' + videoId + '/hqdefault.jpg'; // Replace with your new source URL
2632				jQuery('.tour-video-thumbnail img').attr('src', newSrc);
2633			} else {
2634				jQuery('.tour-video-thumbnail img').attr('src', 'https://assets.cityexperiences.com/wp-content/uploads/2023/06/vimeo-video-thumbnail.jpg');
2635			}
2636			renderTourVideoInterval = setInterval(renderingTourVideoV2, 5000, myObj.video);
2637		}
2638		jQuery('a.ce-package-deal-action').on('click', function(e) {
2639			e.preventDefault();
2640			goToAnchor('#tourComboPackages');
2641
2642		});
2643
2644		jQuery('a.ce-book-now-action').on('click', function(e) {
2645			e.preventDefault();
2646			jQuery('#cart-container').removeClass('hide');
2647			jQuery('#cart-container').removeClass('make-height-0px');
2648			goToAnchor('#cart-container');
2649			//console.log('check-avail', myObj)
2650			if(myObj.settings.is_combo_deal) {
2651				var foundIt = false;
2652				for(var j = 0; j < myObj.settings.combo_deal_properties.length; j++) {
2653					if(!foundIt && !myObj.settings.combo_deal_properties[j].combo_added_to_cart) {
2654						launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[j]);
2655						foundIt = true;
2656					}
2657				}
2658				if(!foundIt) {
2659					jQuery('.combo-complete .btn').removeClass('in-progress');
2660					jQuery('.combo-complete .btn').removeClass('disabled');
2661				}
2662				jQuery('.each-combo-title').on('click', function(e) {
2663					e.preventDefault();
2664					var propBookId = jQuery(this).attr('prop-book-id');
2665					var thisIdx = parseInt(jQuery(this).attr('prop-idx'));
2666					if(!jQuery(this).parent().hasClass('open') && !jQuery(this).hasClass('disabled')) {
2667						jQuery('.combo-wrapper .each-combo').removeClass('open');
2668						jQuery(this).parent().addClass('open');
2669						launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[thisIdx]);
2670						goToAnchor('#comboWrapperTour');
2671					}
2672					event.stopPropagation();
2673				});
2674				jQuery('a.edit-combo-cart').on('click', function(e) {
2675					e.preventDefault();
2676					var propId = jQuery(this).attr('property-id') || '';
2677					var bookId = jQuery(this).attr('booking-id') || '';
2678					var orderId = jQuery(this).attr('order-id') || '';
2679					jQuery('.calendar-drawer-wrapper').addClass('open');
2680					//console.log('edit-combo-cart', propId, bookId, orderId);
2681					addToCartDrawer(propId, bookId, orderId)
2682				});
2683			} else {
2684				if(!jQuery('#hb-commerce-sdk-root').html().length) {
2685					console.log('pre-launch_sdk');
2686					launch_sdk(myObj);
2687				}
2688			}
2689		});
2690		jQuery('.assets-wrapper').slick({
2691			infinite: true,
2692			slidesToShow: 1,
2693			slidesToScroll: 1,
2694			autoplay: false,
2695			autoplaySpeed: 3000,
2696			prevArrow: '<i class="fas fa-angle-left" aria-hidden="true"></i>',
2697			nextArrow: '<i class="fas fa-angle-right" aria-hidden="true"></i>',
2698			fade: true,
2699			cssEase: 'linear',
2700			asNavFor: '.event-thumbnails'
2701		});
2702		jQuery('.event-thumbnails').slick({
2703			slidesToShow: 3,
2704			slidesToScroll: 1,
2705			vertical:true,
2706			asNavFor: '.assets-wrapper',
2707			dots: false,
2708			arrows: false,
2709			focusOnSelect: true,
2710			verticalSwiping:true,
2711			infinite: true,
2712			responsive: [
2713				{
2714					breakpoint: 901,
2715					settings: {
2716						vertical: false
2717					}
2718				}
2719			]
2720		});
2721	//});
2722}
2723
2724function renderTourAssetsV2(myObj) {
2725	if(!myObj.use_promise) {
2726		renderingTourAssetsV2(myObj);
2727	} else {
2728		return new Promise(function(resolve) { 
2729			renderingTourAssetsV2(myObj);
2730			resolve(console.log('promise-assets-resolved')); 
2731		});
2732	}
2733}
2734
2735function renderingTourMapV2(map) {
2736	jQuery('.map-section').html(map);
2737	clearInterval(renderTourMapInterval);
2738}
2739
2740var renderTourMapInterval;
2741
2742function renderingTourDetailV2(myObj) {
2743	//jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail .loading-event' ).fadeOut( 'slow', function() { 
2744		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail .loading-event' ).attr('style','display:none;');
2745		if(myObj.settings.is_default_template) {
2746			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-overview' ).append(myObj.detailsOverviewHTML);
2747			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-about' ).append(myObj.detailsAboutHTML);
2748			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-extra' ).append(myObj.detailsExtraHTML);
2749			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-additional' ).append(myObj.detailsAdditionalHTML);
2750			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-schedule' ).append(myObj.detailsScheduleHTML);
2751			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail-where' ).append(myObj.detailsWhereHTML);
2752		} else {
2753			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-detail' ).append(myObj.detailsHTML);
2754		}
2755		const parentDiv = document.getElementById("product-page-overview");
2756		console.log('parentDiv', parentDiv);
2757		const allText = parentDiv.innerHTML;
2758		const MAX_TEXT_LENGTH = 300;
2759
2760		// Function to calculate text length without HTML tags
2761		function getTextLength(text) {
2762			const div = document.createElement("div");
2763			div.innerHTML = text;
2764			return div.textContent.length;
2765		}
2766
2767		// Calculate the length of the text without HTML tags
2768		const textLength = getTextLength(allText);
2769
2770		if (textLength >= MAX_TEXT_LENGTH) {
2771			const screenWidth = window.innerWidth;
2772			let truncatedText, remainingText;
2773
2774			if (screenWidth <= 500) {
2775				truncatedText = allText.substring(0, 75);
2776				remainingText = allText.substring(75);
2777			} else {
2778				truncatedText = allText.substring(0, MAX_TEXT_LENGTH);
2779				remainingText = allText.substring(MAX_TEXT_LENGTH);
2780			}
2781
2782			parentDiv.innerHTML = truncatedText;
2783
2784			const readMoreLink = document.createElement("a");
2785			readMoreLink.href = "#";
2786			readMoreLink.textContent = "...Read More";
2787			readMoreLink.addEventListener("touchstart", function(e) {
2788				e.preventDefault();
2789				parentDiv.innerHTML = truncatedText + remainingText;
2790				readMoreLink.style.display = "none";
2791				readLessLink.style.display = "inline";
2792			});
2793			readMoreLink.addEventListener("click", function(e) {
2794				e.preventDefault();
2795				parentDiv.innerHTML = allText;
2796				readMoreLink.style.display = "none";
2797				readLessLink.style.display = "inline";
2798			});
2799
2800			const readLessLink = document.createElement("a");
2801			readLessLink.href = "#";
2802			readLessLink.textContent = " Show Less";
2803			readLessLink.addEventListener("touchstart", function(e) {
2804				e.preventDefault();
2805				parentDiv.innerHTML = truncatedText;
2806				readMoreLink.style.display = "inline";
2807				readLessLink.style.display = "none";
2808			});
2809			readLessLink.addEventListener("click", function(e) {
2810				e.preventDefault();
2811				parentDiv.innerHTML = truncatedText;
2812				readMoreLink.style.display = "inline";
2813				readLessLink.style.display = "none";
2814			});
2815			readLessLink.style.display = "none";
2816
2817			parentDiv.insertAdjacentElement("afterend", readMoreLink);
2818			parentDiv.insertAdjacentElement("afterend", readLessLink);
2819		}
2820		jQuery('.overview-div li').each(function() {
2821			if (jQuery(this).text().includes('hour')) {
2822				jQuery(this).addClass('clock-icon');
2823			} else if (jQuery(this).text().includes('minutes')) {
2824				jQuery(this).addClass('clock-icon');
2825			} else if (jQuery(this).text().includes('plated')) {
2826				jQuery(this).addClass('food-icon');
2827			} else if (jQuery(this).text().includes('Plated')) {
2828				jQuery(this).addClass('food-icon');
2829			} else if (jQuery(this).text().includes('Buffet')) {
2830				jQuery(this).addClass('food-icon');
2831			} else if (jQuery(this).text().includes('meal')) {
2832				jQuery(this).addClass('food-icon');
2833			} else if (jQuery(this).text().includes('menu')) {
2834				jQuery(this).addClass('food-icon');
2835			} else if (jQuery(this).text().includes('pastries')) {
2836				jQuery(this).addClass('food-icon');
2837			} else if (jQuery(this).text().includes('lunch')) {
2838				jQuery(this).addClass('food-icon');
2839			} else if (jQuery(this).text().includes('Lunch')) {
2840				jQuery(this).addClass('food-icon');
2841			} else if (jQuery(this).text().includes('dinner')) {
2842				jQuery(this).addClass('food-icon');
2843			} else if (jQuery(this).text().includes('Dinner')) {
2844				jQuery(this).addClass('food-icon');
2845			} else if (jQuery(this).text().includes('Delicious')) {
2846				jQuery(this).addClass('food-icon delicious-item');
2847			} else if (jQuery(this).text().includes('delicious')) {
2848				jQuery(this).addClass('food-icon delicious-item');
2849			} else if (jQuery(this).text().includes('Wheelchair')) {
2850				jQuery(this).addClass('wheelchair-icon');
2851			} else if (jQuery(this).text().includes('wheelchair')) {
2852				jQuery(this).addClass('wheelchair-icon');
2853			} else if (jQuery(this).text().includes('Dress')) {
2854				jQuery(this).addClass('shirt-icon');
2855			} else if (jQuery(this).text().includes('dress')) {
2856				jQuery(this).addClass('shirt-icon');
2857			} else if (jQuery(this).text().includes('entertainment')) {
2858				jQuery(this).addClass('entertainment-icon');
2859			} else if (jQuery(this).text().includes('Alcoholic')) {
2860				jQuery(this).addClass('cocktail-icon');
2861			} else if (jQuery(this).text().includes('cocktail')) {
2862				jQuery(this).addClass('cocktail-icon');
2863			} else if (jQuery(this).text().includes('bar')) {
2864				jQuery(this).addClass('cocktail-icon');
2865			} else if (jQuery(this).text().includes('full-bar')) {
2866				jQuery(this).addClass('cocktail-icon');
2867			} else if (jQuery(this).text().includes('mimosas')) {
2868				jQuery(this).addClass('cocktail-icon');
2869			} else if (jQuery(this).text().includes('views')) {
2870				jQuery(this).addClass('views-icon');
2871			}
2871 else if (jQuery(this).text().includes('Cocktail Cruise')) {
2872				jQuery(this).addClass('cocktail-cruise-menu');
2873			} else if (jQuery(this).text().includes('Happy Hour Cruise')) {
2874				jQuery(this).addClass('happy-hour-cruise-menu');
2875			} else if (jQuery(this).text().includes('commentary')) {
2876				jQuery(this).addClass('headphones-icon');
2877			} else if (jQuery(this).text().includes('champagne')) {
2878				jQuery(this).addClass('cheers-icon');
2879			} else if (jQuery(this).text().includes('wine')) {
2880				jQuery(this).addClass('cheers-icon');
2881			} else if (jQuery(this).text().includes('Prosecco')) {
2882				jQuery(this).addClass('cheers-icon');
2883			} else if (jQuery(this).text().toLowerCase().includes('vip packages')) {
2884				jQuery(this).addClass('crown-icon');
2885			} else if (jQuery(this).text().toLowerCase().includes('vip tickets')) {
2886				jQuery(this).addClass('crown-icon');
2887			}
2888		});
2889
2890		jQuery('.overview-div.alcatraz-overview li').each(function() {
2891			if (jQuery(this).text().includes('Duration')) {
2892				jQuery(this).addClass('clock-icon');
2893			} else if (jQuery(this).text().includes('Round-trip')) {
2894				jQuery(this).addClass('ferry-icon');
2895			} else if (jQuery(this).text().includes('Explore')) {
2896				jQuery(this).addClass('feet-icon');
2897			} else if (jQuery(this).text().includes('explore')) {
2898				jQuery(this).addClass('feet-icon');
2899			} else if (jQuery(this).text().includes('Access')) {
2900				jQuery(this).addClass('feet-icon');
2901			} else if (jQuery(this).text().includes('messaging')) {
2902				jQuery(this).addClass('pencil-icon');
2903			} else if (jQuery(this).text().includes('Audio')) {
2904				jQuery(this).addClass('headphones-icon');
2905			} else if (jQuery(this).text().includes('Admission')) {
2906				jQuery(this).addClass('ticket-icon');
2907			} else if (jQuery(this).text().includes('admission')) {
2908				jQuery(this).addClass('ticket-icon');
2909			} else if (jQuery(this).text().includes('Scenic')) {
2910				jQuery(this).addClass('views-icon');
2911			} else if (jQuery(this).text().includes('Guided')) {
2912				jQuery(this).addClass('hat-icon');
2913			}
2914		});
2915
2916		jQuery('.overview-div.statue-overview li').each(function() {
2917			if (jQuery(this).text().includes('Duration')) {
2918				jQuery(this).addClass('clock-icon');
2919			} else if (jQuery(this).text().includes('Round-trip')) {
2920				jQuery(this).addClass('ferry-icon');
2921			} else if (jQuery(this).text().includes('ferry')) {
2922				jQuery(this).addClass('ferry-icon');
2923			} else if (jQuery(this).text().includes('Explore')) {
2924				jQuery(this).addClass('feet-icon');
2925			} else if (jQuery(this).text().includes('explore')) {
2926				jQuery(this).addClass('feet-icon');
2927			} else if (jQuery(this).text().includes('Access')) {
2928				jQuery(this).addClass('feet-icon');
2929			} else if (jQuery(this).text().includes('messaging')) {
2930				jQuery(this).addClass('pencil-icon');
2931			} else if (jQuery(this).text().includes('Audio')) {
2932				jQuery(this).addClass('headphones-icon');
2933			} else if (jQuery(this).text().includes('Admission')) {
2934				jQuery(this).addClass('ticket-icon');
2935			} else if (jQuery(this).text().includes('admission')) {
2936				jQuery(this).addClass('ticket-icon');
2937			} else if (jQuery(this).text().includes('Scenic')) {
2938				jQuery(this).addClass('views-icon');
2939			} else if (jQuery(this).text().includes('priority')) {
2940				jQuery(this).addClass('star-icon');
2941			} else if (jQuery(this).text().includes('Priority')) {
2942				jQuery(this).addClass('star-icon');
2943			} else if (jQuery(this).text().includes('galleries')) {
2944				jQuery(this).addClass('gallery-icon');
2945			}
2946		});
2947	
2948		jQuery('.overview-div li.shirt-icon:contains("smart-casual attire")').html(function (_, html) {
2949			return html.replace('smart-casual attire', '<span class="tooltip-trigger tooltip-smart-casual">smart-casual attire</span>');
2950		});
2951		jQuery('.overview-div li.shirt-icon .tooltip-smart-casual').append('<span class="dresscode-tooltip">We encourage smart-casual attire. However, please feel free to dress for your occasion whether you are celebrating or just heading out for an amazing meal on the Thames. We would advise against flip-flops, leisurewear and ripped jeans.</span>');
2952	
2953		jQuery('.overview-div li.shirt-icon:contains("casual attire")').html(function (_, html) {
2954			if(!html.includes("smart-casual attire")){
2955			   return html.replace('casual attire', '<span class="tooltip-trigger tooltip-casual">casual attire</span>');
2956			}
2957		});
2958		jQuery('.overview-div li.shirt-icon .tooltip-casual').append('<span class="dresscode
2958-tooltip">Khakis, nice jeans, dresses, button-up shirts, and blouses</span>');
2959
2960		jQuery('.overview-div li.shirt-icon:contains("semi-formal attire")').html(function (_, html) {
2961			return html.replace('semi-formal attire', '<span class="tooltip-trigger tooltip-semi-formal">semi-formal attire</span>');
2962		});
2963		jQuery('.overview-div li.shirt-icon .tooltip-semi-formal').append('<span class="dresscode-tooltip">This is your excuse to dress up! We require semi-formal attire (dress pants, dress shirts, skirts or dresses and dress shoes). Casual jeans, t-shirts, and sandals are not permitted onboard.</span>');
2964
2965		jQuery('.overview-div li.shirt-icon:contains("cocktail attire")').html(function (_, html) {
2966			return html.replace('cocktail attire', '<span class="tooltip-trigger tooltip-cocktail">cocktail attire</span>');
2967		});
2968		jQuery('.overview-div li.shirt-icon .tooltip-cocktail').append('<span class="dresscode-tooltip">Collared shirts, blouses, sports coats, slacks, and dresses</span>');
2969
2970
2971		jQuery('.overview-div li.food-icon:not(.delicious-item)').append('<span class="d-inline inline-dining-menu"> <a href="" data-toggle="modal" data-target="#diningMenu">View Dining Menu</a></span>');
2972		jQuery('.overview-div li.cocktail-cruise-menu').append('<span class="d-inline"> <a href="" data-toggle="modal" data-target="#diningMenu">View Menu</a></span>');
2973		jQuery('.overview-div li.happy-hour-cruise-menu').append('<span class="d-inline"> <a href="" data-toggle="modal" data-target="#diningMenu">View Menu</a></span>');
2974		
2975		if(myObj.has_map) {
2976			renderTourMapInterval = setInterval(renderingTourMapV2, 5000, myObj.map_iframe);
2977		}
2978		
2979	//});
2980}
2981
2982function renderTourDetailV2(myObj) {
2983	if(!myObj.use_promise) {
2984		renderingTourDetailV2(myObj);
2985	} else {
2986		return new Promise(function(resolve) { 
2987			renderingTourDetailV2(myObj);
2988			resolve(console.log('promise-assets-resolved')); 
2989		});
2990	}
2991}
2992
2993function renderingTourBundleV2(myObj) {
2994	//jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-bundle .loading-event' ).fadeOut( 'slow', function() { 
2995		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-bundle .loading-event' ).attr('style','display:none;');
2996		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-bundle' ).append(myObj.bundleHTML);
2997		if(jQuery('.tour-combo-list-wrapper').length) {
2998			jQuery('.tour-combo-list-wrapper').slick({
2999				infinite: false,
3000				slidesToShow: 2,
3001				slidesToScroll: 2,
3002				dots: true,
3003				responsive: [
3004					{
3005						breakpoint: 767,
3006						settings: {
3007							slidesToShow: 1,
3008							slidesToScroll: 1,
3009						}
3010					}
3011				]
3012			});
3013		}
3014	//});
3015}
3016
3017function renderTourBundleV2(myObj) {
3018	if(!myObj.use_promise) {
3019		renderingTourBundleV2(myObj);
3020	} else {
3021		return new Promise(function(resolve) { 
3022			renderingTourBundleV2(myObj);
3023			resolve(console.log('promise-bundle-resolved'));
3024		});
3025	}
3026}
3027
3028function renderingTourReviewV2(myObj) {
3029	jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-review .loading-event' ).fadeOut( 'slow', function() { 
3030		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-review' ).append(myObj.reviewHTML);
3031		if(myObj.has_review && myObj.review.indexOf('EmbedSocialReviewsScript') < 0) {
3032			(function(d, s, id){ var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/embedscript/ri.js"; d.getElementsByTagName("head")[0].appendChild(js); }(document, "script", "EmbedSocialReviewsScript"));
3033		}
3034	});
3035	clearInterval(renderTourReviewInterval);
3036}
3037var renderTourReviewInterval;
3038function renderTourReviewV2(myObj) {
3039	if(!myObj.use_promise) {
3040		//renderingTourReviewV2(myObj);
3041		renderTourReviewInterval = setInterval(renderingTourReviewV2, 5000, myObj)
3042	} else {
3043		return new Promise(function(resolve) { 
3044			renderingTourReviewV2(myObj);
3045			//renderTourReviewInterval = setInterval(renderingTourReviewV2, 5000, myObj)
3046			resolve(console.log('promise-review-resolved'));
3047		});
3048	}
3049}
3050
3051function renderTourRelatedV2(myObj) {
3052		
3053	if(myObj.settings.show_related_tour) {
3054		
3055		if(myObj.settings.use_algolia_recommended_tours && myObj.algoliaRecommendedTours.length) {
3056			myObj.listing = myObj.algoliaRecommendedTours;
3057			myObj.settings.thumbor_filters = '320x200/';
3058			for(var item in myObj.settings.related_tour_settings) {
3059				myObj.settings[item] = myObj.settings.related_tour_settings[item];
3060			}
3061			myObj.relatedTourHTML = Mustache.to_html(myObj.related_product_template_html, myObj );
3062			jQuery( '.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-related .loading-event' ).fadeOut( 'slow', function() {
3063				jQuery('.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-related' ).append(myObj.relatedTourHTML);
3064				jQuery('.hbg-display-tour.' + myObj.element_first + ' .hbgv2-tour-related .slick-listing').slick({
3065					slidesToShow: 4,
3066					slidesToScroll: 4,
3067					centerPadding: '15px',
3068					speed: 1000,
3069					infinite: false,
3070					responsive: [
3071						{
3072							breakpoint: 1181,
3073							settings: {
3074								slidesToShow: 3,
3075								slidesToScroll: 3
3076							}
3077						},
3078						{
3079							breakpoint: 992,
3080							settings: {
3081								slidesToShow: 2,
3082								slidesToScroll: 2
3083							}
3084						},
3085						{
3086							breakpoint: 768,
3087							settings: "unslick"
3088						}
3089					]
3090				});
3091			});			
3092		} else {
3093			
3094			myObj.settings.related_tour_settings.additionalCitiesArr = [];
3095			if(myObj.settings.related_tour_settings.search_city && myObj.settings.related_tour_settings.search_city.length) {
3096				myObj.settings.related_tour_settings.additionalCitiesArr = myObj.settings.related_tour_settings.search_city.split(',');
3097			}
3098			myObj.settings.site_id = '';
3099			myObj.exclude_list = (myObj.exclude_list||[]).length > 0 ? myObj.exclude_list + ',' + myObj.tourId : myObj.tourId;
3100			myObj.exclude_list = myObj.settings.related_tour_settings.exclude_list.length ? myObj.exclude_list + ',' + myObj.settings.related_tour_settings.exclude_list : myObj.exclude_list;
3101			for(var item in myObj.settings.related_tour_settings) {
3102				myObj.settings[item] = myObj.settings.related_tour_settings[item];
3103			}
3104
3105			var startDate = new Date();
3106			var startDateStr =  ('0'+(startDate.getMonth()+1)).slice(-2) + '/' + ('0'+(startDate.getDate())).slice(-2) + '/' + startDate.getFullYear();
3107			var endDate = new Date();
3108			endDate.setMonth(endDate.getMonth() + myObj.settings.related_tour_settings.event_range_in_month);
3109			var endDateStr =  ('0'+(endDate.getMonth()+1)).slice(-2) + '/' + ('0'+(endDate.getDate())).slice(-2) + '/' + endDate.getFullYear();
3110
3111			// TEMPORARY SET SITE_ID TO cityexperiences TO PULL FROM SELL ON FIELD
3112			myObj.settings.related_tour_settings.site_id = 'cityexperiences';
3113			if(myObj.tempShowListing && !myObj.settings.is_experiences) {
3114				myObj.settings.related_tour_settings.additionalCitiesArr = ['boston harbor','alcatraz - san francisco','new york statue','alexandria','potomac riverboat co','ontario','london','berkeley','poole','york'];
3115				myObj.settings.related_tour_settings.additionalCitiesArr = myObj.settings.related_tour_settings.search_city.split(',');
3116				myObj.settings.related_tour_settings.search_city = 'not-available';
3117			}
3118
3119			var relatedData = { propertyId: myObj.settings.related_tour_settings.property_id, searchTerm: myObj.settings.related_tour_settings.search_term, city: myObj.settings.related_tour_settings.search_city, crossSellCities: myObj.settings.related_tour_settings.additionalCitiesArr, siteId: myObj.settings.related_tour_settings.site_id,  includeAvailability: myObj.settings.related_tour_settings.include_availability, includeMenu: false, date: startDateStr, endDate: endDateStr };
3120			HBCommerce
3121				.graphql({ sdkSrc: myObj.sdkSrc })
3122				.then(function(gql) {
3123				gql.searchTours(relatedData).then(function(relatedTours) {
3124					myObj.gql = gql;
3125					//console.log('prePreDisplayRelatedList2', relatedTours);
3126					//preDisplayRelatedList(myObj, relatedTours);
3127				}).catch(console.log);
3128			})
3129				.catch(function(error) {
3130				//Handle error
3131			});	
3132		}
3133
3134	}
3135
3136}
3137
3138function preRenderTourPageV2SDK(myObj) {
3139	//console.log('preRenderTourPageV2SDK', myObj);
3140	if(myObj.tourSdk !== undefined) {
3141		renderTourPageV2SDK(myObj);
3142	} else {
3143		HBCommerce
3144		  .graphql({ sdkSrc: myObj.sdkSrc })
3145		  .then(function(gql) {
3146			gql.searchTours({ propertyId: myObj.property_id, bookingType: myObj.booking_type_id_content, includeAvailability: false, includeMenu: true, showPrivateTours: true, includeLocationTags: true, includeRecentBookings: true, includeLikelyToSellOut: true, addApplicableSpecialCoupons: true })
3147			  .then(function(tour) {
3148				myObj.gql = gql;
3149				myObj.tourSdk = tour;
3150				renderTourPageV2SDK(myObj);
3151			})
3152			.catch(console.log);
3153		  })
3154		  .catch(function(error) {
3155			//Handle error
3156		  });	
3157	}
3158}
3159
3160function customModificationTourPageV2(myObj) {
3161	// START PRODUCT PAGE OVERVIEW TRUNCATION
3162    const parentDiv = document.getElementById("product-page-overview");
3163	if (parentDiv && !myObj.settings.no_truncate_overview) {
3164		const allText = parentDiv.innerHTML;
3165	
3166
3167		// Function to calculate text length without HTML tags
3168		function getTextLength(text) {
3169			const div = document.createElement("div");
3170			div.innerHTML = text;
3171			return div.textContent.length;
3172		}
3173
3174		// Check if a specific class exists on the page for longer truncation
3175		const longerProductPageOverview = parentDiv.classList.contains("longer-product-page-overview");
3176
3177		const MAX_TEXT_LENGTH = longerProductPageOverview ? 600 : 300;
3178
3179		// Calculate the length of the text without HTML tags
3180		const textLength = getTextLength(allText);
3181
3182		if (textLength >= MAX_TEXT_LENGTH) {
3183			const screenWidth = window.innerWidth;
3184			let truncatedText, remainingText;
3185
3186			if (screenWidth <= 500) {
3187				truncatedText = allText.substring(0, 75);
3188				remainingText = allText.substring(75);
3189			} else {
3190				truncatedText = allText.substring(0, MAX_TEXT_LENGTH);
3191				remainingText = allText.substring(MAX_TEXT_LENGTH);
3192			}
3193
3194			parentDiv.innerHTML = truncatedText;
3195
3196			const readMoreLink = document.createElement("a");
3197			readMoreLink.classList.add("overview-read-more");
3198			readMoreLink.href = "#";
3199			readMoreLink.textContent = "...Read More";
3200			readMoreLink.textContent = jQuery('.translation-wrapper .lang-read-more').html();
3201			readMoreLink.addEventListener("touchstart", function(e) {
3202				e.preventDefault();
3203				parentDiv.innerHTML = truncatedText + remainingText;
3204				readMoreLink.style.display = "none";
3205				readLessLink.style.display = "inline";
3206			});
3207			readMoreLink.addEventListener("click", function(e) {
3208				e.preventDefault();
3209				parentDiv.innerHTML = allText;
3210				readMoreLink.style.display = "none";
3211				readLessLink.style.display = "inline";
3212			});
3213
3214			const readLessLink = document.createElement("a");
3215			readLessLink.classList.add("overview-show-less");
3216			readLessLink.href = "#";
3217			readLessLink.textContent = " Show Less";
3218			readLessLink.textContent = jQuery('.translation-wrapper .lang-show-less').html();
3219			readLessLink.addEventListener("touchstart", function(e) {
3220				e.preventDefault();
3221				parentDiv.innerHTML = truncatedText;
3222				readMoreLink.style.display = "inline";
3223				readLessLink.style.display = "none";
3224			});
3225			readLessLink.addEventListener("click", function(e) {
3226				e.preventDefault();
3227				parentDiv.innerHTML = truncatedText;
3228				readMoreLink.style.display = "inline";
3229				readLessLink.style.display = "none";
3230			});
3231			readLessLink.style.display = "none";
3232
3233			parentDiv.insertAdjacentElement("afterend", readMoreLink);
3234			parentDiv.insertAdjacentElement("afterend", readLessLink);
3235		}
3236		// END PRODUCT PAGE OVERVIEW TRUNCATION
3237	}
3238
3239	// START PRODUCT PAGE ESSENTIAL INFO TRUNCATION FOR EXPERIENCES PRODUCTS
3240	const essentialInfoDiv = document.getElementById("experiences-product-page-overview");
3241	if (essentialInfoDiv && !myObj.settings.no_truncate_essential) {
3242		const allEssentialInfoText = essentialInfoDiv.innerHTML;
3243
3244		// Function to calculate text length without HTML tags
3245		function getTextLength(text) {
3246			const div = document.createElement("div");
3247			div.innerHTML = text;
3248			return div.textContent.length;
3249		}
3250
3251		const MAX_TEXT_LENGTH_essential_info = 300;
3252
3253		// Calculate the length of the text without HTML tags
3254		const textLengthEssentialInfo = getTextLength(allEssentialInfoText);
3255
3256		if (textLengthEssentialInfo >= MAX_TEXT_LENGTH_essential_info) {
3257			const screenWidth = window.innerWidth;
3258			let truncatedText, remainingText;
3259
3260			if (screenWidth <= 500) {
3261				truncatedText = allEssentialInfoText.substring(0, 75);
3262				remainingText = allEssentialInfoText.substring(75);
3263			} else {
3264				truncatedText = allEssentialInfoText.substring(0, MAX_TEXT_LENGTH_essential_info);
3265				remainingText = allEssentialInfoText.substring(MAX_TEXT_LENGTH_essential_info);
3266			}
3267
3268			essentialInfoDiv.innerHTML = truncatedText;
3269
3270			const readMoreLink = document.createElement("a");
3271			readMoreLink.classList.add("overview-read-more");
3272			readMoreLink.href = "#";
3273			readMoreLink.textContent = "...Read More";
3274			readMoreLink.textContent = jQuery('.translation-wrapper .lang-read-more').html();
3275			readMoreLink.addEventListener("touchstart", function(e) {
3276				e.preventDefault();
3277				essentialInfoDiv.innerHTML = truncatedText + remainingText;
3278				readMoreLink.style.display = "none";
3279				readLessLink.style.display = "inline";
3280			});
3281			readMoreLink.addEventListener("click", function(e) {
3282				e.preventDefault();
3283				essentialInfoDiv.innerHTML = allEssentialInfoText;
3284				readMoreLink.style.display = "none";
3285				readLessLink.style.display = "inline";
3286			});
3287
3288			const readLessLink = document.createElement("a");
3289			readLessLink.classList.add("overview-show-less");
3290			readLessLink.href = "#";
3291			readLessLink.textContent = " Show Less";
3292			readLessLink.textContent = jQuery('.translation-wrapper .lang-show-less').html();
3293			readLessLink.addEventListener("touchstart", function(e) {
3294				e.preventDefault();
3295				essentialInfoDiv.innerHTML = truncatedText;
3296				readMoreLink.style.display = "inline";
3297				readLessLink.style.display = "none";
3298			});
3299			readLessLink.addEventListener("click", function(e) {
3300				e.preventDefault();
3301				essentialInfoDiv.innerHTML = truncatedText;
3302				readMoreLink.style.display = "inline";
3303				readLessLink.style.display = "none";
3304			});
3305			readLessLink.style.display = "none";
3306
3307			essentialInfoDiv.insertAdjacentElement("afterend", readMoreLink);
3308			essentialInfoDiv.insertAdjacentElement("afterend", readLessLink);
3309		}
3310	}
3311	// END PRODUCT PAGE ESSENTIAL INFO TRUNCATION FOR EXPERIENCES PRODUCTS
3312
3313	// START PRODUCT PAGE ALL OPTIONS INFO TRUNCATION FOR ALL OPTIONS PRODUCTS
3314	const allOptionsInfoDiv = document.getElementById("all-options-product-page-overview");
3315	if (allOptionsInfoDiv) {
3316		//console.log('has all options overview');
3317		const allOptionsInfoText = allOptionsInfoDiv.innerHTML;
3318
3319		// Function to calculate text length without HTML tags
3320		function getTextLength(text) {
3321			const div = document.createElement("div");
3322			div.innerHTML = text;
3323			return div.textContent.length;
3324		}
3325
3326		const MAX_TEXT_LENGTH_all_options_info = 300;
3327
3328		// Calculate the length of the text without HTML tags
3329		const textLengthAllOptionsInfo = getTextLength(allOptionsInfoText);
3330
3331		if (textLengthAllOptionsInfo >= MAX_TEXT_LENGTH_all_options_info) {
3332			const screenWidth = window.innerWidth;
3333			let truncatedText, remainingText;
3334
3335			if (screenWidth <= 500) {
3336				truncatedText = allOptionsInfoText.substring(0, 150);
3337				remainingText = allOptionsInfoText.substring(150);
3338			} else {
3339				truncatedText = allOptionsInfoText.substring(0, MAX_TEXT_LENGTH_all_options_info);
3340				remainingText = allOptionsInfoText.substring(MAX_TEXT_LENGTH_all_options_info);
3341			}
3342
3343			allOptionsInfoDiv.innerHTML = truncatedText;
3344
3345			const readMoreLink = document.createElement("a");
3346			readMoreLink.classList.add("overview-read-more");
3347			readMoreLink.href = "#";
3348			readMoreLink.textContent = "...Read More";
3349			readMoreLink.textContent = jQuery('.translation-wrapper .lang-read-more').html();
3350			readMoreLink.addEventListener("touchstart", function(e) {
3351				e.preventDefault();
3352				allOptionsInfoDiv.innerHTML = truncatedText + remainingText;
3353				readMoreLink.style.display = "none";
3354				readLessLink.style.display = "inline";
3355			});
3356			readMoreLink.addEventListener("click", function(e) {
3357				e.preventDefault();
3358				allOptionsInfoDiv.innerHTML = allOptionsInfoText;
3359				readMoreLink.style.display = "none";
3360				readLessLink.style.display = "inline";
3361			});
3362
3363			const readLessLink = document.createElement("a");
3364			readLessLink.classList.add("overview-show-less");
3365			readLessLink.href = "#";
3366			readLessLink.textContent = " Show Less";
3367			readLessLink.textContent = jQuery('.translation-wrapper .lang-show-less').html();
3368			readLessLink.addEventListener("touchstart", function(e) {
3369				e.preventDefault();
3370				allOptionsInfoDiv.innerHTML = truncatedText;
3371				readMoreLink.style.display = "inline";
3372				readLessLink.style.display = "none";
3373			});
3374			readLessLink.addEventListener("click", function(e) {
3375				e.preventDefault();
3376				allOptionsInfoDiv.innerHTML = truncatedText;
3377				readMoreLink.style.display = "inline";
3378				readLessLink.style.display = "none";
3379			});
3380			readLessLink.style.display = "none";
3381
3382			allOptionsInfoDiv.insertAdjacentElement("afterend", readMoreLink);
3383			allOptionsInfoDiv.insertAdjacentElement("afterend", readLessLink);
3384		}
3385	}
3386	// END PRODUCT PAGE ALL OPTIONS INFO TRUNCATION FOR ALL OPTIONS PRODUCTS
3387
3388	// START PRODUCT PAGE ALL OPTIONS SINGLE TOUR INFO TRUNCATION FOR ALL OPTIONS PRODUCTS
3389	document.querySelectorAll('.ao-tour-description > p').forEach(descriptionDiv => {
3390		const allOptionsInfoText = descriptionDiv.innerHTML;
3391	
3392		const getTextLength = text => {
3393			const div = document.createElement("div");
3394			div.innerHTML = text;
3395			return div.textContent.length;
3396		};
3397		let MAX_TEXT_LENGTH = 400;
3398		if (window.innerWidth <= 500) {
3399			MAX_TEXT_LENGTH = 150;
3400		}
3401		const textLength = getTextLength(allOptionsInfoText);
3402		
3403		if (textLength >= MAX_TEXT_LENGTH /*&& window.innerWidth <= 500*/) {
3404			const truncatedText = allOptionsInfoText.substring(0, MAX_TEXT_LENGTH);
3405			const remainingText = allOptionsInfoText.substring(MAX_TEXT_LENGTH);
3406	
3407			descriptionDiv.innerHTML = truncatedText;
3408	
3409			const readMoreLink = document.createElement("a");
3410			const readLessLink = document.createElement("a");
3411	
3412			readMoreLink.classList.add("overview-read-more");
3413			readLessLink.classList.add("overview-show-less");
3414	
3415			readMoreLink.href = "#";
3416			readLessLink.href = "#";
3417	
3418			readMoreLink.textContent = jQuery('.translation-wrapper .lang-read-more').html() || "...Read More";
3419			readLessLink.textContent = jQuery('.translation-wrapper .lang-show-less').html() || " Show Less";
3420	
3421			readMoreLink.addEventListener("touchstart", toggleContent);
3422			readMoreLink.addEventListener("click", toggleContent);
3423			readLessLink.addEventListener("touchstart", toggleContent);
3424			readLessLink.addEventListener("click", toggleContent);
3425	
3426			readLessLink.style.display = "none";
3427	
3428			descriptionDiv.insertAdjacentElement("afterend", readMoreLink);
3429			descriptionDiv.insertAdjacentElement("afterend", readLessLink);
3430	
3431			function toggleContent(e) {
3432				e.preventDefault();
3433				const isReadMore = e.target === readMoreLink;
3434				descriptionDiv.innerHTML = isReadMore ? allOptionsInfoText : truncatedText;
3435				readMoreLink.style.display = isReadMore ? "none" : "inline";
3436				readLessLink.style.display = isReadMore ? "inline" : "none";
3437			}
3438		}
3439	});
3440	// END PRODUCT PAGE ALL OPTIONS SINGLE TOUR INFO TRUNCATION FOR ALL OPTIONS PRODUCTS
3441
3442
3443    // Sticky bar for regular tour pages
3444	var bookingWidget = document.getElementById('book-now-widget');
3445	// Check if the booking widget exists
3446	if (bookingWidget) {
3447		window.addEventListener('scroll', function() {
3448			var fullBookingWidget = document.getElementById('hb-commerce-sdk-root');
3449			var navbarDesktop = document.getElementById('product-navbar-desktop');
3450			var navbarMobile = document.getElementById('product-navbar-mobile');
3451			var floatingProductCta = document.getElementById('floating-product-cta');
3452			var bookingWidgetRect = bookingWidget.getBoundingClientRect();
3453			var fullBookingWidgetRect = fullBookingWidget.getBoundingClientRect();
3454			var isFullyOutOfViewport = (bookingWidgetRect.bottom <= 0 || bookingWidgetRect.top >= window.innerHeight) && (fullBookingWidgetRect.bottom <= 0 || fullBookingWidgetRect.top >= window.innerHeight);
3455
3456			if (isFullyOutOfViewport) {
3457				navbarMobile.style.opacity = '1';
3458				navbarDesktop.style.opacity = '1';
3459				floatingProductCta.style.opacity = '1';
3460			} else {
3461				navbarMobile.style.opacity = '0';
3462				navbarDesktop.style.opacity = '0';
3463				floatingProductCta.style.opacity = '0';
3464			}
3465		});
3466	}
3467	// End Sticky bar for regular tour pages
3468
3469	// Sticky bar for All Options tour pages
3470	var bookingWidgetAllOptions = document.querySelector('.alloptions-hero');
3471	// Check if the booking widget exists
3472	if (bookingWidgetAllOptions) {
3473		window.addEventListener('scroll', function() {
3474			var fullBookingWidgetAO = document.getElementById('cart-container');
3475			var navbarDesktopAO = document.getElementById('product-navbar-desktop');
3476			var navbarMobileAO = document.getElementById('product-navbar-mobile');
3477			var bookingWidgetRectAO = bookingWidgetAllOptions.getBoundingClientRect();
3478			var fullBookingWidgetRectAO = fullBookingWidgetAO.getBoundingClientRect();
3479			var isFullyOutOfViewportAO = (bookingWidgetRectAO.bottom <= 0 || bookingWidgetRectAO.top >= window.innerHeight);
3480
3481			if (isFullyOutOfViewportAO) {
3482				navbarMobileAO.style.opacity = '1';
3483				navbarDesktopAO.style.opacity = '1';
3484			} else {
3485				navbarMobileAO.style.opacity = '0';
3486				navbarDesktopAO.style.opacity = '0';
3487			}
3488		});
3489	}
3490	// End Sticky bar for All Options tour pages
3491	
3492	
3493	jQuery('.ce-book-now-action ').click(function() {
3494		//jQuery("#product-navbar-desktop").hide();
3495		//jQuery("#product-navbar-mobile").hide();
3496		//jQuery("#floating-product-cta").hide();
3497		//jQuery("#hb-commerce-sdk-root").show();
3498	});
3499	
3500	jQuery('.header-reviews:not(.no-full-reviews)').click(function() {
3501		jQuery('html, body').animate({
3502			scrollTop: jQuery('#full-reviews').offset().top - 100
3503		}, 1000);
3504	});
3505
3506	jQuery('.overview-div li').each(function() {
3507		if (jQuery(this).text().includes('hour')) {
3508			jQuery(this).addClass('clock-icon');
3509		} else if (jQuery(this).text().includes('minutes')) {
3510			jQuery(this).addClass('clock-icon');
3511		} else if (jQuery(this).text().includes('Plated') || jQuery(this).text().includes('plated')) {
3512			jQuery(this).addClass('food-icon');
3513		} else if (jQuery(this).text().includes('Buffet')) {
3514			jQuery(this).addClass('food-icon');
3515		} else if (jQuery(this).text().includes('meal')) {
3516			jQuery(this).addClass('food-icon');
3517		} else if (jQuery(this).text().includes('menu')) {
3518			jQuery(this).addClass('food-icon');
3519		} else if (jQuery(this).text().includes('pastries')) {
3520			jQuery(this).addClass('food-icon');
3521		} else if (jQuery(this).text().includes('Lunch') || jQuery(this).text().includes('lunch')) {
3522			jQuery(this).addClass('food-icon');
3523		} else if (jQuery(this).text().includes('Dinner') || jQuery(this).text().includes('dinner')) {
3524			jQuery(this).addClass('food-icon');
3525		} else if (jQuery(this).text().includes('delicious') || jQuery(this).text().includes('Delicious')) {
3526			jQuery(this).addClass('food-icon delicious-item');
3527			if (jQuery(this).text().includes('fish & chips')) {
3528				jQuery(this).addClass('food-icon-with-menu');
3529			}
3530		} else if (jQuery(this).text().includes('wheelchair') || jQuery(this).text().includes('Wheelchair')) {
3531			jQuery(this).addClass('wheelchair-icon');
3532		} else if (jQuery(this).text().includes('dress') || jQuery(this).text().includes('Dress')) {
3533			jQuery(this).addClass('shirt-icon');
3534			if (jQuery(this).text().includes('sightseeing')) {
3535				jQuery(this).addClass('sightseeing-casual');
3536			}
3537		} else if (jQuery(this).text().includes('entertainment')) {
3538			jQuery(this).addClass('entertainment-icon');
3539		} else if (jQuery(this).text().includes('Alcoholic')) {
3540			jQuery(this).addClass('cocktail-icon');
3541		} else if (jQuery(this).text().includes('cocktail')) {
3542			jQuery(this).addClass('cocktail-icon');
3543		} else if (jQuery(this).text().includes('bar')) {
3544			jQuery(this).addClass('cocktail-icon');
3545			if (jQuery(this).text().includes('snacks available on board')) {
3546				jQuery(this).addClass('snack-menu');
3547			}
3548		} else if (jQuery(this).text().includes('full-bar')) {
3549			jQuery(this).addClass('cocktail-icon');
3550		} else if (jQuery(this).text().includes('mimosas')) {
3551			jQuery(this).addClass('cocktail-icon');
3552		} else if (jQuery(this).text().includes('views')) {
3553			jQuery(this).addClass('views-icon');
3554		}
3554 else if (jQuery(this).text().includes('Cocktail Cruise')) {
3555			jQuery(this).addClass('cocktail-cruise-menu');
3556		} else if (jQuery(this).text().includes('Happy Hour Cruise')) {
3557			jQuery(this).addClass('happy-hour-cruise-menu');
3558		} else if (jQuery(this).text().includes('commentary')) {
3559			jQuery(this).addClass('headphones-icon');
3560		} else if (jQuery(this).text().includes('champagne')) {
3561			jQuery(this).addClass('cheers-icon');
3562		} else if (jQuery(this).text().includes('wine')) {
3563			jQuery(this).addClass('cheers-icon');
3564		} else if (jQuery(this).text().includes('Prosecco')) {
3565			jQuery(this).addClass('cheers-icon');
3566		} else if (jQuery(this).text().includes('snacks available on board')) {
3567			jQuery(this).addClass('snack-menu');
3568		} else if (jQuery(this).text().toLowerCase().includes('vip packages')) {
3569			jQuery(this).addClass('crown-icon');
3570		} else if (jQuery(this).text().toLowerCase().includes('vip tickets')) {
3571			jQuery(this).addClass('crown-icon');
3572		} else if (jQuery(this).text().includes('Assorted snack items and drinks')) {
3573			jQuery(this).addClass('food-icon');
3574		}
3575	});
3576
3577	jQuery('.overview-div.alcatraz-overview li').each(function() {
3578		if (jQuery(this).text().includes('Duration')) {
3579			jQuery(this).addClass('clock-icon');
3580		} else if (jQuery(this).text().includes('Round-trip')) {
3581			jQuery(this).addClass('ferry-icon');
3582		} else if (jQuery(this).text().includes('Explore')) {
3583			jQuery(this).addClass('feet-icon');
3584		} else if (jQuery(this).text().includes('explore')) {
3585			jQuery(this).addClass('feet-icon');
3586		} else if (jQuery(this).text().includes('Access')) {
3587			jQuery(this).addClass('feet-icon');
3588		} else if (jQuery(this).text().includes('messaging')) {
3589			jQuery(this).addClass('pencil-icon');
3590		} else if (jQuery(this).text().includes('Audio')) {
3591			jQuery(this).addClass('headphones-icon');
3592		} else if (jQuery(this).text().includes('Admission')) {
3593			jQuery(this).addClass('ticket-icon');
3594		} else if (jQuery(this).text().includes('admission')) {
3595			jQuery(this).addClass('ticket-icon');
3596		} else if (jQuery(this).text().includes('Scenic')) {
3597			jQuery(this).addClass('views-icon');
3598		} else if (jQuery(this).text().includes('Guided')) {
3599			jQuery(this).addClass('hat-icon');
3600		}
3601	});
3602
3603	jQuery('.overview-div.statue-overview li').each(function() {
3604		if (jQuery(this).text().includes('Duration')) {
3605			jQuery(this).addClass('clock-icon');
3606		} else if (jQuery(this).text().includes('Round-trip')) {
3607			jQuery(this).addClass('ferry-icon');
3608		} else if (jQuery(this).text().includes('ferry')) {
3609			jQuery(this).addClass('ferry-icon');
3610		} else if (jQuery(this).text().includes('Explore')) {
3611			jQuery(this).addClass('feet-icon');
3612		} else if (jQuery(this).text().includes('explore')) {
3613			jQuery(this).addClass('feet-icon');
3614		} else if (jQuery(this).text().includes('Access')) {
3615			jQuery(this).addClass('feet-icon');
3616		} else if (jQuery(this).text().includes('messaging')) {
3617			jQuery(this).addClass('pencil-icon');
3618		} else if (jQuery(this).text().includes('Audio')) {
3619			jQuery(this).addClass('headphones-icon');
3620		} else if (jQuery(this).text().includes('Admission')) {
3621			jQuery(this).addClass('ticket-icon');
3622		} else if (jQuery(this).text().includes('admission')) {
3623			jQuery(this).addClass('ticket-icon');
3624		} else if (jQuery(this).text().includes('Scenic')) {
3625			jQuery(this).addClass('views-icon');
3626		} else if (jQuery(this).text().includes('priority')) {
3627			jQuery(this).addClass('star-icon');
3628		} else if (jQuery(this).text().includes('Priority')) {
3629			jQuery(this).addClass('star-icon');
3630		} else if (jQuery(this).text().includes('galleries')) {
3631			jQuery(this).addClass('gallery-icon');
3632		}
3633	});
3634
3635	jQuery('.overview-div.niagara-overview li').each(function() {
3636		if (jQuery(this).text().includes('Duration')) {
3637			jQuery(this).addClass('clock-icon');
3638		} else if (jQuery(this).text().includes('Round-trip')) {
3639			jQuery(this).addClass('ferry-icon');
3640		} else if (jQuery(this).text().includes('Round-trip')) {
3641			jQuery(this).addClass('ferry-icon');
3642		} else if (jQuery(this).text().includes('Boat')) {
3643			jQuery(this).addClass('ferry-icon');
3644		} else if (jQuery(this).text().includes('Explore')) {
3645			jQuery(this).addClass('feet-icon');
3646		} else if (jQuery(this).text().includes('explore')) {
3647			jQuery(this).addClass('feet-icon');
3648		} else if (jQuery(this).text().includes('Access')) {
3649			jQuery(this).addClass('feet-icon');
3650		} else if (jQuery(this).text().includes('messaging')) {
3651			jQuery(this).addClass('pencil-icon');
3652		} else if (jQuery(this).text().includes('Audio')) {
3653			jQuery(this).addClass('headphones-icon');
3654		} else if (jQuery(this).text().includes('Admission')) {
3655			jQuery(this).addClass('ticket-icon');
3656		} else if (jQuery(this).text().includes('admission')) {
3657			jQuery(this).addClass('ticket-icon');
3658		} else if (jQuery(this).text().includes('Ticketing')) {
3659			jQuery(this).addClass('ticket-icon');
3660		} else if (jQuery(this).text().includes('Scenic')) {
3661			jQuery(this).addClass('views-icon');
3662		} else if (jQuery(this).text().includes('Views')) {
3663			jQuery(this).addClass('views-icon');
3664		} else if (jQuery(this).text().includes('priority')) {
3665			jQuery(this).addClass('star-icon');
3666		} else if (jQuery(this).text().includes('Priority')) {
3667			jQuery(this).addClass('star-icon');
3668		} else if (jQuery(this).text().includes('galleries')) {
3669			jQuery(this).addClass('gallery-icon');
3670		} else if (jQuery(this).text().includes('Poncho')) {
3671			jQuery(this).addClass('shirt-icon');
3672		} else if (jQuery(this).text().includes('Food')) {
3673			jQuery(this).addClass('food-icon');
3674		} else if (jQuery(this).text().includes('food')) {
3675			jQuery(this).addClass('food-icon');
3676		} else if (jQuery(this).text().includes('Music')) {
3677			jQuery(this).addClass('entertainment-icon');
3678		} else if (jQuery(this).text().includes('music')) {
3679			jQuery(this).addClass('entertainment-icon');
3680		}
3681	});
3682
3683	// London specific tooltip - https://www.cityexperiences.com/london/city-cruises/lunch-cruise-river-thames/
3684	jQuery('.page-id-12729 .overview-div li.crown-icon:contains("VIP packages available")').html(function (_, html) {
3685		return html.replace('VIP packages available', '<span class="tooltip-trigger tooltip-vip-packages-available">VIP packages available</span>');
3686	});
3687	//jQuery(".page-id-12729 .overview-div li.crown-icon .tooltip-vip-packages-available").append("<span class='dresscode
3687-tooltip'>For just £20 per person, enjoy premium seating, priority boarding and a complimentary bottle of still or sparkling water. Select 'VIP Package' when booking.</span>");
3688	jQuery(".page-id-12729 .overview-div li.crown-icon .tooltip-vip-packages-available").append("<span class='dresscode-tooltip'><ul><li>Priority boarding and service. </li><li>VIP seating area at the front of the boat so you can enjoy the best views of London.</li><li>Welcome glass of champagne and bottle of still or sparkling water</li><li>Additional course - starter </li></ul></span>");
3689
3690	// London specific tooltips - https://www.cityexperiences.com/london/city-cruises/afternoon-tea-cruise-river-thames/
3691	jQuery('.page-id-12370 .overview-div li.crown-icon:contains("VIP packages available")').html(function (_, html) {
3692		return html.replace('VIP packages available', '<span class="tooltip-trigger tooltip-vip-packages-available">VIP packages available</span>');
3693	});
3694	//jQuery(".page-id-12370 .overview-div li.crown-icon .tooltip-vip-packages-available").append("<span class='dresscode-tooltip'>For just £20 per person, enjoy premium seating, priority boarding and a complimentary bottle of still or sparkling water. Select 'VIP Package' when booking.</span>");
3695	jQuery(".page-id-12370 .overview-div li.crown-icon .tooltip-vip-packages-available").append("<span class='dresscode-tooltip'><ul><li>Priority boarding and service. </li><li>VIP seating area at the front of the boat so you can enjoy the best views of London.</li><li>Welcome glass of champagne and bottle of still or sparkling water</li><li>Additional mini savoury twist to your Afternoon Tea</li></ul></span>");
3696
3697	// London specific tooltips - https://www.cityexperiences.com/london/city-cruises/london-dinner-cruise-river-thames/
3698	jQuery('.page-id-12862 .overview-div li.crown-icon:contains("VIP packages available"), .page-id-12862 .overview-div li.crown-icon:contains("VIP tickets available"), .page-id-12862 .overview-div li.crown-icon:contains("Choose from standard, window and VIP tickets")').html(function (_, html) {
3699		if (html.includes('VIP packages available')) {
3700			return html.replace('VIP packages available', '<span class="tooltip-trigger tooltip-vip-packages-available">VIP packages available</span>');
3701		}
3702		if (html.includes('VIP packages available')) {
3703			return html.replace('VIP tickets available', '<span class="tooltip-trigger tooltip-vip-packages-available">VIP tickets available</span>');
3704		}
3705		if (html.includes('Choose from standard, window and VIP tickets')) {
3706			return html.replace('Choose from standard, window and VIP tickets', '<span class="tooltip-trigger tooltip-vip-packages-available">Choose from standard, window and VIP tickets</span>');
3707		}
3708	});
3709	jQuery(".page-id-12862 .overview-div li.crown-icon .tooltip-vip-packages-available").append("<span class='dresscode-tooltip'>Window tickets guarantee a window seat for the cruise. VIP tickets include seating at the front of the boat, priority boarding with a welcome glass of champagne or still/sparkling water. VIP tickets also benefit from 5 pre-dinner canapes and a post-dinner cheeseboard paired with a dessert wine.</span>");
3710	// End London specific tooltips for 3 pages
3711	
3712	jQuery('.overview-div li.shirt-icon:contains("smart-casual attire")').html(function (_, html) {
3713		return html.replace('smart-casual attire', '<span class="tooltip-trigger tooltip-smart-casual">smart-casual attire</span>');
3714	});
3715	jQuery('.overview-div li.shirt-icon .tooltip-smart-casual').append('<span class="dresscode-tooltip">We encourage smart-casual attire. However, please feel free to dress for your occasion whether you are celebrating or just heading out for an amazing meal on the Thames. We would advise against flip-flops, leisurewear and ripped jeans.</span>');
3716
3717	jQuery('.overview-div li.shirt-icon:contains("sightseeing casual attire")').html(function (_, html) {
3718		return html.replace('sightseeing casual attire', '<span class="tooltip-trigger tooltip-sightseeing-casual">sightseeing casual attire</span>');
3719	});
3720	jQuery('.overview-div li.shirt-icon .tooltip-sightseeing-casual').append('<span class="dresscode
3720-tooltip">Comfortable clothes with layers, close toed shoes, sunglasses.</span>');
3721	
3722	jQuery('.overview-div li.shirt-icon:not(.sightseeing-casual):contains("casual attire")').html(function (_, html) {
3723		if (!html.includes("smart-casual attire")) {
3724			return html.replace('casual attire', '<span class="tooltip-trigger tooltip-casual">casual attire</span>');
3725		}		
3726		//if(!html.includes("smart-casual attire")){
3727		//	return html.replace('casual attire', '<span class="tooltip-trigger tooltip-casual">casual attire</span>');
3728		//}
3729	});
3730	jQuery('.overview-div li.shirt-icon .tooltip-casual').append('<span class="dresscode-tooltip">Khakis, nice jeans, dresses, button-up shirts, and blouses</span>');
3731
3732	jQuery('.overview-div li.shirt-icon:contains("semi-formal attire")').html(function (_, html) {
3733		return html.replace('semi-formal attire', '<span class="tooltip-trigger tooltip-semi-formal">semi-formal attire</span>');
3734	});
3735	jQuery('.overview-div li.shirt-icon .tooltip-semi-formal').append('<span class="dresscode-tooltip">This is your excuse to dress up! We require semi-formal attire (dress pants, dress shirts, skirts or dresses and dress shoes). Casual jeans, t-shirts, and sandals are not permitted onboard.</span>');
3736
3737	jQuery('.overview-div li.shirt-icon:contains("cocktail attire")').html(function (_, html) {
3738		return html.replace('cocktail attire', '<span class="tooltip-trigger tooltip-cocktail">cocktail attire</span>');
3739	});
3740	jQuery('.overview-div li.shirt-icon .tooltip-cocktail').append('<span class="dresscode-tooltip">Collared shirts, blouses, sports coats, slacks, and dresses</span>');
3741
3742
3743	jQuery('.overview-div:not(.niagara-overview) li.food-icon:not(.delicious-item)').append('<span class="d-inline inline-dining-menu"> <a href="" data-toggle="modal" data-target="#diningMenu">View Dining Menu</a></span>');
3744	jQuery('.overview-div:not(.niagara-overview) li.food-icon.food-icon-with-menu').append('<span class="d-inline inline-dining-menu"> <a href="" data-toggle="modal" data-target="#diningMenu">View Dining Menu</a></span>');
3745	jQuery('.overview-div li.cocktail-cruise-menu').append('<span class="d-inline"> <a href="" data-toggle="modal" data-target="#diningMenu">View Menu</a></span>');
3746	jQuery('.overview-div li.happy-hour-cruise-menu').append('<span class="d-inline"> <a href="" data-toggle="modal" data-target="#diningMenu">View Menu</a></span>');
3747	jQuery('.overview-div li.snack-menu').append('<span class="d-inline"> <a href="" data-toggle="modal" data-target="#diningMenu">View Snack Bar Menu</a></span>');
3748
3749	jQuery('.assets-wrapper').slick({
3750		infinite: true,
3751		slidesToShow: 1,
3752		slidesToScroll: 1,
3753		autoplay: false,
3754		autoplaySpeed: 3000,
3755		prevArrow: '<i class="fas fa-angle-left" aria-hidden="true"></i>',
3756		nextArrow: '<i class="fas fa-angle-right" aria-hidden="true"></i>',
3757		fade: true,
3758		cssEase: 'linear',
3759		asNavFor: '.event-thumbnails'
3760	});
3761	jQuery('.event-thumbnails').slick({
3762		slidesToShow: 3,
3763		slidesToScroll: 1,
3764		vertical:true,
3765		asNavFor: '.assets-wrapper',
3766		dots: false,
3767		arrows: false,
3768		focusOnSelect: true,
3769		verticalSwiping:true,
3770		infinite: true,
3771		responsive: [
3772			{
3773				breakpoint: 901,
3774				settings: {
3775					vertical: false
3776				}
3777			}
3778		]
3779	});
3780
3781	if (jQuery('#Product-Tour-FAQ').length === 0) {
3782		//jQuery('.faq-anchor').hide();
3783		jQuery('.faq-anchor').remove();
3784	}
3785
3786	jQuery("#tour-social-share").click(function() {
3787		jQuery(".tour-social-actions").toggleClass("show-tour-social-actions");
3788	});
3789	jQuery(document).on("click", function(event) {
3790		if (!jQuery(event.target).closest("#tour-social-share").length) {
3791			jQuery(".tour-social-actions").removeClass("show-tour-social-actions");
3792		}
3793	});
3794	jQuery(".social-copy-link").click(function() {
3795		jQuery(".tour-social-actions").toggleClass("show-tour-social-actions");
3796	});
3797
3798	jQuery('.menu-type').each(function() {
3799        var text = jQuery(this).text();
3800        var newText = text.replace(/&amp;/g, '&');
3801        jQuery(this).text(newText);
3802    });
3803
3804	// Function to get query parameters from URL
3805	function getQueryParam(param) {
3806		var urlParams = new URLSearchParams(window.location.search);
3807		return urlParams.get(param);
3808	}
3809
3810	// Function to convert a date string to MM/DD/YY format
3811	function convertToTwoDigitYear(dateStr) {
3812		var dateParts = dateStr.split('/');
3813		var month = dateParts[0];
3814		var day = dateParts[1];
3815		var year = dateParts[2].slice(-2); // Get last two digits of the year
3816		return month + '/' + day + '/' + year;
3817	}
3818
3819	var todays = new Date();
3820	var dds = String(todays.getDate()).padStart(2, '0');
3821	var mms = String(todays.getMonth() + 1).padStart(2, '0'); // January is 0!
3822	var yyyys = String(todays.getFullYear()).slice(-2);
3823
3824	todays = mms + '/' + dds + '/' + yyyys;
3825
3826	// Get the "date" query parameter
3827	var urlDate = getQueryParam('date');
3828	
3829	// Convert URL date to MM/DD/YY format if it exists, otherwise use today's date
3830	var selectedDate = urlDate ? convertToTwoDigitYear(urlDate) : todays;
3831	//console.log('sergeeee', myObj);
3832	jQuery('#alloptions-date').daterangepicker({
3833		"singleDatePicker": true,
3834		"minDate": todays, // Always set minDate to today's date
3835		"startDate": selectedDate, // Set the selected date
3836		"autoApply": true,
3837		"locale": {
3838			"format": 'MM/DD/YY' // Two digits for the year
3839		},
3840		// Function to disable dates not in 'myObj.allOptionsAvailableDates'
3841		"isInvalidDate": function(date) {
3842			// Format the date to match your array format (MM/DD/YYYY)
3843			const formattedDate = date.format('MM/DD/YYYY');
3844			// Return true if the date is not in the available dates array (i.e., disable it)
3845			return !myObj.allOptionsAvailableDates.includes(formattedDate);
3846		}
3847	});
3848
3849	jQuery('#alloptions-form .qty-minus').click(function () {
3850		var input = jQuery(this).closest('.qty-holder').find('input[type="number"]');
3851		var count = parseInt(input.val()) - 1;
3852		count = count < 1 ? 0 : count;
3853		input.val(count);
3854		input.change();
3855		if (count === 0) {
3856			jQuery(this).addClass('disabled');
3857		} 
3858		return false;
3859	});
3860	jQuery('#alloptions-form .qty-plus').click(function () {
3861		var input = jQuery(this).closest('.qty-holder').find('input[type="number"]');
3862		input.val(parseInt(input.val()) + 1);
3863		input.change();
3864		jQuery(this).closest('.qty-holder').find('#alloptions-form .qty-minus').removeClass('disabled');
3865		return false;
3866	});
3867	if (jQuery('.qty-holder').length > 0) {
3868		jQuery('.qty-holder').each(function() {
3869			var input = jQuery(this).find('input[type="number"]');
3870			var count = parseInt(input.val());
3871	
3872			if (count === 0) {
3873				jQuery(this).find('.qty-minus').addClass('disabled');
3874			}
3875		});
3876		jQuery('.qty-holder input[type="number"]').on('change', function() {
3877			var count = parseInt(jQuery(this).val());
3878			var $minusButton = jQuery(this).siblings('.qty-trigger').find('.qty-minus');
3879		
3880			if (count === 0) {
3881				$minusButton.addClass('disabled');
3882			} else {
3883				$minusButton.removeClass('disabled');
3884			}
3885		});
3886	}
3887	
3888
3889}
3890
3891function loadSingleCheckoutSDK(myObj) {
3892	if(1) {
3893	var preselection;
3894	try {
3895		preselection = JSON.parse(decodeURIComponent(urlPreselection));
3896	} catch(err) {
3897		preselection = {};
3898	}
3899	if("departureStop" in myObj.settings) {
3900		preselection.departureStop = myObj.settings.departureStop;
3901	}
3902	if("destinationStop" in myObj.settings) {
3903		preselection.destinationStop = myObj.settings.destinationStop;
3904	}
3905	var customStyles = typeof checkoutCustomStyle !== 'undefined' ? checkoutCustomStyle : undefined;
3906	console.log('loadSingleCheckoutSDK-1', myObj);
3907	jQuery('#modalSingleCheckoutSDK').html('');
3908	HBCommerce.launch({
3909		propertyId: myObj.propertyId,
3910		locale: getPageTranslation(),
3911		bookingTypeId: myObj.bookingTypeId,
3912		costRateId: preselection.costRateId || '',
3913		customStyles: customStyles,
3914		selectedDate: preselection.selectedDate,
3915		selectedTimedTicketTypeId: preselection.selectedTimedTicketTypeId,
3916		roundTripEventId: preselection.roundTripEventId,
3917		departureStop: preselection.departureStop,
3918		destinationStop: preselection.destinationStop,
3919		ticketSelection: preselection.ticketSelection,
3920		companyCustomerId: getCookieCompanyId(),
3921		useFrontendV2: '1',
3922		hideInitialSkeleton: '1',
3923		cartMode: false,
3924		theme: 'cityexperiences',
3925		onReserveTimeout: function(event) {
3926			console.log("onReserveTimeout", event);
3927			window.history.go(-1);
3928		},
3929		flags: {
3930			initialPage: HBCommerce.ROUTES.CHECKOUT,
3931			oneTrustCookiesCheckEnabled: myObj.oneTrustCookiesCheckEnabled || false,
3932			skipSingleFormCheckout: true,
3933		},
3934		onCartCheckoutComplete: function(event) {
3935			totalItemsInCart = 0;
3936			anchorCartChange(totalItemsInCart);
3937			if(parseInt(getUrlParam('myTrip', '0')) === 1) {
3938				updateMyTripcount();
3939			}
3940		},
3941		onOrderComplete: function(event) {
3942			window.VWO = window.VWO || [];
3943			VWO.event = VWO.event || function () {VWO.push(['event'].concat([].slice.call(arguments)))};
3944			VWO.event('purchase', {
3945				'purchase': 1
3946			})
3947			VWO.event('revenue', {
3948				'revenue': (((event || {}).payload || {}).order || {}).total
3949			})
3950
3951		},
3952		onStageChange: function(event) {
3953			try {
3954				if (event && event.payload && event.payload.position && event.payload.position.top) {
3955					var widgetTopOffset = jQuery("#modalSingleCheckoutSDK").offset().top;
3956					var stickyHeaderOffset = 90;
3957					jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
3958				}
3959			} catch (err) {
3960				console.log("Commerce:onStageChange:error", err);
3961			}
3962		},
3963		onViewCart: function(event) {
3964			console.log('onViewCartonViewCart',event);
3965			//myObj.search_city = (((event || {}).payload || {}).tourCities || []).toString();
3966			var tour_cities = (((event || {}).payload || {}).tourCities || []);
3967			var search_cities = tour_cities.toString();
3968			myObj.search_city = search_cities;
3969			myObj.tour_cities = tour_cities;
3970			//console.log('search_cities',search_cities);
3971			//console.log('search_city',myObj.search_city);
3972			console.log('myObj',myObj);
3973			if(cartMode && myObj.tour_cities.length && myObj.settings.show_upsell_block) {
3974				upsellBlockCheckout(myObj);
3975			}
3976		},
3977		onCartChange: function(event) {
3978			console.log('eventevent',event);
3979			var totalItemsInCart = (((event || {}).payload || {}).cartItems || []).length;
3980			anchorCartChange(totalItemsInCart);
3981		},
3982		onQuickAddToCart: function(evt) {
3983			var addCartProp = evt.payload || {};
3984			console.log('onQuickAddToCart', addCartProp);
3985			jQuery('.calendar-drawer-wrapper').addClass('open');
3986			var orderId = addCartProp.cartOrderIdToEdit || null;
3987			addToCartDrawer(addCartProp.propertyId, addCartProp.bookingTypeId, orderId);
3988
3989		},
3990		onScrollUp: function(event) {
3991			try {
3992				if (event && event.payload && (event.payload.scrollForReviewOrderModal || event.payload.scrollToTop)) {
3993					jQuery( "html, body" ).animate( { scrollTop: 0 } )
3994				}
3995			} catch(err) {
3996				console.log("Commerce:onScrollUp:error", err);
3997			}
3998		},
3999		onVwoEvent: function(event) {
4000			console.log('vwo event', { event });
4001			const { eventName, data } = (event || {}).payload || {};
4002			window.VWO = window.VWO || [];
4003			VWO.event = VWO.event || function () {VWO.push(['event'].concat([].slice.call(arguments)))};
4004
4005			VWO.event(eventName, data);
4006		},
4007		redirectToPage: function(event) {
4008			console.log('redirecting to page for', event);	
4009			window.location.href = ((event || {}).payload || {}).url;
4010		},
4011	}, "modalSingleCheckoutSDK").then(function(instance) {
4012		_HBCOMMERCEINSTANCE_ = instance;
4013	}).catch(function(err) {
4014		console.log("Error launching commerce sdk", err);
4015	});
4016	};
4017}
4018
4019
4020function afterComboPackageTourFeed(myObj) {
4021	//console.log('afterComboPackageTourFeed', myObj);
4022	if(0) {
4023		myObj.map_iframe_later = myObj.map_iframe;
4024		myObj.map_iframe = '';
4025		myObj.review_later = myObj.review;
4026		myObj.review = '<div class="embedsocial-reviews" data-ref="bb4fa87dcc9d45b176494774825b9cde5e766896"></div>';
4027		myObj.settings.show_related_tour = false;
4028		myObj.settings.secondReview_later = myObj.settings.secondReview;
4029		myObj.settings.secondReview = '<div class="embedsocial-hashtag" data-ref="95331c029bd60a8625fde09f5723a0a26930cd27"></div>';
4030		myObj.settings.show_combo_packages = false;
4031		myObj.has_video = false;
4032	}
4033
4034	// Initialize the new array
4035	myObj.allOptionsTourProperties = myObj.allOptionsTourProperties || [];
4036
4037	// Check if myObj.settings.allOptionsTours exists
4038	if (myObj.settings && myObj.settings.allOptionsTours && myObj.settings.allOptionsPage) {
4039		// Parse the JSON string from allOptionsTours
4040		const allOptionsToursArray = JSON.parse(myObj.settings.allOptionsTours);
4041
4042		// Iterate through each item in the parsed array
4043		let allOptionsTourNumber = 0
4044		allOptionsToursArray.forEach(item => {
4045			// Increment the counter
4046			allOptionsTourNumber++;
4047			myObj.allOptionsTourNumber = allOptionsTourNumber;
4048
4049			// Extract propertyId and selectedTours
4050			const { propertyId, selectedTours } = item;
4051
4052			// Check if selectedTours is an array with a single element, and convert it to a number
4053			const selectedTour = Array.isArray(selectedTours) && selectedTours.length === 1 ? Number(selectedTours[0]) : selectedTours;
4054
4055			// Set myObj.property_id and myObj.booking_type_id
4056			myObj.property_id = propertyId;
4057			myObj.booking_type_id = selectedTour;
4058
4059			// Find the tourTitle for the current property_id and booking_type_id
4060			myObj.aOtourTitle = "";
4061			myObj.aOtourDescription = "";
4062			myObj.aOwhatsIncluded = "";
4063			myObj.aOadditionalInfo = "";
4064			myObj.aOtourThumbnail = "";
4065			myObj.aOtourImages = [];
4066			myObj.allOptionsAvailableDates = myObj.allOptionsAvailableDates || [];
4067			myObj.has_menu;
4068			for (let option of myObj.allOptions) {
4069				if (option.propertyId === myObj.property_id && option.bookingTypeId === myObj.booking_type_id) {
4070					let localizedInfo = option.localizedInfo.find(info => info.locale === "en");
4071					if (localizedInfo) {
4072						let titleObj = localizedInfo.values.find(value => value.id === "title");
4073						if (titleObj) {
4074							myObj.aOtourTitle = titleObj.value;
4075						}
4076						
4077						let descriptionObj = localizedInfo.values.find(value => value.id === "allOptionsDescription");
4078						if (descriptionObj) {
4079							myObj.aOtourDescription = descriptionObj.value;
4080						}
4081
4082						let whatYouGetObj = localizedInfo.values.find(value => value.id === "whatYouGet");
4083						if (whatYouGetObj) {
4084							myObj.aOwhatsIncluded = whatYouGetObj.value;
4085						}
4086
4087						let additionalInfoObj = localizedInfo.values.find(value => value.id === "additionalInfo");
4088						if (additionalInfoObj) {
4089							myObj.aOadditionalInfo = additionalInfoObj.value;
4090						}
4091
4092						if (option.media && option.media.length > 0) {
4093							// Filter out only the items of type "image"
4094							const imageMedia = option.media.filter(function(media) {
4095								return media.type === "image";
4096							});
4097						
4098							if (imageMedia.length > 0) {
4099								myObj.aOtourThumbnail = imageMedia[0].url;
4100								myObj.aOtourImages = imageMedia.slice(1).map(function(image) {
4101									return { url: image.url };
4102								});
4103							}
4104						}
4105
4106						if (option.enabledDates) {
4107							// Get the date keys from 'enabledDates'
4108							const dates = Object.keys(option.enabledDates);
4109							// Add these dates to 'allOptionsAvailableDates'
4110							myObj.allOptionsAvailableDates.push(...dates);
4111						}
4112						myObj.allOptionsAvailableDates = [...new Set(myObj.allOptionsAvailableDates)]
4113							.sort((a, b) => {
4114								// Convert string dates to Date objects for proper comparison
4115								return new Date(a) - new Date(b);
4116							});
4117
4118
4119
4120						
4121						myObj.menu_download_pdf = '/pdf/';
4122						myObj.has_menu = option.menuId && option.menuId.length ? true : false;
4123						myObj.has_download_menu = myObj.has_menu;
4124						myObj.tourMenus = [];
4125						myObj.tourMenusV2 = [];
4126						if(myObj.has_menu) {
4127							var menuPckg = { menuTitle: "", "groupMenu": [], "menuId": "", "menuType": "" };
4128							var groupMenuIndex = 0;
4129							var thisMenuType = '';
4130							var thisIsWineList = false;
4131							for(var tmIdx=0; tmIdx < option.menus.length; tmIdx++) {
4132								menuPckg.active = (tmIdx == 0 ? 'active' : '');
4133								var thisTourMenuObj = option.menus[tmIdx];
4134								//console.log('thisTourMenuObj',thisTourMenuObj);
4135								//console.log('thisTourMenuObj',!thisTourMenuObj);
4136								if(thisTourMenuObj !== null) {
4137									menuPckg.menuTitle = !menuPckg.menuTitle.length && !option.menus ? option.menus[tmIdx].menuTitle : menuPckg.menuTitle;
4138									menuPckg.menuType = !option.menus ? option.menus[tmIdx].menuType : '';
4139									menuPckg.menuId = !option.menus ? option.menus[tmIdx].menuId : '';
4140									for(var itemIdx=0; itemIdx < option.menus[tmIdx].menuItem.length; itemIdx++) {
4141										var thisMenuItem = { };
4142										thisMenuItem.chefDeCuisine = option.menus[tmIdx].chefDeCuisine;
4143										thisMenuItem.has_chefDeCuisine = thisMenuItem.chefDeCuisine === null || thisMenuItem.chefDeCuisine === undefined ? false : true;
4144										thisMenuItem.has_disclaimer = true;
4145										thisMenuItem.disclaimer = '';
4146										thisMenuItem.type = option.menus[tmIdx].menuItem[itemIdx].type;
4147										thisMenuItem.is_enhancement = thisMenuItem.type === 'Enhancements';
4148										thisMenuItem.is_winelist = thisMenuItem.type === 'Dessert Wine' || thisMenuItem.type === 'Sparkling' || thisMenuItem.type === 'Red Wine' || thisMenuItem.type === 'White Wine' || thisMenuItem.type === 'Wine' || thisMenuItem.type === 'Beverage' || thisMenuItem.type === 'Specialty Cocktails' || thisMenuItem.type === 'Spirits' || thisMenuItem.type === 'Non - Alcoholic Beverage' ? true : false;
4149										thisMenuItem.is_cocktails = thisMenuItem.type === 'Specialty Cocktails' ? true : false;
4150										thisMenuItem.subItem = option.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
4151										thisMenuItem.title = option.menus[tmIdx].menuItem[itemIdx].translations.en.title;
4152										thisMenuItem.description = option.menus[tmIdx].menuItem[itemIdx].translations.en.description;
4153										thisMenuItem.clean_desc = thisMenuItem.description ? thisMenuItem.description.replace(/<\/?[^>]+(>|$)/g, "") : '';
4154										var thisDietary = option.menus[tmIdx].menuItem[itemIdx].menuItemDietary || [];
4155										var thisDietaryCode = [];
4156										for(var dietIdx=0; dietIdx < thisDietary.length; dietIdx++) {
4157											thisDietary[dietIdx] = thisDietary[dietIdx].replace(" ", "-");
4158											thisDietaryCode[dietIdx] = thisDietary[dietIdx] === 'Gluten-Free' ? 'G*' : (thisDietary[dietIdx] === 'Nuts' ? 'N' : (thisDietary[dietIdx] === 'Vegan' ? 'VG' : (thisDietary[dietIdx] === 'Vegetarian' ? 'V' : '')));
4159										}
4160										thisMenuItem.dietary = thisDietary;
4161										thisMenuItem.dietaryCode = thisDietaryCode;
4162										thisMenuItem.has_dietary = thisDietary.length > 0;
4163										thisMenuItem.show_type = false;
4164										thisMenuItem.has_subItem = (!thisMenuItem.subItem || 0 === thisMenuItem.subItem.length ? false : true);
4165										if(thisMenuType == thisMenuItem.type || (thisMenuItem.is_winelist && thisIsWineList == thisMenuItem.is_winelist)) {
4166											menuPckg.groupMenu[menuPckg.groupMenu.length-1]['tab_items'].push(thisMenuItem);
4167										} else {
4168											thisIsWineList = thisMenuItem.is_winelist;
4169											thisMenuItem.show_type = true;
4170											menuPckg.groupMenu[groupMenuIndex] = { "tab_name": thisIsWineList ? menuPckg.menuType : thisMenuItem.type, "sub_text": thisMenuItem.subItem, "tab_id": menuPckg.menuId+'-'+groupMenuIndex, "active": groupMenuIndex == 0 ? 'active' : '', "has_chefDeCuisine": thisMenuItem.has_chefDeCuisine, "chefDeCuisine": thisMenuItem.chefDeCuisine, "is_wine_menu": thisIsWineList || thisMenuItem.is_cocktails, "tab_items": [] };
4171											menuPckg.groupMenu[groupMenuIndex]['tab_items'].push(thisMenuItem);
4172											groupMenuIndex = menuPckg.groupMenu.length;
4173											thisMenuType = thisMenuItem.type;
4174										}
4175									}
4176								}
4177							}
4178							option.tourMenusV2 = menuPckg;
4179							for(var tmIdx=0; tmIdx < option.menus.length; tmIdx++) {
4180								var menuPckg = { };
4181								//console.log('option.menus.length',option.menus);
4182								var thisTourMenuObj = option.menus[tmIdx];
4183								if(thisTourMenuObj !== null) {
4184									menuPckg.menuId = option.menus[tmIdx].menuId;
4185									menuPckg.menuTitle = option.menus[tmIdx].menuTitle;
4186									menuPckg.menuType = option.menus[tmIdx].menuType;
4187									menuPckg.chefDeCuisine = option.menus[tmIdx].chefDeCuisine;
4188									menuPckg.has_chefDeCuisine = menuPckg.chefDeCuisine === null || menuPckg.chefDeCuisine === undefined ? false : true;
4189									var defaultDisclaimer = '<strong>DISCLAIMER -</strong> Before placing your order, please inform your server if a person in your party has a food allergy. Consuming raw or undercooked meats, poultry, seafood, shellfish or eggs may increase our risk of food-borne illness, especially if you have a medical condition. Menus subject to change..';
4190									menuPckg.disclaimer = option.menus[tmIdx].settings.disclaimer || defaultDisclaimer;
4191									menuPckg.has_disclaimer = menuPckg.disclaimer === null ? false : true;
4192									menuPckg.show_title = menuPckg.menuType == 'Wine' ? false : true;
4193									//menuPckg.is_wine_menu = menuPckg.menuType == 'Wine' ? true : false;
4194									menuPckg.is_wine_menu = (menuPckg.menuType == 'DRINKS' || menuPckg.menuType == 'BEVERAGES') ? true : false;
4195									menuPckg.active = (tmIdx == 0 ? 'active' : '');
4196									var thisMenuType = '';
4197									menuPckg.groupMenu = [];
4198									var groupMenuIndex = 0;
4199									for(var itemIdx=0; itemIdx < option.menus[tmIdx].menuItem.length; itemIdx++) {
4200										var thisMenuItem = { };
4201										thisMenuItem.type = option.menus[tmIdx].menuItem[itemIdx].type;
4202										thisMenuItem.is_enhancement = thisMenuItem.type === 'Enhancements';
4203										thisMenuItem.is_winelist = thisMenuItem.type === 'Dessert Wine' || thisMenuItem.type === 'Sparkling' || thisMenuItem.type === 'Sparkling Wine' || thisMenuItem.type === 'Beer' || thisMenuItem.type === 'Red Wine' || thisMenuItem.type === 'White Wine' || thisMenuItem.type === 'Wine' || thisMenuItem.type === 'Beverage' || thisMenuItem.type === 'Specialty Cocktails' || thisMenuItem.type === 'Spirits' || thisMenuItem.type === 'Non - Alcoholic Beverage'  ? true : false;
4204										thisMenuItem.subItem = option.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
4205										thisMenuItem.subItem = option.menus[tmIdx].menuItem[itemIdx].menuItemSubtext;
4206										thisMenuItem.title = option.menus[tmIdx].menuItem[itemIdx].translations.en.title;
4207										thisMenuItem.description = option.menus[tmIdx].menuItem[itemIdx].translations.en.description;
4208										thisMenuItem.clean_desc = thisMenuItem.description ? thisMenuItem.description.replace(/<\/?[^>]+(>|$)/g, "") : '';
4209										var thisDietary = option.menus[tmIdx].menuItem[itemIdx].menuItemDietary || [];
4210										var thisDietaryCode = [];
4211										for(var dietIdx=0; dietIdx < thisDietary.length; dietIdx++) {
4212											thisDietary[dietIdx] = thisDietary[dietIdx].replace(" ", "-");
4213											thisDietaryCode[dietIdx] = thisDietary[dietIdx] === 'Gluten-Free' ? 'G*' : (thisDietary[dietIdx] === 'Nuts' ? 'N' : (thisDietary[dietIdx] === 'Vegan' ? 'VG' : (thisDietary[dietIdx] === 'Vegetarian' ? 'V' : '')));
4214										}
4215										thisMenuItem.dietary = thisDietary;
4216										thisMenuItem.dietaryCode = thisDietaryCode;
4217										thisMenuItem.has_dietary = thisDietary.length > 0;
4218										thisMenuItem.show_type = false;
4219										thisMenuItem.has_subItem = (!thisMenuItem.subItem || 0 === thisMenuItem.subItem.length ? false : true);
4220										if(thisMenuType == thisMenuItem.type) {
4221											menuPckg.groupMenu[menuPckg.groupMenu.length-1].push(thisMenuItem);
4222										} else {
4223											thisMenuItem.show_type = true;
4224											menuPckg.groupMenu[groupMenuIndex] = [];
4225											menuPckg.groupMenu[groupMenuIndex].push(thisMenuItem);
4226											groupMenuIndex = menuPckg.groupMenu.length;
4227											thisMenuType = thisMenuItem.type;
4228										}
4229									}
4230									myObj.tourMenus.push(menuPckg);
4231								}
4232							}
4233						}
4234						
4235
4236
4237
4238						break;
4239					}
4240				}
4241			}
4242
4243			// Push the extracted values along with tourTitle into the new array
4244			myObj.allOptionsTourProperties.push({
4245				propertyId, selectedTours: selectedTour,
4246				aOtourTitle: myObj.aOtourTitle,
4247				aOtourDescription: myObj.aOtourDescription,
4248				aOwhatsIncluded: myObj.aOwhatsIncluded,
4249				aOadditionalInfo: myObj.aOadditionalInfo,
4250				aOtourThumbnail: myObj.aOtourThumbnail,
4251				aOtourNumber: myObj.allOptionsTourNumber,
4252				aOtourImages: myObj.aOtourImages,
4253				has_menu: myObj.has_menu,
4254				has_download_menu: myObj.has_download_menu,
4255				tourMenus: myObj.tourMenus,
4256				tourMenusV2: menuPckg
4257			});
4258		});
4259	}
4260	//console.log(myObj.allOptionsTourProperties);
4261
4262	//myObj.settings.hide_affirm_module = myObj.affirm_price < 5000;
4263	myObj.settings.hide_affirm_module = ukProps.includes(myObj.property_id) || (myObj.settings.hide_affirm_module || false);
4264	myObj.assetsHTML = Mustache.to_html(myObj.product_assets_template_html, myObj );
4265	if(myObj.cartMode) {
4266		myObj.detailsHTML = Mustache.to_html(myObj.product_details_cart_template_html, myObj );
4267	} else {
4268		myObj.detailsHTML = Mustache.to_html(myObj.product_details_template_html, myObj );
4269	}
4270	
4271	jQuery( '.hbg-display-tour.' + myObj.element_first + ' .loading-event' ).fadeOut( 'slow', function() { 
4272		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .event-detail-content' ).append(myObj.assetsHTML);
4273		jQuery( '.hbg-display-tour.' + myObj.element_first + ' .event-detail-content' ).append(myObj.detailsHTML);
4274		if(myObj.show_sharing) {
4275			if(!myObj.settings.inhouse_show_sharing) {
4276				loadShareThis();
4277			} else {
4278				loadInhouseShareV2(myObj);
4279			}
4280		}
4281		
4282		console.log('checking-force_not_load_affirm_dynamically');
4283		if(force_not_load_affirm_dynamically) {
4284			console.log('loading-force_not_load_affirm_dynamically');
4285			try {
4286				console.log('trying-force_not_load_affirm_dynamically', typeof affirm.ui.refresh);
4287				affirm.ui.refresh();
4288			}
4289			catch(err) {
4290				console.log('affirm not defined');
4291			}
4292			console.log('loaded-force_not_load_affirm_dynamically');
4293		}
4294		
4295		myObj.settings.show_klarna = myObj.propertyId === "hblonco" && myObj.affirm_price > 5000 ? true : false;
4296		if(myObj.settings.show_klarna) {
4297			console.log('show_klarna', myObj);
4298			const stripe = Stripe('pk_live_51IoJkJLs5AKDbJzGyG91r69Fg1ZROdYVcMeoKkidpGMNqGHLzRewrfevXWA72kzX0MMJDE1YeckJZyVo4LlLT4pm00sFJyqLWZ');
4299			const elements = stripe.elements();
4300			const options = {
4301			  amount: myObj.affirm_price, // $99.00 USD
4302			  currency: myObj.default_currency,
4303				paymentMethodTypes: ['klarna', 'affirm'],
4304			  // the country that the end-buyer is in
4305			  countryCode: 'GB',
4306			};
4307			const PaymentMessageElement =
4308			  elements.create('paymentMethodMessaging', options);
4309			PaymentMessageElement.mount('#payment-method-messaging-element');
4310		}
4311
4312		myObj.settings.secondReview = myObj.settings.secondReview || '';
4313		myObj.has_second_review = myObj.settings.secondReview.length > 0;
4314		if(myObj.has_review && myObj.review.indexOf('EmbedSocialReviewsScript') < 0) {
4315			(function(d, s, id){ var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/embedscript/ri.js"; d.getElementsByTagName("head")[0].appendChild(js); }(document, "script", "EmbedSocialReviewsScript"));
4316		}
4317		if(myObj.has_second_review && myObj.review.indexOf('EmbedSocialHashtagScript') < 0) {
4318			(function(d, s, id) { var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/cdn/ht.js"; d.getElementsByTagName("head")[0].appendChild(js); }(document, "script", "EmbedSocialHashtagScript"));
4319		}
4320
4321		var customStyles = typeof checkoutCustomStyle !== 'undefined' ? checkoutCustomStyle : undefined;
4322		myObj.customStyles = customStyles;
4323		var isTourPrivate = myObj.booking_type_id_content === myObj.booking_type_id && myObj.privateEvent;
4324		jQuery('a.menu-pdf-aws').on('click', function(e) {
4325			e.preventDefault();
4326			var menuId = jQuery(this).attr('data-id');
4327			console.log('menuId', menuId);
4328			if(jQuery('div#a'+menuId+'-desktop a.dup-menu-pdf-aws').length) {
4329				jQuery('div#a'+menuId+'-desktop a.menu-pdf-aws').addClass('hide');
4330				jQuery('div#a'+menuId+'-desktop .generating-menu-pdf').removeClass('hide');
4331			}
4332			if(false && myObj.gql !== undefined) {
4333				myObj.gql.menuPreviewSignedPdf({ propertyId: myObj.property_id, menuId: menuId })
4334					.then(function(url) {
4335					if( ( url.signedURL || '' ).length) {
4336						if(jQuery('a.dup-menu-pdf-aws').length) {
4337							jQuery('.generating-menu-pdf').addClass('hide');
4338							jQuery('a.dup-menu-pdf-aws').attr('href', url.signedURL);
4339							jQuery('a.dup-menu-pdf-aws').removeClass('hide');
4340							//jQuery('a.dup-menu-pdf-aws')[0].click();
4341						} else {
4342							window.open(url.signedURL,'PDF Menu','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1000,height=800');
4343						}
4344					}
4345					//console.log('url', url);
4346				});
4347			} else {
4348				HBCommerce
4349					.graphql({ sdkSrc: myObj.sdkSrc })
4350					.then(function(gql) {
4351					gql.menuPreviewSignedPdf({ propertyId: myObj.property_id, menuId: menuId })
4352						.then(function(url) {
4353						if( ( url.signedURL || '' ).length) {
4354							jQuery('div#a'+menuId+'-desktop .generating-menu-pdf').addClass('hide');
4355							jQuery('div#a'+menuId+'-desktop a.dup-menu-pdf-aws').attr('href', url.signedURL);
4356							jQuery('div#a'+menuId+'-desktop a.dup-menu-pdf-aws').removeClass('hide');
4357							//jQuery('a.dup-menu-pdf-aws')[0].click();
4358							//window.open(url.signedURL,'PDF Menu','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1000,height=800');
4359						}
4360						//console.log('url', url);
4361					})
4362						.catch(console.log);
4363				})
4364					.catch(function(error) {
4365					//Handle error
4366				});	
4367			}
4368		});
4369		
4370		customModificationTourPageV2(myObj);
4371
4372		if(myObj.has_video) {
4373			var embedCode = myObj.video;
4374			var videoIdRegex = /embed\/([^"?]+)/;
4375			var match = embedCode.match(videoIdRegex);
4376			if (match && match.length > 1) {
4377				var videoId = match[1];
4378				//console.log(videoId);
4379				var newSrc = 'https://i3.ytimg.com/vi/' + videoId + '/hqdefault.jpg'; // Replace with your new source URL
4380				jQuery('.tour-video-thumbnail img').attr('src', newSrc);
4381			} else {
4382				jQuery('.tour-video-thumbnail img').attr('src', 'https://assets.cityexperiences.com/wp-content/uploads/2023/06/vimeo-video-thumbnail.jpg');
4383			}
4384		}
4385
4386
4387		updateRecentlyViewedCookie(myObj);
4388		myObj.settings.singleFormCheckout = myObj.singleFormCheckoutV3 ? false : myObj.settings.singleFormCheckout;
4389		myObj.settings.singleFormCheckoutV3Collapse = myObj.singleFormCheckoutV3;
4390		myObj.similarExperiencesV2 = true;
4391		//myObj.lowestFare = parseInt(getUrlParam('lowestFare', 0)) === 1 ? true : false;
4392		//myObj.showLowestFareLink = parseInt(getUrlParam('showLowestFareLink', 0)) === 1 ? true : false;
4393		//myObj.lowestFareCompareOnDisplayPrice = parseInt(getUrlParam('lowestFareCompareOnDisplayPrice', 0)) === 1 ? false : true;
4394		const lowestFareQueryParam = parseInt(getUrlParam('lowestFareForUpcomingEventDays', null)) || (myObj.settings.lowestFareForUpcomingEventDays || 90);
4395		myObj.lowestFareForUpcomingEventDays = lowestFareQueryParam;
4396		myObj.syncDisplayPrice = parseInt(getUrlParam('syncDisplayPrice', 0)) === 1 ? true : false;
4397		myObj.checkoutCalendarLayoutVersion = parseInt(getUrlParam('checkoutCalendarLayoutVersion', 0)) === 1 ? 2 : false;
4398		myObj.showPriceInCalendarForSources = parseInt(getUrlParam('showPriceInCalendarForSources', 0)) === 1 ? "web" : false;
4399		myObj.showCorrespondingTours = parseInt(getUrlParam('showCorrespondingTours', 0)) === 1 ? true : false;
4400		myObj.calendarLoaderTillFinalCalendar = parseInt(getUrlParam('calendarLoaderTillFinalCalendar', 0)) === 1 ? true : false;
4401		myObj.forceHideRedirectToSpecialEventPage = myObj.settings.forceHideRedirectToSpecialEventPage || false;
4402		myObj.enableWaitListOnceTicketTypeSoldOut = myObj.settings.enableWaitListOnceTicketTypeSoldOut !== undefined && myObj.settings.enableWaitListOnceTicketTypeSoldOut !== null ? myObj.settings.enableWaitListOnceTicketTypeSoldOut : true;
4403
4404		myObj.showBuyNowInPDP = parseInt(getUrlParam('showBuyNowInPDP', 0)) === 1 ? true : false;
4405		//myObj.lowestFareForUpcomingEventDays = parseInt(getUrlParam('lowestFareForUpcomingEventDays', 0)) === 45 ? 45 : null;
4406		myObj.openViewMoreByDefault = myObj.settings.openViewMoreByDefault || false;
4407		myObj.addToCartMobileV2 = true;
4408		myObj.useExperiencesAltText = myObj.settings.useExperiencesAltText || false;
4409		if(myObj.useExperiencesAltText) {
4410			myObj.otherExperiencesAlternativeText = '<p><b>Alcatraz Tickets Sold Out?</b><br/>Instead, Join us for the Bay Discovery Cruise!</p>';
4411		}
4412		if(!myObj.settings.hide_affirm_module) {
4413			//affirm.ui.refresh();
4414		}
4415		myObj.chatkey = getUrlParam('chatkey', '');
4416		
4417		// NOT SURE WHY WE DO A TIMEOUT TO GET THE OT COOKIE??? 
4418		/*setTimeout(function() {
4419			getOneTrustSettings(myObj);
4420		}, 3000);*/
4421		getOneTrustSettings(myObj);
4422		
4423
4424		if(myObj.settings.specialDayEvent === "false") {
4425			myObj.settings.specialDayEvent = false;
4426		}
4427		
4428		myObj.specialRequestV2 = true;
4429		myObj.hideWaitlistForAdditionalSpecialityEvents = true;
4430		
4431		myObj.changeAddToCartToBookNowFlag = true;
4432		myObj.underlineBoldProductTileTitleFlag = true;
4433		
4434		myObj.tintSelectedPromoDates = parseInt(getUrlParam('tintSelectedPromoDates', 0)) === 1 ? true : false;
4435	
4436		var enableEnhancementPushExclusions = ["/san-diego/", "/newport-beach/", "/marina-del-rey/", "/long-beach/", "/san-francisco/", "/sacramento/","/london/","/poole/","/york/"];
4437		if(!enableEnhancementPushExclusions.filter(e => location.pathname.includes(e)).length > 0){
4438			myObj.enableEnhancementPush = true   
4439		}
4440		if (myObj.is_canada_tour) {
4441			myObj.enableEnhancementPush = false;
4442		}
4443		
4444		myObj.enableUniformSimilarExperience = parseInt(getUrlParam('enableUniformSimilarExperience', 0)) === 1 ? true : false;
4445		myObj.enableWaitListOnceAllTicketTypeSoldOut = parseInt(getUrlParam('enableWaitListOnceAllTicketTypeSoldOut', 0)) === 1 ? true : false;
4446
4447		myObj.useLowestFareEndMonthFull = myObj.settings.force_selected_date && myObj.settings.force_selected_date.length ? true : (myObj.settings.useLowestFareEndMonthFull || false);
4448		
4449// 		var ccUSCities = ["/alexandria/city-cruises/", "/baltimore/city-cruises/", "/berkeley/city-cruises/", "/boston/city-cruises/", "/chicago/city-cruises/", "/long-beach/city-cruises/","/marina-del-rey/city-cruises/","/newport-beach/city-cruises/","/new-york/city-cruises/","/norfolk/city-cruises/","/philadelphia/city-cruises/","/sacramento/city-cruises/","/san-diego/city-cruises/","/san-francisco/city-cruises/","/washington-dc/city-cruises/","/weehawken/city-cruises/"];
4450// 		if(ccUSCities.filter(e => location.pathname.includes(e))){
4451// 			myObj.allowSelectedDateForSpecialDayEvent = true   
4452// 		}
4453		//myObj.allowSelectedDateForSpecialDayEvent = parseInt(getUrlParam('allowSelectedDateForSpecialDayEvent', 0)) === 1 ? true : false;
4454
4455		var enableCaptureSectionsForVwoInclusions = ["/alexandria/city-cruises/", "/baltimore/city-cruises/", "/berkeley/city-cruises/", "/boston/city-cruises/", "/chicago/city-cruises/", "/long-beach/city-cruises/","/marina-del-rey/city-cruises/","/newport-beach/city-cruises/","/new-york/city-cruises/","/norfolk/city-cruises/","/philadelphia/city-cruises/","/sacramento/city-cruises/","/san-diego/city-cruises/","/san-francisco/city-cruises/","/washington-dc/city-cruises/","/weehawken/city-cruises/"];
4456		if (enableCaptureSectionsForVwoInclusions.some(e => location.pathname.includes(e))) {
4457			myObj.enableCaptureSectionsForVwo = true;
4458			myObj.allowSelectedDateForSpecialDayEvent = true;
4459			myObj.hidePriceInCalendar = true;
4460			myObj.isAdultWithWindowPreferred = true;
4461			myObj.showBuyNowInPDP = true;
4462		}
4463
4464		//myObj.enableCaptureSectionsForVwo = parseInt(getUrlParam('enableCaptureSectionsForVwo', 0)) === 1 ? true : false;
4465		//console.log('checking-here', myObj);
4466		myObj.useFrontendV2 = (myObj.settings.undo_useFrontendV2 || false) ? false : propsUseFrontendV2.includes(myObj.propertyId);
4467
4468		
4469		var singleStepAddToCartInclusions = ["/alexandria/city-cruises/", "/baltimore/city-cruises/", "/berkeley/city-cruises/", "/boston/city-cruises/", "/chicago/city-cruises/", "/long-beach/city-cruises/","/marina-del-rey/city-cruises/","/newport-beach/city-cruises/","/new-york/city-cruises/","/norfolk/city-cruises/","/philadelphia/city-cruises/","/sacramento/city-cruises/","/san-diego/city-cruises/","/san-francisco/city-cruises/","/washington-dc/city-cruises/","/weehawken/city-cruises/"];
4470		var singleStepAddToCartExclusions = ["/san-francisco/city-cruises/alcatraz/", "/new-york/city-cruises/statue/"];  // Add exclusions
4471		if (singleStepAddToCartInclusions.some(e => location.pathname.includes(e)) && 
4472			!singleStepAddToCartExclusions.some(e => location.pathname.includes(e))) {
4473				myObj.singleStepAddToCart = true;
4474		}
4475
4476
4477		if (myObj.is_california_tour) {
4478			myObj.enableEnhancementPushForCaliforniaPort = myObj.is_california_tour;
4479		}
4480
4481		var enableShadowDom = ["/washington-dc/", "/toronto/", "/sacramento/", "/baltimore/", "/boston/"];
4482		if (
4483			enableShadowDom.some(e => location.pathname.includes(e)) &&
4484			myObj?.settings?.is_combo_deal !== true
4485		) {
4486			myObj.useShadowDom = true;
4487		} else {
4488			myObj.useShadowDom = false;
4489		}
4490		
4491		myObj.dateIsPassedInUrl = decodeURIComponent(getUrlParam('date', '')) !== '';
4492		myObj.openSdkIsPassedInUrl = getUrlParam('openSdk', '') === '1';
4493		myObj.qrcode = getUrlParam('qrcode', '') === '1';
4494		myObj.ticketId = getUrlParam('ticketid', '0') !== '0' ? getUrlParam('ticketid', '0').split(',') : [];
4495		myObj.showOnlySelectedProductIds = myObj.qrcode ? getUrlParam('ticketid', '0') : undefined;
4496		if(myObj.qrcode && myObj.ticketId.length) {
4497			var ticketObj = { };
4498			for(var tid = 0; tid < myObj.ticketId.length; tid++) {
4499				ticketObj[myObj.ticketId[tid]] = 1;
4500			}
4501			//console.log('ticketObj', ticketObj);
4502			myObj.ticketSelection = { [myObj.booking_type_id]: ticketObj };
4503		} else {
4504			myObj.ticketSelection = { };
4505		}
4506		myObj.cartMode = myObj.qrcode ? false : myObj.cartMode;
4507		//code below is used to turn off cart mode for selected properties
4508		//myObj.cartMode = myObj.property_id === 'hbchico' || myObj.property_id === 'hbsdco' ? false : (myObj.qrcode ? false : myObj.cartMode);
4509		myObj.showOnlySelectedProduct = myObj.qrcode;
4510		//myObj.urlDate = (myObj.settings.force_selected_date || '').length ? myObj.settings.force_selected_date : myObj.urlDate;
4511		//myObj.ticketSelection = { 210: { 134312: 1 }};
4512		//
4513		// Added by PK
4514        //console.log('launch timeid', myObj.urlTimeId);
4515        //myObj.selectedTimedTicketTypeId: myObj.urlTimeId
4516
4517		if(true || myObj.is_statue_tour){
4518			myObj.showSingleSimilarExperienceInTicketSelection = true;
4519		}
4520		
4521		myObj.trackEventsViaParentPage = false; //getUrlParam('ga4','') === '1';
4522		myObj.settings.disableAdditionalTracking = true;
4523		myObj.disableAdditionalTracking = myObj.settings.disableAdditionalTracking !== undefined ? myObj.settings.disableAdditionalTracking : false;
4524		
4525
4526		myObj.flagStruct = {
4527			cartMode: myObj.cartMode,
4528			showCheckoutBtnNextToAddToCart: myObj.settings.showCheckoutBtnNextToAddToCart,
4529			preselectionMode: myObj.preselectionMode,
4530			viewCheckoutV2: true,
4531			viaEmail: myObj.viaEmail,
4532			viaPhone: myObj.viaPhone,
4533			showViewCartOnPostAddToCart: myObj.settings.showViewCartOnPostAddToCart,
4534			singleFormCheckout: myObj.settings.singleFormCheckout,
4535			singleFormCheckoutV3: myObj.singleFormCheckoutV3,
4536			singleFormCheckoutV3Collapse: myObj.settings.singleFormCheckoutV3Collapse,
4537			cartCheckout: {
4538				showRecommendedTours: myObj.settings.show_recommended_tours,
4539				enableQuickAddInRecommendedTours: myObj.settings.enableQuickAddInRecommendedTours,
4540				enableComboTicketUpsell: myObj.settings.enableComboTicketUpsell,
4541			},
4542			oneTrustCookiesCheckEnabled: myObj.oneTrustCookiesCheckEnabled || false,
4543			singleFormCheckoutV3: true,
4544			optimizedTimeSlots: myObj.settings.optimizedTimeSlots || false,
4545			specialDayEvent: myObj.settings.specialDayEvent || false,
4546			specialDayEventId: myObj.settings.specialDayEventId || null,
4547			specialDayEventBookingTypeId: myObj.settings.specialDayEventBookingTypeId || null,
4548			showAttendeesInCheckout: myObj.settings.showAttendeesInCheckout || false,
4549			chatkey: myObj.chatkey,
4550			similarExperiencesV2: myObj.similarExperiencesV2,
4551			lowestFare: true,
4552			showLowestFareLink: true,
4553			lowestFareForUpcomingEventDays: myObj.lowestFareForUpcomingEventDays,
4554			lowestFareCompareOnDisplayPrice: true,
4555			addToCartMobileV2: myObj.addToCartMobileV2,
4556			syncDisplayPrice: myObj.syncDisplayPrice,
4557			checkoutCalendarLayoutVersion: myObj.checkoutCalendarLayoutVersion,
4558			showPriceInCalendarForSources: myObj.showPriceInCalendarForSources,
4559			handleMultiTabsAddToCart: true,
4560			openViewMoreByDefault: myObj.openViewMoreByDefault,
4561			showHistoricalTrendsFlag: getUrlParam('showHistoricalTrendsFlag','') === '1' ? true : (myObj.settings.showHistoricalTrendsFlag || false),
4562			showCorrespondingTours: myObj.showCorrespondingTours,
4563			enableBestAvailableTimeSlot: myObj.settings.enableBestAvailableTimeSlot || false,
4564			hideAddAndContinueInCheckout: true,
4565			calendarLoaderTillFinalCalendar: myObj.calendarLoaderTillFinalCalendar,
4566			forceHideRedirectToSpecialEventPage: myObj.forceHideRedirectToSpecialEventPage,
4567			allOptions: myObj.allOptionsProps,
4568			enableWaitListOnceTicketTypeSoldOut: myObj.enableWaitListOnceTicketTypeSoldOut,
4569			otherExperiencesAlternativeText: myObj.otherExperiencesAlternativeText,
4570			specialRequestV2: myObj.specialRequestV2,
4571			hideWaitlistForAdditionalSpecialityEvents: myObj.hideWaitlistForAdditionalSpecialityEvents,
4572			changeAddToCartToBookNowFlag: myObj.changeAddToCartToBookNowFlag,
4573			underlineBoldProductTileTitleFlag: myObj.underlineBoldProductTileTitleFlag,
4574			tintSelectedPromoDates: myObj.tintSelectedPromoDates,
4575			enableEnhancementPush: myObj.enableEnhancementPush,
4576			changeCalendarLayoutV6Flag: true,
4577			enableUniformSimilarExperience: myObj.enableUniformSimilarExperience,
4578			enableWaitListOnceAllTicketTypeSoldOut: myObj.enableWaitListOnceAllTicketTypeSoldOut,
4579			allowSelectedDateForSpecialDayEvent: myObj.allowSelectedDateForSpecialDayEvent,
4580			enableCaptureSectionsForVwo: myObj.enableCaptureSectionsForVwo,
4581			hidePriceInCalendar: myObj.hidePriceInCalendar,
4582			disablePaze: getUrlParam('mck','') === '1' ? true : (myObj.useFrontendV2 || myObj.settings.disablePaze || false),
4583			autoSelectDepartureDestinationWhenOnlyOneAvailable: myObj.settings.autoSelectDepartureDestinationWhenOnlyOneAvailable || false,
4584			singleStepAddToCart: myObj.singleStepAddToCart,
4585			enableEnhancementPushForCaliforniaPort: myObj.enableEnhancementPushForCaliforniaPort,
4586			useLowestFareEndMonthFull: myObj.useLowestFareEndMonthFull,
4587			displayMessageForNotPairedProductsSelection: true,
4588			forceKeepSelectedTicketsInWeb: myObj.qrcode,
4589			isAdultWithWindowPreferred: myObj.isAdultWithWindowPreferred,
4590			showBuyNowInPDP: myObj.showBuyNowInPDP,
4591			showOnlySelectedProduct: myObj.showOnlySelectedProduct || false,
4592			enableBuyNowWithProductDetails: myObj.settings.enableBuyNowWithProductDetails || false,
4593			//code below is used to enable enableBuyNowWithProductDetails for selected properties
4594			//enableBuyNowWithProductDetails: myObj.property_id === 'hbchico' || myObj.property_id === 'hbsdco' ? true : (myObj.settings.enableBuyNowWithProductDetails || false),
4595			showSingleSimilarExperienceInTicketSelection: myObj.showSingleSimilarExperienceInTicketSelection,
4596			openOtherAvailableExperiencesInSameWindow: true,
4597			enableNextAvailableTimeSlot: myObj.settings.enableNextAvailableTimeSlot || false,
4598			useShadowDom: myObj.useShadowDom,
4599			trackEventsViaParentPage: myObj.trackEventsViaParentPage || false,
4600			disableAdditionalTracking: myObj.disableAdditionalTracking || false,
4601		};
4602		if(myObj.qrcode) {
4603			myObj.flagStruct.showOnlySelectedProductIds = myObj.showOnlySelectedProductIds;
4604		}
4605		var thisTranslationPage = getPageTranslation();
4606		console.log('flagStruct', myObj.flagStruct);
4607		myObj.translations = thisTranslationPage === 'en' ? { boardingTimeLabel: myObj.settings.boardingTimeLabel || 'Boarding Time' } : {};
4608		if(myObj.cartMode) {
4609			myObj.checkoutStr = myObj.checkoutPrefix + myObj.settings.checkout_domain_url + myObj.settings.prepend_checkout_url + myObj.settings.checkout_path_url;
4610		} else {
4611			//this is pending
4612			if(myObj.settings.replacePreselection || false) {
4613				myObj.checkoutStr = myObj.checkoutPrefix + myObj.settings.checkout_domain_url + myObj.settings.prepend_checkout_url + myObj.settings.checkout_path_url + '?cart=0&bookingTypeId='+myObj.booking_type_id+'&propertyID='+myObj.property_id+'&preselectionFlag=1&qrcode='+(myObj.qrcode ? '1' : '0')+'&preselection=';
4614			} else {
4615				myObj.checkoutStr = myObj.checkoutPrefix + myObj.settings.checkout_domain_url + myObj.settings.prepend_checkout_url + myObj.settings.checkout_path_url + '?cart=0&bookingTypeId='+myObj.booking_type_id+'&propertyID='+myObj.property_id+'&qrcode='+(myObj.qrcode ? '1' : '0')+'&preselection=';
4616			}
4617		}
4618		if(!myObj.settings.show_private_note && !isTourPrivate && !myObj.settings.replace_cal_with_content && !myObj.settings.is_combo_deal && !myObj.settings.checkoutV3) {
4619			//hbCommerceSDKQuery(function() {
4620				//loadTourCalSdkInterval = setInterval(loadTourCalSdk, (isLoadMobile ? 5000 : 4000), myObj);
4621				//launch_sdk(myObj);
4622			//});
4623
4624		}
4625		
4626		function recalculateWidth() {
4627			//console.log('resizing');
4628			if(window.innerWidth <= 500) {
4629				/*var totalNavWidth = window.innerWidth * 2;
4630				var eachNavWidth = window.innerWidth / 2;
4631				jQuery('.product-navbar-items').attr('style', 'width: '+totalNavWidth+'px;');
4632				jQuery('.product-navbar-items li').attr('style', 'width: '+eachNavWidth+'px;');*/
4633			} else {
4634				//jQuery('.product-navbar-items').attr('style', '');
4635			}
4636		}
4637		window.addEventListener("resize", recalculateWidth);
4638		recalculateWidth();
4639
4640		jQuery('a.copy-coupon-saving-code').on('click', function(e) {
4641			e.preventDefault();
4642			var couponCode = jQuery(this).attr('data-code') || '';
4643			jQuery('.coupon-copied').removeClass('d-none');
4644			setTimeout(function() {
4645				jQuery('.coupon-copied').addClass('d-none');
4646			}, 3000);
4647			navigator.clipboard.writeText(couponCode);
4648		});
4649
4650		jQuery('a.social-copy-link').on('click', function(e) {
4651			e.preventDefault();
4652			var socialLink = jQuery(this).attr('data-copylink') || '';
4653			jQuery('.link-copied-text').removeClass('d-none');
4654			jQuery('.default-copy-text').addClass('d-none');
4655			setTimeout(function() {
4656				jQuery('.link-copied-text').addClass('d-none');
4657				jQuery('.default-copy-text').removeClass('d-none');
4658			}, 3000);
4659			navigator.clipboard.writeText(socialLink);
4660		});
4661		
4662		if(!myObj.settings.is_combo_deal && jQuery('#hb-commerce-sdk-root').length && !jQuery('#hb-commerce-sdk-root').html().length) {
4663		//if(!myObj.settings.is_combo_deal && !jQuery('#hb-commerce-sdk-root').html().length) {
4664		//
4665			//console.log('launching-sdk-here', myObj.urlTimeId);
4666			launch_sdk(myObj);
4667			
4668			//loadTourCalSdkInterval = setInterval(loadTourCalSdk, (isLoadMobile ? 5000 : 4000), myObj);
4669			//console.log('loadTourCalSdkInterval',loadTourCalSdkInterval);
4670		}
4671
4672		function handleCheckAvail(event) {
4673			var checkAvail = getUrlParam('checkavail','');
4674			if (checkAvail === '1') {
4675				event.preventDefault();
4676				jQuery('#cart-container').removeClass('hide');
4677				jQuery('#cart-container').removeClass('make-height-0px');
4678				jQuery('#hb-commerce-sdk-root').removeClass('make-height-0px');
4679				goToAnchor('#cart-container');
4680				if(myObj.settings.is_combo_deal) {
4681					var foundIt = false;
4682					for(var j = 0; j < myObj.settings.combo_deal_properties.length; j++) {
4683						if(!foundIt && !myObj.settings.combo_deal_properties[j].combo_added_to_cart) {
4684							console.log('launching-sdk-combo', myObj)
4685							launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[j]);
4686							foundIt = true;
4687						}
4688					}
4689					if(!foundIt) {
4690						jQuery('.combo-complete .btn').removeClass('in-progress');
4691						jQuery('.combo-complete .btn').removeClass('disabled');
4692					}
4693					jQuery('.each-combo-title').on('click', function(e) {
4694						e.preventDefault();
4695						var propBookId = jQuery(this).attr('prop-book-id');
4696						var thisIdx = parseInt(jQuery(this).attr('prop-idx'));
4697						if(!jQuery(this).parent().hasClass('open') && !jQuery(this).hasClass('disabled')) {
4698							jQuery('.combo-wrapper .each-combo').removeClass('open');
4699							jQuery(this).parent().addClass('open');
4700							launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[thisIdx]);
4701							goToAnchor('#comboWrapperTour');
4702						}
4703						event.stopPropagation();
4704					});
4705					jQuery('a.edit-combo-cart').on('click', function(e) {
4706						e.preventDefault();
4707						var propId = jQuery(this).attr('property-id') || '';
4708						var bookId = jQuery(this).attr('booking-id') || '';
4709						var orderId = jQuery(this).attr('order-id') || '';
4710						jQuery('.calendar-drawer-wrapper').addClass('open');
4711						//console.log('edit-combo-cart', propId, bookId, orderId);
4712						addToCartDrawer(propId, bookId, orderId)
4713					});
4714				} else {
4715					if(!jQuery('#hb-commerce-sdk-root').html().length && loadTourCalSdkInterval !== undefined) {
4716						//console.log('manual');
4717						//clearInterval(loadTourCalSdkInterval);
4718						//launch_sdk(myObj);
4719					}
4720				}
4721			}
4722		}
4723		
4724		var checkAvail = getUrlParam('checkavail','');
4725		checkAvail = myObj.qrcode ? '1' : checkAvail;
4726		
4727		
4728		if (checkAvail === '1' || (myObj.dateIsPassedInUrl && myObj.openSdkIsPassedInUrl) ) {
4729			console.log('dateIsPassedInUrl');
4730			jQuery('#cart-container').removeClass('make-height-0px');
4731			jQuery('#hb-commerce-sdk-root').removeClass('make-height-0px');
4732			goToAnchor('#cart-container');
4733		}
4734		
4735		if(myObj.settings.checkoutMode || false) {
4736			loadSingleCheckoutSDK(myObj);
4737		}
4738		
4739		jQuery('a.ce-book-now-action').on('click', function(e) {
4740			e.preventDefault();
4741			if(myObj.settings.checkoutMode || false) {
4742				jQuery('#modalSingleCheckout').modal('toggle');
4743			} else {
4744				//This if condition is used for notification banners if they are setup to link to SDK
4745				if (jQuery(this).hasClass('noti-banner-cta')) {
4746					var sdkDate = jQuery(this).data('sdkdate');
4747					myObj.urlDate = sdkDate;
4748					launch_sdk(myObj);	
4749				}
4750
4751				//This if condition is used for popups if they are setup to link to SDK
4752				if (jQuery(this).hasClass('anchor-to-sdk')) {
4753					launch_sdk(myObj);	
4754				}
4755
4756				jQuery('#cart-container').removeClass('hide');
4757				jQuery('#cart-container').removeClass('make-height-0px');
4758				jQuery('#hb-commerce-sdk-root').removeClass('make-height-0px');
4759				goToAnchor('#cart-container');
4760				if(myObj.settings.is_combo_deal) {
4761					var foundIt = false;
4762					for(var j = 0; j < myObj.settings.combo_deal_properties.length; j++) {
4763						if(!foundIt && !myObj.settings.combo_deal_properties[j].combo_added_to_cart) {
4764							console.log('launching-sdk-combo', myObj)
4765							launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[j]);
4766							foundIt = true;
4767						}
4768					}
4769					if(!foundIt) {
4770						jQuery('.combo-complete .btn').removeClass('in-progress');
4771						jQuery('.combo-complete .btn').removeClass('disabled');
4772					}
4773					jQuery('.each-combo-title').on('click', function(e) {
4774						e.preventDefault();
4775						var propBookId = jQuery(this).attr('prop-book-id');
4776						var thisIdx = parseInt(jQuery(this).attr('prop-idx'));
4777						if(!jQuery(this).parent().hasClass('open') && !jQuery(this).hasClass('disabled')) {
4778							jQuery('.combo-wrapper .each-combo').removeClass('open');
4779							jQuery(this).parent().addClass('open');
4780							launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[thisIdx]);
4781							goToAnchor('#comboWrapperTour');
4782						}
4783						event.stopPropagation();
4784					});
4785					jQuery('a.edit-combo-cart').on('click', function(e) {
4786						e.preventDefault();
4787						var propId = jQuery(this).attr('property-id') || '';
4788						var bookId = jQuery(this).attr('booking-id') || '';
4789						var orderId = jQuery(this).attr('order-id') || '';
4790						jQuery('.calendar-drawer-wrapper').addClass('open');
4791						//console.log('edit-combo-cart', propId, bookId, orderId);
4792						addToCartDrawer(propId, bookId, orderId)
4793					});
4794				} else {
4795					if(!jQuery('#hb-commerce-sdk-root').html().length && loadTourCalSdkInterval !== undefined) {
4796						//console.log('manual');
4797						//clearInterval(loadTourCalSdkInterval);
4798						//launch_sdk(myObj);
4799					}
4800				}
4801			}
4802			
4803
4804		});
4805
4806		let aoUrl = window.location.href;
4807		jQuery('.alloptions-submit').on('click', function(e) {
4808			e.preventDefault();
4809			jQuery('.hb-commerce-sdk-root').addClass('make-height-0px');
4810
4811			const adultsValue = jQuery('#adults').val();
4812			const dateValue = jQuery('#alloptions-date').val();
4813			//const childValue = jQuery('#children').val();
4814
4815			if (adultsValue > 0) {
4816				jQuery('#product-navbar-desktop, #product-navbar-mobile, #floating-product-cta').css('display', 'none');
4817
4818				// Construct the URL parameter string
4819				const urlParams = new URLSearchParams(window.location.search);
4820				urlParams.set('allOptionsTickets', adultsValue);
4821				urlParams.set('allOptionsDate', dateValue);
4822				//urlParams.set('allOptionsChild', childValue);
4823
4824				// Update the URL with the new parameter
4825				const newUrl = window.location.pathname + '?' + urlParams.toString();
4826				window.history.replaceState({}, '', newUrl);
4827
4828				// Optionally, you can log the updated URL to verify the changes
4829				//console.log(newUrl);
4830				
4831				if (newUrl !== aoUrl) {
4832					aoUrl = newUrl;
4833					var timesToRun = myObj.allOptionsTourProperties.length; 
4834					// Loop to run the function multiple times
4835					for (var i = 0; i < timesToRun; i++) {
4836						myObj.sdkContainer = myObj.allOptionsTourProperties[i].propertyId + '-' + myObj.allOptionsTourProperties[i].selectedTours;
4837						myObj.property_id = myObj.allOptionsTourProperties[i].propertyId;
4838						myObj.booking_type_id = myObj.allOptionsTourProperties[i].selectedTours;
4839						launch_sdk_allOptions(myObj);
4840					}
4841				}
4842				
4843				
4844				
4845				jQuery('#cart-container').removeClass('hide');
4846				jQuery('#cart-container').removeClass('make-height-0px');
4847
4848				if (jQuery(this).hasClass('ao-hero-check-avail')) {
4849					goToAnchor('#cart-container');
4850				}
4851				
4852				/* else if (jQuery(this).hasClass('ao-compare-check-avail')) {
4853					var aoCompareAvailId = $(this).attr('id');
4854					goToAnchor('#' + aoCompareAvailId);
4855				} */
4856			} else {
4857				alert('Please add at least one adult or one child ticket.');
4858			}
4859			
4860			jQuery(".hb-commerce-sdk-root .close-sdk").click();
4861			
4862		});
4863
4864		jQuery('.single-tour-info .all-options-single-tour-btn').on('click', function(e) {
4865			//console.log('clicked on the button');
4866			e.preventDefault();
4867			jQuery(this).toggleClass('d-none')
4868			
4869			let singleTourWrapper = jQuery(this).closest('.single-tour-wrapper');
4870			singleTourWrapper.addClass('single-tour-expanded');
4871	
4872			let singleTourSdkWrapper = singleTourWrapper.find('.hb-commerce-sdk-root');
4873			singleTourSdkWrapper.removeClass('make-height-0px');
4874	
4875			let additionalInfoSectionButton = singleTourWrapper.find('.single-tour-additional-info .all-options-single-tour-btn');
4876			additionalInfoSectionButton.addClass('d-none');
4877	
4878			let anchorAttribute = jQuery(this).data('anchor-attribute');
4879			goToAnchor('#' + anchorAttribute);
4880			//jQuery('#' + anchorAttribute).addClass('expanded');
4881		});
4882		
4883	
4884		jQuery('.single-tour-more-details').on('click', function(e) {
4885			//console.log('clicked on the button');
4886			e.preventDefault();
4887			jQuery(this).toggleClass("expanded")
4888			let singleTourWrapper = jQuery(this).closest('.single-tour-wrapper');
4889			singleTourWrapper.toggleClass('single-tour-additional-info-expanded');
4890			let addtionalInfoWrapper = singleTourWrapper.find('.single-tour-additional-info');
4891			addtionalInfoWrapper.toggleClass('d-none additional-info-expanded');
4892	
4893			let topButtonElement = singleTourWrapper.find('.single-tour-info .all-options-single-tour-btn');
4894			if (singleTourWrapper.hasClass('single-tour-additional-info-expanded') && singleTourWrapper.hasClass('single-tour-expanded')) {
4895				topButtonElement.addClass('d-none');
4896			} else if (singleTourWrapper.hasClass('single-tour-additional-info-expanded')) {
4897				topButtonElement.addClass('d-none');
4898			} else if (singleTourWrapper.hasClass('single-tour-expanded')) {
4899				topButtonElement.addClass('d-none');
4900			} else {
4901				topButtonElement.removeClass('d-none');
4902			}
4903			/*let topButtonElement = singleTourWrapper.find('.single-tour-info .all-options-single-tour-btn');
4904			if (singleTourWrapper.hasClass('single-tour-expanded')) {
4905				topButtonElement.addClass('d-none');
4906			}*/
4907			/*if (topButtonElement.css('opacity') == 0 && !singleTourWrapper.hasClass('single-tour-expanded')) {
4908				topButtonElement.css('opacity', 1);
4909			} else {
4910				topButtonElement.css('opacity', 0);
4911			}*/		
4912		});
4913	
4914		jQuery('.single-tour-additional-info .all-options-single-tour-btn').on('click', function(e) {
4915			//console.log('clicked on the button');
4916			e.preventDefault();
4917			jQuery(this).toggleClass("d-none");
4918	
4919			let singleTourWrapper = jQuery(this).closest('.single-tour-wrapper');
4920			singleTourWrapper.addClass('single-tour-expanded');
4921	
4922			let singleTourSdkWrapper = singleTourWrapper.find('.hb-commerce-sdk-root');
4923			singleTourSdkWrapper.removeClass('make-height-0px');
4924	
4925			let anchorAttribute = jQuery(this).data('anchor-attribute');
4926			goToAnchor('#' + anchorAttribute);
4927		});
4928
4929		jQuery('.ao-compare-check-avail').on('click', function(e) {
4930			e.preventDefault();
4931			let anchorAttribute = jQuery(this).data('anchor-attribute');
4932			goToAnchor('#' + anchorAttribute);
4933
4934			if (jQuery('#' + anchorAttribute).hasClass('availability-fetched')) {
4935				jQuery('#'+anchorAttribute + ' .all-options-single-tour-btn').toggleClass('d-none');
4936				
4937			
4938				let singleTourWrapper = jQuery('#' + anchorAttribute).closest('.single-tour-wrapper');
4939				singleTourWrapper.addClass('single-tour-expanded');
4940		
4941				let singleTourSdkWrapper = singleTourWrapper.find('.hb-commerce-sdk-root');
4942				singleTourSdkWrapper.removeClass('make-height-0px');
4943		
4944				let additionalInfoSectionButton = singleTourWrapper.find('.single-tour-additional-info .all-options-single-tour-btn');
4945				additionalInfoSectionButton.addClass('d-none');
4946		
4947				/*let anchorAttribute = jQuery(this).data('anchor-attribute');
4948				goToAnchor('#' + anchorAttribute);*/
4949			}
4950
4951			
4952	
4953			
4954		});
4955	
4956		jQuery('.hb-commerce-sdk-root .close-sdk').on('click', function(e) {
4957			//console.log('clicked on the button');
4958			e.preventDefault();
4959			
4960			let singleTourWrapper = jQuery(this).closest('.single-tour-wrapper');
4961			singleTourWrapper.removeClass('single-tour-expanded');
4962	
4963			let singleTourSdkWrapper = singleTourWrapper.find('.hb-commerce-sdk-root');
4964			singleTourSdkWrapper.addClass('make-height-0px');
4965	
4966			let additionalInfoWrapperButton = singleTourWrapper.find('.single-tour-additional-info .single-tour-info-button .all-options-single-tour-btn');
4967			additionalInfoWrapperButton.removeClass('d-none');
4968	
4969			let topButtonElement = singleTourWrapper.find('.single-tour-info .all-options-single-tour-btn');
4970			if (singleTourWrapper.hasClass('single-tour-additional-info-expanded') && singleTourWrapper.hasClass('single-tour-expanded')) {
4971				topButtonElement.addClass('d-none');
4972			} else if (singleTourWrapper.hasClass('single-tour-additional-info-expanded')) {
4973				topButtonElement.addClass('d-none');
4974			} else if (singleTourWrapper.hasClass('single-tour-expanded')) {
4975				topButtonElement.addClass('d-none');
4976			} else {
4977				topButtonElement.removeClass('d-none');
4978			}
4979		});
4980
4981		jQuery('.gallery-trigger').on('click', function() {
4982            var galleryId = jQuery(this).data('gallery-id');
4983            jQuery('#' + galleryId).ekkoLightbox({
4984                alwaysShowClose: true,
4985				leftArrow: '<i class="fas fa-angle-left slick-arrow ekko-arrow ekko-prev" aria-hidden="true"></i>',
4986				rightArrow: '<i class="fas fa-angle-right slick-arrow ekko-arrow ekko-next" aria-hidden="true"></i>'
4987            });
4988        });
4989
4990		jQuery('.whats-included-bullets ul li').each(function() {
4991			var text = jQuery(this).text().toLowerCase();
4992			if (text.includes('duration')) {
4993				jQuery(this).addClass('clock-icon');
4994			} else if (text.includes('dinner')) {
4995				jQuery(this).addClass('food-icon');
4996			} else if (text.includes('beverages')) {
4997				jQuery(this).addClass('drink-icon');
4998			}
4999		});
5000
5001		jQuery('#mobile-ao-check-avail-main').on('click', function() {
5002            jQuery('#alloptions-date').click();
5003        });
5004
5005		
5006		
5007		
5008		if(false && myObj.settings.use_slick) {
5009			jQuery('.ce20-product-assets:not(.ce20-product-assets-va)').slick({
5010				centerMode: true,
5011				slidesToShow: 1,
5012				centerPadding: '15%',
5013				responsive: [
5014					{
5015						breakpoint: 991,
5016						settings: {
5017							centerPadding: '15%'
5018						}
5019					},
5020					{
5021						breakpoint: 767,
5022						settings: {
5023							centerPadding: '60px'
5024						}
5025					},
5026					{
5027						breakpoint: 788,
5028						settings: {
5029							centerPadding: '60px'
5030						}
5031					}
5032				]
5033			});
5034
5035			jQuery('.ce20-product-assets-va').slick({
5036				centerMode: true,
5037				slidesToShow: 2,
5038				centerPadding: '15%',
5039				responsive: [
5040					{
5041						breakpoint: 991,
5042						settings: {
5043							centerPadding: '15%'
5044						}
5045					},
5046					{
5047						breakpoint: 767,
5048						settings: {
5049							centerPadding: '60px'
5050						}
5051					},
5052					{
5053						breakpoint: 788,
5054						settings: {
5055							centerPadding: '60px'
5056						}
5057					}
5058				]
5059			});
5060		}
5061		
5062		if(false && myObj.settings.is_combo_deal && (myObj.settings.combo_deal_properties || []).length) {
5063			var foundIt = false;
5064			for(var j = 0; j < myObj.settings.combo_deal_properties.length; j++) {
5065				if(!foundIt && !myObj.settings.combo_deal_properties[j].combo_added_to_cart) {
5066					launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[j]);
5067					foundIt = true;
5068				}
5069			}
5070			if(!foundIt) {
5071				jQuery('.combo-complete .btn').removeClass('in-progress');
5072				jQuery('.combo-complete .btn').removeClass('disabled');
5073			}
5074			jQuery('.each-combo-title').on('click', function(e) {
5075				e.preventDefault();
5076				var propBookId = jQuery(this).attr('prop-book-id');
5077				var thisIdx = parseInt(jQuery(this).attr('prop-idx'));
5078				if(!jQuery(this).parent().hasClass('open') && !jQuery(this).hasClass('disabled')) {
5079					jQuery('.combo-wrapper .each-combo').removeClass('open');
5080					jQuery(this).parent().addClass('open');
5081					launch_sdk_combo(myObj, myObj.settings.combo_deal_properties[thisIdx]);
5082					goToAnchor('#comboWrapperTour');
5083				}
5084				event.stopPropagation();
5085			});
5086			jQuery('a.edit-combo-cart').on('click', function(e) {
5087				e.preventDefault();
5088				var propId = jQuery(this).attr('property-id') || '';
5089				var bookId = jQuery(this).attr('booking-id') || '';
5090				var orderId = jQuery(this).attr('order-id') || '';
5091				jQuery('.calendar-drawer-wrapper').addClass('open');
5092				console.log('edit-combo-cart', propId, bookId, orderId);
5093				addToCartDrawer(propId, bookId, orderId)
5094			});
5095		}
5096		if(jQuery('.tour-combo-packages-wrapper:not(.tour-combo-packages-wrapper-v2) .tour-combo-list-wrapper').length) {
5097			console.log('number of items total', myObj.combo_package_list.listing.length);
5098			
5099			jQuery('.tour-combo-list-wrapper').slick({
5100				infinite: false,
5101				slidesToShow: 2,
5102				slidesToScroll: 2,
5103				dots: true,
5104				responsive: [
5105					{
5106						breakpoint: 767,
5107						settings: {
5108							slidesToShow: 1,
5109							slidesToScroll: 1,
5110						}
5111					}
5112				]
5113			});
5114		}
5115		if(jQuery('.tour-combo-packages-wrapper.tour-combo-packages-wrapper-v2 .tour-combo-list-wrapper').length) {
5116			console.log('number of items total', myObj.combo_package_list.listing.length);
5117			if(myObj.combo_package_list.listing.length > 2) {
5118				var comboSlidesToShow = 3;
5119				var comboSlidesToScroll = 3;
5120			} else {
5121				var comboSlidesToShow = 2;
5122				var comboSlidesToScroll = 2;
5123			}
5124			jQuery('.tour-combo-list-wrapper').slick({
5125				infinite: false,
5126				slidesToShow: comboSlidesToShow,
5127				slidesToScroll: comboSlidesToScroll,
5128				dots: true,
5129				responsive: [
5130					{
5131						breakpoint: 767,
5132						settings: {
5133							slidesToShow: 1,
5134							slidesToScroll: 1,
5135						}
5136					}
5137				]
5138			});
5139		}
5140		//console.log('show_related_tour', myObj);
5141		if(myObj.settings.show_related_tour) {
5142			myObj.settings.related_tour_settings.additionalCitiesArr = [];
5143			if(myObj.settings.related_tour_settings.search_city && myObj.settings.related_tour_settings.search_city.length) {
5144				myObj.settings.related_tour_settings.additionalCitiesArr = myObj.settings.related_tour_settings.search_city.split(',');
5145			}
5146			myObj.settings.site_id = '';
5147			myObj.exclude_list = myObj.exclude_list.length > 0 ? myObj.exclude_list + ',' + myObj.tourId : myObj.tourId;
5148			myObj.exclude_list = myObj.settings.related_tour_settings.exclude_list.length ? myObj.exclude_list + ',' + myObj.settings.related_tour_settings.exclude_list : myObj.exclude_list;
5149			for(var item in myObj.settings.related_tour_settings) {
5150				myObj.settings[item] = myObj.settings.related_tour_settings[item];
5151			}
5152
5153			var startDate = new Date();
5154			var startDateStr =  ('0'+(startDate.getMonth()+1)).slice(-2) + '/' + ('0'+(startDate.getDate())).slice(-2) + '/' + startDate.getFullYear();
5155			var endDate = new Date();
5156			endDate.setMonth(endDate.getMonth() + myObj.settings.related_tour_settings.event_range_in_month);
5157			var endDateStr =  ('0'+(endDate.getMonth()+1)).slice(-2) + '/' + ('0'+(endDate.getDate())).slice(-2) + '/' + endDate.getFullYear();
5158
5159			// TEMPORARY SET SITE_ID TO cityexperiences TO PULL FROM SELL ON FIELD
5160			myObj.settings.related_tour_settings.site_id = 'cityexperiences';
5161			if(myObj.tempShowListing && !myObj.settings.is_experiences) {
5162				myObj.settings.related_tour_settings.additionalCitiesArr = ['boston harbor','alcatraz - san francisco','new york statue','alexandria','potomac riverboat co','ontario','london','berkeley','poole','york'];
5163				myObj.settings.related_tour_settings.additionalCitiesArr = myObj.settings.related_tour_settings.search_city.split(',');
5164				myObj.settings.related_tour_settings.search_city = 'not-available';
5165			}
5166
5167			var relatedData = { propertyId: myObj.settings.related_tour_settings.property_id, searchTerm: myObj.settings.related_tour_settings.search_term, city: myObj.settings.related_tour_settings.search_city, crossSellCities: myObj.settings.related_tour_settings.additionalCitiesArr, siteId: myObj.settings.related_tour_settings.site_id,  includeAvailability: myObj.settings.related_tour_settings.include_availability, includeMenu: false, date: startDateStr, endDate: endDateStr, addApplicableSpecialCoupons: true, };
5168			//console.log('relatedData',relatedData);
5169
5170			//console.log('myObj.gql', myObj.gql);
5171
5172			//loadRelatedSdkInterval = setInterval(prePreDisplayRelatedList, 5000, myObj, relatedData);
5173			prePreDisplayRelatedList(myObj, relatedData);
5174
5175		}
5176
5177		if(myObj.settings.has_check_availability) {
5178			//console.log('has_check_availability');
5179			addOnClickAnchorCheckAvailability(myObj, HBCommerce);
5180		}
5181		jQuery('.data-from-anchor a').on('click', function(e) {
5182			e.preventDefault();
5183			window.open(jQuery(this).attr('href'));
5184			//console.log('link-out', jQuery(this).attr('href'));
5185		});
5186		
5187		jQuery('a.ce-package-deal-action').on('click', function(e) {
5188			e.preventDefault();
5189			goToAnchor('#tourComboPackages');
5190
5191		});
5192
5193		addOnClickAnchor(myObj.element_id);
5194
5195		loadAffirmModule(myObj);
5196		//addScrollToTop();
5197
5198	});
5199}
5200
5201function loadAffirmModule(myObj) {
5202	/* Affirm scripts */
5203	if(myObj.is_walks_tour && myObj.default_currency === 'USD' && myObj.affirm_price > 5000) {
5204		myObj.settings.hide_affirm_module = false;
5205	}
5206	console.log('loadAffirmModule');
5207	if(!myObj.settings.hide_affirm_module && !(force_not_load_affirm_dynamically || false)) {
5208		
5209		var affirm_public_api_key = "";
5210		if(myObj.is_walks_tour) {
5211			affirm_public_api_key = "5CENAR6STP7W6MWH";
5212		} else if(myObj.propertyId === 'hbhcco') {
5213			affirm_public_api_key = "VX62AV960JIVDQIU";
5214		} else if(myObj.propertyId === 'hbphico') {
5215			affirm_public_api_key = "MCFTH9967ONJG6A6";
5216		} else {
5217			affirm_public_api_key = "893Y99N8K3TQ3SO4";
5218		}
5219		_affirm_config = {
5220		public_api_key: affirm_public_api_key,
5221		script: "https://cdn1.affirm.com/js/v2/affirm.js"
5222		};
5223		(function(l,g,m,e,a,f,b){var d,c=l[m]||{},h=document.createElement(f),n=document.getElementsByTagName(f)[0],k=function(a,b,c){return function(){a[b]._.push([c,arguments])}};c[e]=k(c,e,"set");d=c[e];c[a]={};c[a]._=[];d._=[];c[a][b]=k(c,a,b);a=0;for(b="set add save post open empty reset on off trigger ready setProduct".split(" ");a<b.length;a++)d[b[a]]=k(c,e,b[a]);a=0;for(b=["get","token","url","items"];a<b.length;a++)d[b[a]]=function(){};h.async=!0;h.src=g[f];n.parentNode.insertBefore(h,n);delete g[f];d(g);l[m]=c})(window,_affirm_config,"affirm","checkout","ui","script","ready");
5224		//console.log('loadAffirmModule', {myObj,affirm_public_api_key});
5225	}
5226	/* End Affirm scripts */	
5227}
5228
5229function renderTourPageSDK(myObj) {
5230	var curSettings = myObj.settings;
5231	//myObj.settings.show_related_tour = false;
5232	
5233	//console.log('renderTourPageSDK', myObj);
5234	myObj = jQuery.extend( myObj, populateTour(myObj.tourSdk, myObj.curLang, myObj.settings, myObj.settings.is_experiences, myObj.settings.is_walks, myObj.settings.is_hide_map) );
5235	myObj.settings = jQuery.extend( myObj.settings, curSettings);
5236	myObj.cartMode = myObj.settings.cartMode;
5237	myObj.preselectionMode = !myObj.cartMode;
5238	myObj.settings.isSoldOutAll = getUrlParam('isSoldOut', 0) === '1' && myObj.fullySoldOut ? true : false;
5239	myObj.settings.all_sold_out_message = (myObj.settings.all_sold_out_message||'').length ? myObj.settings.all_sold_out_message : 'Sorry - tickets on this date are not available. Please check another date or explore our other offerings.';
5240	myObj.settings.soldOutAllButton = (myObj.settings.soldOutAllButton||'').length ? myObj.settings.soldOutAllButton : 'Join the Waitlist';
5241	var thisRecommend = myObj.settings.show_recommended_tours;
5242	myObj.settings.is_combo_deal = myObj.settings.is_combo_deal || false;
5243	myObj.settings.enableQuickAddInRecommendedTours = myObj.settings.enableQuickAddInRecommendedTours || true;
5244
5245	myObj.has_video = isLoadMobile ? false : myObj.has_video;
5246	myObj.additional_assets.length = myObj.additional_assets.length > 9 ? 9 : myObj.additional_assets.length;
5247	if(isLoadMobile) {
5248		myObj.additional_assets.length = myObj.additional_assets.length > 3 ? 3 : myObj.additional_assets.length;
5249	}
5250	myObj.settings.show_only_single_asset = myObj.additional_assets.length === 0;
5251	
5252
5253	//console.log('thisRecommend',thisRecommend, myObj.settings.show_recommended_tours)
5254	//console.log('myObj-tour-page',myObj);
5255	var numberPattern = /[\d|.]+/g;
5256	//myObj.settings.displayPrice = '111';
5257	myObj.settings.displayPriceOnly = ((myObj.settings.displayPrice || '').match(numberPattern)||[])[0] || 0;
5258	myObj.settings.displayPriceSign = (myObj.settings.displayPrice || '').replace(myObj.settings.displayPriceOnly, '');				
5259	myObj.settings.displayPriceCurrency = myObj.settings.displayPriceSign.length ? ( productCurrency[myObj.settings.displayPriceSign] || '' ) : productCurrency[myObj.propertySettings.defaultCurrency];
5260	if(!propNotUseCeiling.includes(myObj.property_id)) {
5261		myObj.settings.displayPriceOnly = Math.ceil(myObj.settings.displayPriceOnly);
5262		myObj.settings.discountedDisplayPrice = Math.ceil(myObj.settings.discountedDisplayPrice);
5263	}
5264	//console.log('pre-propAlwaysTwoDigitDecimal', {myObj,propAlwaysTwoDigitDecimal});
5265	if( propAlwaysTwoDigitDecimal.includes(myObj.property_id)) {
5266		//console.log('propAlwaysTwoDigitDecimal', propAlwaysTwoDigitDecimal, myObj.settings.displayPriceOnly);
5267		myObj.settings.displayPriceOnly = parseFloat(myObj.settings.displayPriceOnly).toFixed(2);
5268	}
5269	myObj.affirm_price = myObj.has_discounted_price ? parseFloat(myObj.settings.discountedDisplayPrice) * 100 : parseFloat(myObj.settings.displayPriceOnly) * 100;
5270
5271
5272	myObj.settings.shouldDisplayPriceWithTaxesAndFees = myObj.settings.shouldDisplayPriceWithTaxesAndFees === "true";
5273
5274	myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly = (myObj.settings.discountedDisplayPriceWithTaxesAndFees || '').match(numberPattern);
5275	myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly = myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly !== null && myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly.length ? Math.ceil(myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly[0]) : 0;
5276
5277	myObj.settings.displayDisplayPriceWithTaxesAndFees = (myObj.settings.displayPriceWithTaxesAndFees || '').match(numberPattern);
5278	myObj.settings.displayDisplayPriceWithTaxesAndFees = myObj.settings.displayDisplayPriceWithTaxesAndFees !== null && myObj.settings.displayDisplayPriceWithTaxesAndFees.length ? Math.ceil(myObj.settings.displayDisplayPriceWithTaxesAndFees[0]) : 0;
5279
5280	myObj.settings.displayPriceWithTaxesAndFees = (myObj.settings.displayPriceWithTaxesAndFees || '').match(numberPattern);
5281	myObj.settings.displayPriceWithTaxesAndFees = myObj.settings.displayPriceWithTaxesAndFees !== null && myObj.settings.displayPriceWithTaxesAndFees.length ? Math.ceil(myObj.settings.displayPriceWithTaxesAndFees[0]) : 0;
5282
5283	const displayPricesWithFeesCookie = document.cookie
5284		.split('; ')
5285		.some(cookie => cookie.startsWith('cex_campaign=display_with_all_fees'));
5286
5287	if (displayPricesWithFeesCookie || myObj.settings.shouldDisplayPriceWithTaxesAndFees) {
5288		//console.log('Cookie cex_campaign exists with value display_with_all_fees.');
5289		if (myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly && myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly > 0) {
5290			myObj.settings.discountedDisplayPrice = myObj.settings.displayDiscountedDisplayPriceWithTaxesAndFeesOnly;
5291		}
5292		if (myObj.settings.displayDisplayPriceWithTaxesAndFees && myObj.settings.displayDisplayPriceWithTaxesAndFees > 0) {
5293			myObj.settings.displayPriceOnly = myObj.settings.displayDisplayPriceWithTaxesAndFees;
5294		}
5295		if (myObj.settings.displayPriceWithTaxesAndFees && myObj.settings.displayPriceWithTaxesAndFees > 0) {
5296			myObj.settings.displayPriceOnly = myObj.settings.displayPriceWithTaxesAndFees;
5297		}
5298	} else {
5299		//console.log('Cookie cex_campaign DOES NOT EXIST with value display_with_all_fees.');
5300	}
5301	
5302	var page_type = window.location.pathname.match('/city-cruises/') !== null ? 'cc' : 'non-cc';
5303// 	postToTealiumAfterloaded('view', {
5304// 		"tealium_event": "page_view",
5305// 		"page_category": "Product Page",
5306// 		"page_name": myObj.locationTags.city || myObj.tour_city || myObj.city || "unknown city",
5307// 		"page_type": page_type,
5308// 		"product_category": myObj.anchor_brand_name,
5309// 		"product_id": myObj.bookingTypeId || 0,
5310// 		"product_name": myObj.title || "",
5311// 		"product_port_city": myObj.locationTags.city || myObj.tour_city || myObj.city || "unknown city",
5312// 		"product_price": myObj.settings.displayPriceOnly || 0,
5313// 		"product_currency": myObj.settings.displayPriceCurrency,
5314// 		"property_id": myObj.propertyId,
5315// 		"url": window.location.href,
5316// 	});
5317
5318	
5319	if(hidePhoneForBrands.includes(myObj.brand_name)) {
5320		jQuery('li.nav-phone-number').addClass('hide');
5321	}
5322	if(myObj.settings.is_experiences) {
5323		var convertedSlugCity = ( (myObj.settings.activityCity || '').trim() || myObj.city || '').replace(/\. /g, '-').replace(/ /g,'-').toLowerCase();
5324		myObj.breadcrumbs = '<a href="/experiences/" role="home" class="breadcrumb-link">Home</a>';
5325		if(myObj.exp_cities[convertedSlugCity] !== undefined){
5326			myObj.breadcrumbs += ' / <a href="/experiences/">'+myObj.exp_cities[convertedSlugCity].country+'</a> ';		
5327			myObj.breadcrumbs += ' / <a href="/experiences/search-result/?country='+myObj.exp_cities[convertedSlugCity].countryslug+'&state='+myObj.exp_cities[convertedSlugCity].stateslug+'&city='+myObj.exp_cities[convertedSlugCity].cityurl+'">'+myObj.exp_cities[convertedSlugCity].state+'</a> ';
5328			myObj.breadcrumbs += ' / <a href="/experiences/search-result/?country='+myObj.exp_cities[convertedSlugCity].countryslug+'&state='+myObj.exp_cities[convertedSlugCity].stateslug+'&city='+myObj.exp_cities[convertedSlugCity].cityurl+'">'+myObj.exp_cities[convertedSlugCity].city+'</a> ';
5329		}
5330	}
5331	if(myObj.settings.is_combo_deal && (myObj.settings.combo_deal_properties || []).length) {
5332		myObj.all_tour_added = true;
5333		myObj.open_tour = false;
5334		var foundItTour = false;
5335		for(var idx = 0; idx < myObj.settings.combo_deal_properties.length; idx++) {
5336			myObj.settings.combo_deal_properties[idx].idx = idx;
5337			myObj.settings.combo_deal_properties[idx].combo_prop_book_id = myObj.settings.combo_deal_properties[idx].combo_property_id + '.' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
5338			myObj.settings.combo_deal_properties[idx].combo_prop_book_id2 = myObj.settings.combo_deal_properties[idx].combo_property_id + '_' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
5339			myObj.settings.combo_deal_properties[idx].combo_prop_book_class = myObj.settings.combo_deal_properties[idx].combo_property_id + '-' + myObj.settings.combo_deal_properties[idx].combo_booking_id;
5340			var itemInCart = getItemInCart(myObj.settings.combo_deal_properties[idx].combo_property_id, myObj.settings.combo_deal_properties[idx].combo_booking_id);
5341			myObj.settings.combo_deal_properties[idx].combo_order_id = Object.keys(itemInCart).length === 0 ? '' : (itemInCart.orderId || '');
5342			myObj.settings.combo_deal_properties[idx].combo_date_time = Object.keys(itemInCart).length === 0 ? '' : (itemInCart.tourDateTimeFormatted || '');
5343			myObj.settings.combo_deal_properties[idx].combo_added_to_cart = myObj.settings.combo_deal_properties[idx].combo_order_id.length > 0;
5344			if(!foundItTour && !myObj.settings.combo_deal_properties[idx].combo_added_to_cart) {
5345				myObj.settings.combo_deal_properties[idx].combo_open_class = 'open';
5346				foundItTour = true;
5347			}
5348			myObj.all_tour_added = myObj.settings.combo_deal_properties[idx].combo_added_to_cart ? myObj.all_tour_added : false;
5349		}
5350	}
5351	
5352	myObj.settings.is_walks_brand = (myObj.settings.brandTag && myObj.settings.brandTag === 'Walks') ? true : false;
5353
5354	//CA cities and NY
5355	const caCities = [
5356		'marina del rey',
5357		'berkeley',
5358		'long beach',
5359		'newport beach',
5360		'sacramento',
5361		'san diego',
5362		'san francisco',
5363		'new york'
5364	  ];
5365	  
5366	  myObj.is_non_ca_ccl_tour = 
5367	  	myObj.settings.categoryTheme.includes('City Cruises Live') &&
5368		!caCities.includes(myObj.city.toLowerCase());
5369
5370
5371	myObj.has_download_menu = myObj.has_download_menu || false;
5372	myObj.new_menu_design = true;
5373	//myObj.new_menu_design = myObj.city_cruises_country == 'US' ? true : false;
5374	//myObj.new_menu_design = (myObj.city == 'london' || myObj.city == 'gananoque' || myObj.city == 'toronto' || myObj.city == 'york' || myObj.city == 'ontario');
5375	translatedTourTitles(myObj);
5376	//console.log('translatedTourTitles', myObj)
5377	if(myObj.settings.show_combo_packages) {
5378		var comboTourUrl = 'https://my.cityexperiences.com/assets/cex_website/'+myObj.propertyId+'/'+myObj.bookingTypeId+'/comboTour.json';
5379		jQuery.ajax({
5380			dataType: "json",
5381			url: comboTourUrl,
5382			crossDomain: true,
5383			success: function (comboListing) {
5384				myObj.combo_package_list = comboListing;
5385				//console.log('comboListing-v2',myObj.combo_package_list);
5386				myObj.settings.show_combo_packages = typeof comboListing === 'object' && comboListing.listing.length;
5387				//myObj.settings.show_combo_packages = typeof comboListing === 'object' && comboListing.listing.length && comboListing.hasOwnProperty('package_unavailable') && comboListing.listing.package_unavailable === false;
5388
5389				if(myObj.settings.show_combo_packages) {
5390					var totalListingsInCombo = myObj.combo_package_list.listing.length;
5391					myObj.settings.multiple_combo_listings = totalListingsInCombo > 1 ? true : false;
5392					myObj.settings.hide_combo_packages = false;
5393					for(var i = 0; i < myObj.combo_package_list.listing.length; i++) {
5394						if (myObj.combo_package_list.listing[i].package_unavailable === true) {
5395							if (!myObj.settings.multiple_combo_listings) {
5396								if (myObj.settings && myObj.settings.hasOwnProperty('ignore_package_unavailable') && myObj.settings.ignore_package_unavailable) {
5397									myObj.settings.hide_combo_packages = false;  
5398								} else {
5399									myObj.settings.hide_combo_packages = true;
5400								}
5401							}
5402							break;
5403						}
5404						for(var j = 0; j < myObj.combo_package_list.listing[i].tour.length; j++) {
5405							myObj.combo_package_list.listing[i].tour[j].selected = myObj.combo_package_list.listing[i].tour[j].tour_booking_type_id === myObj.bookingTypeId;
5406							myObj.combo_package_list.listing[i].tour[j].has_brand_info = (myObj.combo_package_list.listing[i].tour[j].tour_brand_tag ||'').length > 0;
5407							myObj.combo_package_list.listing[i].tour[j].anchor_brand_src = myObj.combo_package_list.listing[i].tour[j].has_brand_info ? brandImgSrc[myObj.combo_package_list.listing[i].tour[j].tour_brand_tag] : '';
5408						}
5409					}
5410
5411					let maxDiscount = 0;
5412					let maxDiscountIndex = -1;
5413					// Loop to find the highest discount
5414					for (var i = 0; i < myObj.combo_package_list.listing.length; i++) {
5415						if (myObj.combo_package_list.listing[i].discount_pct > maxDiscount) {
5416							maxDiscount = myObj.combo_package_list.listing[i].discount_pct;
5417							maxDiscountIndex = i;
5418						}
5419					}
5420					if (maxDiscountIndex !== -1) {
5421						const highestDiscountValue = myObj.combo_package_list.listing[maxDiscountIndex].discount_pct;
5422						myObj.comboPackageDiscount = highestDiscountValue;
5423						//console.log("Highest discount percentage:", highestDiscountValue);
5424					}
5425
5426
5427					if(myObj.settings.use_weight_sorted) {
5428						myObj.combo_package_list.listing.sort(function (a, b) {
5429							return b.combo_weightScaled - a.combo_weightScaled;
5430						});
5431						
5432						//comboTourUrl = tourSortedByWeight(jQuery.extend(true, [], comboTourUrl), myObj.settings.weight_sorted_desc);
5433					}
5434				}
5435				afterComboPackageTourFeed(myObj);
5436			},
5437			error: function (jqXHR, error, errorThrown) {
5438				//console.log('comboListing-v2-not');
5439				myObj.settings.show_combo_packages = false;
5440				afterComboPackageTourFeed(myObj);
5441				if (jqXHR.status && jqXHR.status == 400) {
5442					console.log(jqXHR.responseText);
5443				} else {
5444					console.log("Something went wrong - ", error);
5445				}
5446			},
5447		});
5448	} else {
5449		myObj.settings.show_combo_packages = false;
5450		afterComboPackageTourFeed(myObj);
5451	}
5452
5453}
5454
5455
5456
5457(function ($) {
5458    $(document).ready(function () {
5459
5460		$(window).on('scroll', function() {
5461			var closestYaxis = -5000;
5462			var foundSection = false;
5463			var screenWidth = window.innerWidth;
5464			var ulWidth = parseFloat(jQuery('.product-navbar-items').width());
5465			$('.tour-section-anchor').each(function() {
5466				var thisId = $(this).attr('href').replace('#', '');
5467				//console.log('thisId', thisId);
5468				if(document.getElementById(thisId)) {
5469					var thisIdYaxis = document.getElementById(thisId).getBoundingClientRect().top;
5470					if(thisIdYaxis < 125 && thisIdYaxis > closestYaxis) {
5471						$('.tour-section-anchor').removeClass('active');
5472						$(this).addClass('active');
5473						foundSection = true;
5474					}
5475				}
5476				//console.log( 'anchor', thisId, curYaxis, thisIdYaxis );
5477			})
5478			if(!foundSection) {
5479				$('.tour-section-anchor').removeClass('active');
5480			}
5481			if(window.innerWidth <= 500) {
5482				if(!foundSection) {
5483					//jQuery('.product-navbar-items').attr('style', 'left: 0px;');
5484				} else {
5485					var ulPos = parseFloat(jQuery('.product-navbar-items').offset().left);
5486					var activePos = parseFloat(jQuery('.product-navbar-items a.active').offset().left);
5487					var finalPos = ulPos - activePos + 15;
5488					if(Math.abs(ulPos - screenWidth) > ulWidth) {
5489						finalPos = (ulWidth - screenWidth) * -1;
5490					}
5491					jQuery('.product-navbar-items-wrapper').scrollLeft(Math.abs(finalPos));
5492				}
5493			}
5494        });
5495		
5496		if(window.location.pathname === '/product-page-9/') {
5497			$('.assets-wrapper').slick({
5498                infinite: true,
5499                slidesToShow: 1,
5500                slidesToScroll: 1,
5501                autoplay: false,
5502                autoplaySpeed: 3000,
5503                prevArrow: '<i class="fas fa-angle-left" aria-hidden="true"></i>',
5504                nextArrow: '<i class="fas fa-angle-right" aria-hidden="true"></i>',
5505                fade: true,
5506                cssEase: 'linear',
5507                asNavFor: '.event-thumbnails'
5508            });
5509            $('.event-thumbnails').slick({
5510                slidesToShow: 3,
5511                slidesToScroll: 1,
5512                vertical:true,
5513                asNavFor: '.assets-wrapper',
5514                dots: false,
5515                arrows: false,
5516                focusOnSelect: true,
5517                verticalSwiping:true,
5518                infinite: true,
5519                responsive: [
5520                    {
5521                        breakpoint: 901,
5522                        settings: {
5523                            vertical: false
5524                        }
5525                    }
5526                ]
5527            });
5528		}
5529		
5530		$('.global-listing-dialog-box .tour-selection-btn a').on('click', function(e) {
5531			e.preventDefault();
5532			var datePassed = $(this).attr('date') || '';
5533			var thisHref = $(this).attr('href') + ( datePassed.length ? '?date='+datePassed+'&openSdk=1' : '' );
5534			location.href = thisHref;
5535			//console.log('clicked-button', {datePassed,thisHref});
5536		});
5537		
5538    });
5539})(jQuery);
5540
5541
5542

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.