/*! * MiniCart * * Improve your PayPal integration by creating an overlay which appears as a user adds products to their cart. * * @version 2.5.0 - 2012-12-08, 2:59:35 PM * @author Jeff Harrell * @url http://www.minicartjs.com/ * @license > */ if(typeof PAYPAL=="undefined"||!PAYPAL)var PAYPAL={};PAYPAL.apps=PAYPAL.apps||{},function(){"use strict";var e={parent:document.body,displayEdge:"right",edgeDistance:"50px",formTarget:null,cookiePath:"/",cartDuration:30,strings:{button:"",subtotal:"",discount:"",shipping:"",processing:""},name:"PPMiniCart",peekEnabled:!0,paypalURL:"https://www.paypal.com/cgi-bin/webscr",assetURL:"http://www.minicartjs.com/build/",events:{onRender:null,afterRender:null,onHide:null,afterHide:null,onShow:null,afterShow:null,onAddToCart:null,afterAddToCart:null,onRemoveFromCart:null,afterRemoveFromCart:null,onCheckout:null,onReset:null,afterReset:null}};PAYPAL.apps.MiniCart=function(){var r={},i=!1,s=!1,o={_cart:!0,_xclick:!0},u="MiniCart_AddToCart_WPS_US",a=/^(?:business|currency_code|lc|paymentaction|no_shipping|cn|no_note|invoice|handling_cart|weight_cart|weight_unit|tax_cart|page_style|image_url|cpp_|cs|cbt|return|cancel_return|notify_url|rm|custom|charset)/,f=function(){var t=e.name,n=[],r,i;n.push("#"+t+" form { position:absolute; float:none; left: 50px; top:-250px; "+e.displayEdge+":"+e.edgeDistance+"; width:265px; margin:0; padding:10px 10px 0; min-height:170px; background:#fff; border:1px solid #999; border-top:0; font:13px/normal arial, helvetica; color:#333; text-align:left; -moz-border-radius:0 0 8px 8px; -webkit-border-radius:0 0 8px 8px; border-radius:0 0 8px 8px; -moz-box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1); -webkit-box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1); box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1); } "),n.push("#"+t+" ul { position:relative; overflow-x:hidden; overflow-y:auto; height:130px; margin:0 0 7px; padding:0; list-style-type:none; border-top:1px solid #ccc; border-bottom:1px solid #ccc; } "),n.push("#"+t+" li { position:relative; margin:-1px 0 0; padding:6px 5px 6px 0; border-top:1px solid #f2f2f2; } "),n.push("#"+t+" li a { display: block; width: 155px; color:#333; text-decoration:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } "),n.push("#"+t+" li a span { color:#999; font-size:10px; } "),n.push("#"+t+" li .quantity { position:absolute; top:.5em; right:78px; width:22px; padding:1px; border:1px solid #83a8cc; text-align:right; } "),n.push("#"+t+" li .price { position:absolute; top:.5em; right:4px; } "),n.push("#"+t+" li .remove { position:absolute; top:9px; right:60px; width:14px; height:14px; border:0; cursor:pointer; } "),n.push("#"+t+" p { margin:0; padding:0 0 0 20px; font-size:13px; font-weight:bold; } "),n.push("#"+t+" p:hover { cursor:pointer; } "),n.push("#"+t+" p input { float:right; margin:4px 0 0; padding:1px 4px; text-decoration:none; font-weight:normal; color:#333; border:1px solid #d5bd98; border-right-color:#935e0d; border-bottom-color:#935e0d; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; } "),n.push("#"+t+" p .shipping { display:block; font-size:10px; font-weight:normal; color:#999; } "),r=document.createElement("style"),r.type="text/css",r.styleSheet?r.styleSheet.cssText=n.join(""):r.appendChild(document.createTextNode(n.join(""))),i=document.getElementsByTagName("head")[0],i.appendChild(r)},l=function(){var t=r.UI,n,i,s,o,a;t.wrapper=document.createElement("div"),t.wrapper.id=e.name,n=document.createElement("input"),n.type="hidden",n.name="cmd",n.value="_cart",i=n.cloneNode(!1),i.name="upload",i.value="1",s=n.cloneNode(!1),s.name="bn",s.value=u,t.cart=document.createElement("form"),t.cart.method="post",t.cart.action=e.paypalURL,e.formTarget&&(t.cart.target=e.formTarget),t.cart.appendChild(n),t.cart.appendChild(i),t.cart.appendChild(s),t.wrapper.appendChild(t.cart),t.itemList=document.createElement("ul"),t.cart.appendChild(t.itemList),t.summary=document.createElement("p"),t.cart.appendChild(t.summary),t.button=document.createElement("input"),t.button.type="submit",t.button.value=e.strings.button||"Checkout",t.summary.appendChild(t.button),t.subtotal=document.createElement("span"),t.subtotal.innerHTML=e.strings.subtotal||"Subtotal: ",t.subtotalAmount=document.createElement("span"),t.subtotalAmount.innerHTML="0.00",t.subtotal.appendChild(t.subtotalAmount),t.summary.appendChild(t.subtotal),t.shipping=document.createElement("span"),t.shipping.className="shipping",t.shipping.innerHTML=e.strings.shipping||"does not include shipping & tax",t.summary.appendChild(t.shipping);if(window.attachEvent&&!window.opera){a=navigator.userAgent.match(/MSIE\s([^;]*)/);if(a){a=parseFloat(a[1]);if(a<7||a>=7&&document.compatMode==="BackCompat")t.cart.style.position="absolute",t.wrapper.style[e.displayEdge]="0",t.wrapper.style.setExpression("top","x = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop")}}o=typeof e.parent=="string"?document.getElementById(e.parent):e.parent,o.appendChild(t.wrapper)},c=function(){var t=r.UI,s,u,a;s=document.getElementsByTagName("form");for(a=0;a=15){s.style.backgroundColor="transparent",o==="0.00"&&r.reset();return}setTimeout(p,30)}()},r.show=function(t){var s=parseInt(r.UI.cart.offsetTop,10),o=0,u=e.events,a=u.onShow,f=u.afterShow;t&&t.preventDefault&&t.preventDefault();if(typeof a=="function"&&a.call(r,t)===!1)return;n.util.animate(r.UI.cart,"top",{from:s,to:o},function(){typeof f=="function"&&f.call(r,t)}),r.UI.summary.style.backgroundPosition="-195px 2px",i=!0},r.hide=function(t,s){var o=r.UI,u=o.cart,a=o.summary,f=u.offsetHeight?u.offsetHeight:document.defaultView.getComputedStyle(u,"").getPropertyValue("height"),l=a.offsetHeight?a.offsetHeight:document.defaultView.getComputedStyle(a,"").getPropertyValue("height"),c=parseInt(u.offsetTop,10),h=e.events,p=h.onHide,d=h.afterHide,v;s||r.products.length===0||!e.peekEnabled?v=f*-1:v=(f-l-8)*-1,t&&t.preventDefault&&t.preventDefault();if(typeof p=="function"&&p.call(r,t)===!1)return;n.util.animate(u,"top",{from:c,to:v},function(){typeof d=="function"&&d.call(r,t)}),a.style.backgroundPosition="-195px -32px",i=!1},r.toggle=function(e){i?r.hide(e):r.show(e)},r.reset=function(){var t=r.UI,s=e.events,o=s.onReset,u=s.afterReset;if(typeof o=="function"&&o.call(r)===!1)return;r.products=[],i&&(t.itemList.innerHTML="",t.subtotalAmount.innerHTML="",r.hide(null,!0)),n.storage.remove(),typeof u=="function"&&u.call(r)},r}();var t=function(e,t){this._view(e,t)};t.prototype={_view:function(e,t){var n,r,i,s,o,u,a;this.product=e.product,this.settings=e.settings,this.liNode=document.createElement("li"),this.nameNode=document.createElement("a"),this.metaNode=document.createElement("span"),this.discountNode=document.createElement("span"),this.discountInput=document.createElement("input"),this.priceNode=document.createElement("span"),this.quantityInput=document.createElement("input"),this.removeInput=document.createElement("input");if(!this.product||!this.product.item_name&&!this.product.item_number){this.isPlaceholder=!0;return}this.product.item_name&&(n=this.product.item_name),this.nameNode.innerHTML=n,this.nameNode.title=n,this.nameNode.href=this.product.href,this.nameNode.appendChild(this.metaNode),this.product.item_number&&(this.metaNode.innerHTML="
#"+this.product.item_number),o=this.getOptions();for(a in o)this.metaNode.innerHTML+="
"+a+": "+o[a];s=this.getDiscount(),this.discountInput.type="hidden",this.discountInput.name="discount_amount_"+t,this.discountInput.value=s,this.metaNode.appendChild(this.discountNode),r=this.getPrice(),this.priceNode.className="price",i=this.getQuantity(),this.quantityInput.name="quantity_"+t,this.quantityInput.className="quantity",this.quantityInput.setAttribute("autocomplete","off"),this.setQuantity(i),this.removeInput.type="button",this.removeInput.className="remove",this.liNode.appendChild(this.nameNode),this.liNode.appendChild(this.quantityInput),this.liNode.appendChild(this.discountInput),this.liNode.appendChild(this.removeInput),this.liNode.appendChild(this.priceNode);for(a in this.product)a!=="quantity"&&a.indexOf("discount_")===-1&&(u=document.createElement("input"),u.type="hidden",u.name=a+"_"+t,u.value=this.product[a],this.liNode.appendChild(u))},getDiscount:function(){var e=0,t=this.product.discount_num||-1,n;return this.product.discount_amount?(e=parseFloat(this.product.discount_amount),this.product.discount_amount2&&(n=this.getQuantity(),n>1&&(e+=Math.max(n-1,t)*parseFloat(this.product.discount_amount2)))):this.product.discount_rate&&(e=this.product.amount*parseFloat(this.product.discount_rate)/100,this.product.discount_rate2&&(n=this.getQuantity(),n>1&&(e+=Math.max(n-1,t)*this.product.amount*parseFloat(this.product.discount_amount2)/100))),e&&e.toFixed(2)},getOptions:function(){var e={},t=0;while(typeof this.product["on"+t]!="undefined")e[this.product["on"+t]]=this.product["os"+t],t++;return e},setQuantity:function(t){var r;t=parseInt(t,10),this.product.quantity=t;if(this.quantityInput.value!==t){this.quantityInput.value=t;if(r=this.getDiscount())this.discountInput.value=r,this.discountNode.innerHTML="
",this.discountNode.innerHTML+=e.strings.discount||"Discount: ",this.discountNode.innerHTML+=n.util.formatCurrency(r,this.settings.currency_code)}this.setPrice(this.product.amount*t)},getQuantity:function(){return typeof this.product.quantity!==undefined?this.product.quantity:1},setPrice:function(e){e=parseFloat(e,10),this.priceNode.innerHTML=n.util.formatCurrency(e.toFixed(2),this.settings.currency_code)},getPrice:function(){return(this.product.amount*this.getQuantity()).toFixed(2)}};var n={};n.storage=function(){var t=e.name;return window.localStorage?{load:function(){var e=localStorage.getItem(t),r,i;e&&(e=JSON.parse(decodeURIComponent(e)));if(e&&e.expires){r=new Date,i=new Date(e.expires);if(r>i){n.storage.remove();return}}return e&&e.value?e.value:e},save:function(e,n){var r=new Date,i=[],s,o,u,a;if(e){for(a=0,u=e.length;a0&&s>n.to||i<0&&s