if(typeof(pfd)=="undefined"){pfd=function(){}}pfd.ajax=function(){};pfd.ajax.persistCustomerEmail=function(a,b,c){$.ajax({url:"/PersistCustomerEmail.asmx/PersistCustomerEmailToDatabase",type:"POST",data:"email="+a+"&promotionType="+b,contentType:"application/x-www-form-urlencoded",dataType:"xml",success:function(d){if($(d).find("string").text()=="Invalid Email Address"){if($.cookie("couponEmail")=="initial"){alert("Invalid Email Address. Please Try Again.")}}else{pfd.ajax.onSuccess(c);$.cookie("coupon","true")}},error:function(f,e,d){alert("There was a problem with this page:"+f)}});pfd.ajax.onSuccess=function(d){pfd.display.showSuccessDiv(d);pfd.utility.initializePage()}};pfd.ajax.addItemToCart=function(b,a){$.ajax({url:"/ClientSideOperations.asmx/AddItemToBasket",type:"POST",data:"variantId="+b+"&quantity="+a,contentType:"application/x-www-form-urlencoded",dataType:"xml",success:function(f){var e=document.URL.toString();if(e.indexOf("cart.aspx")>=0){window.location.href="/cart.aspx"}else{var c=document.getElementById("cartCount");var d=f.lastChild.lastChild.data;c.innerHTML=d;pfd.display.ShowPopup("BasketDisplay")}},error:function(e,d,c){alert("error in web service")}})};pfd.ajax.addItemToAutoShip=function(d,c,a,b){$.ajax({url:"/ClientSideOperations.asmx/AddItemToAutoShip",type:"POST",data:"variantId="+d+"&quantity="+c+"&orderGroupId="+a,contentType:"application/x-www-form-urlencoded",dataType:"xml",success:function(e){pfd.display.ShowPopup(b)},error:function(g,f,e){alert("error in web service")}})};function loadXMLString(a){if(window.DOMParser){parser=new DOMParser();xmlDoc=parser.parseFromString(a,"text/xml")}else{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(a)}return xmlDoc};if(typeof(pfd)=="undefined"){pfd=function(){}}pfd.display=function(){};pfd.display.showSuccessDiv=function(a){$(a).removeClass("popup");$(a).addClass("popupSuccess");$("#submitSection").html("")};pfd.display.hideEmailAndSubmit=function(){var a=document.getElementById("emailAddress");a.style.visibility="hidden";var a=document.getElementById("couponSubmit");a.style.visibility="hidden"};pfd.display.showEmailAndSubmit=function(){var a=document.getElementById("emailAddress");a.style.visibility="visible";var a=document.getElementById("couponSubmit");a.style.visibility="visible"};pfd.display.testShowMoreButton=function(){var a=$("#shortDescription").text().length;if(a>300){$("#moreDescriptionLink").removeClass("MoreButtonHidden");$("#moreDescriptionLink").addClass("MoreButton")}};pfd.display.showMoreContent=function(){$("#prodDesc").removeClass("ProductDisplay");$("#prodDesc").addClass("ProductDisplayLong");$("#moreButton").removeClass("MoreButton");$("#moreButtton").addClass("MoreButtonHidden")};pfd.display.changeTitleOnCategory=function(){var a;var c;var d;var b=location.href.toString();if(b.toUpperCase().indexOf("DOG-FOOD")!=-1&&b.toUpperCase().indexOf("/BRAND/")!=-1){a=b.split(/Brand/);c=a[1].replace("/"," ")+" Dog Food | NationalPetPharmacy.com";d=c.replace("-"," ");c=d.replace("-"," ");d=c.replace("/"," ");c=d.replace("/"," ");document.title=c.replace("-"," ")}else{if(b.toUpperCase().indexOf("CAT-FOOD")!=-1&&b.toUpperCase().indexOf("/BRAND/")!=-1){a=b.split(/Brand/);c=a[1].replace("/"," ")+" Cat Food | NationalPetPharmacy.com";d=c.replace("-"," ");c=d.replace("-"," ");d=c.replace("/"," ");c=d.replace("/"," ");document.title=d.replace("-"," ")}}};pfd.display.ShowPopup=function(a){var b=document.getElementById(a);b.style.visibility="visible";b.style.display="block";pfd.display.centerPopupInClient(a);$("#bkgPopup").fadeIn("fast")};pfd.display.HidePopup=function(a){var b=document.getElementById(a);b.style.visibility="hidden";b.style.display="none";$("#bkgPopup").fadeOut("fast")};pfd.display.centerPopupInClient=function(a){var c=2;var b=$("#"+a);var d=$(window);var e=d.width()/2-b.outerWidth()/2;var f=d.height()/c-b.outerHeight()/2;b.css("left",e+d.scrollLeft());b.css("top",f+d.scrollTop())};pfd.display.showNppCommercialPopup=function(URL){day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=0,width=500,height=250,left = 262,top = 259');")};pfd.display.showInstantCoupon=function(){pfd.display.ShowPopup("popup");if($.cookie("coupon")=="true"){pfd.display.showSuccessDiv("#popup")}if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var a=new Number(RegExp.$1)}if(a<7){pfd.display.showSuccessDiv("#popup")}};pfd.display.slideToggleVisibility=function(a){$("#"+a).slideToggle("slow")};pfd.display.show=function(a){$("#"+a).show("slow")};pfd.display.hide=function(a){$("#"+a).hide("slow")};function HideToolTip(){var a=Telerik.Web.UI.RadToolTip.getCurrent();if(a){a.hide()}document.forms[0].submit()};var IEPNGFix=window.IEPNGFix||{};IEPNGFix.tileBG=function(j,r,v){var i=this.data[j.uniqueID],l=Math.max(j.clientWidth,j.scrollWidth),k=Math.max(j.clientHeight,j.scrollHeight),b=j.currentStyle.backgroundPositionX,c=j.currentStyle.backgroundPositionY,a=j.currentStyle.backgroundRepeat;if(!i.tiles){i.tiles={elm:j,src:"",cache:[],img:new Image(),old:{}}}var B=i.tiles,t=B.img.width,q=B.img.height;if(r){if(!v&&r!=B.src){B.img.onload=function(){this.onload=null;IEPNGFix.tileBG(j,r,1)};return B.img.src=r}}else{if(B.src){v=1}t=q=0}B.src=r;if(!v&&l==B.old.w&&k==B.old.h&&b==B.old.x&&c==B.old.y&&a==B.old.r){return}var u={top:"0%",left:"0%",center:"50%",bottom:"100%",right:"100%"},C,E,p;C=u[b]||b;E=u[c]||c;if(p=C.match(/(\d+)%/)){C=Math.round((l-t)*(parseInt(p[1])/100))}if(p=E.match(/(\d+)%/)){E=Math.round((k-q)*(parseInt(p[1])/100))}C=parseInt(C);E=parseInt(E);var w={repeat:1,"repeat-x":1}[a],z={repeat:1,"repeat-y":1}[a];if(w){C%=t;if(C>0){C-=t}}if(z){E%=q;if(E>0){E-=q}}this.hook.enabled=0;if(!({relative:1,absolute:1}[j.currentStyle.position])){j.style.position="relative"}var g=0,D,n=w?l:C+0.1,F,o=z?k:E+0.1,h,A,m;if(t&&q){for(D=C;D<n;D+=t){for(F=E;F<o;F+=q){m=0;if(!B.cache[g]){B.cache[g]=document.createElement("div");m=1}var f=Math.max(0,D+t>l?l-D:t),e=Math.max(0,F+q>k?k-F:q);h=B.cache[g];A=h.style;A.behavior="none";A.left=(D-parseInt(j.currentStyle.paddingLeft))+"px";A.top=F+"px";A.width=f+"px";A.height=e+"px";A.clip="rect("+(F<0?0-F:0)+"px,"+f+"px,"+e+"px,"+(D<0?0-D:0)+"px)";A.display="block";if(m){A.position="absolute";A.zIndex=-999;if(j.firstChild){j.insertBefore(h,j.firstChild)}else{j.appendChild(h)}}this.fix(h,r,0);g++}}}while(g<B.cache.length){this.fix(B.cache[g],"",0);B.cache[g++].style.display="none"}this.hook.enabled=1;B.old={w:l,h:k,x:b,y:c,r:a}};IEPNGFix.update=function(){for(var a in IEPNGFix.data){var b=IEPNGFix.data[a].tiles;if(b&&b.elm&&b.src){IEPNGFix.tileBG(b.elm,b.src)}}};IEPNGFix.update.timer=0;if(window.attachEvent&&!window.opera){window.attachEvent("onresize",function(){clearTimeout(IEPNGFix.update.timer);IEPNGFix.update.timer=setTimeout(IEPNGFix.update,100)})};jQuery.cookie=function(h,m,j){if(typeof m!="undefined"){j=j||{};if(m===null){m="";j.expires=-1}var f="";if(j.expires&&(typeof j.expires=="number"||j.expires.toUTCString)){var d;if(typeof j.expires=="number"){d=new Date();d.setTime(d.getTime()+(j.expires*24*60*60*1000))}else{d=j.expires}f="; expires="+d.toUTCString()}var k=j.path?"; path="+(j.path):"";var e=j.domain?"; domain="+(j.domain):"";var l=j.secure?"; secure":"";document.cookie=[h,"=",encodeURIComponent(m),f,k,e,l].join("")}else{var c=null;if(document.cookie&&document.cookie!=""){var b=document.cookie.split(";");for(var g=0;g<b.length;g++){var a=jQuery.trim(b[g]);if(a.substring(0,h.length+1)==(h+"=")){c=decodeURIComponent(a.substring(h.length+1));break}}}return c}};(function(a){a.fn.extend({_offset:a.fn.offset,offset:function(b){return b?this.setXY(b):this._offset()},setXY:function(b){return this.each(function(){var d=this;var e=false;if(a(d).css("display")=="none"){e=true;a(d).show()}var g=a(d).css("position");if(g=="static"){a(d).css("position","relative");g="relative"}var f=a(d).offset();if(f){var c={left:parseInt(a(d).css("left"),10),top:parseInt(a(d).css("top"),10)};if(isNaN(c.left)){c.left=(g=="relative")?0:d.offsetLeft}if(isNaN(c.top)){c.top=(g=="relative")?0:d.offsetTop}if(b.left||b.left===0){a(d).css("left",b.left-f.left+c.left+"px")}if(b.top||b.top===0){a(d).css("top",b.top-f.top+c.top+"px")}}if(e){a(d).hide()}})}})})(jQuery);$(function(){$(".tab-content").hide();$("ul.tabs li").removeClass("active");$(".product-tab").show();var b=location.href.toString();var a=document.referrer;if(b.toUpperCase().indexOf("/CAT/")!=-1){$($("ul.tabs li")[2]).addClass("active").show();$($(".tab-content")[2]).show()}else{if(b.toUpperCase().indexOf("/DOG/")!=-1){$($("ul.tabs li")[1]).addClass("active").show();$($(".tab-content")[1]).show()}else{if(b.toUpperCase().indexOf("/FLEA-AND-TICK/")!=-1){$($("ul.tabs li")[4]).addClass("active").show();$(".tab-content:first").show()}else{if(b.toUpperCase().indexOf("/PRODUCT/")!=-1){if(!a){}else{if(a.toUpperCase().indexOf("/CAT/")!=-1){$($("ul.tabs li")[2]).addClass("active").show();$($(".tab-content")[2]).show()}else{if(a.toUpperCase().indexOf("/DOG/")!=-1){$($("ul.tabs li")[1]).addClass("active").show();$($(".tab-content")[1]).show()}else{if(a.toUpperCase().indexOf("/FLEA-AND-TICK/")!=-1){$($("ul.tabs li")[4]).addClass("active").show();$(".tab-content:first").show()}else{$("ul.tabs li:first").addClass("active").show();$(".tab-content:first").show()}}}}}else{$("ul.tabs li:first").addClass("active").show();$(".tab-content:first").show()}}}}$("ul.tabs li").click(function(){var d=$(this).find("a").attr("href");var c=$(this).attr("class");var e="";$("ul.tabs li").removeClass("active");$(this).addClass("active");$(".tab-content").hide();$(d).show();switch(c){case"HOME":e="/default.aspx";break;case"PHARMACYREFILLS":e="/landing/Pharmacy-Refills.aspx";break;case"VETDIETS":e="/landing/Vet-Diets-Tab.aspx";break;case"FLEATICK":e="/landing/Flea-Tick-Tab.aspx";break;case"HEALTHCARE":e="/landing/Healthcare.aspx";break;case"PETSUPPLIES":e="/landing/Pet-Supplies.aspx";break;case"FOODTREATS":e="/landing/Food-Treats.aspx";break}e=e+"#"+c.replace(" ","");window.location.replace(e);return false});url=window.location.toString();if(url.indexOf("#")!=-1){loadTab=url.substring(url.indexOf("#")+1);showTabOnLoad(loadTab)}$("#product-content hr").remove();$("#ctl00_MainContent_PaymentManager_PaymentManagerCreditCardViewLabel").hide();$(".search").toggleVal();$(".search-results-product-options").each(function(c){$(".search-results-sizes:nth-child(odd)").addClass("alt")});$("#tabs-21").removeAttr("style");$("#tabs-22").removeAttr("style");$("#tabs-23").removeAttr("style");$("#tabs-24").removeAttr("style");$("#tabs-25").removeAttr("style")});function showTabOnLoad(b){$("ul.tabs li").removeClass("active");$("."+b).addClass("active");$(".tab-content").hide();var a=$("."+b).find("a").attr("href");$(a).show()}var popupStatus=0;function loadPopup(){if(popupStatus==0){$("#autoshipBkgd").css({opacity:"0.15"});$("#autoshipBkgd").fadeIn("fast");$("#autoshipInfo").fadeIn("fast");popupStatus=1}}function disablePopup(){if(popupStatus==1){$("#autoshipBkgd").fadeOut("fast");$("#autoshipInfo").fadeOut("fast");popupStatus=0}}function centerPopup(){var d=document.documentElement.clientWidth;var c=document.documentElement.clientHeight;var a=$("#autoshipInfo").height();var b=$("#autoshipInfo").width();$("#autoshipBkgd").css({height:c})}$(document).ready(function(){$("#button1").click(function(){centerPopup();loadPopup()});$("#autoshipInfoClose").click(function(){disablePopup()});$("#continue").click(function(){disablePopup()});$("#autoshipBkgd").click(function(){disablePopup()});$(document).keypress(function(a){if(a.keyCode==27&&popupStatus==1){disablePopup()}})});
