function cart_updateViewCartItemCount(a){if(a==1){$("#viewCartLink").html('<img src="/resources/images/site/new/buttons/view_cart_icon.png" />View Cart <span style="font-weight:normal;" class="small">('+a+")</span>")}else{$("#viewCartLink").html('<img src="/resources/images/site/new/buttons/view_cart_icon.png" />View Cart <span style="font-weight:normal;" class="small">('+a+")</span>")}}function cart_updateProceedButton(){var b=$("#numberOfItemsInCart").val();var c="/resources/images/site/as21_bt_proceed_grey.gif";var a="/resources/images/site/as21_bt_proceedgreen.gif";if(b==0){$("#cartProceedButton").attr("src",c);$("#cartProceedLink").bind("click",function(){return false})}else{$("#cartProceedButton").attr("src",a);$("#cartProceedLink").unbind("click")}}function ___getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){if(document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{b=self.innerWidth}d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=c}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function cart_show(){var a=___getPageSize();if(!$("#cart-popup").is(":visible")){$("#cart-popup").slideDown("normal")}$("#cart-popup").addClass("popup-show");$("body").append('<div id="popup-overlay"></div>');$("#popup-overlay").css({width:a[0],height:a[1]}).fadeIn()}function cart_hide(){if($("#cart-popup").is(":visible")){$("#cart-popup").slideUp("normal")}$("#popup-overlay").remove()}function cart_add(a){a.quantity=$("#qty"+a.itemID).val();$("#cart-popup").empty();$("#cart-popup").load("cart/cart/add",a,function(){newCount=$("#newCartItemCount").text();cart_updateViewCartItemCount(newCount);cart_show()})}function cart_remove(a,c){var b={};b.itemID=a;$("#shoppingCart").empty();$("#loading").css({display:"block",width:100,height:100});$("#shoppingCart").load("cart/cart/remove/"+c,b,function(){totalItemCount=$("#cartItemCount").text();cart_updateViewCartItemCount(totalItemCount)});$("#loading").css({display:"none"})}function core(){var a=$("#coreBubble").append('<div id="core-popup"> Your core deposit will be refunded to you once you have returned the "core", or the old part that you are replacing.</div>');$("#coreBubble").click(a)}function core_remove(){$("#core-popup").remove()}function cart_apply_promo_code(b){var a={};a.promoCode=$("#promoCode").val();$("#shoppingCart").empty();$("#loading").css({display:"block",width:100,height:100});$("#shoppingCart").load("cart/cart/apply_promo_code/"+b,a,function(){totalItemCount=$("#cartItemCount").text();cart_updateViewCartItemCount(totalItemCount)});$("#loading").css({display:"none"})}function cart_update_item_quantity(a,c){var b={};b.itemID=a;b.itemQuantity=$("#"+a).val();$("#shoppingCart").empty();$("#shoppingCart").load("cart/cart/update_item_quantity/"+c,b,function(){totalItemCount=$("#cartItemCount").text();cart_updateViewCartItemCount(totalItemCount)})}function cart_update_sales_tax(c,a){var b={};b.shipToCity=c;b.shipToState=a;$("#shoppingCart").empty();$("#shoppingCart").load("cart/cart/update_sales_tax",b,function(){})}function emailSignUp_click(){var a={};a.emailAddress=$("#emailSignUpText").val();$("#emailSignUpMsg").empty();$("#emailSignUpMsg").load("email_signup/email_signup/signup",a)}function brandSuggest_click(){var a={};a.suggestBrand=$("#suggestedBrandTxt").val();$("#suggestedBrandMsg").empty();$("#suggestedBrandMsg").load("brand/brand/suggest_brand",a)}function featCat_hoverOver(b,a){$("#"+b).css("color","#f2811a");$("#"+a).css("background","url(resources/images/site/as21_hp_newarrow.gif) no-repeat left bottom")}function featCat_hoverOut(b,a){$("#"+b).css("color","#595959");$("#"+a).css("background","url(resources/images/site/as21_hp_newarrow.gif) no-repeat left top")}function reviewVote(b,c,a){var d={};d.productID=b;d.reviewerName=c;d.vote=a;$.get("store/product_review_vote",d,function(e){$("[id="+c+"_Help_"+b+"]").text(e.votes)},"json")}function trim(b,a){return ltrim(rtrim(b,a),a)}function ltrim(b,a){a=a||"\\s";return b.replace(new RegExp("^["+a+"]+","g"),"")}function rtrim(b,a){a=a||"\\s";return b.replace(new RegExp("["+a+"]+$","g"),"")}function toggleSubcategory(a){$("ul#subcategorytreemenu > li#"+a+a).toggleClass("downtree").children("ul").toggle().end().siblings().removeClass("downtree").children("ul").hide();$("td#.plussign[id='"+a+"']").toggleClass("minussign")}function MM_preloadImages(){var f=document;if(f.images){if(!f.MM_p){f.MM_p=new Array()}var e,c=f.MM_p.length,b=MM_preloadImages.arguments;for(e=0;e<b.length;e++){if(b[e].indexOf("#")!=0){f.MM_p[c]=new Image;f.MM_p[c++].src=b[e]}}}}function MM_swapImgRestore(){var d,b,c=document.MM_sr;for(d=0;c&&d<c.length&&(b=c[d])&&b.oSrc;d++){b.src=b.oSrc}}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function MM_swapImage(){var e,d=0,b,c=MM_swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2]}}}function login(){$("#validbox ul.nopoints").empty();$("#myAcctSignUpForm").validate({rules:{firstName:"required",lastName:"required",pass:"required",passConf:{required:true,equalTo:$("#pass")},emailAddress:{required:true,email:true},emailAddressConf:{required:true,equalTo:$("#emailAddress")}},messages:{firstName:"Please enter your first name.",lastName:"Please enter you last name",pass:"Please enter a password",passConf:{required:"Please confirm your password",equalTo:"Passwords must match"},emailAddress:{required:"Please enter your email address",email:"Please enter a valid email"},emailAddressConf:{required:"Please confirm your email address",equalTo:"Email address must match"}},onfocusout:false,onkeyup:false,onclick:false,wrapper:"li",errorPlacement:function(b,a){b.appendTo("#validbox ul.nopoints")}});$("#checkout-content form input").change(function(){$(this).removeClass()})}function order_validate(){$("#validbox ul.nopoints").empty();$("#checkout-content form").validate({rules:{shippingFirstName:{required:true},shippingLastName:{required:true},shippingAddressLine1:{required:true},shippingCity:{required:true},shippingState:{required:true},shippingZip:{required:true,minlength:5},shippingPhone:{required:true,minlength:10},billingFirstName:{required:true},billingLastName:{required:true},billingAddressLine1:{required:true},billingCity:{required:true},billingState:{required:true},billingZip:{required:true,minlength:5},billingPhone:{required:true,minlength:10},emailAddress:{required:true,email:true},confirmEmailAddress:{required:true,equalTo:"#emailAddress"},password:{required:true,minlength:6},confirmPassword:{required:true,equalTo:"#password"},ccType:{required:true},ccAccountNumber:{required:true,creditcard:true},ccExpiration:{required:true,minlength:5,maxlength:5},ccSecurityCode:{required:true,minlength:3,maxlength:4},agreeToTC:{required:true}},messages:{shippingFirstName:{required:("Please enter the shipping first name")},shippingLastName:{required:("Please enter the shipping last name")},shippingAddressLine1:{required:("Please enter the shipping address")},shippingCity:{required:("Please enter the shipping city")},shippingState:{required:("Please select a shipping state")},shippingZip:{required:("Please enter a shipping zip"),minlenght:("Please enter a valid zip")},shippingPhone:{required:("Please enter a shippping phone number"),minlength:"Please enter a valid phone number"},billingFirstName:{required:("Please enter the billing first name")},billingLastName:{required:("Please enter the billing last name")},billingAddressLine1:{required:("Please enter the billing address")},billingCity:{required:("Please enter the billing city")},billingState:{required:("Please select a billing state")},billingZip:{required:("Please enter a billing zip"),minlenght:("Please enter a valid zip")},billingPhone:{required:("Please enter a shippping phone number"),minlength:("Please enter a valid phone number")},emailAddress:{required:("Please enter a email address"),email:("Please enter a vaild email address")},confirmEmailAddress:{required:("Please confirm your email address"),equalTo:("Email address must match")},password:{required:("Please enter a password"),minlength:("Password is a 6 character minimum")},confirmPassword:{required:("Please confirm password"),equalTo:("Passwords must match")},ccAccountNumber:{required:("Please enter your credit card number")},ccExpiration:{required:("Please enter your credit card expiration date"),minlength:("Please enter an expiration date in MM/YY format"),maxlength:("Please enter an expiration date in MM/YY format")},ccSecurityCode:{required:("Please enter your credit card security code"),minlength:("Security code for Visa, MasterCard & Discover must be 3 digits"),maxlength:("Security code for Visa, MasterCard & Discover must be 3 digits")},agreeToTC:{required:("&nbsp;You must agree to the AutoShepherd.com Terms & Conditions to continue")}},onfocusout:false,onkeyup:false,onclick:false,wrapper:"li",errorPlacement:function(b,a){b.appendTo("#validbox ul.nopoints")},invalidHandler:function(b,a){if($(sameBillShipBox).is(":checked")){$(shippingFields).attr("disabled",true)}}});$("#checkout-content form input").change(function(){$(this).removeClass();if($(sameBillShipBox).is(":checked")){$(shippingFields).removeClass()}})};
