function auction_bidding_menu_open_nav() {
	window.auction_bidding_responsiveMenu=true;
	jQuery(".responsive-menu .sidenav").addClass('show');
}
function auction_bidding_menu_close_nav() {
	window.auction_bidding_responsiveMenu=false;
 	jQuery(".responsive-menu .sidenav").removeClass('show');
}

jQuery(document).ready(function () {
	window.auction_bidding_currentfocus=null;
  	auction_bidding_checkfocusdElement();
	var auction_bidding_body = document.querySelector('body');
	auction_bidding_body.addEventListener('keyup', auction_bidding_check_tab_press);
	var auction_bidding_gotoHome = false;
	var auction_bidding_gotoClose = false;
	window.auction_bidding_responsiveMenu=false;
 	function auction_bidding_checkfocusdElement(){
	 	if(window.auction_bidding_currentfocus=document.activeElement.className){
		 	window.auction_bidding_currentfocus=document.activeElement.className;
	 	}
 	}
 	function auction_bidding_check_tab_press(e) {
		"use strict";
		e = e || event;
		var activeElement;

		if(window.innerWidth < 999){
		if (e.keyCode == 9) {
			if(window.auction_bidding_responsiveMenu){
			if (!e.shiftKey) {
				if(auction_bidding_gotoHome) {
					jQuery( ".responsive-menu .main-menu ul:first li:first a:first-child" ).focus();
				}
			}
			if (jQuery("a.closebtn.mobile-menu").is(":focus")) {
				auction_bidding_gotoHome = true;
			} else {
				auction_bidding_gotoHome = false;
			}

		}else{

			if(window.auction_bidding_currentfocus=="responsivetoggle"){
				jQuery( "" ).focus();
			}}}
		}
		if (e.shiftKey && e.keyCode == 9) {
		if(window.innerWidth < 999){
			if(window.auction_bidding_currentfocus=="header-search"){
				jQuery(".responsivetoggle").focus();
			}else{
				if(window.auction_bidding_responsiveMenu){
				if(auction_bidding_gotoClose){
					jQuery("a.closebtn.mobile-menu").focus();
				}
				if (jQuery( ".responsive-menu .main-menu ul:first li:first a:first-child" ).is(":focus")) {
					auction_bidding_gotoClose = true;
				} else {
					auction_bidding_gotoClose = false;
				}
			
			}else{

			if(window.auction_bidding_responsiveMenu){
			}}}}
		}
	 	auction_bidding_checkfocusdElement();
	}
});

jQuery(function($){
 	"use strict";
   	jQuery('.main-menu > ul').superfish({
		delay:       500,
		animation: {opacity:'show',height:'show'},  
		speed:       'fast'
   	});
});

jQuery('document').ready(function($){
	jQuery(document).ready(function(){
		jQuery(".product-cat").hide();
	    jQuery("button.product-btn").click(function(){
	        jQuery(".product-cat").toggle();
	    });
	});

  setTimeout(function () {
		jQuery("#preloader").fadeOut("slow");
  },1000);
/*sticky sidebar*/
window.addEventListener('scroll', function() {
  var sticky = document.querySelector('.sidebar-sticky');
  if (!sticky) return;

  var scrollTop = window.scrollY || document.documentElement.scrollTop;
  var windowHeight = window.innerHeight;
  var documentHeight = document.documentElement.scrollHeight;

  var isBottom = scrollTop + windowHeight >= documentHeight-100;

  if (scrollTop >= 100 && !isBottom) {
    sticky.classList.add('sidebar-fixed');
  } else {
    sticky.classList.remove('sidebar-fixed');
  }
});
  /*sticky sidebar*/
window.addEventListener('scroll', function() {
  var sticky = document.querySelector('.sidebar-sticky');
  if (!sticky) return;

  var scrollTop = window.scrollY || document.documentElement.scrollTop;
  var windowHeight = window.innerHeight;
  var documentHeight = document.documentElement.scrollHeight;

  var isBottom = scrollTop + windowHeight >= documentHeight-100;

  if (scrollTop >= 100 && !isBottom) {
    sticky.classList.add('sidebar-fixed');
  } else {
    sticky.classList.remove('sidebar-fixed');
  }
});

  // Sticky Copyright
  $(window).scroll(function(){
    var sticky = $('.copyright-sticky'),
      scroll = $(window).scrollTop();

    if (scroll >= 100) sticky.addClass('copyright-fixed');
    else sticky.removeClass('copyright-fixed');
  });
});

jQuery(document).ready(function () {
	jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() > 100) {
      jQuery('.scrollup i').fadeIn();
    } else {
      jQuery('.scrollup i').fadeOut();
    }
	});
	jQuery('.scrollup i').click(function () {
    jQuery("html, body").animate({
      scrollTop: 0
    }, 600);
    return false;
	});
});

jQuery(document).ready(function () {
	  function auction_bidding_search_loop_focus(element) {
	  var auction_bidding_focus = element.find('select, input, textarea, button, a[href]');
	  var auction_bidding_firstFocus = auction_bidding_focus[0];  
	  var auction_bidding_lastFocus = auction_bidding_focus[auction_bidding_focus.length - 1];
	  var KEYCODE_TAB = 9;

	  element.on('keydown', function auction_bidding_search_loop_focus(e) {
	    var isTabPressed = (e.key === 'Tab' || e.keyCode === KEYCODE_TAB);

	    if (!isTabPressed) { 
	      return; 
	    }

	    if ( e.shiftKey ) /* shift + tab */ {
	      if (document.activeElement === auction_bidding_firstFocus) {
	        auction_bidding_lastFocus.focus();
	          e.preventDefault();
	        }
	      } else /* tab */ {
	      if (document.activeElement === auction_bidding_lastFocus) {
	        auction_bidding_firstFocus.focus();
	          e.preventDefault();
	        }
	      }
	  });
	}
	jQuery('.search-box span a').click(function(){
        jQuery(".serach_outer").slideDown(1000);
    	auction_bidding_search_loop_focus(jQuery('.serach_outer'));
    });

    jQuery('.closepop a').click(function(){
        jQuery(".serach_outer").slideUp(1000);
    });
});

// tab

jQuery(document).ready(function () {
	jQuery( ".tablinks" ).first().addClass( "active" );
});

function auction_bidding_services_tab(evt, cityName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  jQuery('#'+ cityName).show()
  evt.currentTarget.className += " active";
}

jQuery(document).ready(function () {
	jQuery('.tabcontent').hide();
	jQuery('.tabcontent:first').show();
});

jQuery('document').ready(function(){
	var date_data_sec2 = document.querySelectorAll('.main-product-section .the_timer');

	date_data_sec2.forEach((element, i) => {
		const timer_elem = jQuery(element).attr('data-date');
		if ( timer_elem != "" ) {
			our_events_timer(element,timer_elem);
		} else {
			jQuery(element).html("Timer not updated.");
		}
	}); 

});

function our_events_timer($timer,mydate){
	
	// Set the date we're counting down to
	var countDownDate = new Date(mydate).getTime();
	// Update the count down every 1 second
	var x = setInterval(function() {
	  // Get todays date and time
	  var now = new Date().getTime();
	  // Find the distance between now an the count down date
	  var distance = countDownDate - now;
	  // Time calculations for days, hours, minutes and seconds
	  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
	  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
	  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
	  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
   
	  if (jQuery($timer).length) {
		jQuery($timer).html( "<span class='numbers'>" + days + "<br><span class='nofont'>Days</span>" + "</span>" + "   " +"<span class='numbers'>" + hours + "<br><span class='nofont'>Hours</span>" + "</span>" + "   " + "<span class='numbers'>" + minutes + "<br><span class='nofont'>Minutes</span>" + "</span>" + "   " + "<span class='numbers'>" + seconds + "<br><span class='nofont'>Seconds</spn" + "</span>");
	  }
   
	  // If the count down is over, write some text
	  if (distance < 0) {
		  clearInterval(x);
   
		  if (jQuery($timer).length) {
			jQuery($timer).html("Timer Up -EVENT EXPIRED");
		  }
	  }
	}, 1000);
   }
/* Progress Bar */
document.addEventListener("DOMContentLoaded", function () {
    const auction_bidding_progressBar =
        document.getElementById("auction_bidding_elemento_progress_bar");
    if (!auction_bidding_progressBar) return;
    window.addEventListener("scroll", function () {
        const auction_bidding_scrollTop =
            document.documentElement.scrollTop || document.body.scrollTop;
        const auction_bidding_height =
            document.documentElement.scrollHeight -
            document.documentElement.clientHeight;
        const auction_bidding_scrolled =
            (auction_bidding_scrollTop / auction_bidding_height) * 100;
        auction_bidding_progressBar.style.width =
            auction_bidding_scrolled + "%";
    });
});   