!function(a){function f(){a(".overlay").length<=0?a("#header").before('<div class="overlay"></div>'):a(".overlay").show()}function g(b,c,d){var e=setTimeout(function(){a("#"+c).html(b),g(b-1,c,d)},1e3);-1==b&&(clearTimeout(e),top.location.href=d)}var e,h,i,j,b=a("body"),c=a(window);a.ajaxaction=function(b,c,d,e){a.ajax({type:"POST",dataType:"json",url:b,data:c,success:function(a){d(a)},complete:function(a,b){e(a,b)}})},a("#aim").length>0&&(e=new Swiper(".swiper-container",{pagination:".pagination",loop:!0,grabCursor:!0,paginationClickable:!0,autoplayDisableOnInteraction:!1,calculateHeight:!0,autoplay:5e3}),a("a.slider-prev").on("click",function(a){a.preventDefault(),e.swipePrev()}),a("a.slider-next").on("click",function(a){a.preventDefault(),e.swipeNext()})),a(function(){function i(){var f,g,b=parseInt(d.val()),c=parseInt(e.html()),h=a(".navigation").attr("data-page");return g=a(".navigation").attr("data-prm")?"?"+a(".navigation").attr("data-prm"):"",h?b>=1&&c>=b?(f=1==b?h+g:h+"/page/"+b+g,location.href=f,void 0):(d.focus(),!1):!1}function j(){a("#order_price").val()?a("#total-price").find("strong").text(Number(a("#order_quantity").val()*a("#order_price").val()).toFixed(2)):a("#total-price").find("strong").text(Number(a("#order_quantity").val()))}"undefined"!=typeof javin_page_redirect&&g(javin_page_redirect["time"],javin_page_redirect["id"],javin_page_redirect["url"]);var c=a("#jump-btn"),d=a("#jump-to"),e=a("#max-page"),h=a("#go-page");d.on("focus",function(){h.addClass("active")}),d.on("blur",function(){h.removeClass("active")}),d.on("keydown",function(){13==event.keyCode&&i()}),c.on("click",function(){i()}),a("[data-pop]").on("click",function(){var b=a(this).attr("data-pop");a(".popupbox").hide(),f(),a("#"+b).fadeIn()}),a("body").on("click","div.overlay,a.popup-close",function(){return a("div.popupbox, div.overlay").fadeOut(),!1}),a("[data-top]").on("click",function(){var b=a(this).attr("data-top");"true"==b&&a("body,html").animate({scrollTop:0},0)}),a("#search").on("click",function(){a(this).addClass("active"),a("#search-input").focus()}),a("#search-input").on("keyup",function(){a(this).val().length>0&&a("#search-submit").removeAttr("disabled")}),a("#toggle-icon").on("click",function(){navstate=a(this).attr("aria-expanded"),"false"==navstate?(b.addClass("show-nav"),a(this).attr("aria-expanded","true").html('<i class="fa fa-times"></i>')):(b.removeClass("show-nav"),a(this).attr("aria-expanded","false").html('<i class="fa fa-bars"></i>'))}),a("div.amount-number a").on("click",function(b){b.preventDefault(),fieldName=a(this).attr("field"),fieldstyle=a(this).attr("id");var c=parseInt(a("input[name="+fieldName+"]").val());"plus"==fieldstyle?Number(c)>=99999?a("input[name="+fieldName+"]").val(99999):isNaN(c)?a("input[name="+fieldName+"]").val(0):a("input[name="+fieldName+"]").val(c+1):"minus"==fieldstyle&&(!isNaN(c)&&c>1?a("input[name="+fieldName+"]").val(c-1):a("input[name="+fieldName+"]").val(1))}),a("input[name=amountquantity]").keyup(function(){var c=a(this).val();(!/^(\+|-)?\d+$/.test(c)||0>=c)&&a(this).val(1)}),a("a.buy-btn").on("click",function(b){b.preventDefault(),a("input[name=order_quantity]").val(a("input[name=amountquantity]").val()),j()}),j(),a("#order_quantity").keyup(function(){var c=a(this).val();""==c?(a(this).val(),a("#pay-submit").attr("disabled","disabled")):(a("#pay-submit").removeAttr("disabled"),(!/^(\+|-)?\d+$/.test(c)||0>=c)&&a(this).val(1)),j()}),a(".smilies-icon").mouseenter(function(){a(".smilies-box").show()}),a(document).on("click",function(b){var c=a(b.target);0==c.closest("#search").length&&(a("#search").removeClass("active"),a("#search-submit").attr("disabled",!0),a("#search-input").val("")),0==c.closest("#smilies").length&&a(".smilies-box").hide()})}),h=0,i=0,j=509,i=a(".billboard").length>0?200:5,a(".sub-billboard.large").length>0&&(i=300),c.scroll(function(){var f,g,c=a(this).scrollTop(),d=a("div.billboard"),e=d.height();c>=e?d.css("background-position","center "+e+"px"):d.css("background-position","center "+c+"px"),f=a("#header"),f.queue(c>=i||b.scrollTop()>=i?function(){a(this).addClass("min"),a(this).dequeue()}:function(){a(this).removeClass("min"),a(this).dequeue()}),h=c,0>=c&&f.removeClass("min"),g=a("#suspend"),c>0||b.scrollTop()>0?(g.addClass("show"),g.find("#backtop").die().live("click",function(){a("body,html").animate({scrollTop:0},800)})):g.removeClass("show"),c>j||b.scrollTop()>j?a("#wrapnav").addClass("nav-fixed"):a("#wrapnav").removeClass("nav-fixed")}),a("#wrapnav").on("click","li",function(d){d.preventDefault(),a("#wrapnav li").removeClass("active"),a(this).addClass("active"),hrefName=a(this).find("a").attr("href"),a(".wrapbox").removeClass("curbox"),a(hrefName).addClass("curbox"),(c.scrollTop()>j||b.scrollTop()>j)&&a("body,html").animate({scrollTop:j},0)})}(jQuery);