enquire.register("screen and (min-width: 1025px)",{match:function(){$("body").addClass("desktop")},unmatch:function(){$("body").removeClass("desktop")}}).register("screen and (min-width: 771px) and (max-width: 1024px)",{match:function(){$("body").addClass("tablet")},unmatch:function(){$("body").removeClass("tablet")}}).register("screen and (max-width: 770px)",{match:function(){$("body").addClass("mobile")},unmatch:function(){$("body").removeClass("mobile")}});
/SamsungBrowser/i.test(navigator.userAgent)&&$("body").addClass("samsungBrowser");/Android 4.4.2;/i.test(navigator.userAgent)&&$("body").addClass("samsungBrowser");$(window).on("resize",function(){$("body").hasClass("mobile")||($("img[data-src]").each(function(){var a=$(this).data("src");$(this).prop("src",a)}),console.log("loading desktop Image"))}).resize();
$(function(){function a(a,b,c){var h=new Date;h.setTime(h.getTime()+864E5*c);c="expires="+h.toUTCString();document.cookie=a+"="+b+"; "+c}var b=$(".mainnav"),c=$(".bagfollow"),d=$(".logo"),g=$(".logo a img.dtTab"),e=!1,f=$(window);$("#wrapper").height();f.scroll(function(){if(!$("body").hasClass("mobile")){var a=71<f.scrollTop();a&&!e?(b.addClass("followme"),g.attr("src","/images/petpostmob.png"),d.addClass("followme"),c.show(),e=!0):!a&&e&&(b.removeClass("followme"),d.removeClass("followme"),g.attr("src",
"/images/petpost.png"),c.hide(),e=!1)}});$(".mainproductimage").zoom({on:"click",magnify:2});$(".delsearchwrap .search input").focus(function(){$(this).data("placeholder",$(this).attr("placeholder"));$(this).attr("placeholder","")});$(".delsearchwrap .search input").blur(function(){$(this).attr("placeholder",$(this).data("placeholder"))});$(".accnew input").click(function(){$(".accnewopen").slideToggle()});$(".welcomepush .mfp-close").click(function(){a("lb_welcomepop",1,1);$(".welcomepush").slideUp("fast")});
$(".submenu1 li.haschildren").click(function(){event.preventDefault();$(".submenu1 li").removeClass("js-active");$(this).addClass("js-active");var a=$(".submenu2"),b=$(this).data("categoryid");$("div",a).hide();$("div[data-categoryid="+b+"]").show();$(this).parent("ul").parent("div").parent("div").parent(".submegamenu").addClass("js-clicked");$(this).parent("ul").parent("div").parent("div").parent(".submegamenu").hasClass("js-clicked")&&$(".submenu2").addClass("js-clicked")});$(".hassub").hover(function(){$(".submenu2, .submegamenu").removeClass("js-clicked");
$(".submenu1 li").removeClass("js-active")});MQ.init([{context:"mobile",match:function(){$("body").addClass("mobile")},unmatch:function(){$("body").removeClass("mobile")}},{context:"tablet",match:function(){$("body").addClass("tablet")},unmatch:function(){$("body").removeClass("tablet")}},{context:"desktop",match:function(){$("body").addClass("desktop")},unmatch:function(){$("body").removeClass("desktop")}}]);$(".raty").raty({numberMax:5});$(".inpbutton").on("click",function(){var a=$(this),b=a.parent().find("input"),
c=$(b).val();newVal=parseFloat(c);newVal+="+"==a.text()?1:-1;a=$(b).attr("min");c=$(b).attr("max");newVal=newVal>c?c:newVal;newVal=newVal<a?a:newVal;$(b).val(newVal)});$(".landing .col section .title").click(function(){var a=$(this).siblings("ul");$("body").hasClass("mobile")&&a.length&&($(this).toggleClass("js-clicked"),$(this).siblings("ul").slideToggle())});$(".landing .col section .title a").click(function(){var a=$(this).parent(".title").siblings("ul");$("body").hasClass("mobile")&&a.length&&
event.preventDefault()});$(".dashopen").click(function(){$(this).toggleClass("js-clicked");$(".account .dashside ul").slideToggle()});$(".faqopen").click(function(){$(this).toggleClass("js-clicked");$(".faqside ul").slideToggle()});$("#choose-petkind-dash li").on("click",function(){$(this).toggleClass("chosen");var a="";$("#choose-petkind-dash li").each(function(b,c){$(this).hasClass("chosen")&&(a+=" "+$(this).data("pet"))});$("#petkind").val($.trim(a))});$(".artopen").click(function(){$(this).toggleClass("js-clicked");
$(this).siblings("ul").slideToggle()});$(".refine").click(function(){$(this).toggleClass("js-clicked");$(".filter").toggle()});$(".gc .buygc .select .card").click(function(){$(".gc .buygc .select .card").removeClass("js-active");$(this).toggleClass("js-active")});$(".close").click(function(){$(".refine").removeClass("js-clicked");$(".filter").hide()});$(".tabs .title").click(function(){$("body").hasClass("mobile")&&($(this).toggleClass("js-clicked"),$(this).siblings("div").slideToggle())});$(".tabs .title div").click(function(){$(this).siblings("div").removeClass("js-active");
$(this).addClass("js-active");0<$(".desc-btn.js-active").length&&($(".desc").show(),$(".del, .rev, .bundle-details, .ingre, .other, .other").hide());0<$(".del-btn.js-active").length&&($(".del").show(),$(".desc, .rev, .bundle-details, .ingre, .other").hide());0<$(".rev-btn.js-active").length&&($(".rev").show(),$(".del, .desc, .bundle-details, .ingre, .other").hide());0<$(".bundle-btn.js-active").length&&($(".bundle-details").show(),$(".del, .desc, .rev, .ingre, .other").hide());0<$(".ingre-btn.js-active").length&&
($(".ingre").show(),$(".del, .desc, .rev, .bundle-details, .other").hide());0<$(".other-btn.js-active").length&&($(".other").show(),$(".del, .desc, .rev, .ingre, .bundle-details").hide())});$("footer .lists > div .title.mobOnly").click(function(a){a.preventDefault();$("body").hasClass("mobile")&&$(this).siblings("ul").slideToggle()});$(".mainnav ul > li").mouseenter(function(){if($(this).children(".submegamenu").length){var a=$(window).width(),b=$(this).children(".submegamenu").outerWidth(),c=$(this).children(".submegamenu").offset();
b+c.left>a&&(a=b+c.left-a+10,$(this).children(".submegamenu").css("left","-"+a+"px"))}});$(".mainnav > li").mouseleave(function(){$(".submegamenu").removeAttr("style")});$(".menuicon").click(function(){$(".mobmenu").toggleClass("js-mobmenu-open");$("body").toggleClass("js-mobmenu-push-toleft");$("html").toggleClass("js-click")});$(".mobmenu .close").click(function(){$(".mobmenu").toggleClass("js-mobmenu-open");$("body").toggleClass("js-mobmenu-push-toleft");$("html").toggleClass("js-click")});$(".hassub a.title").click(function(){$("body").hasClass("mobile")&&
(event.preventDefault(),$(this).siblings(".sub").slideToggle())});$(".blogcarousel").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,singleItem:!0});$(".mostpopcarousel").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[350,2],[600,3],[800,4],[1150,3]]});$(".freqcarousel").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[350,
2],[1150,2]]});$(".freqcarousel2").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[650,3]]});$(".tabcarousel").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[350,2],[1150,2]]});$(".cartcarousel").owlCarousel({navigation:!0,slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[350,2],[650,4]]});$(".artcarousel").owlCarousel({navigation:!0,
slideSpeed:300,paginationSpeed:400,navigationText:!1,pagination:!1,itemsCustom:[[0,1],[350,2],[800,3],[850,5]]});$(".quick-subscribe").on("submit",function(a){a.preventDefault();var b=$(".inputwrap"),c=$(this);a=c.serializeArray();c.fadeTo(.5);$.ajax({url:"/quick-signup-ajax",type:"post",dataType:"json",data:a,success:function(a){c.fadeOut();a.success?b.find(".alert-error").addClass("hidden").end().find(".alert-success").removeClass("hidden").text(a.message):b.find(".alert-success").addClass("hidden").end().find(".alert-error").removeClass("hidden").text(a.message);
subscribeTimer=setTimeout(function(){b.find(".alert").addClass("hidden");c.fadeIn()},3E3)},error:function(){}})});$(".headersignup").on("submit",function(b){b.preventDefault();var c=$(".joinwrap"),d=$(this);b=d.serializeArray();d.fadeTo(.5);$.ajax({url:"/quick-signup-ajax",type:"post",dataType:"json",data:b,success:function(b){d.fadeOut();b.success?c.find(".alert-error").addClass("hidden").end().find(".alert-success").removeClass("hidden").text(b.message):c.find(".alert-success").addClass("hidden").end().find(".alert-error").removeClass("hidden").text(b.message);
subscribeTimer=setTimeout(function(){c.find(".alert").addClass("hidden");d.fadeIn();b.success&&(a("lb_welcomepop",1,1E4),$(".welcomepush").slideUp("slow"))},3E3)},error:function(){}})});$(".quick-subscribe-doctors").on("submit",function(a){a.preventDefault();var b=$(".inputwrap.petdoctors"),c=$(this);a=c.serializeArray();c.fadeTo(.5);$.ajax({url:"/quick-signup-ajax",type:"post",dataType:"json",data:a,success:function(a){c.fadeOut();a.success?b.find(".alert-error").addClass("hidden").end().find(".alert-success").removeClass("hidden").text(a.message):
b.find(".alert-success").addClass("hidden").end().find(".alert-error").removeClass("hidden").text(a.message);subscribeTimer=setTimeout(function(){b.find(".alert").addClass("hidden");c.fadeIn()},3E3)},error:function(){}})});$(".firsttoreview").on("click",function(){$(".title.dtTab > div").removeClass("js-active");$(".title.mobOnly").removeClass("js-clicked");$(".rev-btn").addClass("js-active");$(".reviewmob").addClass("js-clicked");$(".text.desc").hide();$(".text.del").hide();$(".text.rev").show();
$(".openreviewstuff").show();var a=jQuery("#reviewstuff").offset().top;jQuery("html, body").animate({scrollTop:a},"slow")});new Pikaday({field:document.getElementById("datepicker"),firstDay:1,format:"D MMM YYYY",minDate:new Date(2016,0,1),maxDate:new Date(2017,12,31),yearRange:[2016,2020]});if("undefined"!==typeof ga_datepickers)for(li_index in ga_datepickers){var k=ga_datepickers[li_index];console.log(k);ga_datepickers[li_index]=new Pikaday({field:document.getElementById(k),format:"DD/MM/YYYY",onDraw:function(){lb_datepickermanualupdate=
!0}})}});$(document).on("click",".closepopup",function(){$(".mfp-close").click()});$(document).on("click",".mfp-close",function(){$(".dropdownbag").load("/shopping-bag-include")});$(document).on("click",".popuptrigger",function(a){a.preventDefault();a=$(this).attr("href");if("undefined"==typeof a||"/login"==a)a="/login-popup";$.magnificPopup.open({items:{type:"ajax",src:a,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})});
$(document).on("click",".atc",function(a){a.preventDefault();a=$(this).data("productid");var b=$(this).attr("data-variantid"),c=$("#productqty").val(),d=$("#autoshipweek").val(),g=$(this).data("vetproduct");if(isNaN(c)||0>=c)alert("Minimum quantity is 0");else{var e=$("#productqty").data("quantities").split(",");console.log($("#productqty").data("quantities"));for(index in e){var f=e[index].split(":");if(""!=f[1]&&f[0]==b&&parseInt(c)>parseInt(f[1])){alert("Maxiumum quantity is "+f[1]);return}}"undefined"==
typeof c&&(c=1);1==g?$.magnificPopup.open({items:{type:"ajax",src:"/added-vet-popup?a=add&i="+a+"&v="+b+"&q="+c+"&auto="+d,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}}):$.magnificPopup.open({items:{type:"ajax",src:"/add-to-cart-popup?a=add&i="+a+"&v="+b+"&q="+c+"&auto="+d,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})}});
$(document).on("click","#ack-box",function(){$(this).is(":checked")?$(".confirmpurchasebtn").prop("disabled",!1):$(".confirmpurchasebtn").prop("disabled",!0)});
$(document).on("click",".confirmpurchasebtn",function(){var a=$(this).data("productid"),b=$(this).data("variantid"),c=$(this).data("qty"),d=$(this).data("autoship");"undefined"==typeof c&&(c=1);$.magnificPopup.open({items:{type:"ajax",src:"/add-to-cart-popup?a=add&i="+a+"&v="+b+"&q="+c+"&auto="+d,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})});
$(document).on("submit","#gcpurchase",function(a){a.preventDefault();$(this).serializeArray();20>$("#gctotal").val()?alert("Min card value is $20.00"):$.magnificPopup.open({items:{type:"ajax",src:"/add-to-cart-popup?a=gcadd"},ajax:{settings:{type:"POST",data:$("#gcpurchase").serializeArray()}},callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}})});
$(document).on("click",".gcme",function(){$(this).addClass("gc-active");$(".delivery-details").hide();$(".gcother").removeClass("gc-active");$("#gcsendoption").val("me");$("#gctotalme").show()});$(document).on("click",".gcother",function(){$(this).addClass("gc-active");$(".delivery-details").show();$(".gcme").removeClass("gc-active");$("#gcsendoption").val("other");$("#gctotalme").hide()});
$(document).on("click",".addtowish",function(a){a.preventDefault();a=$(this).find("img").data("productid");var b=$(this).find("img").attr("data-variantid"),c=$(this).find("img").data("customerid");$.magnificPopup.open({items:{type:"ajax",src:"/wishlist-popup?a=add&i="+a+"&v="+b+"&c="+c,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})});
$(document).on("click",".removewishlist",function(a){a.preventDefault();a=$(this).data("wishlistid");var b=$(this).data("customerid");$.getJSON("/wishlist-update-ajax",{a:"remove",i:a,c:b},function(a){location.reload()})});$(document).on("submit","#login-form",function(a){a.preventDefault();$.post("/login-ajax",$(this).serialize(),function(a){1!=a.success?$("#login-response").html(a.message):window.location=a.page&&"home"==a.page?"/dashboard":a.page?"/"+a.page:"/dashboard"},"jSON");return!1});
$(document).on("submit","#notifyme-form",function(a){a.preventDefault();$.post("/notify-me-ajax",$(this).serialize(),function(a){1!=a.success?$("#login-response").html(a.message):($("#login-response").html(a.message),setTimeout(function(){$.magnificPopup.close()},3E3))},"jSON");return!1});
$(document).on("submit","#password-form",function(a){a.preventDefault();$.post("/password-ajax",$(this).serialize(),function(a){1!=a.success?$("#login-response").html(a.message):($("#login-response").html(a.message),setTimeout(function(){$.magnificPopup.close()},3E3))},"jSON");return!1});
$(document).on("change","#productsize",function(){var a=this.value;$(".price.variantprice").hide();$('.price [data-variantid="'+a+'"]:hidden').show();$(".availabilitydisplay").hide();$('.stock [data-variantid="'+a+'"]:hidden').show();$(".productcartbtn").hide();$('.addtocart .productcartbtn[data-variantid="'+a+'"]:hidden').show();$(".notifydisplay").hide();$('.comparewish .notifydisplay[data-variantid="'+a+'"]:hidden').show()});
$(document).on("change","#productcolour",function(){var a=this.value;if(10<a.length){$(".selectsize").hide();$(".selectsize."+a).show();var b=$(".selectsize."+a).val();$(".price.variantprice").hide();$('.price [data-variantid="'+b+'"]:hidden').show();$(".availabilitydisplay").hide();$('.stock [data-variantid="'+b+'"]:hidden').show();$(".productcartbtn").hide();$('.addtocart [data-variantid="'+b+'"]:hidden').show();$(".notifydisplay").hide();$('.comparewish .notifydisplay[data-variantid="'+b+'"]:hidden').show()}else $(".price.variantprice").hide(),
$('.price [data-variantid="'+a+'"]:hidden').show(),$(".availabilitydisplay").hide(),$('.stock [data-variantid="'+a+'"]:hidden').show(),$(".productcartbtn").hide(),$('.addtocart [data-variantid="'+a+'"]:hidden').show(),$(".notifydisplay").hide(),$('.comparewish .notifydisplay[data-variantid="'+b+'"]:hidden').show(),b=a;var c=$("#productqty").data("quantities").split(",");for(index in c){var d=c[index].split(":");d[0]==a&&(d[1]?$("#productqty").attr("max",d[1]):$("#productqty").removeAttr("max"),$("#productqty").val()>
d[1]&&(d[1]=1>d[1]?1:d[1],$("#productqty").val(d[1])))}$(this).hasClass("mainsizing");$.get("/show-gallery?v="+b,function(a){$("#imagegallery").html(a);$(".mainproductimage").zoom({on:"click",magnify:2})})});$(document).on("click",".select .card",function(){var a=$(this).data("value");$("#gctotal").val(a);$("#gctotalme").val(a)});$(document).on("keyup","#gcamount",function(){$(".select .card").removeClass("js-active");var a=$(this).val();$("#gctotal").val(a);$("#gctotalme").val(a)});
$(".usecardbtn").on("click",function(){$(this).data("cardnumber")});$(document).on("click",".thumbs img",function(){var a=$(this).data("image"),b="/products/410/"+a;a="/products/large/"+a;$(".thumbs div").removeClass("active");$(this).parent("div").addClass("active");$(".mainproductimage img").attr("src",b);$("img.zoomImg").attr("src",a)});
$("#reviewform").on("submit",function(a){a.preventDefault();var b=$(".reviewbox"),c=$(this);a=c.serializeArray();c.fadeTo(.5);$.ajax({url:"/product-review-ajax",type:"post",dataType:"json",data:a,success:function(a){c.fadeOut();a.success?b.find(".alert-error").addClass("hidden").end().find(".alert-success").removeClass("hidden").text(a.message):b.find(".alert-success").addClass("hidden").end().find(".alert-error").removeClass("hidden").text(a.message);subscribeTimer=setTimeout(function(){b.find(".alert").addClass("hidden");
c.fadeIn()},3E3)},error:function(){}})});$(".faq .question").click(function(){$(this).next(".answer").slideToggle("medium")});$(document).on("click",".repeatorder",function(a){a.preventDefault();$(this).data("orderid")});$("#choose-petkind li").on("click",function(){$(this).toggleClass("chosen");var a="";$("#choose-petkind li").each(function(b,c){$(this).hasClass("chosen")&&(a+=" "+$(this).data("pet"))});$("#petkind").val($.trim(a))});
$(document).on("click",".choose-one .options",function(){$(".choose-one .options").removeClass("js-added").find("button").html("add");$(this).addClass("js-added").find("button").html("added");var a=$(this).find("button"),b=a.data("salegroupid"),c=a.data("variantid");a=a.data("summary");$(".salegroup-"+b).html(a);$(".salegroup-"+b).next(".bundlevariantid").val(c)});
$(".editoption").on("click",function(){var a=$(this).data("salegroupid"),b=$(this).data("variantid");$.get("/bundles-products-include?v="+b+"&g="+a,function(a){$(".choose-one").html(a)})});
$(document).on("click",".bundleatc",function(){var a=$(this).data("saleid"),b="";$(".bundlevariantid").each(function(a,d){b+=$(this).val()+"|"});$.magnificPopup.open({items:{type:"ajax",src:"/add-to-cart-popup?a=addbundle&s="+a+"&v="+b,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})});var ls_searchstring=null;
$(document).on("keyup","#ps_search",function(a){var b=$(this).val();38==a.keyCode||40==a.keyCode||13==a.keyCode?autocomplete(a.keyCode):(ls_searchstring!=b&&(ls_searchstring=b),3>b.length?($(".searchsuggestion").hide(),$(".searchsuggestion").html("")):$.getJSON("/header-search",{q:b},function(a){""===a.data.dropdown?($(".searchsuggestion").html(""),$(".searchsuggestion").hide()):($(".searchsuggestion").show(),$(".searchsuggestion").html(a.data.dropdown))}))});
function autocomplete(a){if(0>=a.length)return!1;if(38===a){$("#headersearchresults a.sc-active").removeClass("sc-active").prev().addClass("sc-active");0>=$("#headersearchresults a.sc-active").length&&$("#headersearchresults a:last").addClass("sc-active");var b=$("#headersearchresults a.sc-active")[0].innerText;$("#ps_search").val(b)}40===a&&($("#headersearchresults a.sc-active").removeClass("sc-active").next().addClass("sc-active"),0>=$("#headersearchresults a.sc-active").length&&$("#headersearchresults a:first").addClass("sc-active"),
b=$("#headersearchresults a.sc-active")[0].innerText,$("#ps_search").val(b));if(13===a&&$("#headersearchresults a.sc-active").length)return document.location=$("#headersearchresults a.sc-active").prop("href"),!1}$(document).on("click",".trackevent",function(){var a=$(this).data("trackcategory"),b=$(this).data("trackaction"),c=$(this).data("tracklabel");c&&b&&a&&ga("send","event",a,b,c)});
$("#removesavedcard").on("click",function(){if(!confirm("Are you sure you want to remove this card?"))return!1;document.location=$(this).prop("href")});$(".removecard").on("click",function(){if(!confirm("Are you sure you want to remove this card?"))return!1;document.location="/my-saved-cards?a=remove"});$("#removepet").on("click",function(){if(!confirm("Are you sure you want to remove this pet?"))return!1;var a=$(this).data("petid");document.location="/my-pets?a=remove&i="+a});
$(document).on("change","#autoshipweek",function(){if($(this).hasClass("ascart"))return!1;var a=$(this).val(),b=0;$(this).find(":selected").attr("data-key")&&(b=$(this).find(":selected").data("key"));$.getJSON("/calculate-autoship-date",{i:a,k:b},function(a){!1!==a.success?($("#autoshipdate").show(),$("#autoshipdate").addClass("js-show"),$(".autoshipdate").html(a.data)):$("#autoshipdate").hide()})});
$(document).on("change","#changeautoshipweek",function(){var a=$(this).val(),b=$(this).find(":selected").data("customerid"),c=$(this).find(":selected").data("autoshipid");updateautoship({i:c,c:b,w:a})});var lb_datepickermanualupdate=!1;$(document).on("change",".changeautoshipdate",function(){if(!lb_datepickermanualupdate)return!1;var a=$(this).val(),b=$(this).data("customerid"),c=$(this).data("autoshipid");updateautoship({i:c,c:b,d:a})});
function updateautoship(a){$.getJSON("/update-autoship",a,function(b){console.log(b);0==b.success?alert(b.message):($(".shipperiod-"+a.i).html(b.frequency),$(".shipdate-"+a.i).html(b.date),console.log(a.i),console.log(b.nextlong),$("#datepicker_"+a.i).val(b.date),$(".shipnext-"+a.i).html(b.date),$("#shipnext-"+a.i).html(b.nextlong))})}
$(document).on("click",".deleteautoship",function(){if(!confirm("Are you sure you want to delete this Repeat Delivery?"))return!1;var a=$(this).data("autoshipid");window.location="/my-repeatdeliveries?a=delete&i="+a});$(document).on("click",".sendNowBtn",function(a){if(!confirm("Are you sure you want to process this repeat delivery immediately?"))return!1});
$(document).on("click",".repeatDelivToggler",function(a){$(".repeatDelivToggler").not(this).next(".repeatDelivEditBox").slideUp();$(".repeatDelivToggler").not(this).find("i").removeClass("ion-ios-arrow-down").addClass("ion-ios-arrow-right");$(this).next(".repeatDelivEditBox").slideToggle();$(this).find("i").toggleClass("ion-ios-arrow-right ion-ios-arrow-down")});
$(document).on("click",".j-claimtreasure",function(a){a.preventDefault();a=$(this).data("id");$.magnificPopup.open({items:{type:"ajax",src:"/claim-treasure?a=init&i="+a,callbacks:{ajaxContentAdded:function(a){$("#popup").find("*").addClass("mfp-prevent-close");$("#popup").find(".mfp-close").removeClass("mfp-prevent-close")}}}})});
$(document).on("submit","#redeem-form",function(a){a.preventDefault();a=$(this).serializeArray();$.post("/claim-treasure?a=claim",a,function(a){$(".j-error").addClass("hidden");$(".j-message").addClass("hidden");0==a.status&&$(".j-error").html(a.message).removeClass("hidden");1==a.status&&$(".j-message").html(a.message).removeClass("hidden")})});