var TBID = "212aca94770a153e8e9b3292b6bb65b2";
		  if("" !== TBID) {
		  	setCookie( "TBID", TBID,(60*60) ); 
			console.log("setting TBID:"+TBID);
		  };
function allFormsCallback(){
				console.log("allFormsCallback");
			};
t_hours();
(function() { var link = document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; link.href = '/site-uploads/1001014/Files/favicon.ico'; document.getElementsByTagName('head')[0].appendChild(link); }());
$("#carousel-28250").on("slide.bs.carousel", function () {
    $("#carousel-28250 .item>img").each(function(){
            $(this).attr("src", $(this).attr("img-src")); 
    });
  });
if ( window.hashPos == undefined )
			window.hashPos = '';
		if ( window.hRef == undefined )
			window.hRef = '';
		if ( window.hRefHash == undefined )
			window.hRefHash = '';
		if(!window.hRef) {
			window.hRef	 = '/'+window.pageName+'/';
		}
		

		window.compParmes = {"vin":0,"logo":"","year":1,"color":1,"limit":60,"model":1,"order":"year","price":1,"vin_d":1,"width":"","adId_d":1,"ads_id":0,"border":0,"height":"","year_d":1,"adsView":"list_responsive_light_2017","color_d":1,"model_d":1,"orderAD":"DESC","price_d":1,"comments":0,"fontSize":14,"location":0,"odometer":1,"quantity":1,"rollover":"#FFFFFF","AdsPerRow":4,"ads_title":1,"fontColor":"#000000","moreColor":"#000000","sale_type":0,"fontFamily":"Verdana,Arial,sans-serif","margin-top":"","odometer_d":1,"quantity_d":1,"search_box":0,"ShowOrderBy":1,"ads_compare":0,"ads_title_d":1,"borderColor":"#FFFFFF","detailsFont":"#000000","engine_size":0,"margin-left":"","padding-top":"","sale_type_d":1,"detailsColor":"#FFFFFF","manufacturer":1,"margin-right":"","model_height":"","padding-left":"","stock_number":0,"taxesDisplay":"none","title_height":"","ShowCatsFirst":0,"date_received":0,"engine_size_d":1,"hide_listings":0,"margin-bottom":"","padding-right":"","product_img_w":300,"viewViewTypes":1,"catSubcatColor":"#FFFFFF","detailsDisplay":"horizontal_2_2017","listings_count":0,"manufacturer_d":1,"override_views":"","padding-bottom":"","pto_hp_listing":0,"show_financing":1,"stock_number_d":1,"backgroundColor":"#FFFFFF","backgroundImage":"","calculate_price":0,"hide_categories":1,"show_backbutton":1,"ShowListingTitle":0,"backgroundRepeat":"repeat-x","container_height":"","image_max_height":140,"reCaptchaVersion":2,"pto_speed_listing":0,"show_main_headers":1,"show_msrp_details":1,"show_msrp_listing":1,"show_rent_details":1,"show_rent_listing":0,"details_new_window":0,"hBackgroundPosition":"center","property_box_height":"","show_details_header":0,"vBackgroundPosition":"center","details_email_button":1,"listing_email_button":1,"ShowCatsFirstViewType":1,"generic_blogs_details":"","generic_items_details":"","generic_parts_details":"","show_backbutton_title":1,"show_comments_listing":1,"show_location_listing":0,"show_readmore_details":1,"details_getdirs_button":1,"listing_getdirs_button":1,"product_img_min_height":140,"calculate_price_listing":0,"details_bookdemo_button":1,"details_loancalc_button":1,"generic_instock_details":"","listing_bookdemo_button":1,"listing_loancalc_button":1,"show_rent_image_details":0,"ShowCatsFirstColumnCount":"","ShowCatsFirstShowAllTypes":1,"details_valuetrade_button":1,"listing_valuetrade_button":1,"show_sales_people_details":1,"generic_outofstock_details":"","show_rent_listing_thumbnail":0,"show_left_subcat_menu_listing":0,"websiteId":1001014,"enable_ecommerce":1};
		window.fullAdUrl = 'https://schradermotors.com/items/itemid/31717268/2025-Polaris-PATRIOT-850-RMK-KHAOS-165/';
		//console.log(window.compParmes);
		var isResponsiveMode = 'horizontal_2_2017' === "responsive1_vertical" ||
			'horizontal_2_2017' === "responsive1_normal" ||
			'horizontal_2_2017' === "responsive1_vertical_rental1" ||
			'horizontal_2_2017' === "responsive1_normal_rental1" ||
			'horizontal_2_2017' === "responsive1_vertical_escComp";
		var reCaptchaVersion = 2;

		var AgDealer_link_JS = '#';
		window.adId = 31717268;

		
		$( document ).ready( function () {
	if($("[data-size='invisible']").length > 0 && typeof grecaptcha.execute === 'function' ) {
				grecaptcha.execute();
	}
			var title = '2025 Polaris PATRIOT 850 RMK KHAOS 165';


	
		$( "img[src*='resize.php?image=&'],img[src*='']" ).each( function ( i, elm ) {

			$( elm ).attr( 'src', $( this ).attr( 'src' ).replace( 'resize.php?image=&', 'resize.php?image=/images/no-photo2.gif&' ) );
		} )

	

		var hRef = location.href;
		var hashPos = window.hRefHash + "POS"; window.hashPos = hashPos.replace( "#", "" ); window.hRef = hRef.replace( hRefHash, "" );

		$( '.adYoutube' ).fancybox( {
			'width': '75%',
			'height': '90%',
			'autoScale': false,
			'transitionIn': 'none',
			'transitionOut': 'none',
			'type': 'iframe',
			'overlayShow': true
		} ); /*$( ".lightbox" ).fancybox( {
			'overlayShow': false,
			'width': 870,
			'height': 650,
			'autoScale': false,
			'autoDimensions': true,
			'centerOnScroll': false,
			'type': 'iframe'
		} );*/ $( ".lightbox2" ).fancybox( {
			'overlayShow': false,
			'width': 600,
				'height': 600,
			'autoScale': false,
			'autoDimensions': true,
			'centerOnScroll': false,
			'type': 'iframe'
		} ); $( ".lightbox3" ).fancybox( {
			'overlayShow': false,
			'width': 600,
				'height': 600,
			'autoScale': false,
			'autoDimensions': true,
			'centerOnScroll': false
		} );

		window.refreshFancy = function () {
			$( ".lightbox" ).fancybox( {
				'overlayShow': false,
			'width': 600,
				'height': 600,
				'autoScale': false,
				'autoDimensions': true,
				'centerOnScroll': false,
				'type': 'iframe'
			} );
			$( ".lightbox2" ).fancybox( {
				'overlayShow': false,
				'width': 600,
				'height': 600,
				'autoScale': false,
				'autoDimensions': true,
				'centerOnScroll': false,
				'type': 'iframe'
			} );
			$( ".lightbox3" ).fancybox( {
				'overlayShow': false,
			'width': 600,
				'height': 600,
				'autoScale': false,
				'autoDimensions': true,
				'centerOnScroll': false,
				'type': 'iframe'
			} );

		}
		$( "img[onmouseover*='.pdf'],img[onmouseover*='.pptx']" ).each( function ( i, elm ) {

						var plink = $( elm ).attr( 'onmouseover' ).match( /'([^']+)',/ );
						var FileName = plink[ 1 ].split( '/' );
						//console.log( plink, FileName );
						FileName = FileName[ FileName.length - 1 ];
						//var ShortFileName = FileName.length > 10 ? FileName.substr(0, 10) + '' : FileName;
						var ShortFileName = $( elm ).attr( 'title' ) ? $( elm ).attr( 'title' ) : FileName.replace( '.pdf', '' ).replace( '.pptx', '' ).replace( '-', ' ' ).replace( '_', ' ' );
						if ( plink[ 1 ].indexOf( 'http' ) == -1 ) {

							plink[ 1 ] = "https://equipmentsearch.com" + plink[ 1 ];
							var Icon = 'https://equipmentsearch.com/images/downloads3.png';
						}
						if ( plink[ 1 ].indexOf( '.pdf' ) != -1 ) {

							//plink[ 1 ] = "/helper/viewpdf/tar/" + btoa( plink[ 1 ] );
							//plink[ 1 ] = plink[ 1 ];
							var Icon = '/images/pdf-icon2.png';
						}

						$( elm ).remove();
						var _html = '<div class="col-lg-4 col-md-3 text-left"><a href="' + plink[ 1 ] + '" target="_blank" rel="nofollow" title="' + FileName + '"><img loading="lazy"  src="' + Icon + '" width="72" alt="' + FileName + '" class="img-thumbnail" style="margin:10px" /><br />' + ShortFileName + '</a></div>';
						if ( $( '#DocumentsDiv' ).size() == 0 ) {
							$( "div:contains('Click on photo for gallery')" ).parent( 'td' ).append( '<div id="DocumentsDiv" style="padding:5px;margin:5px"><b>Documents : </b><br /> <a href="' + plink[ 1 ] + '" target="_blank" rel="nofollow" style="text-align:center;float:left;over-flow:hidden;margin:5px" title="' + FileName + '"><img loading="lazy"  src="' + Icon + '" width="72" alt="' + FileName + '" /><br />' + ShortFileName + '</a></div>' );
							if ( isResponsiveMode ) {
								$( "#DocumentsDiv_responsive" ).append( '<div id="DocumentsDiv" class="col-lg-12" style="margin-top: 15px;"><strong>Documents :</strong></div>' );
								$( '#DocumentsDiv' ).append( '<div class="row">' + _html + '</div>' );
							}
						} else {
							if ( isResponsiveMode ) {
								$( '#DocumentsDiv .row' ).append( _html );
							} else {
								$( '#DocumentsDiv .row' ).append( '<a href="' + plink[ 1 ] + '" target="_blank" rel="nofollow" style="text-align:center;float:left;over-flow:hidden;margin:5px" title="' + FileName + '"><img loading="lazy"  src="' + Icon + '" width="64" alt="' + FileName + '" class="img-thumbnail"/><br />' + ShortFileName + '</a>' );
							}
						}


					} )
		// Hide Image section for Retnal views
		setInterval( function () {
			if ( ( "horizontal_2_2017" === "responsive1_normal_rental1" || "horizontal_2_2017" === "responsive1_vertical_rental1" ) && 0 === 0 ) {
				$( '.HideWhenRental' ).hide();
				$( '.rightContainer' ).css( {
					width: '100%'
				} );
			}

			if ( window.compParmes.show_backbutton_title != undefined && window.compParmes.show_backbutton_title != 1 ) {
				$( '.show_backbutton_title' ).hide();
			}
			if ( window.compParmes.show_backbutton != undefined && window.compParmes.show_backbutton != 1 ) {
				$( "[onclick*='backTo']" ).hide();
			}


		}, 500 );

		$( '#PreferredStartDate' ).datepicker();

		$( 'a[href*="#"]:not([href="#"])' ).click( function () {
			if ( location.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && location.hostname == this.hostname ) {
				var target = $( this.hash );
				target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' );
				if ( target.length ) {
					$( 'html, body' ).animate( {
						scrollTop: target.offset().top
					}, 1000 );
					return false;
				}
			}
		} );
		} );

		function CalcRightHeights() {

			if ( 'horizontal_2_2017' === "responsive1_vertical" || 'horizontal_2_2017' === "responsive1_vertical_escComp" || 'horizontal_2_2017'.indexOf('2017') != -1 ) {
				return 400;
			}
			var l = $( '.leftContainer' ).height();
			var r = $( '.rightContainer' ).height();
			var temp1 = l - r;
			var readMoreHeight = $( '.ShowReadMore' ).height();
			var temp2 = temp1 + readMoreHeight + 7;
			return temp2 > 250 ? temp2 : 250;
		}
		setInterval( function () {
			if ( window.self !== window.top ) {
				$( '#fancybox-wrap:visible' ).css( 'top', '110px' ); 
				//console.log('here');

			}
		}, 1000 );
	/*	setTimeout( function () {
			//console.log('here2');
			if ( $( '.ShowReadMore' ).length ) {
				var oldHeight = 0;   
				$( '.ShowReadMore' ).readmore( {
					speed: 250,
					heightMargin: 20,
					collapsedHeight: CalcRightHeights(), 
					moreLink: '<a href="#" style="margin-top: 15px;">Read more ...</a>',
					lessLink: '<a href="#" style="margin-top: 15px;" >Read less</a>',
					beforeToggle: function () {
						$.fn.matchHeight._update();
					},
					afterToggle: function () {
						$.fn.matchHeight._update();
					}
				} );
			}

		}, 2000 );*/
	
$(document).ready(function() {
	$("#lightSlider").lightSlider();  
});
var locations = [
				                		['Schraders - ', 'Schraders ', '/'],				                		];

				                		var geocoder;
				                		var map;  
				                		var bounds = new google.maps.LatLngBounds();

				                		function initialize() {
											//alert('dd');
				                			map = new google.maps.Map(
				                				document.getElementById("map_canvas"), {
				                					center: new google.maps.LatLng(37.4419, -122.1419),
				                					zoom: 10,
				                					mapTypeId: google.maps.MapTypeId.ROADMAP
				                				});
				                			geocoder = new google.maps.Geocoder();

				                			for (i = 0; i < locations.length; i++) {


				                				geocodeAddress(locations, i);
				                			}
				                		}
				                		

				                		function geocodeAddress(locations, i) {
				                			var title = locations[i][0];
				                			var address = locations[i][1];
				                			var url = locations[i][2];
				                			
				                			geocoder.geocode({
				                				'address': locations[i][1]
				                			},

				                			function(results, status) {
				                				if (status == google.maps.GeocoderStatus.OK) {
				                					var marker = new google.maps.Marker({
				                						icon: 'http://maps.google.com/mapfiles/ms/icons/blue.png',
				                						map: map,
				                						position: results[0].geometry.location,
				                						title: title,
				                						animation: google.maps.Animation.DROP,
				                						address: results[0].formatted_address,
				                						id:results[0].place_id,
				                						url: url
				                					})
				                					infoWindow(marker, map, title, address, url);
				                					bounds.extend(marker.getPosition());
				                					map.fitBounds(bounds);
				                					if(locations.length==1){map.setZoom(11)}
				                				} else {
				                					alert("geocode of " + address + " failed:" + status);
				                				}
				                			});
				                		}

				                		function infoWindow(marker, map, title, address, url) {
				                			var dealer_logo= 'https://equipmentsearch.com/uploadedimages/8546/logo/8546.jpg';
				                			google.maps.event.addListener(marker, 'click', function() {
				                				var html = '<h5>' + title + '</h5><p>' + marker.address + '</p><a class="btn btn-primary" target="_blank" rel="nofollow" href="https://www.google.com/maps/dir/?api=1&destination_place_id=' + marker.id + '&destination='+ address +'">Get directions</a>&nbsp;'+'<img style="max-width:130px; max-height:60px; float:right;" loading="lazy"  src="'+ dealer_logo +'" />';
				                				iw = new google.maps.InfoWindow({
				                					content: html,
				                					maxWidth: 350
				                				});
				                				iw.open(map, marker);
				                			});
				                		}

				                		function createMarker(results) {
				                			var marker = new google.maps.Marker({
				                				icon: 'http://maps.google.com/mapfiles/ms/icons/blue.png',
				                				map: map,
				                				position: results[0].geometry.location,
				                				title: title,
				                				animation: google.maps.Animation.DROP,
				                				address: address,
				                				url: url
				                			})
				                			bounds.extend(marker.getPosition());
				                			map.fitBounds(bounds);
				                			infoWindow(marker, map, title, address, url);
				                			return marker;
				                		}
				                		
										
										//$( window).load(function() {
  //google.maps.event.addDomListener(window, "load", initialize);
/* affix the navbar after scroll below header */
		$(window).ready(function() {
			setTimeout(function(){  
				$( '#imageGallery' ).lightSlider( {
					gallery: true,
					item: 1,								
					thumbItem:5,
					slideMargin: 0,
					speed:580,
					verticalHeight:500,
					auto:false,
					loop:false
				} );


				$("#video-gallery").lightSlider({
					item: 2,
					verticalHeight:500,
				}); 

				$("#docs").lightSlider({
					item: 3,
					verticalHeight:500,						
				}); 		


				if($("#FooterDiv").outerHeight(true) < $(".model_desc_values_print").outerHeight(true)){
					$(".form-section").affix({offset: {
						top: $(".price-section").outerHeight(true)+$("#parent>.row:nth-child(1)").outerHeight(true)+$(".page-ttl").outerHeight(true)+$(".breadcrumbParent").outerHeight(true)+$(".home-title").outerHeight(true),
						bottom: 40 + $("#FooterDiv").outerHeight(true),				
					} });
				}


				$(".social-group").affix({offset: {
					top: $("#parent>.row:nth-child(1)").outerHeight(true),
					bottom: 20+ $("#FooterDiv").outerHeight(true),		

				} });	



			}, 1500);
		});
$(document).scroll(function() {
						var y = $(this).scrollTop();
						if (y > 230) {
							$('.CTA').fadeIn();
						} else {
							$('.CTA').fadeOut();
						}
					});

					$(function(){
						CaptchaCallback();
					});
$(document).ready(function() { $('#Carousel2').carousel({ interval: 5000 }) });
window.WebsiteModal = false;
		window.PageModal = false;