var TBID = "9690067c70311f70c47a72d1b1d43820";
		  if("" !== TBID) {
		  	setCookie( "TBID", TBID,(60*60) ); 
			console.log("setting TBID:"+TBID);
		  };
function allFormsCallback(){
				console.log("allFormsCallback");
			};
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 = {"override_views":1,"generic_blogs_details":"","generic_items_details":"normal","generic_parts_details":"parts_details","generic_instock_details":"normal","generic_outofstock_details":"showroom_vdp","websiteId":1001361,"enable_ecommerce":1,"quantity_d":1,"ads_title_d":1,"quantity":1,"reCaptchaVersion":2};
		window.fullAdUrl = 'https://northlandmarineandstorage.ca/items/itemid/31647996/Yamaha-F300-Grey/';
		//console.log(window.compParmes);
		var isResponsiveMode = 'showroom_vdp' === "responsive1_vertical" ||
			'showroom_vdp' === "responsive1_normal" ||
			'showroom_vdp' === "responsive1_vertical_rental1" ||
			'showroom_vdp' === "responsive1_normal_rental1" ||
			'showroom_vdp' === "responsive1_vertical_escComp";
		var reCaptchaVersion = 2;

		var AgDealer_link_JS = '#';
		window.adId = 31647996;

		
		$( document ).ready( function () {
	if($("[data-size='invisible']").length > 0 && typeof grecaptcha.execute === 'function' ) {
				grecaptcha.execute();
	}
			var title = 'Yamaha F300 Grey';


	
		$( "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 ( ( "showroom_vdp" === "responsive1_normal_rental1" || "showroom_vdp" === "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 ( 'showroom_vdp' === "responsive1_vertical" || 'showroom_vdp' === "responsive1_vertical_escComp" || 'showroom_vdp'.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();  
});
$(function(){ 
                    $('#model-accordion > .panel > .panel-collapse').first().collapse('show');  

                    $('#right-cta-buttons').affix({
                          offset: {
                            top:function () {
                              return (this.top = $("#model-right-content").offset().top)
                            },
                            bottom: function () {
                              /*return (this.bottom = $('#FooterDiv').outerHeight(true))*/
                               return (this.bottom = $('body').outerHeight(true)-($('#normal_vdp').offset().top+ $('#normal_vdp').outerHeight(true))+20 )
                            }
                          }
                        });  

                        /*force acccordion to scroll top */
                        $('#model-accordion').on('shown.bs.collapse', function () {
                         if($('#model-accordion .collapse.in').offset().top < $(document).scrollTop()){
                            //$(document).scrollTop($('#model-accordion .collapse.in').offset().top);
                            $('html, body').animate({
                                scrollTop: $('#model-accordion .collapse.in').offset().top-$('#model-accordion .accord-btn').outerHeight()
                            }, 0);
                         }
                        });          
                     
                    /*show first tab*/
                    $('#details-tabs li:first-child a').tab('show');

                    /*Affix tabs menu*/
                    $('#details-tabs').affix({
                              offset: {
                                top: function () {
                                  return (this.top = $('.model-tabs').offset().top)
                                }
                              }
                            });
                /*Moving the tabs menu undet main sticky menu */
                $( window ).scroll(function() {
                    var top_padding= $('.sticky-header').outerHeight()? $('.sticky-header').outerHeight():'';
                  $( "#details-tabs" ).css( "top", top_padding );
                });
                  
                 /**activate Fancybox gallery */
                 $("a.model-gall").fancybox();

                 
                 /* Scroll to sections when click on menu items*/
                $("#details-tabs a").click(function(event) {
                    event.preventDefault();
                    $sec_target=$(this).attr("aria-controls");
                    $('#details-tabs li.active').removeClass('active');
                    $(this).parent().addClass('active');
                    $([document.documentElement, document.body]).animate({
                        scrollTop: $('#'+$sec_target).offset().top-20
                    }, 1000);
                });

            });/* End of ready function*/;
window.WebsiteModal = false;
		window.PageModal = false;