function avia_cart_dropdown_changed(){var t=jQuery("html"),a=jQuery("body").is(".woocommerce-cart"),e=jQuery(".cart_dropdown .av-cart-counter"),r=jQuery(".cart_dropdown"),o=0,i=jQuery("body").hasClass("avia-woocommerce-30");a&&(i?o=parseInt(e.text(),10):r.find(".cart_list li .quantity").each(function(){o+=parseInt(jQuery(this).text(),10)}),0==o?(e.removeClass("av-active-counter").text(o),setTimeout(function(){t.removeClass("html_visible_cart")},200)):e.length>0&&o>0&&setTimeout(function(){e.addClass("av-active-counter").text(o),t.addClass("html_visible_cart")},10))}function update_cart_dropdown(t){var a=jQuery("html"),e=jQuery(".cart_dropdown"),r=jQuery(".cart_dropdown .av-cart-counter"),o=e.find(".empty"),i=e.data("success"),n=jQuery.extend({name:"Product",price:"",image:""},avia_clicked_product),d=0,c=jQuery("body").hasClass("avia-woocommerce-30");if(0!=r.length){if(o.length>0&&void 0!==t&&a.addClass("html_visible_cart"),void 0!==t){var s=jQuery(".html_header_sticky #header_main .cart_dropdown_first, .html_header_sidebar #header_main .cart_dropdown_first"),u=(jQuery(".added_to_cart_notification").trigger("avia_hide"),jQuery("
\""+n.name+'" '+i+"
"+n.image+"
").css("opacity",0));s.length||(s="body"),u.on("mouseenter avia_hide",function(){u.animate({opacity:0,top:parseInt(u.css("top"),10)+15},function(){u.remove()})}).appendTo(s).animate({opacity:1},500),setTimeout(function(){u.trigger("avia_hide")},2500)}"object"==typeof t&&"added_to_cart"==t.type&&c||setTimeout(function(){c?d=r.text():e.find(".cart_list li .quantity").each(function(){d+=parseInt(jQuery(this).text(),10)}),r.length>0&&d>0&&setTimeout(function(){r.addClass("av-active-counter").text(d)},10)},300)}}jQuery(function(t){function a(){jQuery(".quantity input[type=number]").each(function(){var a=t(this),e=a.val(),r=a.clone(!0);if(void 0===e||""==(e+"").trim()){var o=r.attr("placeholder");o=void 0===o||""==(o+"").trim()?1:o,r.attr("value",o)}var i=parseFloat(a.attr("max")),n=parseFloat(a.attr("min")),d=parseInt(a.attr("step"),10),c=r.insertAfter(a);c.addClass("no-spin-num"),a.remove(),setTimeout(function(){if(0===c.next(".plus").length){var t=jQuery('').insertBefore(c),a=jQuery('').insertAfter(c);t.on("click",function(){var t=parseInt(c.val(),10);isNaN(t)&&(t=0),t=(t=(t-=d)<0?0:t)i?i:t,c.val(t).trigger("change")})}},10)})}cart_improvement_functions(),cart_dropdown_improvement(),track_ajax_add_to_cart(),jQuery.fn.avia_sc_slider&&jQuery(".shop_slider_yes ul").avia_sc_slider({appendControlls:!1,group:!0,slide:".product",arrowControll:!0,autorotationInterval:"parent"}),jQuery("body.single-product").on("click",".single-product-main-image .avia-wc-30-product-gallery-lightbox",function(a){a.preventDefault();var e=t(this).parents(".single-product-main-image"),r=e.find(".flex-active-slide a.lightbox-added").eq(0);0==r.length&&(r=e.find("a.lightbox-added").eq(0)),r.trigger("click")}),product_add_to_cart_click(),a(),t(document).on("updated_cart_totals",a),setTimeout(first_load_amount,10),t("body").on("added_to_cart",update_cart_dropdown),t("body").on("wc_fragments_refreshed",avia_cart_dropdown_changed),jQuery(".avia_mobile .sort-param").on("touchstart",function(){})});var avia_clicked_product={};function track_ajax_add_to_cart(){jQuery("body").on("click",".add_to_cart_button",function(t){var a=jQuery(this).parents(".product").eq(0),e={};e.name=a.find(".woocommerce-loop-product__title").text(),e.image=a.find(".thumbnail_container img"),e.price=a.find(".price .amount").last().text(),""===e.name&&(e.name=a.find(".inner_product_header h3").text()),0===a.length&&(a=jQuery(this),e.name=a.find(".av-cart-update-title").text(),e.image=a.find(".av-cart-update-image"),e.price=a.find(".av-cart-update-price").text()),e.image.length?e.image="":e.image="",avia_clicked_product=e})}function first_load_amount(){var t=0,a=function(){jQuery(".cart_dropdown .dropdown_widget_cart").eq(0).find(".total .amount").length?update_cart_dropdown():++t<15&&setTimeout(a,500)};if(a(),jQuery(".av-display-cart-on-load").length&&0===jQuery(".woocommerce-message").length){var e=jQuery(".cart_dropdown");setTimeout(function(){e.trigger("mouseenter")},500),setTimeout(function(){e.trigger("mouseleave")},2500)}}function product_add_to_cart_click(){var t=jQuery("body"),a=jQuery(".av-catalogue-item"),e=!1;a.length&&(e=jQuery.avia_utilities.loading()),t.on("click",".add_to_cart_button",function(t){var a=jQuery(this);a.parents(".product").eq(0).addClass("adding-to-cart-loading").removeClass("added-to-cart-check"),a.is(".av-catalogue-item")&&e.show();var r=jQuery("html");r.hasClass("html_visible_cart")||r.addClass("html_visible_cart")}),t.on("added_to_cart",function(){jQuery(".adding-to-cart-loading").removeClass("adding-to-cart-loading").addClass("added-to-cart-check"),!1!==e&&e.hide()})}function cart_improvement_functions(){jQuery(".product_type_downloadable, .product_type_virtual").addClass("product_type_simple"),jQuery(".woocommerce-tabs .tabs a").addClass("no-scroll"),jQuery(".single-product-main-image>.images a").attr("rel","product_images[grouped]")}function cart_dropdown_improvement(){var t=jQuery(".cart_dropdown"),a=t.find(".cart_dropdown_link"),e=t.find(".dropdown_widget").css({display:"none",opacity:0});a.on("focus",function(){t.trigger("mouseenter")}).on("blur",function(){t.trigger("mouseleave")}),t.on("mouseenter",function(){e.css({display:"block"}).stop().animate({opacity:1})}).on("mouseleave",function(){e.stop().animate({opacity:0},function(){e.css({display:"none"})})})}