/* * The PayPal Mini Cart * Visit https://minicart.paypal-labs.com/ for details * Use subject to license agreement as set forth at the link below * * @author Jeff Harrell * @version 2.0.4 * @license https://minicart.paypal-labs.com/LICENSE eBay Open Source License Agreement */ if(typeof PAYPAL=="undefined"||!PAYPAL){var PAYPAL={}}PAYPAL.apps=PAYPAL.apps||{};(function(){var a={parent:document.body,displayEdge:"right",edgeDistance:"50px",cookiePath:"/",strings:{button:"",subtotal:"",discount:"",shipping:""},name:"PPMiniCart",peekEnabled:true,paypalURL:"https://www.paypal.com/cgi-bin/webscr",assetURL:"https://minicart.paypal-labs.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 o=arguments.callee;o.products=[];o.UI={};o.isShowing=false;var m=function(r){var t,s,q,p;for(q in r){if(a[q]){a[q]=r[q]}}l();g();t=location.hash.substring(1);if(t.indexOf(a.name+"=")===0){s=t.split("=")[1];if(s=="reset"){o.reset();location.hash=""}}if(o.isShowing){setTimeout(function(){o.hide(null)},500)}else{c.storage.remove()}o.updateSubtotal()};var l=function(){if(typeof a.events.onRender=="function"){a.events.onRender.call(o)}j();n();f();if(typeof a.events.afterRender=="function"){a.events.afterRender.call(o)}};var j=function(){var r,s,q,p=a.name;q="#"+p+" form { position:fixed; float:none; top:-250px; "+a.displayEdge+":"+a.edgeDistance+"; width:265px; margin:0; padding:50px 10px 0; min-height:170px; background:#fff url("+a.assetURL+"images/minicart_sprite.png) no-repeat -125px -60px; border:1px solid #999; border-top:0; font:13px/normal arial, helvetica; color:#333; -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); } ";q+="#"+p+" 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; } ";q+="#"+p+" li { position:relative; margin:-1px 0 0; padding:6px 5px 6px 0; border-top:1px solid #f2f2f2; } ";q+="#"+p+" li a { color:#333; text-decoration:none; } ";q+="#"+p+" li a span { color:#999; font-size:10px; } ";q+="#"+p+" li .quantity { position:absolute; top:.5em; right:78px; width:22px; padding:1px; border:1px solid #83a8cc; text-align:right; } ";q+="#"+p+" li .price { position:absolute; top:.5em; right:4px; } ";q+="#"+p+" li .remove { position:absolute; top:9px; right:60px; width:14px; height:14px; background:url("+a.assetURL+"images/minicart_sprite.png) no-repeat -134px -4px; border:0; cursor:pointer; } ";q+="#"+p+" p { margin:0; padding:0 0 0 20px; background:url("+a.assetURL+"images/minicart_sprite.png) no-repeat; font-size:13px; font-weight:bold; } ";q+="#"+p+" p:hover { cursor:pointer; } ";q+="#"+p+" p input { float:right; margin:4px 0 0; padding:1px 4px; text-decoration:none; font-weight:normal; color:#333; background:#ffa822 url("+a.assetURL+"images/minicart_sprite.png) repeat-x left center; border:1px solid #d5bd98; border-right-color:#935e0d; border-bottom-color:#935e0d; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; } ";q+="#"+p+" p .shipping { display:block; font-size:10px; font-weight:normal; color:#999; } ";s=document.createElement("style");s.type="text/css";if(s.styleSheet){s.styleSheet.cssText=q}else{s.appendChild(document.createTextNode(q))}r=document.getElementsByTagName("head")[0];r.appendChild(s)};var n=function(){var s,r,t;o.UI.wrapper=document.createElement("div");o.UI.wrapper.id=a.name;s=document.createElement("input");s.type="hidden";s.name="cmd";s.value="_cart";r=s.cloneNode(false);r.name="upload";r.value="1";t=s.cloneNode(false);t.name="bn";t.value="MiniCart_AddToCart_WPS_US";o.UI.cart=document.createElement("form");o.UI.cart.method="post";o.UI.cart.action=a.paypalURL;o.UI.cart.appendChild(s);o.UI.cart.appendChild(r);o.UI.cart.appendChild(t);o.UI.wrapper.appendChild(o.UI.cart);o.UI.itemList=document.createElement("ul");o.UI.cart.appendChild(o.UI.itemList);o.UI.summary=document.createElement("p");o.UI.cart.appendChild(o.UI.summary);o.UI.button=document.createElement("input");o.UI.button.type="submit";o.UI.button.value=a.strings.button||"Checkout";o.UI.summary.appendChild(o.UI.button);o.UI.subtotal=document.createElement("span");o.UI.subtotal.innerHTML=a.strings.subtotal||"Subtotal: ";o.UI.subtotalAmount=document.createElement("span");o.UI.subtotalAmount.innerHTML="0.00";o.UI.subtotal.appendChild(o.UI.subtotalAmount);o.UI.summary.appendChild(o.UI.subtotal);o.UI.shipping=document.createElement("span");o.UI.shipping.className="shipping";o.UI.shipping.innerHTML=a.strings.shipping||"does not include shipping & tax";o.UI.summary.appendChild(o.UI.shipping);if(window.attachEvent&&!window.opera){var p=navigator.userAgent.match(/MSIE\s([^;]*)/);if(p){p=parseFloat(p[1]);if(p<7||(p>=7&&document.compatMode==="BackCompat")){o.UI.cart.style.position="absolute";o.UI.wrapper.style[a.displayEdge]="0";o.UI.wrapper.style.setExpression("top","x = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop")}}}var q=(typeof a.parent==="string")?document.getElementById(a.parent):a.parent;q.appendChild(o.UI.wrapper)};var f=function(){var p,r,q;p=document.getElementsByTagName("form");for(q=0;q=15){o.UI.subtotalAmount.style.backgroundColor="transparent";if(q=="0.00"){o.hide(null,true)}return}setTimeout(arguments.callee,30)}())};o.addToCart=function(p){var r=false,q;if(typeof a.events.onAddToCart==="function"){if(a.events.onAddToCart.call(o,p)===false){return}}p=e(p);q=p.details.offset;if(typeof q!="undefined"&&o.products[q]){o.products[q].details.quantity+=parseInt(p.details.quantity||1,10);o.products[q].setPrice(p.details.amount*o.products[q].details.quantity);o.products[q].setQuantity(o.products[q].details.quantity);r=true}else{p.details.offset=o.products.length;r=k(p)}o.updateSubtotal();o.show(null);c.storage.save(o.products);if(typeof a.events.afterAddToCart==="function"){a.events.afterAddToCart.call(o,p)}return r};o.show=function(p){var r=parseInt(o.UI.cart.offsetTop,10),q=0;if(p&&p.preventDefault){p.preventDefault()}if(typeof a.events.onShow=="function"){a.events.onShow.call(o,p)}c.util.animate(o.UI.cart,"top",{from:r,to:q},function(){if(typeof a.events.afterShow=="function"){a.events.afterShow.call(o,p)}});o.UI.summary.style.backgroundPosition="-195px 2px";o.isShowing=true};o.hide=function(s,q){var p=(o.UI.cart.offsetHeight)?o.UI.cart.offsetHeight:document.defaultView.getComputedStyle(o.UI.cart,"").getPropertyValue("height"),r=(o.UI.summary.offsetHeight)?o.UI.summary.offsetHeight:document.defaultView.getComputedStyle(o.UI.summary,"").getPropertyValue("height"),u=parseInt(o.UI.cart.offsetTop,10),t;if(q||!a.peekEnabled){t=p*-1}else{t=(p-r-8)*-1}if(s&&s.preventDefault){s.preventDefault()}if(typeof a.events.onHide=="function"){a.events.onHide.call(o,s)}c.util.animate(o.UI.cart,"top",{from:u,to:t},function(){if(typeof a.events.afterHide=="function"){a.events.afterHide.call(o,s)}});o.UI.summary.style.backgroundPosition="-195px -32px";o.isShowing=false};o.toggle=function(p){if(o.isShowing){o.hide(p)}else{o.show(p)}};o.reset=function(){if(typeof a.events.onReset==="function"){a.events.onReset.call(o)}o.products=[];if(o.isShowing){o.UI.itemList.innerHTML="";o.UI.subtotalAmount.innerHTML="";o.hide(null,true)}c.storage.remove();if(typeof a.events.afterReset==="function"){a.events.afterReset.call(o)}};return{render:function(p){m(p)},addToCart:function(p){o.addToCart(p)},show:function(p){o.show(p)},hide:function(q,p){o.hide(q,p)},toggle:function(p){o.toggle()},reset:function(){o.reset()}}}());var b=function(e,d){this.details=null;this.settings=null;this.liNode=null;this.nameNode=null;this.metaNode=null;this.priceNode=null;this.quantityNode=null;this.removeNode=null;this.isPlaceholder=false;this._init(e,d)};b.prototype={_init:function(k,e){var d,l,j,h,g,f;this.details=k.details;this.settings=k.settings;this.liNode=document.createElement("li");this.nameNode=document.createElement("a");this.metaNode=document.createElement("span");this.priceNode=document.createElement("span");this.quantityNode=document.createElement("input");this.removeNode=document.createElement("input");if(!this.details.item_name&&!this.details.item_number){this.isPlaceholder=true;return}if(this.details.item_name){l=this.details.item_name;d=(l.length>20)?l.substr(0,20)+"...":l}this.nameNode.innerHTML=d;this.nameNode.title=l;this.nameNode.href=this.details.href;this.nameNode.appendChild(this.metaNode);if(this.details.item_number){this.metaNode.innerHTML="
#"+this.details.item_number}f=0;while(typeof this.details["on"+f]!=="undefined"){this.metaNode.innerHTML+="
"+this.details["on"+f]+": "+this.details["os"+f];f++}if(this.details.discount_amount){this.metaNode.innerHTML+="
";this.metaNode.innerHTML+=a.strings.discount||"Discount: ";this.metaNode.innerHTML+=c.util.formatCurrency(this.details.discount_amount,this.settings.currency_code)}this.details.quantity=parseInt(this.details.quantity,10);this.quantityNode.name="quantity_"+e;this.quantityNode.value=this.details.quantity?this.details.quantity:1;this.quantityNode.className="quantity";this.quantityNode.setAttribute("autocomplete","off");this.removeNode.type="button";this.removeNode.className="remove";j=parseFloat(this.details.amount,10);if(this.details.discount_amount){j-=this.details.discount_amount}this.priceNode.innerHTML=c.util.formatCurrency((j*parseFloat(this.details.quantity,10)).toFixed(2),this.settings.currency_code);this.priceNode.className="price";this.liNode.appendChild(this.nameNode);this.liNode.appendChild(this.quantityNode);this.liNode.appendChild(this.removeNode);this.liNode.appendChild(this.priceNode);for(g in this.details){if(g!=="quantity"){h=document.createElement("input");h.type="hidden";h.name=g+"_"+e;h.value=this.details[g];this.liNode.appendChild(h)}}},setQuantity:function(d){d=parseInt(d,10);this.details.quantity=d;if(this.quantityNode.value!=d){this.quantityNode.value=d}this.setPrice(this.details.amount*d)},getQuantity:function(){return(parseFloat(this.quantityNode.value,10)||1)},setPrice:function(d){d=parseFloat(d,10);this.priceNode.innerHTML=c.util.formatCurrency(parseFloat(d,10).toFixed(2),this.settings.currency_code)},getPrice:function(){return(this.details.amount*this.getQuantity())}};var c={};c.storage=(function(){var d=a.name;if(window.localStorage){return{load:function(){var e=localStorage.getItem(d);if(e){e=JSON.parse(unescape(e))}return e},save:function(j){var h=[],g,e,f;if(j){for(f=0,e=j.length;f0&&g>d.to)||(f<0&&g
