// Mondo Shop 2 2.6.0.5 200406201132
function VATPrice(){this.value=0;this.quot=0;this.type=0;this.getValue=getValue;this.add=add;this.getValueNet=getValueNet;this.getVATPercent=getVATPercent;function getValue(){return MondoRound(this.value);}function add(val){this.value=this.value+MondoRound(val);}function getValueNet(){if(shop.config.readBool('ShowNetPrices'))return MakeNet(this.value,this.getVATPercent());else return MondoRound(this.value);}function getVATPercent(){return shop.VATList.getVATPercent(this.type);}}function PricesByVAT(toCopy){this.entries=new Array();this.quots=false;this.avrg=0;this.getTotal=getTotal;this.getTotalNet=getTotalNet;this.getTotalPrice=getTotalPrice;this.add=add;this.calcQuots=calcQuots;this.applyValue=applyValue;this.clear=clear;this.getNewPrices=getNewPrices;this.minus=minus;this.initList=initList;function initList(){if((this.entries.length==0)&&(shop.VATList!=null)){for(var i=0;i<shop.VATList.count();i++){var p=new VATPrice();p.type=shop.VATList.entries[i].type;this.entries[this.entries.length]=p;
}}}function minus(p){var erg=new PricesByVAT(this);if(p){for(var i=0;i<erg.entries.length;i++)erg.entries[i].add(-p.entries[i].getValue());}return erg;}function add(val,type){this.initList();for(var i=0;i<this.entries.length;i++)if(this.entries[i].type==type){this.entries[i].add(val);break;}}function clear(){for(var i=0;i<this.entries.length;i++){this.entries[i].value=0;this.entries[i].quot=0;}this.quots=false;this.avrg=0;}function getTotal(){var total=0;for(var i=0;i<this.entries.length;i++)total+=this.entries[i].getValue();return total;}function getTotalPrice(type){var erg=new SolePrice();if(type==null){erg.priceNet=0;erg.priceGross=0;for(var i=0;i<this.entries.length;i++){var p=this.entries[i];var pz=shop.VATList.getVATPercent(p.type);if(shop.config.readBool('ShowNetPrices')){erg.priceNet+=p.getValue();erg.priceGross+=MakeGross(p.getValue(),pz);}else{erg.priceGross+=p.getValue();erg.priceNet+=MakeNet(p.getValue(),pz);}}}else{for(var i=0;i<this.entries.length;i++){var p=this.entries[i];
if(p.type==type){erg.VATType=type;if(shop.config.readBool('ShowNetPrices'))erg.priceNet=p.getValue();else erg.priceGross=p.getValue();break;}}}return erg;}function calcQuots(){var total=this.getTotalNet();if(isNotNull(total)){this.avrg=0;for(var i=0;i<this.entries.length;i++){this.entries[i].quot=this.entries[i].getValueNet()/total;this.avrg+=this.entries[i].getVATPercent()*this.entries[i].quot;}var p=this.getTotalPrice();this.quots=true;}}function getNewPrices(value){var newval=new PricesByVAT(this);newval.applyValue(value);return newval;}function applyValue(value){var totalbefore=this.getTotal();value=MondoRound(value);if(!this.quots)this.calcQuots();if((!this.quots)||((totalbefore+value)<=0.000001)){for(var i=0;i<this.entries.length;i++)this.entries[i].value=0;}else{for(var i=0;i<this.entries.length;i++)this.entries[i].add(value*this.entries[i].quot);var totalsoll=totalbefore+value;var totalist=this.getTotal();var step=0.01;var count=Math.round((totalsoll-totalist)/step);if(count<0){count*=-1;step=-0.01;}
step=MondoRound(step);var vtype=0;for(var i=0;i<count;i++){this.entries[vtype].add(step);vtype++;if(vtype>=this.entries.length)vtype=0;}}}function getTotalNet(){var total=0;for(var i=0;i<this.entries.length;i++)total+=this.entries[i].getValueNet();return total;}if(toCopy!=null){this.quots=toCopy.quots;this.avrg=toCopy.avrg;for(var i=0;i<toCopy.entries.length;i++){var p=new VATPrice();p.value=toCopy.entries[i].value;p.quot=toCopy.entries[i].quot;p.type=toCopy.entries[i].type;this.entries[this.entries.length]=p;}}else{this.initList();}}function Voucher(){this.getTotalPrice=getTotalPrice;this.getTotalDeliveryPrice=getTotalDeliveryPrice;this.getOnlineDiscount=getOnlineDiscount;this.getPersonDiscount=getPersonDiscount;this.hasBankData=hasBankData;this.hasCCData=hasCCData;this.hasOnlinePaymentData=hasOnlinePaymentData;this.replaceAddress=replaceAddress;function replaceAddress(){var p=shop.payment.paymentMethod;if(p&&p.type==11)return true;return false;}function hasBankData(){var pm=shop.payment.getPaymentMethod();
if(pm)return((pm.type==1)||(pm.type==5));else return false;}function hasCCData(){var pm=shop.payment.getPaymentMethod();if(pm)return((pm.type==2)||(pm.type==6)||(pm.type==8));else return false;}function hasOnlinePaymentData(){var pm=shop.payment.getPaymentMethod();if(pm)return((pm.type==5)||(pm.type==6)||(pm.type==8)||(pm.type==11));else return false;}function getOnlineDiscount(total,VAT){if(shop.onlineDiscount==null)return 0;else{var disc=shop.onlineDiscount.value;if(shop.onlineDiscount.type==1)disc=total*disc/100;else disc=adjust(disc,VAT);return-MondoRound(disc);}}function getPersonDiscount(total){if(shop.user.discount)return-MondoRound(total*shop.user.discount/100);else return 0;}function getTotalDeliveryPrice(){var p0=shop.basket.getPricesByVAT(true);var p2=p0.getNewPrices(this.getOnlineDiscount(p0.getTotal(),p0.avrg));var p4=p2.getNewPrices(this.getPersonDiscount(p2.getTotal()));var p6=p4.getNewPrices(shop.payment.getMinAmountSurchargePrice(p4.getTotal(),p4.avrg).getPrice(1));
return p6.getTotal();}function getTotalPrice(step,type){var p0=shop.basket.getPricesByVAT();var t=(type==null)?null:type;if(step==0)return p0.getTotalPrice(t);var p2=p0.getNewPrices(this.getOnlineDiscount(p0.getTotal(),p0.avrg));if(step==2)return p2.getTotalPrice(t);var p1=p2.minus(p0);if(step==1)return p1.getTotalPrice(t);var p4=p2.getNewPrices(this.getPersonDiscount(p2.getTotal()));if(step==4)return p4.getTotalPrice(t);var p3=p4.minus(p2);if(step==3)return p3.getTotalPrice(t);var p6=p4.getNewPrices(shop.payment.getMinAmountSurchargePrice(p4.getTotal(),p4.avrg).getPrice(1));if(step==6)return p6.getTotalPrice(t);var p5=p6.minus(p4);if(step==5)return p5.getTotalPrice(t);var p8=p6.getNewPrices(shop.delivery.getDeliveryCost(this.getTotalDeliveryPrice(),p6.avrg,3));if(step==8)return p8.getTotalPrice(t);if(step==70){var p80=p6.getNewPrices(shop.delivery.getDeliveryCost(this.getTotalDeliveryPrice(),p6.avrg,0));var p70=p80.minus(p6);return p70.getTotalPrice(t);}if(step==71){var p81=p6.getNewPrices(shop.delivery.getDeliveryCost(this.getTotalDeliveryPrice(),p6.avrg,1));
var p71=p81.minus(p6);return p71.getTotalPrice(t);}if(step==72){var p82=p6.getNewPrices(shop.delivery.getDeliveryCost(this.getTotalDeliveryPrice(),p6.avrg,2));var p72=p82.minus(p6);return p72.getTotalPrice(t);}var p7=p8.minus(p6);if(step==7)return p7.getTotalPrice(t);var p10=p8.getNewPrices(shop.payment.getPaymentSurcharge(p6.avrg));if(step==10)return p10.getTotalPrice(t);var p9=p10.minus(p8);if(step==9)return p9.getTotalPrice(t);return null;}}function ArticleVariant(){this.mask=0;this.variantNo=0;this.available=true;this.dispNo='';this.description='';this.infoURL='';this.shortText='';this.longText='';this.hint='';this.quantityUnit=-1;this.lotSize=1;this.minQuantity=1;this.weight=0;this.stock=-1;this.fixedArtDisc=-1;this.discClass=-1;this.staggerClass=-1;this.noDeliveryCost=0;this.doNotCalcDeliveryCost=0;this.stockMinVal=-1;this.outAttributes=null;this.imageList=null;this.priceList=null;}function ArticleDef(){this.articleNo='';this.available=true;this.missingMessage='';this.templateFileName=null;
this.dataFileName=null;this.isInSearch=true;this.isInCrawlerData=true;this.combiMap=new Array();this.selAttrs=new SelAttrList();this.defaultValues=null;this.variants=new Array();this.stdVariant=0;this.crossRefs=null;this.inAttributeDefs=null;this.catalog=null;}function BA_getFormName(){return'SN_ArtListForm';}function BA_calcCombiIndex(){var erg=0;var fakt=1;for(var i=this.def.selAttrs.attributes.length-1;i>=0;i--){var attrib=this.def.selAttrs.attributes[i];erg+=this.currentCombi[i]*fakt;fakt*=attrib.values.values.length;}return erg;}function BA_applyInput(wnd,noselattrs){var form=wnd.document.SN_ArtListForm;if(form){var fn=this.getInputName();if(this.getInAttributeDefs()){for(var i=0;i<this.getInAttributeDefs().getCount();i++){var itemattr=this.getInAttributeDefs().getAttributeDef(i);var inatt=eval('form.'+fn+'customItemAttr'+itemattr.getNo()+';');if(inatt){this.getInAttributeValues().getAttributeValue(itemattr.getNo()).setValue(inatt.value);}}}if(!noselattrs){if(this.getSAList()){
for(var i=0;i<this.getSAList().attributes.length;i++){var selAttr=this.getSAList().getByNo(i);var sa=eval('form.'+fn+'selAttr'+selAttr.groupID+';');if(sa){this.setSAValue(selAttr.groupID,sa.options[sa.selectedIndex].value);}}}}var quan=eval('form.'+fn+'quantity;');if(quan){this.setQuantity(quan.value);quan.value=this.quantity;}}return true;}function BA_getArtNo(){return this.def.articleNo;}function BA_getVariantNo(){return this.def.combiMap[this.calcCombiIndex()];}function BA_getDispNo(){if(this.currentVariant&&(this.currentVariant.mask&(1<<3)))return this.currentVariant.dispNo;else if(this.def.selAttrs.attributes.length>0)return this.def.articleNo+'-'+this.getVariantNo();else return this.def.articleNo;}function BA_getStock(){return(this.currentVariant&&(this.currentVariant.mask&(1<<13)))?this.currentVariant.stock:this.def.defaultValues.stock;}function BA_stockMinVal(){return(this.currentVariant&&(this.currentVariant.mask&(1<<13)))?this.currentVariant.stockMinVal:this.def.defaultValues.stockMinVal;
}function BA_isOnStock(){var stock=this.getStock();return(stock>0);}function BA_isStockLow(){var stock=this.getStock();var minval=this.getStockMinVal();return((stock>0)&&(stock<=minval));}function BA_getCatNo(){return this.def.catalog.catNo;}function BA_getInfoURL(){return(this.currentVariant&&(this.currentVariant.mask&(1<<5)))?this.currentVariant.infoURL:this.def.defaultValues.infoURL;}function BA_getDescription(){return(this.currentVariant&&(this.currentVariant.mask&(1<<4)))?this.currentVariant.description:this.def.defaultValues.description;}function BA_getShortText(){return(this.currentVariant&&(this.currentVariant.mask&(1<<6)))?this.currentVariant.shortText:this.def.defaultValues.shortText;}function BA_getLongText(){return(this.currentVariant&&(this.currentVariant.mask&(1<<7)))?this.currentVariant.longText:this.def.defaultValues.longText;}function BA_getHint(){return(this.currentVariant&&(this.currentVariant.mask&(1<<8)))?this.currentVariant.hint:this.def.defaultValues.hint;
}function BA_getQuantityUnitObject(){var no=(this.currentVariant&&(this.currentVariant.mask&(1<<9)))?this.currentVariant.quantityUnit:this.def.defaultValues.quantityUnit;return((no>=0)&&shop.quantityUnitList)?shop.quantityUnitList.getQuantityUnitByID(no):null;}function BA_getQuantityUnit(){var obj=this.getQuantityUnitObject();return obj?this.getQuantityUnitObject().shortName:'';}function BA_getBaseQuantityUnit(){var obj=this.getQuantityUnitObject();return obj?obj.baseUnit:'';}function BA_getSingleBasePrice(){var p=new SolePrice();var obj=this.getQuantityUnitObject();var factor=obj?obj.baseFactor:1;var price=this.getPriceList().findPrice(this.getMinQuantity());if(factor==0)factor=1;p.setPrice(price.price);p.VATType=this.getPriceList().getVATType();p.minQuantity=price.minQuantity;p.baseFactor=factor;return this.applyFAD(p);}function BA_getBestBasePrice(){var p=new SolePrice();var obj=this.getQuantityUnitObject();var factor=obj?obj.baseFactor:1;var price=this.getPriceList().findBestPrice();
if(factor==0)factor=1;p.setPrice(price.price);p.VATType=this.getPriceList().getVATType();p.minQuantity=price.minQuantity;p.baseFactor=factor;return this.applyFAD(p);}function BA_getCurrentBasePrice(){var p=new SolePrice();var obj=this.getQuantityUnitObject();var factor=obj?obj.baseFactor:1;var price=this.getPriceList().findPrice(this.quantity);if(factor==0)factor=1;p.setPrice(price.price);p.VATType=this.getPriceList().getVATType();p.minQuantity=price.minQuantity;p.baseFactor=factor;return this.applyFAD(p);}function BA_getTotalPrice(){var p=this.getCurrentPrice();if(shop.config.readBool('ShowNetPrices')){p.priceNet=MondoRound(p.getPriceNet(0))*this.quantity;p.priceGross=null;}else{p.priceGross=MondoRound(p.getPriceGross(0))*this.quantity;p.priceNet=null;}p.discount=0;var sc=this.getStaggerClass();if(sc)p.discount=sc.getDiscount(this.quantity);return p;}function BA_getPersonalTotalPrice(){var p=this.getTotalPrice();if(shop.config.readBool('ShowNetPrices')){p.priceNet=MondoRound(p.getPriceNet(0));
p.priceGross=null;}else{p.priceGross=MondoRound(p.getPriceGross(0));p.priceNet=null;}p.discount=0;var rel=this.getDiscClassRel();if(rel){p.discount=rel.discount;if(shop.config.readBool('UseOnlyOneDiscount'))if(shop.config.readBool('FixedDiscountPriority')){var d=this.getFixedArtDisc();if(d){var c=shop.fixedArtDiscs?shop.fixedArtDiscs.getByID(d):null;if(c&&(c.discount>0))p.discount=0;}}}return p;}function BA_getDiscClassRel(){if(shop.user.loggedOn&&shop.discClassRels){var ac=this.getDiscountClass();var uc=shop.user.personDiscountClass;if(ac&&uc)return rel=shop.discClassRels.getByIDs(ac.id,uc.id);}return null;}function BA_getSinglePrice(){var p=new SolePrice();var price=this.getPriceList().findPrice(this.getMinQuantity());p.setPrice(price.price);p.minQuantity=price.minQuantity;p.VATType=this.getPriceList().getVATType();return this.applyFAD(p);}function BA_getBestPrice(){var p=new SolePrice();var price=this.getPriceList().findBestPrice();p.setPrice(price.price);p.minQuantity=price.minQuantity;
p.VATType=this.getPriceList().getVATType();return this.applyFAD(p);}function BA_getCurrentPrice(){var p=new SolePrice();var price=this.getPriceList().findPrice(this.quantity);p.setPrice(price.price);p.minQuantity=price.minQuantity;p.VATType=this.getPriceList().getVATType();return this.applyFAD(p);}function BA_getPriceListEntry(n){var p=new SolePrice();var price=this.getPriceList().getItem(n);p.setPrice(price.price);p.minQuantity=price.minQuantity;p.VATType=this.getPriceList().getVATType();return this.applyFAD(p);}function BA_getVATPercent(){return this.getPriceList().getVATPercent();}function BA_getVATType(){return this.getPriceList().getVATType();}function BA_getLotSize(){return(this.currentVariant&&(this.currentVariant.mask&(1<<10)))?this.currentVariant.lotSize:this.def.defaultValues.lotSize;}function BA_getMinQuantity(){return(this.currentVariant&&(this.currentVariant.mask&(1<<11)))?this.currentVariant.minQuantity:this.def.defaultValues.minQuantity;}function BA_hasWeight(){return(this.getWeight()>0);
}function BA_getWeight(){return(this.currentVariant&&(this.currentVariant.mask&(1<<12)))?this.currentVariant.weight:this.def.defaultValues.weight;}function BA_getTotalWeight(){return this.getWeight()*this.quantity;}function BA_getPriceList(){if(!this.isAvailable()){p=new PriceList();p.add(1,0.0);return p;}return(this.currentVariant&&(this.currentVariant.mask&(1<<16)))?this.currentVariant.priceList:this.def.defaultValues.priceList;}function BA_isAvailable(){return(this.currentVariant&&(this.currentVariant.mask&(1<<2)))?this.currentVariant.available:this.def.available;}function BA_isInSearch(){return this.def.isInSearch;}function BA_isInCrawlerData(){return this.def.isInCrawlerData;}function BA_isNoDeliveryCost(){return(this.currentVariant&&(this.currentVariant.mask&(1<<17)))?this.currentVariant.noDeliveryCost:this.def.defaultValues.noDeliveryCost;}function BA_isDoNotCalcDeliveryCost(){return(this.currentVariant&&(this.currentVariant.mask&(1<<18)))?this.currentVariant.doNotCalcDeliveryCost:this.def.defaultValues.doNotCalcDeliveryCost;
}function BA_getImages(){return(this.currentVariant&&(this.currentVariant.mask&(1<<21)))?this.currentVariant.imageList:this.def.defaultValues.imageList;}function BA_getInAttributeDefs(){return this.def.inAttributeDefs;}function BA_getOutAttribute(no){var obj=(this.currentVariant&&(this.currentVariant.mask&(1<<20)))?this.currentVariant.outAttributes:this.def.defaultValues.outAttributes;return obj?obj.getByNo(no):null;}function BA_getTemplateFileName(){return this.def.templateFileName?this.def.templateFileName:this.def.catalog.artTemplateFileName;}function BA_getSAList(){return this.def.selAttrs;}function BA_getSAValue(index){return this.def.selAttrs.attributes[index].values.values[this.currentCombi[index]];}function BA_setSAValue(index,ident){this.currentCombi[index]=ident;var no=this.def.combiMap[this.calcCombiIndex()];var foundVar=this.def.variants[no];if(foundVar)this.currentVariant=foundVar;else this.currentVariant=null;this.checkQuantity();return true;}function BA_getMissingMessage(){
return this.def.missingMessage;}function BA_getImageList(){return(this.currentVariant&&(this.currentVariant.mask&(1<<21)))?this.currentVariant.imageList:this.def.defaultValues.imageList;}function BA_hasPriceList(){return(this.getPriceList().count()>1);}function BA_hasBaseQuantityUnit(){var obj=this.getQuantityUnitObject();return obj?obj.hasBaseUnit():false;}function BA_hasQuantityUnit(){return(this.getQuantityUnitObject()!=null);}function BA_getQuantity(){this.checkQuantity(true);return this.quantity;}function BA_setQuantity(q){this.quantity=q;this.checkQuantity(false);}function BA_checkQuantity(silent){var orig=this.quantity;var origArticle;this.quantity=parseInt(this.quantity,10);if((this.quantity < this.getMinQuantity())||(isNaN(this.quantity))){this.quantity=this.getMinQuantity();}this.quantity=this.quantity-(this.quantity % this.getLotSize());if(orig!=this.quantity){origArticle=shop.article;shop.article=this;if(silent!=true)alert(toText(shop.shopTexts.getText('SN_AdjustOrderQuantity')));
shop.article=origArticle;}}function BA_getInAttributeValues(){return this.inAttributes;}function BA_needsApplyLink(){var salist=this.getSAList();var inlist=this.getInAttributeDefs();if(inlist)inlist=inlist.getCount();else inlist=0;if(salist)salist=salist.attributes.length;else salist=0;return(this.hasPriceList()||(salist!=0)||(inlist!=0));}function BA_canShowAsMatrix(){return(this.def.selAttrs.attributes.length==2);}function BA_getVariantIndex(){return this.calcCombiIndex();}function BA_getCrossRefs(){return this.def.crossRefs;}function BA_getFixedArtDisc(){return(this.currentVariant&&(this.currentVariant.mask&(1<<14)))?this.currentVariant.fixedArtDisc:this.def.defaultValues.fixedArtDisc;}function BA_applyFAD(p){var d=this.getFixedArtDisc();if(d>=0){var c=shop.fixedArtDiscs?shop.fixedArtDiscs.getByID(d):null;var rel=null;if(c){p.discount=c.discount;if(shop.config.readBool('UseOnlyOneDiscount')){if(!shop.config.readBool('FixedDiscountPriority')){rel=this.getDiscClassRel();if(rel)if(rel.discount>0)
p.discount=0;}}}}return p;}function BA_getStaggerClass(){var e=(this.currentVariant&&(this.currentVariant.mask&(1<<16)))?this.currentVariant.staggerClass:this.def.defaultValues.staggerClass;return((e>=0)&&shop.staggerClasses)?shop.staggerClasses.getByID(e):null;}function BA_getDiscountClass(){var e=(this.currentVariant&&(this.currentVariant.mask&(1<<15)))?this.currentVariant.discClass:this.def.defaultValues.discClass;return((e>=0)&&shop.persArtDiscClasses)?shop.persArtDiscClasses.getByID(e):null;}function BA_setCombiByIndex(no){for(var i=0;i<this.def.selAttrs.attributes.length;i++){var faktor=1;for(var j=i+1;j<this.def.selAttrs.attributes.length;j++)faktor*=this.def.selAttrs.attributes[j].values.values.length;this.currentCombi[i]=parseInt(no/faktor);no-=this.currentCombi[i]*faktor;}}function CA_getApplyLink(){var no='CAT'+this.def.catalog.catNo+'ART'+this.getArtNo();return'javascript:shop.retrieveObject(\''+no+'\').applyInput(window);';}function CA_getInputName(){return'ART_'+str2hex(this.getArtNo());
}function CA_getAddArticleLink(){return'javascript:'+this.getAddArticleCode();}function CA_getAddArticleCode(){var no='CAT'+this.def.catalog.catNo+'ART'+this.getArtNo();return'shop.retrieveObject(\''+no+'\').applyInput(window);'+'shop.basket.add(shop.retrieveObject(\''+no+'\').toBasket());';}function CA_getAddVariantLink(){var no='CAT'+this.def.catalog.catNo+'ART'+this.getArtNo();return'javascript:shop.basket.add(shop.retrieveObject(\''+no+'\').applyVariant('+this.getVariantIndex()+',window));';}function CA_setVariant(no){var v=this.def.variants[this.def.combiMap[no]];this.currentVariant=v?v:null;this.setCombiByIndex(no);}function CA_applyVariant(indexno,wnd){this.setVariant(indexno);this.applyInput(wnd,true);return this.toBasket();}function CA_toBasket(){if(shop.config.readBool('ShowArtHints')){var b=false;if(this.def.catalog.getHint()){h=this.def.catalog.getHint();b=true;}if(this.getHint()){h=b?h+'<br>'+this.getHint():this.getHint();b=true;}if(b)if(!confirm(toText(h)))return null;
}var Result=new Article(1);Result.def=this.def;Result.currentVariant=this.currentVariant;for(var i=0;i<this.currentCombi.length;i++)Result.currentCombi[i]=this.currentCombi[i];Result.quantity=this.quantity;shop.artStats.basketChange(Result.getArtNo(),Result.getVariantNo(),Result.quantity);if(this.getInAttributeDefs()){Result.inAttributes=new AttributeValueList();Result.inAttributes.assign(this.inAttributes);}if(shop.config.readBool('ResetArticleOnPutInBasket'))this.init();return Result;}function CA_init(){this.setCombiByIndex(this.def.stdVariant);this.quantity=this.getMinQuantity();var list=this.inAttributes;if(list){for(var i=0;i < list.getCount();i++)list.attributes[i].value='';}}function BasketArt_getApplyLink(){return'javascript:shop.basket.getByNo('+this.getPositionNo()+').applyInput(window);reloadFrame(window);';}function BasketArt_getInputName(){return'POS_'+this.getPositionNo();}function BasketArt_setSAValue(index,ident){var ret=this.inherited_setSAValue(index,ident);
return ret;}function BasketArt_getPositionNo(){return this.positionNo;}function BasketArt_setPositionNo(n){this.positionNo=n;}function BasketArt_setQuantity(q){var oldq=this.quantity;this.quantity=parseInt(q);if(isNaN(this.quantity)){this.checkQuantity(false);shop.notifyBasketChange();}else{this.checkQuantity(false);shop.notifyBasketChange();}shop.artStats.basketChange(this.getArtNo(),this.getVariantNo(),this.quantity-oldq);}function BasketArt_applyInput(wnd){if(this.inherited_applyInput(wnd))shop.notifyBasketChange();}function Article(type){this.def=null;this.inAttributes=new AttributeValueList();this.currentVariant=null;this.quantity=1;this.currentCombi=new Array();this.countVariants=getCountVariants;this.setCombiByIndex=BA_setCombiByIndex;this.calcCombiIndex=BA_calcCombiIndex;this.getTotalWeight=BA_getTotalWeight;this.getArtNo=BA_getArtNo;this.getVariantNo=BA_getVariantNo;this.getDispNo=BA_getDispNo;this.getCatNo=BA_getCatNo;this.getInfoURL=BA_getInfoURL;this.getDescription=BA_getDescription;
this.getShortText=BA_getShortText;this.getLongText=BA_getLongText;this.getHint=BA_getHint;this.getQuantityUnitObject=BA_getQuantityUnitObject;this.getQuantityUnit=BA_getQuantityUnit;this.getBaseQuantityUnit=BA_getBaseQuantityUnit;this.getVATPercent=BA_getVATPercent;this.getVATType=BA_getVATType;this.getLotSize=BA_getLotSize;this.getMinQuantity=BA_getMinQuantity;this.getWeight=BA_getWeight;this.getSinglePrice=BA_getSinglePrice;this.getSingleBasePrice=BA_getSingleBasePrice;this.getBestBasePrice=BA_getBestBasePrice;this.getBestPrice=BA_getBestPrice;this.getCurrentBasePrice=BA_getCurrentBasePrice;this.getCurrentPrice=BA_getCurrentPrice;this.getPriceListEntry=BA_getPriceListEntry;this.getTotalPrice=BA_getTotalPrice;this.getPriceList=BA_getPriceList;this.isAvailable=BA_isAvailable;this.isInSearch=BA_isInSearch;this.isInCrawlerData=BA_isInCrawlerData;this.getImageList=BA_getImageList;this.getInAttributeDefs=BA_getInAttributeDefs;this.getOutAttribute=BA_getOutAttribute;this.getTemplateFileName=BA_getTemplateFileName;
this.getSAList=BA_getSAList;this.getSAValue=BA_getSAValue;this.setSAValue=BA_setSAValue;this.getMissingMessage=BA_getMissingMessage;this.hasPriceList=BA_hasPriceList;this.hasBaseQuantityUnit=BA_hasBaseQuantityUnit;this.hasQuantityUnit=BA_hasQuantityUnit;this.checkQuantity=BA_checkQuantity;this.getQuantity=BA_getQuantity;this.setQuantity=BA_setQuantity;this.getInAttributeValues=BA_getInAttributeValues;this.getStock=BA_getStock;this.isOnStock=BA_isOnStock;this.getFormName=BA_getFormName;this.needsApplyLink=BA_needsApplyLink;this.canShowAsMatrix=BA_canShowAsMatrix;this.getVariantIndex=BA_getVariantIndex;this.getCrossRefs=BA_getCrossRefs;this.getFixedArtDisc=BA_getFixedArtDisc;this.applyFAD=BA_applyFAD;this.getStaggerClass=BA_getStaggerClass;this.getDiscountClass=BA_getDiscountClass;this.getPersonalTotalPrice=BA_getPersonalTotalPrice;this.applyInput=BA_applyInput;this.getDiscClassRel=BA_getDiscClassRel;this.isNoDeliveryCost=BA_isNoDeliveryCost;this.isDoNotCalcDeliveryCost=BA_isDoNotCalcDeliveryCost;
this.getStockMinVal=BA_stockMinVal;this.isStockLow=BA_isStockLow;if(type==0){this.init=CA_init;this.toBasket=CA_toBasket;this.getApplyLink=CA_getApplyLink;this.getInputName=CA_getInputName;this.getAddArticleLink=CA_getAddArticleLink;this.getAddArticleCode=CA_getAddArticleCode;this.getAddVariantLink=CA_getAddVariantLink;this.setVariant=CA_setVariant;this.applyVariant=CA_applyVariant;}if(type==1){this.inherited_setSAValue=BA_setSAValue;this.setSAValue=BasketArt_setSAValue;this.inherited_applyInput=this.applyInput;this.applyInput=BasketArt_applyInput;this.setQuantity=BasketArt_setQuantity;this.getPositionNo=BasketArt_getPositionNo;this.setPositionNo=BasketArt_setPositionNo;this.getApplyLink=BasketArt_getApplyLink;this.getInputName=BasketArt_getInputName;}function getCountVariants(){return this.def.combiMap.length;}}function ArticleList_applyInput(wnd){var form=wnd.document.SN_ArtListForm;if(form){for(var i=0;i<this.entries.length;i++){var art=this.entries[i];var fn=art.getInputName();
if(art.getInAttributeDefs()){for(var j=0;j<art.getInAttributeDefs().getCount();j++){var itemattr=art.getInAttributeDefs().getAttributeDef(j);var inatt=eval('form.'+fn+'customItemAttr'+itemattr.getNo()+';');if(inatt){art.getInAttributeValues().getAttributeValue(itemattr.getNo()).setValue(inatt.value);}}}if(art.getSAList()){for(var j=0;j<art.getSAList().attributes.length;j++){var selAttr=art.getSAList().getByNo(j);var sa=eval('form.'+fn+'selAttr'+selAttr.groupID+';');if(sa){art.setSAValue(selAttr.groupID,sa.options[sa.selectedIndex].value);}}}var quan=eval('form.'+fn+'quantity;');if(quan){art.setQuantity(quan.value);quan.value=art.getQuantity();}}}}function ArticleList_add(art){this.entries[this.entries.length]=art;}function ArticleList_count(){return this.entries.length;}function ArticleList_getByNo(no){return this.entries[no];}function Catalog(){this.catNo='';this.parentCat='';this.artCount=0;this.description='';this.hint='';this.hasData=false;this.hasSubCats=0;this.linkDesign='';
this.alTemplateFileName='';this.catTemplateFileName='';this.hideInNavigation=false;this.shortText='';this.longText='';this.link='';this.artTemplateFileName='';this.maxCountPerSeg=0;this.thumbWidth=0;this.thumbHeight=0;this.imageList=null;this.entries=new Array();this.subCats=new Array();this.path=new Array();this.search=null;this.entriesLoaded=false;this.activeSegment=1;this.segments=new SegmentList();this.navLoaded=false;this.otherLoaded=false;this.subsLoaded=false;this.inherited_add=ArticleList_add;this.getByNo=ArticleList_getByNo;this.add=add;this.count=count;this.getByNo=getByNo;this.getCatNo=getCatNo;this.getDescription=getDescription;this.getShortText=getShortText;this.getLongText=getLongText;this.getHint=getHint;this.getLink=getLink;this.getAlTemplateFileName=getAlTemplateFileName;this.getCatTemplateFileName=getCatTemplateFileName;this.getArtTemplateFileName=getArtTemplateFileName;this.getImageList=getImageList;this.getFormName=BA_getFormName;this.applyInput=ArticleList_applyInput;
this.getSegmentCount=getSegmentCount;this.getHasNextSegment=getHasNextSegment;this.getNextSegmentURL=getNextSegmentURL;this.getHasPrevSegment=getHasPrevSegment;this.getPrevSegmentURL=getPrevSegmentURL;this.getArticleListURL=getArticleListURL;this.setSegment=setSegment;this.addCatImage=addCatImage;this.addSubCat=addSubCat;this.getSubCatCount=getSubCatCount;this.getSubCat=getSubCat;function addCatImage(){if(this.imageList==null)this.imageList=new ImageList();var im=new _Image();this.imageList.entries[this.imageList.entries.length]=im;return im;}function getHasNextSegment(){var sc=this.getSegmentCount();if((sc>1)&&(this.activeSegment < sc))return true;else return false;}function getNextSegmentURL(){return this.getArticleListURL()+'&seg='+(this.activeSegment+1);}function getHasPrevSegment(){if(this.activeSegment > 1)return true;else return false;}function getPrevSegmentURL(){return this.getArticleListURL()+'&seg='+(this.activeSegment-1);}function setSegment(s){var no=parseInt(s);
if(isNaN(no))return;if((no>0)&&(no<=this.getSegmentCount()))this.activeSegment=no;else this.activeSegment=1;}function getArticleListURL(){var templ;var func=shop.frameSetup.getFunctionByName('SN_ArticleList');if(this.alTemplateFileName)templ=this.alTemplateFileName;else if(func)templ=func.templateFile;else return'';return templ+'?cat='+mmescape(this.catNo);}function addSubCat(c){var cat=shop.catList.getByName(c);if(cat==null){cat=new Catalog();cat.catNo=c;shop.catList.add(c,cat);}this.subCats[this.subCats.length]=cat;for(var i=0;i<this.path.length;i++){cat.path[i]=this.path[i];}var hideFirstLevel=shop.config.readBool('HideRootCatalog');if(!(hideFirstLevel&&(this.catNo=='0'))){cat.path[cat.path.length]=this;}}function getSubCatCount(){return this.subCats.length;}function getSubCat(no){return this.subCats[no];}function getCatNo(){return this.catNo;}function getDescription(){return this.description;}function getShortText(){return this.shortText;}function getLongText(){return this.longText;}
function getHint(){return this.hint;}function getLink(){return this.link;}function getAlTemplateFileName(){return this.alTemplateFileName;}function getCatTemplateFileName(){return this.catTemplateFileName;}function getArtTemplateFileName(){return this.artTemplateFileName;}function add(art){this.inherited_add(art);art.def.catalog=this.catNo;}function getImageList(){return this.imageList;}function getSegmentCount(){if(this.maxCountPerSeg>0)return Math.ceil(this.entries.length/this.maxCountPerSeg);else return 1;}function count(){var artCount=this.entries.length;var c;if(this.maxCountPerSeg>0){c=this.maxCountPerSeg;if(artCount<this.activeSegment*c)c=artCount-(this.activeSegment-1)*c}else{c=artCount;}return c;}function getByNo(no){return this.entries[(this.activeSegment-1)*this.maxCountPerSeg+no];}}function Segment(n){this.no=n;this.getNo=getNo;this.getURL=getURL;this.isActive=isActive;function getNo(){return this.no;}function getURL(){return shop.cat.getArticleListURL()+'&seg='+this.no;
}function isActive(){return(this.no==shop.cat.activeSegment);}}function SegmentList(){this.getByNo=getByNo;this.count=count;function getByNo(n){if((n>=0)&&(n<shop.cat.getSegmentCount()))return new Segment(n+1);else return null;}function count(){return shop.cat.getSegmentCount();}}function Basket(){this.entries=new Array();this.orderTime=new Date();this.changed=true;this.pricesByVAT=new PricesByVAT();this.dPricesByVAT=new PricesByVAT();this.count=ArticleList_count;this.getByNo=ArticleList_getByNo;this.add=add;this.refreshTotalPrice=refreshTotalPrice;this.getPricesByVAT=getPricesByVAT;this.getArticleCount=getArticleCount;this.isEmpty=isEmpty;this.clear=clear;this.remove=remove;this.getTotalWeight=getTotalWeight;this.getFormName=BA_getFormName;this.applyInput=ArticleList_applyInput;this.getOrderDate=getOrderDate;this.setModified=setModified;this.isNoDeliveryCost=isNoDeliveryCost;function isNoDeliveryCost(){var calcno=0;for(var i=0;i<this.entries.length;i++){if(this.entries[i].isNoDeliveryCost())return true;
if(this.entries[i].isDoNotCalcDeliveryCost())calcno++;}if(calcno==this.entries.length)return true;return false;}function setModified(){this.changed=true;}function refreshTotalPrice(){if(this.changed){this.pricesByVAT.clear();this.dPricesByVAT.clear();for(var i=0;i<this.entries.length;i++){var val=this.entries[i].getPersonalTotalPrice().getPrice(0);var vattype=this.entries[i].getVATType();this.pricesByVAT.add(val,vattype);if(!this.entries[i].isDoNotCalcDeliveryCost())this.dPricesByVAT.add(val,vattype);}this.changed=false;}}function getPricesByVAT(delivery){this.refreshTotalPrice();return delivery?this.dPricesByVAT:this.pricesByVAT;}function getOrderDate(){this.orderTime=new Date();return this.orderTime;}function remove(n){var origArticle;if(shop.config.readBool('RemoveArticleFromBasketConfirm')){origArticle=shop.article;shop.article=this.getByNo(n);if(!confirm(toText(shop.shopTexts.getText('SN_AskRemoveFromBasket')))){shop.article=origArticle;return false;}shop.article=origArticle;}for(var i=n;i < this.entries.length-1;i++){
this.entries[i]=this.entries[i+1];this.entries[i].setPositionNo(i);}this.entries.length=this.entries.length-1;shop.notifyBasketChange();return true;}function getTotalWeight(){var w=0;for(var i=0;i < this.entries.length;i++)if(!this.entries[i].isDoNotCalcDeliveryCost())w+=this.entries[i].getTotalWeight();return w;}function getArticleCount(){var c;c=0;for(var i=0;i < this.count();i++){c+=this.entries[i].getQuantity();}return c;}function getPositionCount(){return this.count();}function isEmpty(){return(this.count()==0);}function clear(){if(shop.config.readBool('EmptyBasketAfterConfirm')){if(confirm(toText(shop.shopTexts.getText('SN_AskClearBasket')))){this.entries.length=0;shop.notifyBasketChange();}}}function add(art){if(!art)return;if(!art.isAvailable()){alert(art.getMissingMessage());return;}if(shop.config.readBool('BlockAddSameArticle')){for(var j=0;j<this.entries.length;j++){var bart=this.entries[j];var iad=bart.getInAttributeDefs();if(iad)iad=iad.getCount();else iad=0;
if((bart.getArtNo()==art.getArtNo())&&(bart.getVariantNo()==art.getVariantNo())&&(iad==0)){if(confirm(shop.shopTexts.getText('SN_ErrorAddSameArticle'))){shop.showFunction('SN_ShowBasket');}return;}}}var show=false;var frame=null;var c=this.entries.length;this.entries[c]=art;this.setModified();art.setPositionNo(c);if(shop.decideShowBasket()){shop.showFunction('SN_ShowBasket');show=true;frame=shop.frameSetup.getFunctionByName('SN_ShowBasket').frameName}for(var i=0;i<shop.frameSetup.startPages.length;i++){if(shop.frameSetup.startPages[i].autoReload){if((show&&(frame!=shop.frameSetup.startPages[i].frameName))||!show){var f=findFrame(shop.frameSetup.startPages[i].frameName);reloadFrame(f);}}}}}function ArtStat(){this.artNo=null;this.varNo=null;this.hits=0;this.inBskt=0;this.outBskt=0;}function CatStat(){this.catNo=null;this.hits=0;}function ArtStatList(){this.entries=new Array();this.add=CList_add;this.count=CList_count;this.getByNo=CList_getByNo;this.getByArtVarNo=getByArtVarNo;this.basketChange=basketChange;
this.incHits=incHits;this.clear=CList_clear;function basketChange(artNo,varNo,n){var v=this.getByArtVarNo(artNo,varNo);if(n<0)v.outBskt-=n;else v.inBskt+=n;}function getByArtVarNo(artNo,varNo){var v=null;for(var i=0;i<this.count();i++)if((this.entries[i].artNo==artNo)&&(this.entries[i].varNo==varNo))v=this.entries[i];if(v==null){v=new ArtStat();v.artNo=artNo;v.varNo=varNo;this.add(v);}return v;}function incHits(artNo,varNo){this.getByArtVarNo(artNo,varNo).hits++;}}function CatStatList(){this.entries=new Array();this.add=CList_add;this.count=CList_count;this.getByNo=CList_getByNo;this.incHits=incHits;this.clear=CList_clear;function incHits(catNo){var cat=null;for(var i=0;i<this.count();i++)if(this.entries[i].catNo==catNo){cat=this.entries[i].hits++;break;}if(cat==null){cat=new CatStat();cat.catNo=catNo;this.add(cat);}cat.hits++;}}function CrossRef(){this.catNo=null;this.artNo=null;this.text=null;this.img=null;this.getCrossRefLink=getCrossRefLink;function getCrossRefLink(){return'javascript:shop.showArticle(\''+this.catNo+'\',\''+this.artNo+'\');';
}}function CrossRefList(){this.entries=new Array();this.add=CList_add;this.count=CList_count;this.getByNo=CList_getByNo;}
jsl=true;
