/*
 * 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<p.length;q++){r=p[q];if(r.cmd&&(r.cmd.value==="_cart"||r.cmd.value==="_xclick")){if(r.add){c.event.add(r,"submit",function(t){t.preventDefault(t);o.addToCart(t.target.elements)})}else{if(r.display){c.event.add(r,"submit",function(t){t.preventDefault();o.show(t)})}}}}c.event.add(document,"click",function(u){if(o.isShowing){var t=u.target;if(!(/input|button|select|option/i.test(t.tagName))){while(t.nodeType===1){if(t===o.UI.cart){return}t=t.parentNode}o.hide(null)}}});c.event.add(o.UI.cart,"submit",function(t){h(t)});c.event.add(o.UI.summary,"click",function(u){var t=u.target;if(t!==o.UI.button){o.toggle(u)}});function s(){o.products=[];o.UI.itemList.innerHTML="";o.UI.subtotalAmount.innerHTML="";g();o.updateSubtotal()}if(window.attachEvent&&!window.opera){c.event.add(document,"storage",function(t){setTimeout(s,100)})}else{c.event.add(window,"storage",function(t){if((t.key&&t.key==a.name)||!t.key){s()}})}};var g=function(){var q,p;if((q=c.storage.load())){p=q.length;for(i=0;i<p;i++){if(k(q[i])){o.isShowing=true}}}};var e=function(z){var v={},r={},x=/^(?:item_number|item_name|amount|quantity|on|os|option_|tax|weight|handling|shipping|discount)/,w=/^(?: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)/,q=z.length,t,y,p,s,u;for(u=0;u<q;u++){t=z[u];if(x.test(t.name)){y=c.util.getInputValue(t);if(y){v[t.name]=y}}else{if(w.test(t.name)){y=c.util.getInputValue(t);if(y){r[t.name]=y}}}}for(u=0,q=o.products.length;u<q;u++){p=o.products[u].details;if((!v.item_name||v.item_name===p.item_name)&&(!v.item_number||v.item_number===p.item_number)&&(!v.os0||v.os0===p.os0)&&(!v.os1||v.os1===p.os1)){v.offset=p.offset;break}}v.href=v.href||window.location.href;v.quantity=v.quantity||1;v.amount=v.amount||0;if(r["return"]&&r["return"].indexOf("#")==-1){r["return"]+="#"+a.name+"=reset"}s=(v.option_index)?v.option_index:0;while(z["os"+s]){u=0;while(typeof v["option_select"+u]!="undefined"){if(v["option_select"+u]==v["os"+s]){v.amount=v.amount+parseFloat(v["option_amount"+u]);break}u++}s++}return{details:v,settings:r}};var k=function(s){var p,r=new b(s,o.UI.itemList.children.length+1),t=s.details.offset;o.products[t]=r;for(key in s.settings){if(o.UI.cart.elements[key]){if(o.UI.cart.elements[key].value){o.UI.cart.elements[key].value=s.settings[key]}else{o.UI.cart.elements[key]=s.settings[key]}}else{hiddenInput=document.createElement("input");hiddenInput.type="hidden";hiddenInput.name=key;hiddenInput.value=s.settings[key];o.UI.cart.appendChild(hiddenInput)}}if(r.isPlaceholder){return false}else{c.event.add(r.removeNode,"click",function(){d(r,t)});var q=r.quantityNode.value;c.event.add(r.quantityNode,"keyup",function(){var u=this;p=setTimeout(function(){var v=parseInt(u.value,10);if(!isNaN(v)&&v!=q){q=v;r.setQuantity(v);if(!r.getQuantity()){d(r,t)}o.updateSubtotal();c.storage.save(o.products)}},250)});o.UI.itemList.appendChild(r.liNode);c.util.animate(r.liNode,"opacity",{from:0,to:1});return true}};var d=function(p,q){if(typeof a.events.onRemoveFromCart=="function"){a.events.onRemoveFromCart.call(o,p)}p.setQuantity(0);p.quantityNode.style.display="none";c.util.animate(p.liNode,"opacity",{from:1,to:0},function(){c.util.animate(p.liNode,"height",{from:18,to:0},function(){try{p.liNode.parentNode.removeChild(p.liNode)}catch(y){}var z=o.UI.cart.getElementsByTagName("li"),r=z.length,x,u,A,w,v,t,s=1;for(v=0;v<r;v++){x=z[v].getElementsByTagName("input");u=x.length;for(t=0;t<u;t++){A=x[t];w=/(.+)_[0-9]+$/.exec(A.name);if(w&&w[1]){A.name=w[1]+"_"+s}}s++}if(typeof a.events.afterRemoveFromCart=="function"){a.events.afterRemoveFromCart.call(o,p)}})});o.products[q].details.item_name="";o.products[q].details.item_number="";o.updateSubtotal();c.storage.save(o.products)};var h=function(p){if(typeof a.events.onCheckout=="function"){a.events.onCheckout.call(o,p)}};o.calculateSubtotal=function(){var q,s,t,r,u,p=0;for(q=0,s=o.products.length;q<s;q++){if((t=o.products[q].details)){if(t.amount){r=t.amount;u=(t.discount_amount)?t.discount_amount:0;p+=parseFloat((r-u)*t.quantity)}}}return p.toFixed(2)};o.updateSubtotal=function(){var r,u,q=o.calculateSubtotal(),v=1,t,p,s;r="";u="";if(o.UI.cart.elements.currency_code){r=o.UI.cart.elements.currency_code.value||o.UI.cart.elements.currency_code}else{for(s=0,p=o.UI.cart.elements.length;s<p;s++){if(o.UI.cart.elements[s].name=="currency_code"){r=o.UI.cart.elements[s].value||o.UI.cart.elements[s];break}}}o.UI.subtotalAmount.innerHTML=c.util.formatCurrency(q,r);(function(){t=v.toString(16);v++;o.UI.subtotalAmount.style.backgroundColor="#ff"+t;if(v>=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="<br>#"+this.details.item_number}f=0;while(typeof this.details["on"+f]!=="undefined"){this.metaNode.innerHTML+="<br>"+this.details["on"+f]+": "+this.details["os"+f];f++}if(this.details.discount_amount){this.metaNode.innerHTML+="<br>";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;f<e;f++){g=j[f];h.push({details:g.details,settings:g.settings})}h=escape(JSON.stringify(h));localStorage.setItem(d,h)}},remove:function(){localStorage.removeItem(d)}}}else{return{load:function(){var l,j,h,g=d+"=",k,f;try{j=document.cookie.split(";");for(f=0;f<j.length;f++){h=j[f];while(h.charAt(0)===" "){h=h.substring(1,h.length)}if(h.indexOf(g)===0){k=h.substring(g.length,h.length);l=JSON.parse(unescape(k))}}}catch(m){}return l},save:function(l,k){var f=new Date(),j=[],h,e,g;if(l){for(g=0,e=l.length;g<e;g++){h=l[g];j.push({details:h.details,settings:h.settings})}k=k||30;f.setTime(f.getTime()+k*24*60*60*1000);document.cookie=a.name+"="+escape(JSON.stringify(j))+"; expires="+f.toGMTString()+"; path="+a.cookiePath}},remove:function(){this.save(null,-1)}}}}());c.event={cache:[],add:function(h,g,f,e){e=e||h;var d;if(h.addEventListener){d=function(j){f.call(e,j)};h.addEventListener(g,d,false)}else{if(h.attachEvent){d=function(){var j=window.event;j.target=j.target||j.srcElement;j.preventDefault=function(){j.returnValue=false};f.call(e,j)};h.attachEvent("on"+g,d)}}this.cache.push([h,g,f,d])},remove:function(k,h,g){var f,j,d,e;for(e=0;e<this.cache.length;e++){j=this.cache[e];if(j[0]==k&&j[1]==h&&j[2]==g){f=j[3];if(f){if(k.removeEventListener){k.removeEventListener(h,f,false)}else{if(k.detachEvent){k.detachEvent("on"+h,f)}}delete this.cache[e]}}}}};c.util={animate:function(e,j,d,h){d=d||{};d.from=d.from||0;d.to=d.to||0;d.duration=d.duration||10;d.unit=(/top|bottom|left|right|width|height/.test(j))?"px":"";var f=(d.to-d.from)/20;var g=d.from;(function(){e.style[j]=g+d.unit;g+=f;if((f>0&&g>d.to)||(f<0&&g<d.to)||f===0){e.style[j]=d.to+d.unit;if(typeof h==="function"){h()}return}setTimeout(arguments.callee,d.duration)})()},getInputValue:function(e){var d=e.tagName.toLowerCase();if(d=="select"){return e.options[e.selectedIndex].value}else{if(d=="textarea"){return e.innerHTML}else{if(e.type=="radio"){return(e.checked)?e.value:null}else{if(e.type=="checkbox"){return(e.checked)?e.value:null}else{return e.value}}}}},formatCurrency:function(f,g){var e={AED:{before:"\u062c"},ANG:{before:"\u0192"},ARS:{before:"$"},AUD:{before:"$"},AWG:{before:"\u0192"},BBD:{before:"$"},BGN:{before:"\u043b\u0432"},BMD:{before:"$"},BND:{before:"$"},BRL:{before:"R$"},BSD:{before:"$"},CAD:{before:"$"},CHF:{before:""},CLP:{before:"$"},CNY:{before:"\u00A5"},COP:{before:"$"},CRC:{before:"\u20A1"},CZK:{before:"Kc"},DKK:{before:"kr"},DOP:{before:"$"},EEK:{before:"kr"},EUR:{before:"\u20AC"},GBP:{before:"\u00A3"},GTQ:{before:"Q"},HKD:{before:"$"},HRK:{before:"kn"},HUF:{before:"Ft"},IDR:{before:"Rp"},ILS:{before:"\u20AA"},INR:{before:"Rs."},ISK:{before:"kr"},JMD:{before:"J$"},JPY:{before:"\u00A5"},KRW:{before:"\u20A9"},KYD:{before:"$"},LTL:{before:"Lt"},LVL:{before:"Ls"},MXN:{before:"$"},MYR:{before:"RM"},NOK:{before:"kr"},NZD:{before:"$"},PEN:{before:"S/"},PHP:{before:"Php"},PLN:{before:"z"},QAR:{before:"\ufdfc"},RON:{before:"lei"},RUB:{before:"\u0440\u0443\u0431"},SAR:{before:"\ufdfc"},SEK:{before:"kr"},SGD:{before:"$"},THB:{before:"\u0E3F"},TRY:{before:"TL"},TTD:{before:"TT$"},TWD:{before:"NT$"},UAH:{before:"\u20b4"},USD:{before:"$"},UYU:{before:"$U"},VEF:{before:"Bs"},VND:{before:"\u20ab"},XCD:{before:"$"},ZAR:{before:"R"}};var d=e[g],h="",j="";if(d){if(d.before){h=d.before}if(d.after){h=d.after}}return h+f+j}};if(!this.JSON){JSON={}}(function(){function h(f){return f<10?"0"+f:f}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(f){return this.getUTCFullYear()+"-"+h(this.getUTCMonth()+1)+"-"+h(this.getUTCDate())+"T"+h(this.getUTCHours())+":"+h(this.getUTCMinutes())+":"+h(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(f){return this.valueOf()}}var g=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,l,e,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},m;function d(f){k.lastIndex=0;return k.test(f)?'"'+f.replace(k,function(o){var p=n[o];return typeof p==="string"?p:"\\u"+("0000"+o.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}function j(u,r){var p,o,w,f,s=l,q,t=r[u];if(t&&typeof t==="object"&&typeof t.toJSON==="function"){t=t.toJSON(u)}if(typeof m==="function"){t=m.call(r,u,t)}switch(typeof t){case"string":return d(t);case"number":return isFinite(t)?String(t):"null";case"boolean":case"null":return String(t);case"object":if(!t){return"null"}l+=e;q=[];if(Object.prototype.toString.apply(t)==="[object Array]"){f=t.length;for(p=0;p<f;p+=1){q[p]=j(p,t)||"null"}w=q.length===0?"[]":l?"[\n"+l+q.join(",\n"+l)+"\n"+s+"]":"["+q.join(",")+"]";l=s;return w}if(m&&typeof m==="object"){f=m.length;for(p=0;p<f;p+=1){o=m[p];if(typeof o==="string"){w=j(o,t);if(w){q.push(d(o)+(l?": ":":")+w)}}}}else{for(o in t){if(Object.hasOwnProperty.call(t,o)){w=j(o,t);if(w){q.push(d(o)+(l?": ":":")+w)}}}}w=q.length===0?"{}":l?"{\n"+l+q.join(",\n"+l)+"\n"+s+"}":"{"+q.join(",")+"}";l=s;return w}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(q,o,p){var f;l="";e="";if(typeof p==="number"){for(f=0;f<p;f+=1){e+=" "}}else{if(typeof p==="string"){e=p}}m=o;if(o&&typeof o!=="function"&&(typeof o!=="object"||typeof o.length!=="number")){throw new Error("JSON.stringify")}return j("",{"":q})}}if(typeof JSON.parse!=="function"){JSON.parse=function(q,f){var p;function o(u,t){var s,r,w=u[t];if(w&&typeof w==="object"){for(s in w){if(Object.hasOwnProperty.call(w,s)){r=o(w,s);if(r!==undefined){w[s]=r}else{delete w[s]}}}}return f.call(u,t,w)}g.lastIndex=0;if(g.test(q)){q=q.replace(g,function(r){return"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(q.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){p=eval("("+q+")");return typeof f==="function"?o({"":p},""):p}throw new SyntaxError("JSON.parse")}}}())}());
