PageSourceSearch

https://argoatv.com/assets/js/jquery.main.js?v=1750875588

js argoatv.com collected 2026-10-02 13:14:53 UTC 53,220 bytes, 2,008 lines download raw bytes

1/*
2  
3  Name: Argo Machine
4  Date: 6/1/2018
5  Author: John Peacock [email protected]
6
7*/
8
9var Argo = Argo || {
10	events: Array(),
11	container: null,
12}
13
14Argo.init = function () {
15	this.container = $("#container")
16
17	// account for adding document classes based on device type
18	var deviceAgent = navigator.userAgent.toLowerCase()
19	this.isMobile = deviceAgent.match(/(iphone|ipod|ipad|android)/)
20	this.isiPad = deviceAgent.match(/(ipad)/)
21	this.isPhone = deviceAgent.match(/(iphone|ipod|mobile safari|opera mobi)/)
22	this.isFirefox = deviceAgent.match(/(firefox)/)
23	this.isChrome = deviceAgent.match(/(chrome)/)
24
25	if (this.isMobile) {
26		$(document.documentElement).addClass("istouch")
27	}
28	if (this.isPhone) {
29		$(document.documentElement).addClass("phone")
30	}
31	if (this.isiPad) {
32		$(document.documentElement).addClass("ipad")
33	}
34	if (this.isFirefox) {
35		$(document.documentElement).addClass("firefox")
36	}
37	if (this.isChrome) {
38		$(document.documentElement).addClass("chrome")
39	}
40
41	if (this.isMobile) {
42		if ($("#tinylodge-panel").length > 0) {
43			var tlDatePanel = $("#tinylodge-panel")
44			tlDatePanel.remove()
45			$(".media-slider").after(tlDatePanel)
46		}
47	}
48
49	$("nav.main a")
50		.eq(0)
51		.on("mouseenter", function (e) {
52			clearTimeout(Argo.hoverTimeout)
53			var _this = $(this)
54			var _panel = _this.parent().find("ul.submenu").eq(0)
55			_panel.show()
56		})
57		.on("mouseleave", function () {
58			var _this = $(this)
59			var _panel = _this.parent().find("ul.submenu").eq(0)
60			Argo.hoverTimeout = setTimeout(function () {
61				_panel.hide()
62			}, 800)
63		})
64
65	$(".vehicle-compare-single").matchHeight()
66
67	$(".key-trigger").on("click", function (e) {
68		e.preventDefault()
69		$(".map-key").toggleClass("onscreen")
70	})
71
72	$("nav.main ul.submenu")
73		.eq(0)
74		.on("mouseenter", function (e) {
75			clearTimeout(Argo.hoverTimeout)
76			var _this = $(this)
77			_this.show()
78		})
79		.on("mouseleave", function () {
80			var _this = $(this)
81			Argo.hoverTimeout = setTimeout(function () {
82				_this.hide()
83			}, 200)
84		})
85
86	if ($(".archive-filtering").length > 0) {
87		this.setupArchiveFilters()
88	}
89
90	if ($("form#dealerContact").length > 0) {
91		var storedItems = store.get("savedVehicle")
92
93		if (storedItems) {
94			var savedConfig = storedItems[0].modelName + ": "
95
96			$.each(storedItems, function (index, value) {
97				savedConfig += value.title + ","
98			})
99			savedConfig = savedConfig.substring(0, savedConfig.length - 1)
100			$("form#dealerContact input[name='customizedVehicle']").val(savedConfig)
101		}
102
103		if (dealerName.length > 0) {
104			$("form#dealerContact input[name='dealerDetails']").val(
105				"Dealer Name: " + dealerName + ", Dealer ID: " + dealerId
106			)
107		}
108
109		if ($(".dealer-detail .cta-btns").length > 0) {
110			$(".dealer-detail .cta-btns button").on("click", function (e) {
111				$(this).toggleClass("inactive")
112				$(this).siblings("button").toggleClass("inactive")
113			})
114		}
115	}
116
117	if ($(".gallery-builder").length > 0) {
118		$(".gallery-builder").swipebox({
119			useCSS: true, // false will force the use of jQuery for animations
120			useSVG: true, // false to force the use of png for buttons
121			initialIndexOnArray: 0, // which image index to init when a array is passed
122			hideCloseButtonOnMobile: false, // true will hide the close button on mobile devices
123			removeBarsOnMobile: true, // false will show top bar on mobile devices
124			hideBarsDelay: 10000, // delay before hiding bars on desktop
125			videoMaxWidth: 1140, // videos max width
126			beforeOpen: function () {
127				//console.log('opening');
128			}, // called before opening
129			afterOpen: null, // called after opening
130			afterClose: function () {
131				//console.log('closign');
132			}, // called after closing
133			loopAtEnd: false, // true will return to the first image after the last image is reached
134		})
135	}
136
137	if ($("#tiny-lodge-date .picker, #panel-date .picker").length > 0) {
138		var today = new Date()
139		today.setDate(today.getDate())
140
141		var tinyLodgeForm = $(".tiny-lodge-form form#tinyLodge")
142
143		$("#find-a-dealer-inline").hide()
144		tinyLodgeForm.submit(function (e) {
145			e.preventDefault()
146			var _this = $(this)
147
148			$.post(
149				tinyLodgeForm.attr("action"),
150				tinyLodgeForm.serialize(),
151				function (data) {
152					//console.log(data);
153					if (data.success == true) {
154						if (_this.attr("id") == "tinyLodge") {
155							$("#tinyLodgeBookingConfirmation .hide-after-submit").fadeOut(
156								"fast"
157							)
158							$("#tinyLodgeMainForm").fadeOut("fast", function () {
159								$("#tinyLodgeMainForm").next(".thanks").fadeIn()
160							})
161						}
162					}
163				}
164			)
165		})
166
167		var tinyLodgeWaitlistForm = $(".tiny-lodge-form form#tinyLodgeWaitlist")
168
169		tinyLodgeWaitlistForm.submit(function (e) {
170			e.preventDefault()
171			var _this = $(this)
172
173			$.post(
174				tinyLodgeWaitlistForm.attr("action"),
175				tinyLodgeWaitlistForm.serialize(),
176				function (data) {
177					//console.log(data);
178					if (data.success == true) {
179						if (_this.attr("id") == "tinyLodgeWaitlist") {
180							$("#tinyLodgeBooked .hide-after-submit").fadeOut("fast")
181
182							_this.fadeOut("fast", function () {
183								$("#find-a-dealer-inline").fadeIn()
184							})
185						}
186					}
187				}
188			)
189		})
190
191		Argo.waitlistTimeout = setTimeout(function () {
192			$("#tinyLodgeBookedButton").trigger("click")
193		}, 7000)
194
195		$("#numberOfGuests").on("change", function () {
196			var guests = $(this).find("option:selected").text()
197			tinyLodgeForm.find("input[name=numberOfGuests]").val(guests)
198		})
199
200		//$("#showBookingButton").hide();
201		if ($("#tiny-lodge-date .picker").length > 0) {
202			$("#tiny-lodge-date .picker")
203				.dateRangePicker({
204					inline: true,
205					container: "#tiny-lodge-date .picker",
206					alwaysOpen: true,
207					startDate: moment().month("september"),
208					endDate: "2018-12-15",
209					maxDays: 3,
210					beforeShowDay: function (t) {
211						if (tinyLodgeBooked == true) {
212							return [valid, "booked"]
213						}
214						if (
215							$.inArray(moment(t).format("MM/DD/YYYY"), disabledDates) !== -1
216						) {
217							return [valid, "booked", "Already Booked"]
218						}
219						var valid = !(
220							t.getDay() == 1 ||
221							t.getDay() == 2 ||
222							t.getDay() == 3 ||
223							t.getDay() == 4
224						) //disable saturday and sunday
225						return [valid]
226					},
227				})
228				.bind("datepicker-first-date-selected", function (event, obj) {
229					changeDate(tinyLodgeForm, obj)
230					//$("#showBookingButton").show();
231				})
232				.bind("datepicker-change", function (event, obj) {
233					changeDate(tinyLodgeForm, obj)
234					if (obj.date2) {
235						$("#showBookingButton").show()
236					}
237				})
238		}
239
240		if ($("#panel-date .picker #two-inputs").length > 0) {
241			$("#panel-date .picker #two-inputs")
242				.dateRangePicker({
243					inline: true,
244					container: "#panel-date .picker",
245					alwaysOpen: true,
246					separator: " to ",
247					singleMonth: true,
248					autoClose: false,
249					startDate: moment().month("september"),
250					endDate: "2018-12-15",
251					maxDays: 3,
252					getValue: function () {
253						if ($("#date-range-start").val() && $("#date-range-end").val()) {
254							return (
255								$("#date-range-start").val() +
256								" to " +
257								$("#date-range-end").val()
258							)
259						} else {
260							//return '';
261						}
262					},
263					setValue: function (s, s1, s2) {
264						$("#date-range-start").val(moment(s1).format("MM/DD/YYYY"))
265						$("#date-range-end").val(moment(s2).format("MM/DD/YYYY"))
266					},
267					beforeShowDay: function (t) {
268						if (tinyLodgeBooked == true) {
269							return [valid, "booked"]
270						}
271						if (
272							$.inArray(moment(t).format("MM/DD/YYYY"), disabledDates) !== -1
273						) {
274							return [valid, "booked"]
275						}
276						var valid = !(
277							t.getDay() == 1 ||
278							t.getDay() == 2 ||
279							t.getDay() == 3 ||
280							t.getDay() == 4
281						) //disable saturday and sunday
282						return [valid]
283					},
284				})
285				.bind("datepicker-first-date-selected", function (event, obj) {
286					changeDate(tinyLodgeForm, obj)
287				})
288				.bind("datepicker-change", function (event, obj) {
289					changeDate(tinyLodgeForm, obj)
290				})
291		}
292	}
293
294	function changeDate(tinyLodgeForm, date) {
295		var checkInDate, checkOutDate
296
297		if (date.date1) {
298			checkInDate = moment(date.date1).format("M/DD/YYYY")
299		}
300		if (date.date2) {
301			checkOutDate = moment(date.date2).format("M/DD/YYYY")
302			$("#tinylodge-panel button[type=submit]").removeAttr("disabled")
303		}
304
305		tinyLodgeForm.find("input[name=checkInDate]").val(checkInDate)
306		tinyLodgeForm.find("input[name=checkOutDate]").val(checkOutDate)
307	}
308
309	// geocoding setup
310	if (!Cookies.get("userLatLng")) {
311		setTimeout(function () {
312			Argo.prepGeocoding()
313		}, 7000)
314	} else {
315		if (!Cookies.get("userAssumedCountry")) {
316			Argo.geocodeLatLng(Cookies.getJSON("userLatLng"))
317		} else {
318			this.userAssumedCountry = Cookies.get("userAssumedCountry")
319			this.handleCountryPostGeolocation()
320		}
321	}
322
323	/*$("#change-location").on("click", function (e) {
324		$(".distance-from h5 span, .distance-from .your-location").text("*")
325		Cookies.remove("userLatLng")
326		Cookies.remove("userAssumedAddress")
327		setTimeout(Argo.prepGeocoding, 1000)
328		$(this).prepend(
329			'<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>'
330		)
331		e.preventDefault()
332	})*/
333
334	var mobilenavBtn = $("[data-action='toggle-mobilenav']")
335	var mobileVehicles = $(".siteheader-mobile-vehicles")
336	var mobileVehiclesBtn = $("[data-action='toggle-mobileVehicles']")
337
338	mobilenavBtn.on("click", function (e) {
339		e.preventDefault()
340		$(".siteheader-mobile-menu__nav").slideToggle(
341			"100",
342			"easeInOutQuad",
343			function () {}
344		)
345	})
346
347	mobileVehiclesBtn.on("click", function (e) {
348		e.preventDefault()
349		mobileVehicles.toggleClass("mobilenav-open")
350		$(".siteheader-mobile-vehicles__list").slideToggle(
351			"600",
352			"easeInOutQuad",
353			function () {}
354		)
355	})
356
357	if ($(".siteheader-mobile-menu__links").length > 0) {
358		var mobileLinks = $(".siteheader-mobile-menu__links li a")
359		mobileLinks.on("click", function (e) {
360			mobilenavBtn.trigger("click")
361		})
362	}
363
364	$(".toggle-mobile-nav").on("click", function (e) {
365		mobileVehiclesBtn.trigger("click")
366	})
367
368	if ($(".swatches").length > 0) {
369		// if swatches exist
370		if ($(".swatches li").length > 1) {
371			// if there's more than 1 swatch, enable a click event
372			var swatches = $(".swatches li a")
373			var images = $("#vehicle-image-wrapper .feature-image")
374
375			$.each(swatches.eq(0), function () {
376				var _this = $(this)
377				if (_this.data("color-price")) {
378					setVehicleColorPrice(_this.data("color-price"))
379				}
380			})
381
382			swatches.on("click", function (e) {
383				var _this = $(this)
384				var swatchHandle = _this.data("color-swatch")
385
386				images.hide()
387				var activeImage = images.filter(function () {
388					return $(this).data("color-swatch") == swatchHandle
389				})
390				activeImage.show().removeClass("hidden")
391
392				if (_this.data("color-price")) {
393					setVehicleColorPrice(_this.data("color-price"))
394				}
395				e.preventDefault()
396			})
397		}
398
399		function setVehicleColorPrice(price) {
400			$(".vehicle-price").text("$" + Argo.numberWithCommas(price))
401		}
402	}
403
404	if ($(".scroll-toggle, .scroll-trigger").length > 0) {
405		if (this.isMobile) {
406			$(".slide .scroll-toggle").remove()
407		}
408		this.animateArrow()
409
410		$(".scroll-toggle, .scroll-trigger").on("click", function (e) {
411			var nextElement = $(this)
412				.parent()
413				.parent()
414				.parent()
415				.parent()
416				.parent()
417				.parent()
418				.next()
419			console.log(nextElement)
420
421			if (nextElement.length > 0) {
422				$("html, body").animate(
423					{
424						scrollTop: nextElement.offset().top,
425					},
426					800
427				)
428			}
429
430			e.preventDefault()
431		})
432	}
433
434	this.initRetinaCover()
435
436	// gallery grid adherence
437	var isotopeGrid = $(".gallery-grid").isotope({
438		// options
439		transitionDuration: 0,
440		itemSelector: ".grid-item",
441		percentPosition: true,
442		layoutMode: "packery",
443		masonry: {
444			// use element for option
445			columnWidth: ".grid-sizer",
446		},
447	})
448	//this.initSameHeight()
449	isotopeGrid.isotope("layout")
450
451	setTimeout(function () {
452		isotopeGrid.isotope("layout")
453	}, 500)
454	isotopeGrid.imagesLoaded().progress(function () {
455		isotopeGrid.isotope("layout")
456	})
457	// ./ grid
458
459	// sidebar follower
460	$("#follower").on("mouseover", function (e) {
461		$(this).removeClass("tucked")
462	})
463	$("#follower").on("mouseout", function (e) {
464		$(this).addClass("tucked")
465	})
466	// ./sidebar follower
467
468	// in-page triggers
469	$("#more-specs").on("click", function (e) {
470		var _this = $(this)
471		_this.find("span").toggle()
472		if (!Argo.specsAllHidden) {
473			Argo.specsAllHidden = _this.prev().find(".hidden")
474		}
475		$.each(Argo.specsAllHidden, function () {
476			$(this).toggleClass("hidden")
477		})
478
479		e.preventDefault()
480	})
481
482	$(".find-a-dealer-fma form").on("submit", function () {
483		$(this)
484			.find("button")
485			.html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>')
486	})
487	// ./in page triggers
488
489	if ($(".history .panel").length > 0) {
490		$(".history .panel")
491			.mouseover(function () {
492				$(this).addClass("active")
493			})
494			.mouseout(function () {
495				$(this).removeClass("active")
496			})
497	}
498
499	if (window.location.hash) {
500		var element = $(window.location.hash)
501		element.find("a").trigger("click")
502	}
503
504	// $('#video-modal').on('shown.bs.modal', function () {
505	//   $(".video-container").fitVids();
506	// });
507
508	this.setupCompare()
509	this.setupCustomizer()
510	this.setupTinyLodgePanel()
511	this.setupVideoPopup()
512	this.setupSiteSearch()
513	this.setupMediaSlider()
514	this.setupImageSlider()
515	this.setupMap()
516}
517
518Argo.setupArchiveFilters = function () {
519	const urlParams = new URLSearchParams(window.location.search)
520	let series = urlParams.get("series")
521
522	$(".selectpicker").on(
523		"changed.bs.select",
524		function (e, clickedIndex, isSelected, previousValue) {
525			var selectedValue = $(this).val().toLowerCase()
526			$(".selectpicker[name='series']").removeAttr("disabled")
527
528			if ($(this).attr("name") == "type") {
529				$(".selectpicker[name='series'] option").show()
530				$(
531					".selectpicker[name='series'] option[data-vehicletype!='" +
532						selectedValue +
533						"']"
534				).hide()
535
536				if (series == null && previousValue.length > 0) {
537					$(".selectpicker[name='series']").selectpicker("val", "")
538				}
539				series = null
540			} else if ($(this).attr("name") == "series") {
541				$(".selectpicker[name='year']")
542					.attr("disabled", true)
543					.selectpicker("refresh")
544
545				var postData = {
546					type: $(".selectpicker[name='type']").val(), //.toLowerCase(),
547					series: $(".selectpicker[name='series']").val(), //.toLowerCase(),
548				}
549
550				// Add the CSRF Token
551				postData[csrfTokenName] = csrfTokenValue
552
553				$(".selectpicker[name='year']").empty()
554
555				$.ajax({
556					type: "POST",
557					url: "/ajax/check-archive-availability",
558					data: postData,
559					beforeSend: function () {},
560					success: function (data) {
561						if (data == 0) {
562							$(".selectpicker[name='year']")
563								.attr("disabled", true)
564								.selectpicker("refresh")
565							series = null
566							return
567						}
568						const soloYear = data.years[0].year
569
570						$.each(data.years, function (index, value) {
571							$(
572								".selectpicker[name='year']"
573							).append(`<option value="${value.year}">
574                      ${value.year}
575                </option>`)
576						})
577
578						$(".selectpicker[name='year']")
579							.removeAttr("disabled")
580							.selectpicker("refresh")
581
582						if (data.years.length == 1) {
583							$(".selectpicker[name='year']").selectpicker("val", soloYear)
584							$(".selectpicker[name='year']").selectpicker("refresh")
585						}
586					},
587				})
588
589				$(".selectpicker[name='year']")
590					.removeAttr("disabled")
591					.selectpicker("refresh")
592			}
593			$(".selectpicker[name='series']").selectpicker("refresh")
594		}
595	)
596
597	$(".selectpicker").on(
598		"loaded.bs.select",
599		function (e, clickedIndex, isSelected, previousValue) {
600			if ($(this).val().toLowerCase() != "") {
601				$(this).trigger("change")
602			}
603		}
604	)
605
606	$(".selectpicker").on(
607		"refreshed.bs.select",
608		function (e, clickedIndex, isSelected, previousValue) {
609			if ($(this).attr("name") == "series") {
610				$(".selectpicker[name='series']")
611					.siblings(".dropdown-menu.open")
612					.addClass("remove-min-height")
613			}
614		}
615	)
616
617	// var filters = $(".archive-filtering select").on("input", function (e) {
618	// 	console.log("changed")
619	// 	// $("#edit-field-service-sub-cat-value option[value=" + title + "]").hide();
620	// })
621}
622
623Argo.setupCompare = function () {
624	if ($(".compare-dropdown").length > 0) {
625		var compareMenus = $(".compare-dropdown")
626		var compareUrl = "/ajax/compare-vehicle"
627
628		compareMenus.on("change", function (e) {
629			var _this = $(this)
630			var vehicleId = _this.find(":selected").val()
631			var siteId = _this.data("site-id")
632			console.log(siteId)
633			console.log(vehicleId)
634
635			var postData = {
636				entryId: vehicleId,
637				siteId: siteId,
638			}
639
640			// Add the CSRF Token
641			postData[csrfTokenName] = csrfTokenValue
642
643			$.ajax({
644				type: "POST",
645				url: compareUrl,
646				data: postData,
647				beforeSend: function () {},
648				success: function (data) {
649					console.log(data)
650					_this.next(".vehicle-compare-single").html(data)
651				},
652			})
653
654			e.preventDefault()
655		})
656	}
657}
658
659Argo.animateArrow = function () {
660	$(".scroll-toggle")
661		.delay(1000)
662		.animate(
663			{
664				bottom: 40,
665			},
666			400,
667			function () {
668				$(".scroll-toggle").animate(
669					{
670						bottom: 20,
671					},
672					400,
673					function () {
674						Argo.animateArrow()
675					}
676				)
677			}
678		)
679}
680
681Argo.initSameHeight = function () {
682	if ($(".gallery-grid").length > 0) {
683		$(".gallery-grid").sameHeight({
684			elements: ".sameheight",
685			flexible: true,
686			multiLine: true,
687		})
688	}
689}
690
691Argo.initRetinaCover = function () {
692	$(".bg-stretch").retinaCover()
693}
694
695Argo.setupMediaSlider = function () {
696	if ($(".media-slider.active").length) {
697		this.heroSliders = $(".media-slider.active .slider")
698		this.heroSlidersParents = $(".media-slider")
699
700		$.each(this.heroSliders, function () {
701			var _slider = $(this)
702
703			_slider.slick({
704				adaptiveHeight: false,
705				dots: true,
706				pauseOnFocus: true,
707				pauseOnHover: false,
708				appendArrows: false,
709				autoplay: true,
710				autoplaySpeed: 7000,
711				speed: 1000,
712			})
713
714			_slider.hide()
715			_slider.find(".feature").hide()
716
717			//$(".media-slider.active .slider, .media-slider.active .slider .feature").hide();
718			_slider.fadeIn(500, function () {
719				_slider.find(".feature").fadeIn(500)
720			})
721
722			_slider.on(
723				"beforeChange",
724				function (event, slick, currentSlide, nextSlide) {
725					var activeSlide = $(this).find(".slide.slick-current")
726					if (activeSlide.length > 0) {
727						activeSlide.find(".video-wrapper a.close-x").trigger("click")
728					}
729				}
730			)
731		})
732
733		$.each(this.heroSlidersParents, function () {
734			var _sliderParent = $(this)
735
736			if (_sliderParent.length > 1) {
737				_sliderParent.filter(":gt(0)").addClass("not-first")
738				//$(".media-slider.active:gt(0)").addClass('not-first');
739			}
740		})
741		// $(".media-slider.active .slider").slick({
742		//   adaptiveHeight: true,
743		//   dots: true,
744		//   pauseOnFocus: true,
745		//   pauseOnHover: false,
746		//   appendArrows: false,
747		//   autoplay: true,
748		//   autoplaySpeed: 5000,
749		//   speed: 1000
750		// });
751		// $(".media-slider.active .slider, .media-slider.active .slider .feature").hide();
752		// $(".media-slider.active .slider").fadeIn(500, function(){
753		//   $(".media-slider.active .slider .feature").fadeIn(500);
754		// });
755
756		// $(".media-slider.active .slider").on('beforeChange', function(event, slick, currentSlide, nextSlide){
757		//   var activeSlide = $(this).find('.slide.slick-current');
758		//   if (activeSlide.length > 0){
759		//     activeSlide.find('.video-wrapper a.close-x').trigger('click');
760		//   }
761		// });
762
763		// if ($(".media-slider").length > 1) {
764		//   $(".media-slider.active:gt(0)").addClass('not-first');
765		// }
766
767		if ($(".media-slider .video video.embedded").length > 0) {
768			if ($(".media-slider .video video.embedded").length > 0) {
769				$(".media-slider .video video.embedded").siblings().remove()
770				$(".media-slider .video video.embedded")
771					.parent()
772					.addClass("inline-video")
773					.parent()
774					.addClass("inline-video-wrapper")
775			}
776		}
777
778		if ($(".media-slider .video:not(.embedded)").length > 0) {
779			var tag = document.createElement("script")
780			tag.src = "//www.youtube.com/iframe_api"
781			var firstScriptTag = document.getElementsByTagName("script")[0]
782			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
783
784			var videoPlayButton = $(".media-slider .video .play")
785			videoPlayButton.on("click", function (e) {
786				e.preventDefault()
787
788				$(".media-slider.active .slider").slick("slickPause")
789
790				var _this = $(this)
791				var videoIframe = _this.next("iframe")
792				var closeBtn = videoIframe.parent().find(".close-x")
793
794				if (typeof _this.data("iframeSrc") === "undefined") {
795					_this.data("iframeSrc", videoIframe.attr("src"))
796				}
797				var iFrameSrc = _this.data("iframeSrc")
798
799				if (!Argo.isMobile) {
800					$("#tinylodge-panel").hide()
801				}
802				closeBtn.show()
803				videoIframe.attr("src", iFrameSrc + "?autoplay=1")
804
805				_this.fadeOut(500, function () {
806					videoIframe.addClass("active")
807					$(window).trigger("resize")
808				})
809
810				closeBtn.off()
811				closeBtn.on("click", function (e) {
812					closeBtn.hide()
813					_this.fadeIn(500)
814					videoIframe.attr("src", "").removeClass("active")
815					if (!Argo.isMobile) {
816						$("#tinylodge-panel").show()
817					}
818				})
819			})
820
821			function postMessageToPlayer(player, command) {
822				if (player == null || command == null) return
823				player.contentWindow.postMessage(JSON.stringify(command), "*")
824			}
825		}
826
827		// Find all YouTube videos
828		;(Argo.allVideos = $(".media-slider iframe")),
829			(Argo.fluidContainer = Argo.allVideos.eq(0).parent())
830
831		// The element that is fluid width
832		$.each(Argo.allVideos, function () {
833			var _this = $(this)
834			_this.attr("src", _this.attr("src"))
835
836			_this
837				.data("aspectRatio", this.height / this.width)
838				.removeAttr("height")
839				.removeAttr("width")
840		})
841
842		$(window)
843			.resize(function () {
844				var newWidth = Argo.fluidContainer.width()
845				Argo.allVideos.each(function () {
846					var video = $(this)
847					var close = $(this).parent().find(".close-x")
848
849					video.width(newWidth).height(newWidth * video.data("aspectRatio"))
850
851					close.css("top", video.position().top - 50)
852				})
853			})
854			.resize()
855
856		$(window).on("orientationchange", function () {
857			Argo.heroSliders.slick("resize")
858			// console.log("reinit")
859		})
860
861		// var player;
862		// var videoPlayer = $(".media-slider .video iframe").eq(0);
863		// console.log(videoPlayer);
864
865		// function onYouTubeIframeAPIReady() {
866		//   console.log('youtube');
867		//   player = new YT.Player(videoPlayer, {
868		//     events: {
869		//       'onReady': onPlayerReady,
870		//       'onStateChange': onPlayerStateChange
871		//     }
872		//   });
873		// }
874
875		// function onPlayerReady() {
876		//   console.log("hey Im ready");
877		//   //do whatever you want here. Like, player.playVideo();
878
879		// }
880
881		// function onPlayerStateChange() {
882		//   console.log("my state changed");
883		// }
884	}
885}
886
887Argo.setupImageSlider = function () {
888	if ($(".image-slider").length) {
889
890		this.imageSliders = $(".image-slider")
891
892		$.each(this.imageSliders, function () {
893			var _slider = $(this)
894
895			_slider.slick({
896				slidesToShow: 4,
897				slidesToScroll: 1,
898				arrows: false,
899				dots: false,
900				infinite: true,
901				speed: 500,
902				autoplay: true,
903				autoplaySpeed: 2000,
904				responsive: [
905					{
906					  breakpoint: 768,
907					  settings: {
908						slidesToShow: 2
909					  }
910					}
911				]
912			})
913
914		})
915
916	}
917}
918
919Argo.setupSiteSearch = function () {
920	if ($("#site-search").length > 0) {
921		$("#site-search form").on("submit", function (e) {
922			$("#wrapper header .logo").toggleClass("inactive")
923			$(this).toggleClass("inactive")
924			$(this).find("input[type=text]").focus()
925			e.preventDefault()
926		})
927
928		$("#site-search input[type=text]").on("keyup", function (e) {
929			e.stopPropagation()
930
931			var charCount = $(this).val().replace(/\s/g, "").length
932			if (charCount < 2) {
933				return
934			}
935
936			$("#site-search .output").html("")
937			$("#site-search .output").stop().show().addClass("active")
938			var searchField = $(this).val()
939			var regEx = new RegExp(searchField, "i")
940
941			var postData = {}
942			postData[csrfTokenName] = csrfTokenValue
943			postData["query"] = searchField
944
945			$.ajax({
946				method: "POST",
947				url: currentBaseUrl + "ajax/search",
948				data: postData,
949			}).done(function (data) {
950				$("#site-search .output").html("")
951
952				$.each(data, function (key, value) {
953					$("#site-search .output").append(
954						"<a href='" + value.url + "' class='list'>" + value.title + "</a>"
955					)
956				})
957			})
958		})
959
960		$(document).on("click", function (e) {
961			e.stopPropagation()
962			$("#site-search .output").stop().html("").hide().removeClass("active")
963		})
964
965		$("#site-search").on("click", function (e) {
966			e.stopPropagation()
967		})
968		$("#site-search .output").on("click", function (e) {
969			e.stopPropagation()
970		})
971
972		// var postData = {};
973		// postData[csrfTokenName] = csrfTokenValue;
974
975		// $('#site-search input[type=text]').typeahead({
976		//   onSelect: function(item) {
977		//     console.log(item);
978		//   },
979		//   ajax: {
980		//     url: '/ajax/search',
981		//     triggerLength: 3,
982		//     method: 'POST',
983		//     preDispatch: function (query) {
984		//       postData['query'] = query;
985		//       return postData;
986		//     },
987		//     preProcess: function (data) {
988		//       console.log(data);
989		//       return data;
990		//     }
991		//   }
992		// });
993	}
994}
995
996Argo.setupVideoPopup = function () {
997	if ($(".video-popup").length > 0) {
998		var videoTriggers = $(".video-popup")
999
1000		var modals = $(".video-modal")
1001		$.each(modals, function () {
1002			$(this).data("video-code", $(this).find(".video-embed-code").html())
1003		})
1004
1005		videoTriggers.on("click", function (e) {
1006			var modalId = $(this).data("modal")
1007			var modal = $("#" + modalId)
1008			modal.removeClass("hidden")
1009
1010			var videoScript = modal
1011				.find(".video-embed-code")
1012				.html(modal.data("video-code"))
1013
1014			modal.find(".video-embed-code").fitVids()
1015
1016			modal.find(".close").on("click", function (e) {
1017				modal.addClass("hidden")
1018				modal.find(".video-embed-code").empty()
1019				$(this).off()
1020				e.preventDefault()
1021			})
1022
1023			e.preventDefault()
1024		})
1025	}
1026}
1027
1028Argo.setupTinyLodgePanel = function () {
1029	if ($("#tinylodge-panel").length > 0) {
1030		var headerHeight = $("#header").height()
1031		var panel = $("#tinylodge-panel")
1032
1033		// $(window).scroll(function (event) {
1034		//   var scroll = $(window).scrollTop();
1035		//   console.log(scroll);
1036		//   if (scroll < headerHeight){
1037		//     panel.removeClass('sticky');
1038		//   } else {
1039		//     panel.addClass('sticky');
1040		//   }
1041		// }).trigger('scroll');
1042
1043		panel.addClass("initial")
1044	}
1045}
1046
1047Argo.setupCustomizer = function () {
1048	if ($("#customizer").length > 0) {
1049		this.modelName = $("#model-name").text()
1050		var headerHeight = $("#header").height()
1051		var customizer = $("#customizer")
1052		var optionListing = $("#chosen-customizer-options")
1053		this.customizerOptions = []
1054
1055		$(window)
1056			.scroll(function (event) {
1057				var scroll = $(window).scrollTop()
1058				if (scroll < headerHeight) {
1059					customizer.removeClass("sticky")
1060				} else {
1061					customizer.addClass("sticky")
1062				}
1063			})
1064			.trigger("scroll")
1065
1066		customizer.find(".save").on("click", function (e) {
1067			var _this = $(this)
1068			_this.addClass("spin")
1069			setTimeout(function () {
1070				_this.removeClass("spin")
1071				_this.blur()
1072			}, 1000)
1073
1074			//console.log(Argo.customizerOptions);
1075			store.set("savedVehicle", Argo.customizerOptions)
1076			e.preventDefault()
1077		})
1078
1079		var options = $("ul#options li")
1080		var parents = options.find("a")
1081		var clickToRemove = options.find("span")
1082
1083		$("#chosen-customizer-options").on("click", clickToRemove, function (e) {
1084			var _this = $(e.target)
1085			var _parent = _this.parent().parent()
1086			var _price = _parent.data("price")
1087			var _productName = _parent.find(".option-name").text()
1088
1089			if (!_price) {
1090				Argo.tallyVehiclePrice(_productName, null)
1091			} else {
1092				Argo.tallyVehiclePrice(_productName, -Argo.parseAsInteger(_price))
1093			}
1094
1095			_parent.remove()
1096			e.preventDefault()
1097		})
1098
1099		parents.on("click", function (e) {
1100			//window.location.href = $(this).attr('href');
1101			e.preventDefault()
1102		})
1103		customizer.addClass("initial")
1104
1105		var accessories = $("#content .product.customizer")
1106		var addLinks = accessories.find("span.add").filter(function () {
1107			return $(this)
1108		})
1109		addLinks.on("click", function () {
1110			var _this = $(this)
1111			var productTitle = _this.data("title")
1112			var productPrice = _this.data("price")
1113
1114			var clonedListItem = $("#cloner").clone().removeClass("hidden")
1115
1116			clonedListItem.find(".option-name").text(productTitle)
1117			clonedListItem.attr("data-price", productPrice)
1118
1119			var exists = Argo.customizerOptions.filter(function (el) {
1120				return el.modelName === Argo.modelName && el.title === productTitle
1121			})
1122
1123			if (exists == 0) {
1124				if (productPrice) {
1125					Argo.tallyVehiclePrice(productTitle, productPrice)
1126				} else {
1127					Argo.tallyVehiclePrice(productTitle, null, "add")
1128				}
1129				clonedListItem.appendTo(optionListing)
1130			}
1131		})
1132
1133		var storedItems = store.get("savedVehicle")
1134
1135		if (storedItems) {
1136			$.each(storedItems, function (index, value) {
1137				if (this.modelName == Argo.modelName) {
1138					// if the price and accessory name match, trigger a click to keep it in the customize cart
1139					var links = $(
1140						"#content .product.customizer .add[data-title='" + this.title + "']"
1141					)
1142					var price = links.data("price")
1143					if (price) {
1144						price = Argo.parseAsInteger(price)
1145					}
1146					if (price == this.price) {
1147						links.trigger("click")
1148					}
1149				}
1150			})
1151		}
1152	}
1153}
1154
1155Argo.parseAsInteger = function (number) {
1156	var regex = /[^0-9\.]+/g
1157	var needsCleaning = false
1158	if (!Number.isInteger(number)) {
1159		needsCleaning = number.regexIndexOf(regex, 0)
1160	}
1161	if (needsCleaning) {
1162		number = parseFloat(number.replace(regex, ""))
1163	}
1164	return number
1165}
1166
1167Argo.tallyVehiclePrice = function (productTitle, priceAdjustment, remov
1167ing) {
1168	removing = removing || 1
1169	var regex = /[^0-9\.]+/g
1170
1171	if (!this.currentPrice) {
1172		this.currentPrice = parseFloat(
1173			$("#vehicle-price span.main-price").text().replace(regex, "")
1174		)
1175	}
1176
1177	if (priceAdjustment) {
1178		priceAdjustment = Argo.parseAsInteger(priceAdjustment)
1179		this.currentPrice = this.currentPrice + priceAdjustment
1180	} else {
1181		this.currentPrice = this.currentPrice
1182	}
1183
1184	var thisItem = {
1185		modelName: this.modelName,
1186		title: productTitle,
1187		price: priceAdjustment,
1188	}
1189	if (priceAdjustment > 0) {
1190		Argo.customizerOptions.push(thisItem)
1191	} else {
1192		if (priceAdjustment === null && removing == "add") {
1193			Argo.customizerOptions.push(thisItem)
1194		} else {
1195			Argo.customizerOptions = Argo.customizerOptions.filter(function (obj) {
1196				return obj.title != productTitle && obj.modelName == Argo.modelName
1197			})
1198		}
1199	}
1200
1201	//console.log(Argo.customizerOptions);
1202
1203	$("#customizer #vehicle-price span.main-price").text(
1204		"$" + Argo.numberWithCommas(this.currentPrice)
1205	)
1206}
1207
1208Argo.numberWithCommas = function (x) {
1209	var parts = x.toString().split(".")
1210	parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",")
1211	return parts.join(".")
1212}
1213
1214String.prototype.regexIndexOf = function (regex, startpos) {
1215	var indexOf = this.substring(startpos || 0).search(regex)
1216	return indexOf >= 0 ? indexOf + (startpos || 0) : indexOf
1217}
1218
1219Argo.setupGeolocation = function () {
1220	console.log("Attempting geolocation...")
1221	//this.appendToPage('\nAttempting geolocation...\n');
1222
1223	if (navigator.geolocation) {
1224		navigator.geolocation.getCurrentPosition(
1225			function (position) {
1226				var pos = {
1227					lat: position.coords.latitude,
1228					lng: position.coords.longitude,
1229				}
1230				//console.log(position);
1231
1232				Argo.appendToPage(JSON.stringify(pos, null, 2))
1233
1234				Cookies.set("userLatLng", pos, { expires: 1 })
1235				Argo.geocodeLatLng(pos)
1236				Argo.userLatLng = pos
1237
1238				if (allLocations.length == 0 && geolocationTrigger != true) {
1239					Argo.setupDefaultLocation()
1240				}
1241
1242				if (geolocationTrigger == true) {
1243					if (Argo.userAssumedAddress) {
1244						$("#find-a-dealer form input[name='q']").val(
1245							Argo.userAssumedAddress
1246						)
1247						$("#find-a-dealer form .btn").trigger("click")
1248					}
1249				}
1250			},
1251			function () {
1252				Argo.handleLocationError(true)
1253			}
1254		)
1255	} else {
1256		// Browser doesn't support Geolocation
1257		Argo.handleLocationError(false)
1258	}
1259}
1260
1261Argo.getCountry = function (addrComponents) {
1262	for (var i = 0; i < addrComponents.length; i++) {
1263		if (addrComponents[i].types[0] == "country") {
1264			return addrComponents[i].short_name
1265		}
1266		if (addrComponents[i].types.length == 2) {
1267			if (addrComponents[i].types[0] == "political") {
1268				return addrComponents[i].short_name
1269			}
1270		}
1271	}
1272	return false
1273}
1274
1275Argo.geocodeLatLng = function (pos) {
1276	console.log(pos)
1277
1278	if (
1279		!Cookies.get("userAssumedAddress") ||
1280		!Cookies.get("userAssumedCountry")
1281	) {
1282		var geocoder = new google.maps.Geocoder()
1283		geocoder.geocode({ location: pos }, function (results, status) {
1284			if (status === "OK") {
1285				if (results[0]) {
1286					Argo.userAssumedCountry = Argo.getCountry(
1287						results[0].address_components
1288					)
1289
1290					Argo.displayAddress(results[0].formatted_address)
1291					Argo.displayDistanceApart(pos)
1292
1293					Cookies.set("userAssumedCountry", Argo.userAssumedCountry, {
1294						expires: 1,
1295					})
1296					Cookies.set("userAssumedAddress", results[0].formatted_address, {
1297						expires: 1,
1298					})
1299
1300					Argo.handleCountryPostGeolocation()
1301				} else {
1302					console.log("No results found")
1303				}
1304			} else {
1305				console.log("Geocoder failed due to: " + status)
1306			}
1307		})
1308	} else {
1309		console.log("skipping geocoding - already saved locally")
1310		var userAssumedAddress = Cookies.getJSON("userAssumedAddress")
1311		Argo.userAssumedAddress = userAssumedAddress
1312
1313		// if (Cookies.get('userLatLng')){
1314		//   if (!Cookies.get('userAssumedCountry')){
1315		//     Argo.geocodeLatLng(Cookies.get('userLatLng'));
1316		//   }
1317		// }
1318
1319		this.displayAddress(userAssumedAddress)
1320		this.displayDistanceApart(pos)
1321	}
1322}
1323
1324Argo.displayAddress = function (address) {
1325	this.appendToPage("\n" + address)
1326	$(".distance-from .your-location").text(address)
1327	$("#change-location i").remove()
1328}
1329
1330Argo.displayDistanceApart = function (pos) {
1331	if (typeof dealerLat !== "undefined") {
1332		var point_a = new google.maps.LatLng(pos.lat, pos.lng)
1333		var point_b = new google.maps.LatLng(dealerLat, dealerLng)
1334		var distance_miles = this.getDistanceInMiles(point_a, point_b)
1335		this.appendToPage("\n" + distance_miles.toFixed(1) + " miles away from you")
1336
1337		$(".distance-from h5 span").text(distance_miles.toFixed(1))
1338	}
1339}
1340
1341Argo.getDistanceInMiles = function (point_a, point_b) {
1342	var distance_in_meters =
1343		google.maps.geometry.spherical.computeDistanceBetween(point_a, point_b)
1344	return distance_in_meters * 0.000621371 // convert meters to miles
1345}
1346
1347Argo.handleLocationError = function (browserHasGeolocation) {
1348	if (browserHasGeolocation) {
1349		console.log("Error: The Geolocation service failed.")
1350		Argo.appendToPage("Geocoding service failed.")
1351	} else {
1352		console.log("Error: Your browser doesn't support geolocation.")
1353		Argo.appendToPage("Your browser doesn't support geolocation.")
1354	}
1355}
1356
1357Argo.handleCountryPostGeolocation = function () {
1358	return
1359	var possibleLocations = ["CA", "US", "INTL", "FR"]
1360
1361	var match = $.inArray(
1362		this.userAssumedCountry.toUpperCase(),
1363		possibleLocations
1364	)
1365	if (match === -1) {
1366		this.userAssumedCountry = "INTL"
1367	}
1368
1369	if (Cookies.get("userDisableLocation")) {
1370	} else {
1371		if (this.userAssumedCountry != window.currentSiteLocation) {
1372			console.log("country mismatch")
1373
1374			$("#locationChooserTrigger").trigger("click")
1375			$("#locationsToChooseFrom")
1376				.find("p." + this.userAssumedCountry)
1377				.removeClass("hidden")
1378		} else {
1379			console.log("country match - do nothing")
1380		}
1381
1382		$(".switcher a").off()
1383		$(".switcher a").on("click", function (e) {
1384			Cookies.set("userDisableLocation", true, { expires: 1 })
1385		})
1386		$("#locationChooserModal").on("hidden.bs.modal", function () {
1387			Cookies.set("userDisableLocation", true, { expires: 1 })
1388		})
1389	}
1390}
1391
1392Argo.appendToPage = function (data) {
1393	if ($("#user-geolocation-data").length > 0) {
1394		$("#user-geolocation-data pre").append(data)
1395	} else {
1396		//console.log(data);
1397	}
1398}
1399
1400Argo.prepGeocoding = function () {
1401	console.log("prepGeocoding")
1402	if (!Cookies.get("userLatLng")) {
1403		console.log("no latlng")
1404		Argo.setupGeolocation()
1405	} else {
1406		console.log("lat/lng found - reverse geocoding...")
1407		Argo.userLatLng = Cookies.get("userLatLng")
1408		Argo.geocodeLatLng(Cookies.getJSON("userLatLng"))
1409
1410		if (geolocationTrigger == true) {
1411			if (Argo.userAssumedAddress) {
1412				$("#find-a-dealer form input[name='q']").val(Argo.userAssumedAddress)
1413				$("#find-a-dealer form .btn").trigger("click")
1414			}
1415		}
1416	}
1417}
1418
1419Argo.createInfowindowContent = function (location) {
1420	var adventureDealer = ""
1421	var carriesImageExtension = ""
1422	if (
1423		location.XTVProgramLevel == "Ultimate" ||
1424		location.ATVProgramLevel == "Ultimate"
1425	) {
1426		adventureDealer = "adventure-dealer"
1427		carriesImageExtension = "-white"
1428	}
1429	var content =
1430		'<div id="map-bubble-argo" class="map-bubble ' + adventureDealer + '">'
1431
1432	if (
1433		location.XTVProgramLevel == "Ultimate" ||
1434		location.ATVProgramLevel == "Ultimate"
1435	) {
1436		console.log("ultimate")
1437		content +=
1438			"<div class='logo-wrap'><img src='/assets/images/icons/UAE_new-Logo.png'>" +
1439			"<p><strong>Ultimate ARGO Experience Dealer</strong></p><ul><li>ARGO specialist on staff</li><li>Variety of models & colors in stock</li><li>Demo ride area on location</li></ul>" +
1440			"</div><div class='info-wrap'>"
1441	}
1442
1443	if (!/^https?:\/\//i.test(location.web)) {
1444		location.fullUrl = "http://" + location.web
1445	}
1446	// console.log(location)
1447	
1448	var variousModels = "";
1449
1450	// CarriesXTV: "Y",
1451	// CarriesATV: "N",
1452	// CarriesSSV: "N",
1453	// CarriesUTV: "N",
1454	// CarriesUTVB: "N",
1455	// CarriesGEN: "Y",
1456	// CarriesPro: "Y",
1457	// CarriesRec: "Y",
1458	// CarriesCom: "N",
1459	// CarriesIntl: "N",
1460
1461	// If dealer carries recreation 
1462
1463	if(location.CarriesRec == "Y") {
1464
1465		variousModels += "<ul class='model-icons' data-title='ARGO Recreation Products'>";
1466		if (location.CarriesATV == "Y") {
1467			variousModels +=
1468				"<li><img src='/assets/images/icons/2024-ATV" +
1469				carriesImageExtension +
1470				".png?v=2'><span>atv</span></li>"
1471		}
1472		if (location.CarriesSSV == "Y") {
1473			variousModels +=
1474				"<li><img src='/assets/images/icons/2024-SSV" +
1475				carriesImageExtension +
1476				".png?v=2'><span>ssv</span></li>"
1477		}
1478		if (location.CarriesXTV == "Y") {
1479			variousModels +=
1480				"<li><img src='/assets/images/icons/2024-XTV" +
1481				carriesImageExtension +
1482				".png?v=2'><span>xtv</span></li>"
1483		}
1484		if (location.CarriesGEN == "Y") {
1485			variousModels +=
1486				"<li><img src='/assets/images/icons/2024-GEN" +
1487				carriesImageExtension +
1488				".png?v=2'><span>gen</span></li>"
1489		}
1490		// if (location.CarriesUTV == "Y") {
1491		// 	variousModels +=
1492		// 		"<li><img src='/assets/images/icons/2024-UTV" +
1493		// 		carriesImageExtension +
1494		// 		".png?v=2'><span>CENTAUR</span></li>"
1495		// }
1496		variousModels += "</ul>";
1497		
1498	}
1499
1500	// If dealer carries commercial 
1501
1502	if(location.CarriesCom == "Y" || location.CarriesPro == "Y") {
1503
1504		variousModels += "<ul class='model-icons commercial' data-title='ARGO Commercial Products'>";
1505			if (location.CarriesATV == "Y") {
1506				variousModels +=
1507					"<li><img src='/assets/images/icons/2024-ATV" +
1508					carriesImageExtension +
1509					".png?v=2'><span>atv</span></li>"
1510			}
1511			if (location.CarriesSSV == "Y") {
1512				variousModels +=
1513					"<li><img src='/assets/images/icons/2024-SSV" +
1514					carriesImageExtension +
1515					".png?v=2'><span>SSV</span></li>"
1516			}
1517			if (location.CarriesPro == "Y") {
1518				variousModels +=
1519					"<li><img src='/assets/images/icons/2024-PRO" +
1520					carriesImageExtension +
1521					".png?v=2'><span>xtv</span></li>"
1522			}
1523			if (location.CarriesUTVB == "Y") {
1524				variousModels +=
1525					"<li><img src='/assets/images/icons/2024-SASQUATCH" +
1526					carriesImageExtension +
1527					".png?v=2'><span>SASQUATCH</span></li>"
1528			}
1529			if (location.CarriesGEN == "Y") {
1530				variousModels +=
1531					"<li><img src='/assets/images/icons/2024-GEN" +
1532					carriesImageExtension +
1533					".png?v=2'><span>gen</span></li>"
1534			}
1535		// if (location.CarriesPro == "Y") {
1536		// 	if (location.CarriesSSV == "Y") {
1537		// 		variousModels +=
1538		// 			"<li><img src='/assets/images/icons/2024-SSV" +
1539		// 			carriesImageExtension +
1540		// 			".png?v=2'><span>xtv</span></li>"
1541		// 	}
1542		// 	if (location.CarriesSSV == "Y") {
1543		// 		variousModels +=
1544		// 			"<li><img src='/assets/images/icons/2024-SSV" +
1545		// 			carriesImageExtension +
1546		// 			".png?v=2'><span>xtv</span></li>"
1547		// 	}
1548		// 	variousModels +=
1549		// 		"<li><img src='/assets/images/icons/2024-SSV" +
1550		// 		carriesImageExtension +
1551		// 		".png?v=2'><span>ssv</span></li>"
1552		// 	variousModels +=
1553		// 		"<li><img src='/assets/images/icons/2024-PRO" +
1554		// 		carriesImageExtension +
1555		// 		".png?v=2'><span>xtv</span></li>"
1556		// }
1557
1558		variousModels += "</ul>";
1559
1560	}
1561	
1562	// if (location.CarriesUTV == "Y") {
1563	// 	variousModels +=
1564	// 		"<li><img src='/assets/images/icons/utv@4x" +
1565	// 		carriesImageExtension +
1566	// 		".png?v=2'><span>utv</span></li>"
1567	// }
1568
1569	// if (location.CarriesXTV == "Y") {
1570	// 	variousModels +=
1571	// 		"<li><img src='/assets/images/icons/xtv@4x" +
1572	// 		carriesImageExtension +
1573	// 		".png?v=1'><span>xtv</span></li>"
1574	// }
1575
1576	// if (location.CarriesATV == "Y") {
1577	// 	variousModels +=
1578	// 		"<li><img src='/assets/images/icons/atv@4x" +
1579	// 		carriesImageExtension +
1580	// 		".png?v=1'><span>atv</span></li>"
1581	// 	variousModels +=
1582	// 		"<li><img src='/assets/images/icons/sxs@4x" +
1583	// 		carriesImageExtension +
1584	// 		".png?v=1'><span>sxs</span></li>"
1585	// }
1586
1587	variousModels += "</ul>"
1588
1589	content +=
1590		'<h2>' +
1591		location.businessName
1592			.replace("- Ultimate ARGO Experience Dealer", "")
1593			.replace("Ultimate ARGO Experience Dealer", "") +
1594		"</h2>" +
1595		"<p>" +
1596		location.address1 +
1597		" " +
1598		location.address2 +
1599		" " +
1600		location.city +
1601		", " +
1602		location.state +
1603		" " +
1604		location.zip +
1605		"</p>" +
1606		'<p><a href="tel:{{ element.phoneNumber }}">' +
1607		location.phone +
1608		"</a></p>" +
1609		'<p><a href="' +
1610		location.fullUrl +
1611		'" target="_blank">' +
1612		location.web +
1613		"</a><br><strong>" +
1614		location.distance + " Miles</strong></p>" +
1615		variousModels +
1616		"</div>"
1617	if (location.carriesAtv == "Y") {
1618		content += "</div>"
1619	}
1620	return content
1621}
1622
1623Argo.setupDefaultLocation = function () {
1624	var userLocation = { lat: 39.7545377, lng: -75.6294947 }
1625
1626	if (Argo.userLatLng) {
1627		userLocation = attemptJsonParsing(Argo.userLatLng)
1628	} else {
1629		if (typeof defaultCoords != "undefined") {
1630			userLocation = defaultCoords
1631		}
1632	}
1633
1634	function attemptJsonParsing(str) {
1635		try {
1636			return $.parseJSON(str)
1637		} catch (e) {
1638			return str
1639		}
1640	}
1641
1642	var _location = new google.maps.LatLng(userLocation.lat, userLocation.lng)
1643
1644	if (Argo.map) {
1645		Argo.map.setZoom(10)
1646		Argo.map.panTo(_location)
1647	}
1648}
1649
1650Argo.setupMap = function () {
1651	if ($("#map-container").length > 0) {
1652		var styles = [
1653			{
1654				featureType: "all",
1655				elementType: "labels.text.fill",
1656				stylers: [{ saturation: 36 }, { color: "#000000" }, { lightness: 40 }],
1657			},
1658			{
1659				featureType: "all",
1660				elementType: "labels.text.stroke",
1661				stylers: [
1662					{ visibility: "on" },
1663					{ color: "#000000" },
1664					{ lightness: 16 },
1665				],
1666			},
1667			{
1668				featureType: "all",
1669				elementType: "labels.icon",
1670				stylers: [{ visibility: "off" }],
1671			},
1672			{
1673				featureType: "administrative",
1674				elementType: "geometry.fill",
1675				stylers: [{ color: "#000000" }, { lightness: 20 }],
1676			},
1677			{
1678				featureType: "administrative",
1679				elementType: "geometry.stroke",
1680				stylers: [{ color: "#000000" }, { lightness: 17 }, { weight: 1.2 }],
1681			},
1682			{
1683				featureType: "administrative",
1684				elementType: "labels",
1685				stylers: [
1686					{ color: "#ffffff" },
1687					{ visibility: "simplified" },
1688					{ lightness: "-35" },
1689				],
1690			},
1691			{
1692				featureType: "landscape",
1693				elementType: "geometry",
1694				stylers: [{ color: "#000000" }, { lightness: "26" }],
1695			},
1696			{
1697				featureType: "poi",
1698				elementType: "geometry",
1699				stylers: [{ color: "#000000" }, { lightness: 21 }],
1700			},
1701			{
1702				featureType: "road.highway",
1703				elementType: "geometry.fill",
1704				stylers: [{ color: "#f25c23" }, { lightness: "-59" }, { gamma: "1" }],
1705			},
1706			{
1707				featureType: "road.highway",
1708				elementType: "geometry.stroke",
1709				stylers: [
1710					{ color: "#000000" },
1711					{ lightness: 29 },
1712					{ weight: 0.2 },
1713					{ visibility: "off" },
1714				],
1715			},
1716			{
1717				featureType: "road.arterial",
1718				elementType: "geometry",
1719				stylers: [{ color: "#000000" }, { lightness: 18 }],
1720			},
1721			{
1722				featureType: "road.local",
1723				elementType: "geometry",
1724				stylers: [{ color: "#000000" }, { lightness: 16 }],
1725			},
1726			{
1727				featureType: "transit",
1728				elementType: "geometry",
1729				stylers: [{ color: "#000000" }, { lightness: 19 }],
1730			},
1731			{
1732				featureType: "water",
1733				elementType: "geometry",
1734				stylers: [{ color: "#000000" }, { lightness: 17 }],
1735			},
1736		]
1737
1738		var map = new google.maps.Map(
1739			document.getElementById("smartmap-mapcanvas-1"),
1740			{
1741				zoom: 4,
1742				styles: styles,
1743			}
1744		)
1745		Argo.map = map
1746
1747		var bounds = new google.maps.LatLngBounds()
1748		var infowindow = new google.maps.InfoWindow()
1749
1750		var marker, i
1751		var markers = []
1752
1753		const origin = JSON.parse(originLocation)
1754		if (origin.latitude != null && origin.longitude != null) {
1755			this.placeSearchOriginMarker(origin)
1756		}
1757
1758		if (allLocations.length == 0 && geolocationTrigger == true) {
1759			if (Argo.userAssumedAddress) {
1760				$("#find-a-dealer form input[name='q']").val(Argo.userAssumedAddress)
1761				$("#find-a-dealer form .btn").trigger("click")
1762			}
1763		}
1764
1765		if (allLocations.length == 0 && geolocationTrigger != true) {
1766			Argo.setupDefaultLocation()
1767		}
1768
1769		$.each(allLocations, function (index, value) {
1770			var _this = this
1771			var _location = new google.maps.LatLng(_this.latitude, _this.longitude)
1772
1773			if (index < 4) {
1774				bounds.extend(_location)
1775			}
1776
1777			var iconUrl = ""
1778			var iconScaledSizeWidth = 91
1779			var iconScaledSizeHeight = 56
1780			// var commercial = (recreational = false)
1781			var commercial = _this.CarriesCom == 'Y' ||  _this.CarriesPro == 'Y' ? true : false;
1782			var recreational = _this.CarriesRec == 'Y' ? true : false;
1783
1784			// if (_this.CarriesATV == "Y") {
1785			// 	recreational = true
1786			// }
1787			// if (_this.CarriesXTV == "Y") {
1788			// 	recreational = true
1789			// 	commercial = true
1790			// }
1791			// if (_this.CarriesUTV == "Y") {
1792			// 	commercial = true
1793			// }
1794
1795			if (commercial && recreational) {
1796				iconUrl =
1797					"/assets/images/icons/Argo_Recreation-and-Commercial_Map-icon.png"
1798			} else if (commercial && !recreational) {
1799				iconUrl = "/assets/images/icons/Argo_Commercial_Map-icon.png"
1800			} else if (recreational && !commercial) {
1801				iconUrl = "/assets/images/icons/Argo_Recreation_Map-icon.png"
1802			}
1803
1804			// console.log(_this.XTVProgramLevel)
1805			// console.log(_this.ATVProgramLevel)
1806			// if (
1807			// 	_this.XTVProgramLevel == "Ultimate" ||
1808			// 	_this.ATVProgramLevel == "Ultimate"
1809			// ) {
1810			// 	iconUrl = "/assets/images/marker-ultimate-dealer.png"
1811			// 	iconScaledSizeWidth = 97
1812			// 	iconScaledSizeHeight = 110
1813			// }
1814
1815			marker = new google.maps.Marker({
1816				position: _location,
1817				map: map,
1818				icon: {
1819					url: iconUrl,
1820					scaledSize: new google.maps.Size(
1821						iconScaledSizeWidth,
1822						iconScaledSizeHeight
1823					),
1824				},
1825			})
1826
1827			markers.push(marker)
1828			var clickEvent = "click"
1829
1830			google.maps.event.addListener(
1831				marker,
1832				clickEvent,
1833				(function (marker, i) {
1834					return function () {
1835						infowindow.setContent(Argo.createInfowindowContent(_this))
1836						infowindow.open(map, marker)
1837						map.panTo(this.position)
1838					}
1839				})(marker, i)
1840			)
1841
1842			google.maps.event.addListener(infowindow, "domready", function () {
1843				var iwOuter = $(".gm-style-iw")
1844				var iwBackground = iwOuter.prev()
1845				var iwCloseBtn = iwOuter.next()
1846
1847				var isAdventureDealer = $(this.content).hasClass("adventure-dealer")
1848
1849				iwBackground.children(":nth-child(4)").removeClass("adventure-dealer")
1850				iwBackground
1851					.children(":nth-child(3)")
1852					.find("div")
1853					.children()
1854					.css({ "background-color": "rgb(255, 255, 255)", "z-index": "1" })
1855
1856				if (isAdventureDealer == true) {
1857					iwBackground.children(":nth-child(4)").addClass("adventure-dealer")
1858					iwBackground
1859						.children(":nth-child(3)")
1860						.find("div")
1861						.children()
1862						.css({ "background-color": "rgb(242, 93, 34)", "z-index": "1" })
1863				}
1864
1865				// Apply the desired effect to the close button
1866				var closeX = '<i class="fa fa-times" aria-hidden="true"></i>'
1867				iwCloseBtn.empty().addClass("close-icon").html(closeX)
1868			})
1869		})
1870
1871		if (allLocations.length > 0) {
1872			map.fitBounds(bounds)
1873			map.panToBounds(bounds)
1874			var zoomListener = google.maps.event.addListener(
1875				map,
1876				"idle",
1877				function () {
1878					//console.log("map.getZoom()", map.getZoom())
1879					if (map.getZoom() > 12) map.setZoom(12)
1880					google.maps.event.removeListener(zoomListener)
1881				}
1882			)
1883		}
1884	}
1885
1886	if ($("#find-a-dealer.landing-page").length > 0) {
1887		for (var i = 0; i < markers.length; i++) {
1888			smartMap.deleteMarker(markers[i])
1889		}
1890	}
1891}
1892
1893Argo.placeSearchOriginMarker = function (origin) {
1894	var locs = [origin]
1895
1896	$.each(locs, function (index, value) {
1897		var _this = this
1898		var _location = new google.maps.LatLng(_this.latitude, _this.longitude)
1899
1900		var iconUrl = "/assets/images/icons/pinDrop.png"
1901		var iconScaledSizeWidth = 30
1902		var iconScaledSizeHeight = 49
1903
1904		marker = new google.maps.Marker({
1905			position: _location,
1906			map: Argo.map,
1907			icon: {
1908				url: iconUrl,
1909				scaledSize: new google.maps.Size(
1910					iconScaledSizeWidth,
1911					iconScaledSizeHeight
1912				),
1913			},
1914		})
1915	})
1916}
1917
1918Argo.triggerResize = function () {
1919	if ($(".history .panel").length > 0) {
1920		var panels = $(".history .panel")
1921		$.each(panels, function (index, element) {
1922			var _this = $(this)
1923			var h = _this.find(".panel-body").height()
1924			_this.find(".v-line").height(h + 125)
1925
1926			if (index === panels.length - 1) {
1927				_this.find(".v-line").remove()
1928			}
1929		})
1930	}
1931}
1932
1933// precision is 10 for 10ths, 100 for 100ths, etc.
1934Argo.roundUp = function (num, precision) {
1935	return Math.ceil(num * precision) / precision
1936}
1937
1938Argo.percentCalculation = function (a, b) {
1939	var c = parseFloat(a) * (parseFloat(b) / 100)
1940	return Math.round(c)
1941}
1942
1943Argo.scaleBetween = function (unscaledNum, minAllowed, maxAllowed, min, max) {
1944	return (
1945		((maxAllowed - minAllowed) * (unscaledNum - min)) / (max - min) + minAllowed
1946	)
1947}
1948
1949Argo.isEmail = function (email) {
1950	var regex =
1951		/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
1952	return regex.test(email)
1953}
1954
1955Argo.stripTrailingSlash = function (str) {
1956	if (str.substr(-1) === "/") {
1957		return str.substr(0, str.length - 1)
1958	}
1959	return str
1960}
1961
1962Array.prototype.clean = function (deleteValue) {
1963	for (var i = 0; i < this.length; i++) {
1964		if (this[i] == deleteValue) {
1965			this.splice(i, 1)
1966			i--
1967		}
1968	}
1969	return this
1970}
1971
1972Array.prototype.unique = function () {
1973	var a = this
1974	var b = []
1975	for (var c = a.length; c--; ) {
1976		var d = a[c]
1977		if ($.inArray(d, b) === -1) {
1978			b.unshift(d)
1979		}
1980	}
1981	return b
1982}
1983
1984Argo.arraySearch = function (arr, val) {
1985	for (var i = 0; i < arr.length; i++) if (arr[i] === val) return i
1986	return false
1987}
1988
1989Argo.sortArrayByNumbers = function (a, b) {
1990	return a - b
1991}
1992
1993Argo.makeUniqueArray = function (a) {
1994	var temp = {}
1995	for (var i = 0; i < a.length; i++) temp[a[i]] = true
1996	var r = []
1997	for (var k in temp) r.push(k)
1998	return r
1999}
2000
2001$(document).ready(function () {
2002	Argo.init()
2003
2004	$(window).resize(function () {
2005		Argo.triggerResize()
2006	})
2007	Argo.triggerResize()
2008})

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.