
////site-uploads/1001569/frontjs/Search_script1.js
setTimeout(function() {
    document.getElementById("searchbox2")?.addEventListener("keyup", function(event) {
        event.preventDefault();
        if (event.keyCode === 13) {
            document.getElementById("searchbtn2")?.click();
        }
    });
}, 2000);


function srch() {
    //var e = document.getElementById("pagedd");
    //var dest= e.options[e.selectedIndex].value;
    var valuee = document.getElementById('searchbox2')?.value;
    if (valuee != "") {
        window.location = "/Search-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/1001569/frontjs/main_v8.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_1716300301176").addClass("sticky-nav");
      } else {
          $("#comp_1716300301176").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;
  });

  /* Move VDP Header from CenterDiv to HeaderDiv */
  if($("#detailsParentDiv").size()>0){
    $('#HeaderDiv').append( $('.vdp-header'));
    $(".vdp-header").removeClass("hidden-xs");
    };

});




/* Stop the pause on mouse hover - carousel */
$('.carousel').carousel({
  pause: "false"
});





/* 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">New Inventory</a>
                                <a href="/Pre-Owned-Inventory">Pre-Owned</a>
                                <a href="/Promotions">Promotions</a>
                            </div>
                        </div>
                    </div>`;

    $('#CenterDiv').html(content);
  }
});
