var NextId=1,Custom="Custom",GoogleCheckout="GoogleCheckout",PayPal="PayPal",Email="Email",AustralianDollar=AUD="AUD",CanadianDollar=CAD="CAD",CzechKoruna=CZK="CZK",DanishKrone=DKK="DKK",Euro=EUR="EUR",HongKongDollar=HKD="HKD",HungarianForint=HUF="HUF",IsraeliNewSheqel=ILS="ILS",JapaneseYen=JPY="JPY",MexicanPeso=MXN="MXN",NorwegianKrone=NOK="NOK",NewZealandDollar=NZD="NZD",PolishZloty=PLN="PLN",PoundSterling=GBP="GBP",SingaporeDollar=SGD="SGD",SwedishKrona=SEK="SEK",SwissFranc=CHF="CHF",USDollar=
USD="USD",English={PRICE:"price",QUANTITY:"quantity",TOTAL:"total"},PRICE="price",TOTAL="total",QUANTITY="quantity",TAX="tax",INFO="info";function setLanguage(a){PRICE=a.PRICE.toLowerCase();QUANTITY=a.QUANTITY.toLowerCase();TOTAL=a.TOTAL.toLowerCase()}
function Cart(){var a=this;a.Version="2.0.1";a.Shelf=new Shelf;a.items={};a.isLoaded=!1;a.pageIsReady=!1;a[QUANTITY]=0;a[TOTAL]=0;a.taxRate=0;a.taxCost=0;a.MWST7=0;a.MWST19=0;a.shippingFlatRate=0;a.shippingTotalRate=0;a.shippingQuantityRate=0;a.shippingRate=0;a.shippingCost=0;a.currency=USD;a.checkoutTo=PayPal;a.email="";a.merchantId="";a.cartHeaders=["Name","Price","Quantiy","Total","TAX"];a.add=function(){this.pageIsReady||(this.initializeView(),this.update());this.isLoaded||(this.load(),this.update());
var a=new CartItem;if(!arguments||arguments.length===0)error("No values passed for item.");else{var b=arguments;arguments[0]&&typeof arguments[0]!="string"&&typeof arguments[0]!="number"&&(b=arguments[0]);a.parseValuesFromArray(b);a.checkQuantityAndPrice();this.hasItem(a)?(b=this.hasItem(a),this.items[b][QUANTITY]=parseInt(this.items[b][QUANTITY],10)+parseInt(a[QUANTITY],10)):(this.items[a.id]=a,alert(this.items[a.id][INFO]));this.update()}};a.remove=function(a){var b={},d;for(d in this.items)d!=
a&&(b[d]=this.items[d]);this.items=b};a.empty=function(){simpleCart.items={};simpleCart.update()};a.find=function(c){if(!c)return null;var b=[],d;for(d in a.items){var f=a.items[d],e=!0,g;for(g in c)if(!f[g]||f[g]!=c[g])e=!1;e&&b.push(a.next)}return b.length==0?null:b};a.checkout=function(){if(simpleCart[QUANTITY]===0)error("Cart is empty");else switch(simpleCart.checkoutTo){case PayPal:simpleCart.paypalCheckout();break;case GoogleCheckout:simpleCart.googleCheckout();break;case Email:simpleCart.emailCheckout();
break;default:simpleCart.customCheckout()}};a.paypalCheckout=function(){var a=this,b="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&upload=1&business="+a.email+"&currency_code="+a.currency,d=1,f="";a=this;a.taxRate&&(b=b+"&tax_cart="+a.currencyStringForPaypalCheckout(a.taxCost));for(var e in a.items){var g=a.items[e],i="",h;for(h in g)typeof g[h]!="function"&&h!="id"&&h!=PRICE&&h!=QUANTITY&&h!="name"&&h!="shipping"&&(i=i+", "+h+"="+g[h]);i=i.substring(2);f=f+"&item_name_"+d+"="+g.name+"&item_number_"+
d+"="+d+"&quantity_"+d+"="+g[QUANTITY]+"&amount_"+d+"="+a.currencyStringForPaypalCheckout(g[PRICE])+"&on0_"+d+"=Options&os0_"+d+"="+i;d++}a.shipping()!=0&&(f=f+"&item_name_"+d+"=Shipping&item_number_"+d+"="+d+"&quantity_"+d+"=1&amount_"+d+"="+a.currencyStringForPaypalCheckout(a.shippingCost));b+=f;window.open(b,"paypal","scrollbars,location,resizable,status")};a.googleCheckout=function(){if(this.currency!=USD&&this.currency!=GBP)error("Google Checkout only allows the USD and GBP for currency.");else if(this.merchantId===
""||this.merchantId===null||!this.merchantId)error("No merchant Id for google checkout supplied.");else{var a=document.createElement("form"),b=1;a.style.display="none";a.method="POST";a.action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/"+this.merchantId;a.acceptCharset="utf-8";for(var d in this.items){var f=this.items[d];a.appendChild(this.createHiddenElement("item_name_"+b,f.name));a.appendChild(this.createHiddenElement("item_quantity_"+b,f[QUANTITY]));a.appendChild(this.createHiddenElement("item_price_"+
b,f[PRICE]));a.appendChild(this.createHiddenElement("item_currency_"+b,this.currency));a.appendChild(this.createHiddenElement("item_tax_rate_"+b,this.taxRate));a.appendChild(this.createHiddenElement("_charset_",""));var e="",g;for(g in f)typeof f[g]!="function"&&g!="id"&&g!=QUANTITY&&g!=PRICE&&(e=e+", "+g+": "+f[g]);e=e.substring(1);a.appendChild(this.createHiddenElement("item_description_"+b,e));b++}document.body.appendChild(a);a.submit();document.body.removeChild(a)}};a.emailCheckout=function(){var c=
a.updateCartView(document.createElement("div"));c="<div class='simpleCart_items'>"+c.innerHTML+"</div>";$.post("email.php",{div:c},function(a){alert(a)})};a.customCheckout=function(){};a.load=function(){this.items={};this[TOTAL]=0;this[QUANTITY]=0;if(readCookie("simpleCart"))for(var a=unescape(readCookie("simpleCart")).split("++"),b=0,d=a.length;b<d;b++){var f=a[b].split("||"),e=new CartItem;e.parseValuesFromArray(f)&&(e.checkQuantityAndPrice(),this.items[e.id]=e)}this.isLoaded=!0};a.save=function(){var a=
"",b;for(b in this.items)a=a+"++"+this.items[b].print();createCookie("simpleCart",a.substring(2),30)};a.initializeView=function(){this.totalOutlets=getElementsByClassName("simpleCart_"+TOTAL);this.quantityOutlets=getElementsByClassName("simpleCart_"+QUANTITY);this.cartDivs=getElementsByClassName("simpleCart_items");this.taxCostOutlets=getElementsByClassName("simpleCart_taxCost");this.taxRateOutlets=getElementsByClassName("simpleCart_taxRate");this.shippingCostOutlets=getElementsByClassName("simpleCart_shippingCost");
this.finalTotalOutlets=getElementsByClassName("simpleCart_finalTotal");this.addEventToArray(getElementsByClassName("simpleCart_checkout"),simpleCart.checkout,"click");this.addEventToArray(getElementsByClassName("simpleCart_empty"),simpleCart.empty,"click");this.Shelf.readPage();this.pageIsReady=!0};a.updateView=function(){a.updateViewTotals();a.cartDivs&&a.cartDivs.length>0&&a.updateCartView()};a.updateViewTotals=function(){for(var c=[[QUANTITY,"none"],[TOTAL,"currency"],["shippingCost","currency"],
["taxCost","currency"],["taxRate","percentage"],["finalTotal","currency"]],b=0,d=c.length;b<d;b++){var f=c[b][0]+"Outlets",e,g;for(g in a[f]){switch(c[b][1]){case "none":e=""+a[c[b][0]];break;case "currency":e=a.valueToCurrencyString(a[c[b][0]]);break;case "percentage":e=a.valueToPercentageString(a[c[b][0]]);break;default:e=""+a[c[b][0]]}a[f][g].innerHTML=""+e}}};a.updateCartView=function(c){var b=[],d,f,e,g,i,h,k,j,l;f=document.createElement("div");for(i in a.cartHeaders){h=document.createElement("div");
e=a.cartHeaders[i].split("_");h.innerHTML=e[0];h.className="item"+e[0];d=1;for(xlen=e.length;d<xlen;d++)if(e[d].toLowerCase()=="noheader")h.style.display="none";f.appendChild(h)}f.className="cartHeaders";b[0]=f;d=1;for(g in a.items){f=document.createElement("div");e=a.items[g];for(i in a.cartHeaders){h=document.createElement("div");k=a.cartHeaders[i].split("_");switch(k[0].toLowerCase()){case TOTAL:j=a.valueToCurrencyString(parseFloat(e[PRICE])*parseInt(e[QUANTITY],10));break;case "increment":j=a.valueToLink("+",
"javascript:;","onclick=\"simpleCart.items['"+e.id+"'].increment();\"");break;case "decrement":j=a.valueToLink("-","javascript:;","onclick=\"simpleCart.items['"+e.id+"'].decrement();\"");break;case "remove":j=a.valueToLink("x","javascript:;","onclick=\"simpleCart.items['"+e.id+"'].remove();\"");break;case PRICE:j=a.valueToCurrencyString(e[k[0].toLowerCase()]?e[k[0].toLowerCase()]:" ");break;default:j=e[k[0].toLowerCase()]?e[k[0].toLowerCase()]:" "}for(var m=1,n=k.length;m<n;m++)switch(l=k[m].toLowerCase(),
l){case "image":case "img":j=a.valueToImageString(j);break;case "input":j=this.valueToTextInput(j,"onchange=\"simpleCart.items['"+e.id+"'].set('"+k[0].toLowerCase()+"' , this.value);\"");break;case "div":case "span":case "h1":case "h2":case "h3":case "h4":case "p":j=a.valueToElement(l,j,"");break;case "noheader":break;default:error("unkown header option: "+l)}h.innerHTML=j;h.className="item"+k[0];f.appendChild(h)}f.className="itemContainer";b[d]=f;d++}if(c){for(;c.childNodes[0];)c.removeChild(c.childNodes[0]);
d=0;for(f=b.length;d<f;d++)c.appendChild(b[d]);return c}else for(g in a.cartDivs){for(c=a.cartDivs[g];c.childNodes[0];)c.removeChild(c.childNodes[0]);d=0;for(f=b.length;d<f;d++)c.appendChild(b[d])}};a.addEventToArray=function(a,b,d){for(var f in a){var e=a[f];e.addEventListener?e.addEventListener(d,b,!1):e.attachEvent&&e.attachEvent("on"+d,b)}};a.createHiddenElement=function(a,b){var d=document.createElement("input");d.type="hidden";d.name=a;d.value=b;return d};a.currencySymbol=function(){switch(a.currency){case JPY:return"&yen;";
case EUR:return"&euro;";case GBP:return"&pound;";case USD:case CAD:case AUD:case NZD:case HKD:case SGD:return"&#36;";default:return""}};a.currencyStringForPaypalCheckout=function(c){return a.currencySymbol()=="&#36;"?"$"+parseFloat(c).toFixed(2):""+parseFloat(c).toFixed(2)};a.valueToCurrencyString=function(c){return parseFloat(c).toCurrency(a.currencySymbol())};a.valueToPercentageString=function(a){return parseFloat(100*a)+"%"};a.valueToImageString=function(a){return a.match(/<\s*img.*src\=/)?a:'<img src="'+
a+'" />'};a.valueToTextInput=function(a,b){return'<input type="text" value="'+a+'" '+b+" />"};a.valueToLink=function(a,b,d){return'<a href="'+b+'" '+d+" >"+a+"</a>"};a.valueToElement=function(a,b,d){return"<"+a+" "+d+" > "+b+"</"+a+">"};a.hasItem=function(c){for(var b in a.items){var d=a.items[b],f=!0,e;for(e in c)typeof c[e]!="function"&&e!="quantity"&&e!="id"&&c[e]!=d[e]&&(f=!1);if(f)return b}return!1};a.update=function(){simpleCart.isLoaded||simpleCart.load();simpleCart.pageIsReady||simpleCart.initializeView();
a.updateTotals();a.updateView();a.save();var c=a.updateCartView(document.createElement("div"));c="<div class='simpleCart_items'>"+c.innerHTML+"</div>";document.getElementById("info").value=c;if(a.finalTotal==0){c=document.getElementById("korb");var b=document.getElementById("empty").innerHTML;c.innerHTML=b}};a.updateTotals=function(){a[TOTAL]=0;a[QUANTITY]=0;a.MWST7=0;$versandmwst=a.MWST19=0;for(var c in a.items){var b=a.items[c];b[QUANTITY]<1?b.remove():b[QUANTITY]!==null&&b[QUANTITY]!="undefined"&&
(a[QUANTITY]=parseInt(a[QUANTITY],10)+parseInt(b[QUANTITY],10));b[PRICE]&&(a[TOTAL]=parseFloat(a[TOTAL])+parseInt(b[QUANTITY],10)*parseFloat(b[PRICE]),b[TAX]==0.07&&(a.MWST7+=parseInt(b[QUANTITY],10)*parseFloat(b[PRICE])*0.07),b[TAX]==0.19&&(a.MWST19+=parseInt(b[QUANTITY],10)*parseFloat(b[PRICE])*0.19),$versandmwst+=parseInt(b[QUANTITY],10)*parseFloat(1.14))}a.shippingCost=a.shipping();a.taxCost=parseFloat(a.MWST7+a.MWST19+$versandmwst);a.finalTotal=a.shippingCost+a.taxCost+a[TOTAL]};a.shipping=function(){if(parseInt(a[QUANTITY],
10)===0)return 0;var c=parseFloat(a.shippingFlatRate)+parseFloat(a.shippingTotalRate)*parseFloat(a[TOTAL])+parseFloat(a.shippingQuantityRate)*parseInt(a[QUANTITY],10),b,d;for(d in a.items)b=a.items[d],b.shipping&&(c+=typeof b.shipping=="function"?parseFloat(b.shipping()):parseFloat(b.shipping));return c};a.initialize=function(){simpleCart.initializeView();simpleCart.load();simpleCart.update()}}function CartItem(){this.id="c"+NextId++}
CartItem.prototype.set=function(a,c){a=a.toLowerCase();typeof this[a]!="function"&&a!="id"?(a==QUANTITY?(c=c.replace(/[^(\d|\.)]*/gi,""),c=c.replace(/,*/gi,""),c=parseInt(c,10)):a==PRICE&&(c=c.replace(/[^(\d|\.)]*/gi,""),c=c.replace(/,*/gi,""),c=parseFloat(c)),typeof c=="number"&&isNaN(c)?error("Improperly formatted input."):(this[a]=c,this.checkQuantityAndPrice())):error("Cannot change "+a+", this is a reserved field.");simpleCart.update()};
CartItem.prototype.increment=function(){this[QUANTITY]=parseInt(this[QUANTITY],10)+1;simpleCart.update()};CartItem.prototype.decrement=function(){parseInt(this[QUANTITY],10)<2?this.remove():(this[QUANTITY]=parseInt(this[QUANTITY],10)-1,simpleCart.update())};CartItem.prototype.print=function(){var a="",c;for(c in this)typeof this[c]!="function"&&(a+=escape(c)+"="+escape(this[c])+"||");return a.substring(0,a.length-2)};
CartItem.prototype.checkQuantityAndPrice=function(){!this[QUANTITY]||this[QUANTITY]==null||this[QUANTITY]=="undefined"?(this[QUANTITY]=1,error("No quantity for item.")):(this[QUANTITY]=(""+this[QUANTITY]).replace(/,*/gi,""),this[QUANTITY]=parseInt((""+this[QUANTITY]).replace(/[^(\d|\.)]*/gi,""),10),isNaN(this[QUANTITY])&&(error("Quantity is not a number."),this[QUANTITY]=1));!this[PRICE]||this[PRICE]==null||this[PRICE]=="undefined"?(this[PRICE]=0,error("No price for item or price not properly formatted.")):
(this[PRICE]=(""+this[PRICE]).replace(/,*/gi,""),this[PRICE]=parseFloat((""+this[PRICE]).replace(/[^(\d|\.)]*/gi,"")),isNaN(this[PRICE])&&(error("Price is not a number."),this[PRICE]=0))};CartItem.prototype.parseValuesFromArray=function(a){if(a&&a.length&&a.length>0){for(var c=0,b=a.length;c<b;c++){a[c].replace(/||/,"| |");a[c].replace(/\+\+/,"+ +");var d=a[c].split("=");if(d.length>1){if(d.length>2)for(var f=2,e=d.length;f<e;f++)d[1]=d[1]+"="+d[f];this[unescape(d[0]).toLowerCase()]=unescape(d[1])}}return!0}else return!1};
CartItem.prototype.remove=function(){simpleCart.remove(this.id);simpleCart.update()};function Shelf(){this.items={}}Shelf.prototype.readPage=function(){this.items={};var a=getElementsByClassName("simpleCart_shelfItem"),c;for(c in a){var b=new ShelfItem;this.checkChildren(a[c],b);this.items[b.id]=b}};
Shelf.prototype.checkChildren=function(a,c){for(var b=0;a.childNodes[b];b++){var d=a.childNodes[b];if(d.className&&d.className.match(/item_[^ ]+/)){var f=/item_[^ ]+/.exec(d.className)[0].split("_");if(f[1]=="add"||f[1]=="Add"){f=[];f.push(d);var e=simpleCart.Shelf.addToCart(c.id);simpleCart.addEventToArray(f,e,"click");d.id=c.id}else c[f[1]]=d}d.childNodes[0]&&this.checkChildren(d,c)}};Shelf.prototype.empty=function(){this.items={}};
Shelf.prototype.addToCart=function(a){return function(){simpleCart.Shelf.items[a]?simpleCart.Shelf.items[a].addToCart():error("Shelf item with id of "+a+" does not exist.")}};function ShelfItem(){this.id="s"+NextId++}ShelfItem.prototype.remove=function(){simpleCart.Shelf.items[this.id]=null};
ShelfItem.prototype.addToCart=function(){var a=[],c,b;for(b in this)if(typeof this[b]!="function"&&b!="id"){c="";switch(b){case PRICE:if(this[b].value)c=this[b].value;else if(this[b].innerHTML)c=this[b].innerHTML;c=c.replace(/[^(\d|\.)]*/gi,"");c=c.replace(/,*/,"");break;case "image":c=this[b].src;break;default:c=this[b].value?this[b].value:this[b].innerHTML?this[b].innerHTML:this[b].src?this[b].src:this[b]}a.push(b+"="+c)}simpleCart.add(a)};
function createCookie(a,c,b){if(b){var d=new Date;d.setTime(d.getTime()+b*864E5);b="; expires="+d.toGMTString()}else b="";document.cookie=a+"="+c+b+"; path=/"}function readCookie(a){a+="=";for(var c=document.cookie.split(";"),b=0;b<c.length;b++){for(var d=c[b];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return d.substring(a.length,d.length)}return null}function eraseCookie(a){createCookie(a,"",-1)}
var getElementsByClassName=function(a,c,b){getElementsByClassName=document.getElementsByClassName?function(a,b,c){a=(c||document).getElementsByClassName(a);b=b?RegExp("\\b"+b+"\\b","i"):null;c=[];for(var g,i=0,h=a.length;i<h;i+=1)g=a[i],(!b||b.test(g.nodeName))&&c.push(g);return c}:document.evaluate?function(a,b,c){b=b||"*";c=c||document;var g=a.split(" "),i="",h=document.documentElement.namespaceURI==="http://www.w3.org/1999/xhtml"?"http://www.w3.org/1999/xhtml":null;a=[];for(var k,j=0,l=g.length;j<
l;j+=1)i+="[contains(concat(' ', @class, ' '), ' "+g[j]+" ')]";try{k=document.evaluate(".//"+b+i,c,h,0,null)}catch(m){k=document.evaluate(".//"+b+i,c,null,0,null)}for(;b=k.iterateNext();)a.push(b);return a}:function(a,b,c){b=b||"*";c=c||document;var g=a.split(" ");a=[];b=b==="*"&&c.all?c.all:c.getElementsByTagName(b);c=[];var i;i=0;for(var h=g.length;i<h;i+=1)a.push(RegExp("(^|\\s)"+g[i]+"(\\s|$)"));h=0;for(var k=b.length;h<k;h+=1){g=b[h];i=!1;for(var j=0,l=a.length;j<l;j+=1)if(i=a[j].test(g.className),
!i)break;i&&c.push(g)}return c};return getElementsByClassName(a,c,b)};String.prototype.reverse=function(){return this.split("").reverse().join("")};Number.prototype.withCommas=function(){for(var a=6,c=parseFloat(this).toFixed(2).toString().reverse();a<c.length;)c=c.substring(0,a)+","+c.substring(a),a+=4;return c.reverse()};Number.prototype.toCurrency=function(a){return(a?a:"$")+this.withCommas()};function error(a){try{console.log(a)}catch(c){}}var simpleCart=new Cart;
typeof jQuery!=="undefined"?$(document).ready(function(){simpleCart.initialize()}):typeof Prototype!=="undefined"?Event.observe(window,"load",function(){simpleCart.initialize()}):window.onload=simpleCart.initialize;

