
////site-uploads/1001567/frontjs/frontjs_v5.js
$(function () {
	
	$(".finacning-link").attr("target", "_self");
	
	$("#logo-slider").lightSlider({
		item: 6,
		slideMargin: 0,
	});
	
	
	$('#mfg-gallery').lightSlider({
		item:7,
		slideMove:2,
		easing: 'cubic-bezier(0.25, 0, 0.25, 1)',
		speed:600,
		auto:true,
		loop:true,
		pager:false,
		responsive : [
			{
				breakpoint:800,
				settings: {
					item:3,
					slideMove:1,
					slideMargin:6,
				  }
			},
			{
				breakpoint:480,
				settings: {
					item:2,
					slideMove:1
				  }
			}
		]
	});  
	

	 $( "#imageGallery" ).on('DOMSubtreeModified', function() {
	  if($('#normal_vdp').size()>0){
				 $('.vertical .lSSlideWrapper').prepend($('.stock-num, div.back-btn'));
			 }
	});
		
     
	  
	$('.slid-logo .lSSlideOuter').prepend($('.lSAction'))


});


$(function () {
	if (window.innerWidth <= 768) {
        $(".navbar-nav").append($('.lang-drop'))
    }
});
////site-uploads/1001567/frontjs/Search_script1.js
if($('#searchbox2').length){
    setTimeout(function() {
        document.getElementById("searchbox2")?.addEventListener("keyup", function(event) {
            event.preventDefault();
            if (event.keyCode === 13) {
                document.getElementById("searchbtn2")?.click();
            }
        });
    }, 2000);
    }
    
    var theLanguage = $("html").attr("lang");
    // Diferent language
    if (theLanguage == "fr") {
        function srch() {
            //var e = document.getElementById("pagedd");
            //var dest= e.options[e.selectedIndex].value;
            var valuee = document.getElementById('searchbox2').value;
            if (valuee != "") {
                window.location = "/fr/Inventaire/search/".concat(valuee);
            } else {
                document.getElementById('searchbox2').placeholder = "This field is required";
                var sheet = window.document.styleSheets[0];
                sheet.insertRule('input#searchbox2::-webkit-input-placeholder {color: red !important}', sheet.cssRules.length);
                sheet.insertRule('input#searchbox2::-moz-placeholder {color:#909; opacity:1;}', sheet.cssRules.length);
                sheet.insertRule('input#searchbox2:-moz-placeholder {color:#909; opacity:1;}', sheet.cssRules.length);
            }
        }
    } else {
        function srch() {
            //var e = document.getElementById("pagedd");
            //var dest= e.options[e.selectedIndex].value;
            var valuee = document.getElementById('searchbox2').value;
            if (valuee != "") {
                window.location = "/Inventory/search/".concat(valuee);
            } else {
                document.getElementById('searchbox2').placeholder = "This field is required";
                var sheet = window.document.styleSheets[0];
                sheet.insertRule('input#searchbox2::-webkit-input-placeholder {color: red !important}', sheet.cssRules.length);
                sheet.insertRule('input#searchbox2::-moz-placeholder {color:#909; opacity:1;}', sheet.cssRules.length);
                sheet.insertRule('input#searchbox2:-moz-placeholder {color:#909; opacity:1;}', sheet.cssRules.length);
            }
        }
    }
    
    
    
    $(function () {
        /* Focus on input afrer modal open */
        $('#searchModal').on('shown.bs.modal', function () {
            $('#searchbox2').focus();
        }); 
    });
////site-uploads/1001567/frontjs/forms_disclaimers.js
$(function(){
	/*Add Disclaimer checkbox to all forms */
	let discl_obj = {
	 'en/financing' : "I hereby give my voluntary and informed consent for all the information I have provided to Évasion Sport Inc. to be recorded in a file to be created in connection with my application for financing. I authorize Évasion Sport Inc. and its lenders to obtain a copy of my credit report and any other documents required for my financing application. I authorize Évasion Sport Inc. to contact me regarding my financing application.",
	 'en/rental' : "I hereby give my voluntary and informed consent for all information I have provided to Évasion Sport Inc. to be recorded in a file to be created in connection with my rental application. I authorize Évasion Sport Inc. to contact me regarding my rental request.",
	 'en/services' : "I hereby give my voluntary and informed consent for all information I have provided to Évasion Sport Inc. to be recorded in a file to be created regarding my request for a service appointment. I authorize Évasion Sport Inc. to contact me regarding my request for a service appointment.",
	 'en/parts' : "I hereby give my voluntary and informed consent for all the information I have provided to Évasion Sport Inc. to be recorded in a file to be created in connection with my parts order request. I authorize Évasion Sport Inc. to contact me regarding my parts order request.",
	 'en/contact-us' : " I hereby give my voluntary and informed consent for Évasion Sport Inc. to use all the information I have provided to communicate with me.",
	 'en/careers' : "I hereby give my voluntary and informed consent for all the information I have provided to Évasion Sport Inc. to be recorded in a file to be created regarding my application for a position with the team. I authorize Évasion Sport Inc. to contact me regarding my application.", 
	 
	 'fr/financement' : "Par la présente, je consens d'une façon libre et éclairée, à ce que tous les renseignements que j'ai communiqué à Évasion Sport Inc. soient consignés dans un dossier qui sera créé à propos de ma demande de financement. J'autorise Évasion Sport Inc. et ses prêteurs à obtenir une copie de mon dossier de crédit et tous autres documents nécessaires à ma demande de financement. J'autorise Évasion Sport Inc. à communiquer avec moi concernant ma demande de financement.",
	 'fr/location' : "Par la présente, je consens d'une façon libre et éclairée, à ce que tous les renseignements que j'ai communiqué à Évasion Sport Inc. soient consignés dans un dossier qui sera créé à propos de ma demande de location. J'autorise Évasion Sport Inc. à communiquer avec moi concernant ma demande de location.",
	 'fr/service' : "Par la présente, je consens d'une façon libre et éclairée, à ce que tous les renseignements que j'ai communiqué à Évasion Sport Inc. soient consignés dans un dossier qui sera créé à propos de ma demande de rendez-vous au service. J'autorise Évasion Sport Inc. à communiquer avec moi concernant ma demande de rendez-vous au service.",
	 'fr/pièces' : "Par la présente, je consens d'une façon libre et éclairée, à ce que tous les renseignements que j'ai communiqué à Évasion Sport Inc. soient consignés dans un dossier qui sera créé à propos de ma demande de commande de pièces. J'autorise Évasion Sport Inc. à communiquer avec moi concernant ma demande de commande de pièces.",
	 'fr/nous-contacter' : "Par la présente, je consens d'une façon libre et éclairée, à ce que Évasion Sport Inc. utilise tous les renseignements que j'ai communiqué pour communiquer avec moi.",
	 'fr/carrières' : "Par la présente, je consens d'une façon libre et éclairée, à ce que tous les renseignements que j'ai communiqués à Évasion Sport Inc. soient consignés dans un dossier qui sera créé à propos de ma candidature pour un poste au sein de l'équipe. J'autorise Évasion Sport Inc. à communiquer avec moi concernant ma demande d'emploi.", 
	};
	
	let page_lower = window.pageName.toLowerCase();
	if(page_lower in discl_obj){
		$('.formsParent .SendCopyCheck').before('<div class="terms-agreement required"><input type="checkbox" name="terms-agreement" id="terms-agreement-btn" title="Terms Agreement"><label for="terms-agreement-btn">'+discl_obj[page_lower]+'</label></div>');
	}
});
////site-uploads/1001567/frontjs/main_v2.3.js
/* Menu */
$(document).ready(function () {
  $(".navbar-toggle").on("click", function () {
      $(this).toggleClass("active");
  });
});

/* Active State Menu */
$(document).ready(function () {
  var url = window.location.pathname;
  $('ul.nav a[href="'+ url +'"]').parent().addClass('active');
  $('ul.nav a').filter(function() {
       return this.href == url;
  }).parent().addClass('active');
});

/* Sticky Menu on Scroll */
$(function () {
  $(window).on("scroll", function () {
      if ($(window).scrollTop() > 48) {
          $("#comp_1715352857771").addClass("sticky-nav");
      } else {
          $("#comp_1715352857771").removeClass("sticky-nav");
      }
  });
});

/* Slide to top */
$(document).ready(function () {
  $("a[href='#top']").on('click', function (e) {
    e.preventDefault();
    $("html, body").animate({
      scrollTop: 0
    }, "slow");
    return false;
  });
});

/* Change Slider transition from slide to fade */
$(function () {
  $(".carousel").removeClass("slide");
  $(".carousel").addClass("carousel-fade");
});

/* Stop the pause on mouse hover - carousel */
$('.carousel').carousel({
  pause: "false"
});

/* Footer Brands */
$(document).ready(function() {
  if($('#brandSlider').length>0){$('#brandSlider').multislider({
      interval: 5000,
      duration: 500,
  });}
});

  $(".finacning-link").attr(
    "href",
    "/Finance"
  );
  
  $(".finacning-link").attr("target", "_self");

/* 404 page */

$(function () {
  if ($("img[alt='Error:404 Page Not Found']").length) {
    console.log('404');
    var content = `<div class="_404-container">
                        <div>
                            <p>404 PAGE NOT FOUND. CHECKOUT OUR INVENTORY OR <a href="/Contact-Us/">CONTACT US</a></p>

                            <div class="btn-link">
                                <a href="/New-Inventory">In-Stock Inventory</a>
                                <a href="/Pre-Owned">Pre-Owned Inventory</a>
                                <a href="/Rental">Rental</a>
                            </div>
                        </div>
                    </div>`;

    $('#CenterDiv').html(content);
  }
});

// make link in menu clickable
$("a[href*=Pre-Owned]").removeAttr("data-toggle");
$("a[href*=New]").removeAttr("data-toggle");
////site-uploads/1001567/frontjs/multislider.min.js
/*
*   MultiSlider | MIT License
*
*   Copyright (c) 2017 Trevor Blackman
*   http://www.multislider.info
*
*/
!function(n){n.fn.multislider=function(e,t){var i,s,o,a,r,l,u,c,m,d,f,p=n(this),v=p.find(".MS-content"),g=p.find("button.MS-right"),h=p.find("button.MS-left"),A=v.find(".item:first");if("string"==typeof e)return i=e,void 0!==p.data(i)?p.data(i)():console.error("Multislider currently only accepts the following methods: next, prev, pause, play"),p;function w(n){p.hasClass("ms-PAUSE")?(p.removeClass("ms-PAUSE"),n(),p.addClass("ms-PAUSE")):n(),E()}function S(){P(),r=A.width();var n=parseInt(v.find(".item:first").css("padding-left")),e=parseInt(v.find(".item:first").css("padding-right"));0!==n&&(r+=n),0!==e&&(r+=e)}function C(){f=setInterval(function(){p.hasClass("ms-PAUSE")||u()},m.interval)}function E(){0!==m.interval&&!1!==m.interval&&!0!==m.continuous&&(clearInterval(f),C())}function P(){A=v.find(".item:first"),s=v.find(".item:last")}function U(n){p.hasClass("ms-animating")||p.hasClass("ms-HOVER")||p.hasClass("ms-PAUSE")||(p.trigger("ms.before.animate"),p.addClass("ms-animating"),n())}function y(){p.hasClass("ms-animating")&&(p.removeClass("ms-animating"),p.trigger("ms.after.animate"))}function b(){o=v.width(),a=Math.floor(o/r)}function M(){U(function(){P(),function(){d=m.duration;var n=parseFloat(v.find(".item:first").css("margin-left"));d*=1-n/-(r-1)}(),A.animate({marginLeft:-(r+1)},{duration:d,easing:"linear",complete:function(){A.insertAfter(s).removeAttr("style"),y(),M()}})})}function x(){U(function(){P(),b();var e=v.children(".item").clone().splice(0,a);v.append(e),A.animate({marginLeft:-o},{duration:d,easing:"swing",complete:function(){n(v.children(".item").splice(0,a)).remove(),y()}})})}function B(){U(function(){P(),b();var e=v.children(".item").length,t=v.children(".item").clone().splice(e-a,e);n(n(t)[0]).css("margin-left",-o),v.prepend(t),P(),A.animate({marginLeft:0},{duration:d,easing:"swing",complete:function(){e=v.find(".item").length,n(v.find(".item").splice(e-a,e)).remove(),A.removeAttr("style"),y()}})})}function L(){U(function(){P(),A.animate({marginLeft:-r},{duration:d,easing:"swing",complete:function(){A.detach().removeAttr("style").appendTo(v),y()}})})}function I(){U(function(){P(),s.css("margin-left",-r).prependTo(v),s.animate({marginLeft:0},{duration:d,easing:"swing",complete:function(){s.removeAttr("style"),y()}})})}return"object"!=typeof e&&void 0!==e||(v.contents().filter(function(){return 3==this.nodeType&&!/\S/.test(this.nodeValue)}).remove(),c=m||{continuous:!1,slideAll:!1,interval:2e3,duration:500,hoverPause:!0,pauseAbove:null,pauseBelow:null},m=n.extend({},c,e),S(),d=m.duration,m.hoverPause&&(m.continuous?(v.on("mouseover",function(){y(),v.children(".item:first").stop()}),v.on("mouseout",function(){M()})):(v.on("mouseover",function(){p.addClass("ms-HOVER")}),v.on("mouseout",function(){p.removeClass("ms-HOVER")}))),!0!==m.continuous&&0!==m.interval&&!1!==m.interval&&!1!==m.autoSlide&&C(),null!==m.pauseAbove&&"number"==typeof m.pauseAbove&&(window.innerWidth>m.pauseAbove&&p.addClass("ms-PAUSE"),n(window).on("resize",function(){window.innerWidth>m.pauseAbove?p.addClass("ms-PAUSE"):p.removeClass("ms-PAUSE")})),null!==m.pauseBelow&&"number"==typeof m.pauseBelow&&(window.innerWidth<m.pauseBelow&&p.addClass("ms-PAUSE"),n(window).on("resize",function(){window.innerWidth<m.pauseBelow?p.addClass("ms-PAUSE"):p.removeClass("ms-PAUSE")})),p.data({pause:function(){p.addClass("ms-PAUSE")},unPause:function(){p.removeClass("ms-PAUSE")},continuous:function(){p.removeClass("ms-PAUSE"),M()},next:function(){w(L)},nextAll:function(){w(x)},prev:function(){w(I)},prevAll:function(){w(B)},settings:m}),m.continuous?(m.autoSlide=!1,M()):m.slideAll?(l=p.data("prevAll"),u=p.data("nextAll")):(l=p.data("prev"),u=p.data("next"))),g.on("click",u),h.on("click",l),p.on("click",".MS-right, .MS-left",E),n(window).on("resize",S),p}}(jQuery);
////site-uploads/1001567/frontjs/breadcrumbs.js
jQuery(function ($) {
  /* Start for add custom breadcrumb Link */
  function returnPageSlug() {
    console.log('window.location.href => ', window.location.href);
    var allURL = window.location.href;
    var domainName = window.location.hostname;
    var currentPage = allURL.replace(domainName, '');
    var currentPage = currentPage.replace('https', '');
    var currentPage = currentPage.replace('http', '');
    var currentPage = currentPage.replace(/\//g, '');
    var currentPage = currentPage.replace(/:/g, '');
    if (currentPage.includes('?')) {
      var currentPage = currentPage.slice(0, currentPage.indexOf('?'));
    }
    console.log('currentPage => ', currentPage);
    return currentPage;
  }

  var pagesNeedCustomBreadcrumb = [
    // {
    //   target: {
    //     name: 'BOAT & PWC LIFTS',
    //     url: '/Boat-&-PWC-Lifts'
    //   },
    //   pages: [
    //     'Naylor-Dock-Products-'
    //   ]
    // }
  ];
  /* End It Here*/
  if ($('nav.breadcrumbParent').length) {
    var breadcrumbListItemsCount = $('ol.breadcrumb li').length;

    /*Related to add custom breadcrumb*/
    if (pagesNeedCustomBreadcrumb && pagesNeedCustomBreadcrumb.length !== 0) {
      var currentPageURL = returnPageSlug();
      for (let i = 0; i < pagesNeedCustomBreadcrumb.length; i++) {
        console.log(pagesNeedCustomBreadcrumb[i]);
        if (pagesNeedCustomBreadcrumb[i].pages.includes(currentPageURL)) {
          console.log('found');
          var el =
            '<li class="breadcrumb-item" style="text-transform: capitalize;"><a href="' +
            pagesNeedCustomBreadcrumb[i].target.url +
            '">' +
            pagesNeedCustomBreadcrumb[i].target.name +
            '</a></li>';
          $(el).insertBefore($('.breadcrumb-item.active'));
          breadcrumbListItemsCount++;
        }
      }
    }
    /* End It Here*/

    var modelTitle = '';
    if ($('.model-details-content.container .model-title').length) {
      $('.model-details-content.container .model-title').hide();
      modelTitle = $('.model-details-content.container .model-title').text();
    }

    var elementToHide = $('.breadcrumb-item.active');
    var new_title = elementToHide.text();
    console.log('new_title => ', new_title);
    elementToHide.hide();
    new_title = new_title
      .split('-')
      .filter(function (item) {
        item = item ? item.replace(/-/g, '') : item;
        return item;
      })
      .join(' ');

    new_title =
      modelTitle.length === 0 ? new_title.replace(/  +/g, ' - ') : modelTitle;
    /* handle get breadcrumb text from DOM Element */
    var customTitleExist = document.getElementById('_custome_breadcrumb_title');
    if (customTitleExist) {
      console.log(customTitleExist.innerText);
      customTitleExist.style.display = 'none';
      new_title = customTitleExist.innerText;
    }
    console.log('customTitleExist => ', customTitleExist);
    new_titleCharCount = new_title.length;
    if (new_titleCharCount > 25 || breadcrumbListItemsCount > 2 || 1 === 1) {
      var style =
        '<style>@media screen and (max-width: 620px){.breadcrumbParent {flex-direction: column;}.breadcrumbParent h2 {padding-top: 1.5vw;}}</style>';
      $('nav.breadcrumbParent').prepend(style);
    }
    ttlelement = '<h1>' + new_title + '</h1>';
    $('nav.breadcrumbParent').prepend(ttlelement);
    if ($('.col-sm-9.col-xs-12.model-ttl .model-title').length) {
      $('.col-sm-9.col-xs-12.model-ttl .model-title').hide();
    }

    /* start Capitalize other breadcrumb li elements */
    var oltherListItems = $('ol.breadcrumb li').not('.active');
    oltherListItems.each(function () {
      $(this).css({ 'text-transform': 'capitalize' });
    });
    /* End */
  }
});

function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

jQuery(function ($) {
  if (
    $(
      'div.col-lg-8.col-md-10.col-sm-10.col-xs-7.text-left.descColumnResponsive'
    ).length
  ) {
    $(
      'div.col-lg-8.col-md-10.col-sm-10.col-xs-7.text-left.descColumnResponsive'
    ).each(function () {
      console.log($(this).text());
      var text = $(this).text().replace(/\s/g, '');
      if (text === 'N/A') {
        $(this).parent().hide();
      }
    });
  }
});
