home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / chipshop / shop / web66.js
Text File  |  2000-09-12  |  43KB  |  431 lines

  1. /*#########################################################################
  2. #
  3. #        web66.js v2.04
  4. #        ⌐ 1999-2000 MedienTeam66 (www.web66.de)
  5. #
  6. #        JavaScript Shopping Cart Software
  7. #
  8. #        by Joerg Weishaupt
  9. #
  10. #        created            Jul 24, 1999
  11. #        last modified    Apr  6, 2000
  12. #
  13. #        Unauthorized usage, removal of this copyright notice
  14. #        and excerption of code snippets forbidden!
  15. #        Please get written agreement from MedienTeam66 before
  16. #        doing any modifications within this script!
  17. #
  18. #########################################################################*/
  19. function browserVersion()
  20. {var strAgent=navigator.userAgent.toLowerCase();this.nMajor=parseInt(navigator.appVersion);this.nMinor=parseFloat(navigator.appVersion);this.bNS=((strAgent.indexOf('mozilla')!= -1)&&((strAgent.indexOf('spoofer')== -1)&&(strAgent.indexOf('compatible')== -1)));this.bNS2=(this.bNS&&(this.nMajor==2));this.bNS3=(this.bNS&&(this.nMajor==3));this.bNS4b=(this.bNS&&(this.nMinor<4.04));this.bNS4=(this.bNS&&(this.nMajor>=4));this.bIE=(strAgent.indexOf("msie")!= -1);this.bIE3=(this.bIE&&(this.nMajor==2));this.bIE4=(this.bIE&&(this.nMajor>=4));this.bOP3=(strAgent.indexOf("opera")!= -1);this.bWin=(strAgent.indexOf("win")!= -1);this.bMac=(strAgent.indexOf("mac")!= -1);this.bUnix=(strAgent.indexOf("x11")!= -1);this.bCSS=(this.bIE4||this.bNS4||this.bOP3);}var objAgent=new browserVersion();function web66Shop()
  21. {this.strName='';this.fltMaxQuantity=0;this.nMaxItems=0;this.strCurrency1='';this.strCurrency2='';this.strCurrencyCode='';this.strDecimalSep=',';this.strThousandSep='.';this.bVATInclusive=true;this.fltExchangeRate=1;this.strFormAction='';this.nDecimals=2;this.bDecimalQuantity=false;this.nQuantityDecimals=0;this.strChecked='Ja';this.strNotChecked='Nein';this.bTabular=false;this.strBgColor='';this.strValue='';this.strTotal='';this.strVAT='';this.bCookie=false;this.strMinQuantityAlert='';this.strMaxQuantityAlert='';this.strMaxItemAlert='';this.strCartEmptyAlert='';this.strObject='';this.objHeaderFont=new cartFont();this.objDataFont=new cartFont();this.objCaptionFont=new cartFont();this.bUpdate=false;this.bUpdateVariable=false;this.bDelete=false;this.nHeaderFields=0;this.objHeaderFields=new Array();this.nDataFields=0;this.objDataFields=new Array();this.nPaymentOptions=0;this.objPaymentOptions=new Array();this.nSelectedPayment=0;this.nPaymentFields=0;this.objPaymentFields=new Array();this.nCartImages=0;this.objCartImages=new Array();this.nCharges=0;this.objCharges=new Array();this.nRebates=0;this.objRebates=new Array();this.nHiddenFields=0;this.objHiddenFields=new Array();this.nPositions=0;this.objPositions=new Array();this.fltTotal=0;this.bSum=false;this.bEven=false;this.setSource=shopSetSource;this.setHeaderFont=cartSetHeaderFont;this.setDataFont=cartSetDataFont;this.setCaptionFont=cartSetCaptionFont;this.addHeaderField=cartAddHeaderField;this.addDataField=cartAddDataField;this.addPaymentOption=cartAddPaymentOption;this.addPaymentField=cartAddPaymentField;this.addCartImage=cartAddImage;this.addCharge=cartAddCharge;this.addRebate=cartAddRebate;this.addHiddenField=cartAddHiddenField;this.addPosition=cartAddPosition;this.deletePosition=cartDeletePosition;this.searchPosition=cartSearchPosition;this.increaseQuantity=cartIncreaseQuantity;this.decreaseQuantity=cartDecreaseQuantity;this.updateQuantity=cartUpdateQuantity;this.hasPositions=cartHasPositions;this.clearCart=cartClear;this.printCart=cartPrint;this.printHeader=cartPrintHeader;this.printPositions=cartPrintPositions;this.printAmount=cartPrintAmount;this.printOrderForm=cartPrintOrderForm;this.printPaymentForm=cartPrintPaymentForm;this.printSubmitForm=cartPrintSubmitForm;this.onSubmit=cartOnSubmit;this.printRule=cartPrintRule;this.reloadCart=cartReload;this.calcCharge=cartCalcCharge;this.calcRebate=cartCalcRebate;this.checkRequired=cartCheckRequired;}function shopSetSource(strFrame)
  22. {if((strFrame.length>0)&&(strFrame.charAt(strFrame.length-1)!='.'))
  23. strFrame+='.';this.strObject=strFrame+this.strName+'.';}function cartSetHeaderFont(strFace,strSize,strColor,bBold,bItalic,bUnderline,strClass)
  24. {var strOptional='';if(arguments.length==7)
  25. strOptional=strClass;this.objHeaderFont.strFace=strFace;this.objHeaderFont.strSize=strSize;this.objHeaderFont.strColor=strColor;this.objHeaderFont.bBold=bBold;this.objHeaderFont.bItalic=bItalic;this.objHeaderFont.bUnderline=bUnderline;this.objHeaderFont.strClass=strOptional;}function cartSetDataFont(strFace,strSize,strColor,bBold,bItalic,bUnderline,strClass)
  26. {var strOptional='';if(arguments.length==7)
  27. strOptional=strClass;this.objDataFont.strFace=strFace;this.objDataFont.strSize=strSize;this.objDataFont.strColor=strColor;this.objDataFont.bBold=bBold;this.objDataFont.bItalic=bItalic;this.objDataFont.bUnderline=bUnderline;this.objDataFont.strClass=strOptional;}function cartSetCaptionFont(strFace,strSize,strColor,bBold,bItalic,bUnderline,strClass)
  28. {var strOptional='';if(arguments.length==7)
  29. strOptional=strClass;this.objCaptionFont.strFace=strFace;this.objCaptionFont.strSize=strSize;this.objCaptionFont.strColor=strColor;this.objCaptionFont.bBold=bBold;this.objCaptionFont.bItalic=bItalic;this.objCaptionFont.bUnderline=bUnderline;this.objCaptionFont.strClass=strOptional;}function cartAddHeaderField(strHeader,nAlign,nColumnType,nWidth,strClass)
  30. {var strOptClass='';if((nAlign<1)||(nAlign>3)||(isNaN(nAlign)))
  31. {alert('Der Wert fⁿr die horizontale Ausrichtung der Spalte "'+strHeader+'" ist ungⁿltig !');return;}if((nColumnType<1)||(nColumnType>6)||(isNaN(nColumnType)))
  32. {alert('Der Wert fⁿr den Inhalt der Spalte "'+strHeader+'" ist ungⁿltig!');return;}if((nWidth<0)||(nWidth>100)||(isNaN(nWidth)))
  33. {alert('Der Wert fⁿr die Breite der Spalte "'+strHeader+'" ist ungⁿltig !');return;}if(arguments.length>4)
  34. {strOptClass=strClass;}if(nColumnType==5)
  35. {this.bSum=true;}this.objHeaderFields[++this.nHeaderFields]=new cartHeaderField(strHeader,nAlign,nColumnType,nWidth,strOptClass);}function cartAddDataField(strName,strCaption,nType,nCols,nRows,bRequired,varDefault)
  36. {var varOptional;if((nType<1)||(nType>5)||(isNaN(nType)))
  37. {alert('Der Wert fⁿr die Art des Eingabefeldes "'+strName+'" ist ungⁿltig !');return;}if(arguments.length==7)
  38. {varOptional=varDefault;}else
  39. {if(nType<5)
  40. {varOptional='';}else
  41. {varOptional=false;}}this.objDataFields[++this.nDataFields]=new cartDataField('',strName,strCaption,nType,nCols,nRows,bRequired,this.nDataFields,varOptional);}function cartAddPaymentOption(strPayment,fltExtraCharge,fltVAT,strExtraCharge)
  42. {var strOptional='';if(arguments.length==4)
  43. strOptional=strExtraCharge;this.objPaymentOptions[++this.nPaymentOptions]=new cartPaymentOption(strPayment,fltExtraCharge,fltVAT,strOptional,this.nPaymentOptions);if(this.nPaymentOptions==1)
  44. {this.nSelectedPayment=1;}}function cartAddPaymentField(strPayment,strName,strCaption,nType,nCols,nRows,bRequired,varDefault)
  45. {var varOptional;if((nType<1)||(nType>5)||(isNaN(nType)))
  46. {alert('Der Wert fⁿr die Art des Eingabefeldes "'+strName+'" ist ungⁿltig !');return;}if(arguments.length==8)
  47. {varOptional=varDefault;}else
  48. {if(nType<5)
  49. {varOptional='';}else
  50. {varOptional=false;}}this.objPaymentFields[++this.nPaymentFields]=new cartDataField(strPayment,strName,strCaption,nType,nCols,nRows,bRequired,this.nPaymentFields,varOptional);}function cartAddImage(strImage,nType,strAlt,nWidth,nHeight)
  51. {var nOptionalWidth=0;var nOptionalHeight=0;if((nType<1)||(nType>4)||(isNaN(nType)))
  52. {alert('Der Typ fⁿr das angegebene Bild ist ungⁿltig !');return;}else if(nType==2||nType==3)
  53. this.bUpdate=true;else if(nType==4)
  54. {this.bUpdate=true;this.bUpdateVariable=true;}else
  55. this.bDelete=true;if(arguments.length==5)
  56. {nOptionalWidth=nWidth;nOptionalHeight=nHeight;}this.objCartImages[++this.nCartImages]=new cartImage(strImage,nType,strAlt,nOptionalWidth,nOptionalHeight);}function cartAddCharge(strName,nType,fltValue,fltVAT,fltLimit)
  57. {var fltOptional=0;if((nType<1)||(nType>3)||(isNaN(nType)))
  58. {alert('Der Typ fⁿr die angegebenen Kosten ist ungⁿltig !');return;}if(arguments.length==5)
  59. {fltOptional=fltLimit;}this.objCharges[++this.nCharges]=new cartCharge(strName,nType,fltValue,fltVAT,fltLimit);}function cartAddRebate(strName,nType,fltValue,fltLimit)
  60. {var fltOptional=0;if((nType<1)||(nType>3)||(isNaN(nType)))
  61. {alert('Der Typ fⁿr den angegebenen Rabatt ist ungⁿltig !');return;}if(arguments.length==4)
  62. {fltOptional=fltLimit;}this.objRebates[++this.nRebates]=new cartRebate(strName,nType,fltValue,fltLimit);}function cartAddHiddenField(strName,strValue)
  63. {this.objHiddenFields[++this.nHiddenFields]=new cartHiddenField(strName,strValue);}function cartAddPosition(objForm,strMsg)
  64. {var nQuantity=0;var fltPrice=0;var fltVAT=0;var nPos=0;var fltMinQuantity=0;var fltMaxQuantity=0;var fltWeight=0;var objElement=null;var strProductCode='';var strProductName='';var nVariants=0;var strVariants='';for(var i=0;i<objForm.length;i++)
  65. {objElement=objForm.elements[i];if(objElement.type=='text'&&objElement.name=='Quantity')
  66. {nQuantity=0+((this.bDecimalQuantity)?(stringToFloat(objElement.value,this.strDecimalSep,'')):(parseInt(objElement.value)));if(isNaN(nQuantity))
  67. {alert('Nur numerische Werte erlaubt !');return;}if(strMsg!=null)
  68. {strMsg=strMsg.replace('<QUANTITY>',objElement.value);}}else if(objElement.type=='hidden')
  69. {if(objElement.name=='MinOrder')
  70. {fltMinQuantity=stringToFloat(objElement.value,this.strDecimalSep,this.strThousandSep);}else if(objElement.name=='MaxOrder')
  71. {fltMaxQuantity=stringToFloat(objElement.value,this.strDecimalSep,this.strThousandSep);}else if(objElement.name=='Weight')
  72. {fltWeight=stringToFloat(objElement.value,this.strDecimalSep,this.strThousandSep);}else if(objElement.name=='Code')
  73. {strProductCode=objElement.value;}else if(objElement.name=='Name')
  74. {strProductName=objElement.value;}else if(objElement.name=='Price')
  75. {fltPrice=stringToFloat(objElement.value,this.strDecimalSep,this.strThousandSep);}else if(objElement.name=='Tax')
  76. {fltVAT=stringToFloat(objElement.value,this.strDecimalSep,this.strThousandSep);}}else if(objElement.type=='select-one')
  77. {if(nVariants>0)
  78. {strVariants+=', ';}strVariants+=objElement[objElement.selectedIndex].value;nVariants++;}}if((fltMinQuantity!=0)&&(nQuantity<fltMinQuantity))
  79. {alert(this.strMinQuantityAlert.replace('<QUANTITY>',fltMinQuantity));return;}if(fltMaxQuantity>0)
  80. {if(nQuantity>fltMaxQuantity)
  81. {alert(this.strMaxQuantityAlert.replace('<QUANTITY>',fltMaxQuantity));return;}}else if(this.fltMaxQuantity>0)
  82. {if(nQuantity>this.fltMaxQuantity)
  83. {alert(this.strMaxQuantityAlert.replace('<QUANTITY>',this.fltMaxQuantity));return;}}fltMaxQuantity=Math.max(fltMaxQuantity,this.fltMaxQuantity);nPos=this.searchPosition(strProductCode,strVariants);if(this.nMaxItems>0)
  84. {if((nPos<=0)&&(this.nPositions>this.nMaxItems)&&(nQuantity>0))
  85. {alert(this.strMaxItemAlert.replace('<QUANTITY>',this.nMaxItems));return;}}if(nQuantity<=0)
  86. {if(nPos>0)
  87. this.deletePosition(nPos);}else
  88. {if(nPos>0)
  89. {this.objPositions[nPos].nQuantity=nQuantity;if(strMsg!=null)
  90. {alert(strMsg.replace('<NAME>',strProductName));}}else
  91. {nPos= ++this.nPositions;this.objPositions[nPos]=new cartPosition(strProductCode,strProductName,nQuantity,
  92. fltMinQuantity,fltMaxQuantity,fltPrice,fltVAT,fltWeight,strVariants);if(strMsg!=null)
  93. {alert(strMsg.replace('<NAME>',strProductName));}}}return;}function cartDeletePosition(nPos)
  94. {if((nPos<=this.nPositions)&&(nPos>0))
  95. {for(var i=nPos;i<this.nPositions;i++)
  96. this.objPositions[i]=this.objPositions[i+1];this.nPositions--;}}function cartSearchPosition(strProductID,strVariants)
  97. {for(var i=1;i<=this.nPositions;i++)
  98. {if((this.objPositions[i].strProductID==strProductID)&&(this.objPositions[i].strVariants==strVariants))
  99. return(i);}return(0);}function cartIncreaseQuantity(nPos,fltQuantity)
  100. {var fltIncrease=1;if(arguments.length==2)
  101. fltIncrease=fltQuantity;if((nPos<=this.nPositions)&&(nPos>0))
  102. {if(this.objPositions[nPos].fltMaxQuantity>0)
  103. {if((this.objPositions[nPos].nQuantity+fltIncrease)<=this.objPositions[nPos].fltMaxQuantity)
  104. this.objPositions[nPos].nQuantity+=fltIncrease;else
  105. alert(this.strMaxQuantityAlert.replace('<QUANTITY>',this.objPositions[nPos].fltMaxQuantity));}else
  106. {this.objPositions[nPos].nQuantity+=fltIncrease;}}}function cartDecreaseQuantity(nPos,fltQuantity)
  107. {var fltDecrease=1;if(arguments.length==2)
  108. fltDecrease=fltQuantity;if((nPos<=this.nPositions)&&(nPos>0))
  109. {if(this.objPositions[nPos].fltMinQuantity>0)
  110. {if((this.objPositions[nPos].nQuantity-fltDecrease)>=this.objPositions[nPos].fltMinQuantity)
  111. this.objPositions[nPos].nQuantity-=fltDecrease;else
  112. alert(this.strMinQuantityAlert.replace('<QUANTITY>',this.objPositions[nPos].fltMinQuantity));}else
  113. this.objPositions[nPos].nQuantity-=fltDecrease;if(this.objPositions[nPos].nQuantity<=0)
  114. this.deletePosition(nPos);}}function cartUpdateQuantity(nPos,strQuantity,strDecimalSep)
  115. {var nQuantity=0;nQuantity+=((this.bDecimalQuantity)?(stringToFloat(strQuantity,strDecimalSep,'')): parseInt(strQuantity));if(isNaN(nQuantity))
  116. {alert('Nur numerische Werte erlaubt !');return;}if((nPos<=this.nPositions)&&(nPos>0))
  117. {if(nQuantity<this.objPositions[nPos].nQuantity)
  118. {this.decreaseQuantity(nPos,(this.objPositions[nPos].nQuantity-nQuantity));}else if(nQuantity>this.objPositions[nPos].nQuantity)
  119. this.increaseQuantity(nPos,(nQuantity-this.objPositions[nPos].nQuantity));}}function cartHasPositions()
  120. {return(this.nPositions>0);}function cartClear()
  121. {for(var i=this.nPositions;i>0;i--)
  122. {this.deletePosition(i);}}function cartPrint(nType,objTarget,nBorder,nWidth,nCellSpacing,nCellPadding)
  123. {var strResult='';if(nType!=3)
  124. {strResult+='<p align="center">\n';if(!this.hasPositions())
  125. {strResult+=this.objDataFont.format(this.strCartEmptyAlert)+'</p>\n';strResult+='<center>\n';strResult+='<form name="Back"><input type="button" value="Zurück" onClick="self.history.back();"></form></center>\n';}else
  126. {strResult+='<table border="'+nBorder+'" width="'+nWidth+'%" cellspacing="'+nCellSpacing+'" cellpadding="'+nCellPadding+'">\n';strResult+=this.printHeader(nType);strResult+=this.printPositions(nType);strResult+='</table></p>\n';}objTarget.document.write(strResult);}else
  127. {strResult=this.printPositions(nType);return(strResult);}}function cartPrintHeader(nType)
  128. {var strResult='<tr>\n';if((nType==1)&&(this.bUpdate))
  129. {strResult+='<th valign="middle"';if(!this.bUpdateVariable)
  130. strResult+='colspan="2"';strResult+='>'+this.objHeaderFont.format(' ');strResult+='</th>\n';}for(var i=1;i<=this.nHeaderFields;i++)
  131. strResult+=this.objHeaderFields[i].print(this);if((nType==1)&&(this.bDelete))
  132. {strResult+='<th valign="middle"';strResult+='>'+this.objHeaderFont.format(' ');strResult+='</th>\n';}strResult+='</tr>\n';return(strResult);}function cartPrintPositions(nType)
  133. {var strResult='';var i=0;var j=0;var s=0;var v=0;var x=0;var fltAmount=0;var bAmount=false;var nColSpan=0;var nColAmount=0;var fltTotalAmount=0;var fltCurrentVAT=0;var nVATs=0;var objVATs=new Array();var bVATAdded=false;var nStars=0;var bCtrlCharges=false;this.bEven=false;for(i=1;i<=this.nPositions;i++)
  134. {if(this.bSum)
  135. {fltAmount=(this.objPositions[i].nQuantity*this.objPositions[i].fltPrice);fltTotalAmount+=fltAmount;fltCurrentVAT=this.objPositions[i].fltVAT;nStars=0;if(fltCurrentVAT!=0)
  136. {bVATAdded=false;for(v=1;v<=nVATs;v++)
  137. {if(objVATs[v].fltValue==fltCurrentVAT)
  138. {objVATs[v].add(fltAmount);nStars=(v-1);bVATAdded=true;break;}}if(!bVATAdded)
  139. {objVATs[++nVATs]=new cartVAT(fltCurrentVAT);objVATs[nVATs].add(fltAmount);nStars=(nVATs-1);}}}if(nType!=3)
  140. {this.bEven=!this.bEven;if((this.bEven)&&(this.bTabular))
  141. {strResult+='<tr bgcolor="'+this.strBgColor+'">\n';}else
  142. {strResult+='<tr>\n';}if(nType==1)
  143. {strResult+='<form name="position'+i+'">';if(this.bUpdate)
  144. {if(this.bUpdateVariable)
  145. {for(x=1;x<=this.nCartImages;x++)
  146. {if(this.objCartImages[x].nType==4)
  147. {strResult+=this.objCartImages[x].print(this,i);if(i==1)
  148. {nColSpan++;}break;}}}else
  149. {for(x=1;x<=this.nCartImages;x++)
  150. {if(this.objCartImages[x].nType==3)
  151. {strResult+=this.objCartImages[x].print(this,i);if(i==1)
  152. {nColSpan++;}}else if(this.objCartImages[x].nType==2)
  153. {strResult+=this.objCartImages[x].print(this,i);if(i==1)
  154. {nColSpan++;}}}}}}for(j=1;j<=this.nHeaderFields;j++)
  155. {bAmount=false;strResult+='<td valign="middle"';if(this.objHeaderFields[j].nAlign==2)
  156. strResult+=' align="center"';else if(this.objHeaderFields[j].nAlign==3)
  157. strResult+=' align="right"';if(this.objHeaderFields[j].nWidth>0)
  158. strResult+=' width="'+this.objHeaderFields[j].nWidth+'%"';strResult+='>';switch(this.objHeaderFields[j].nColumnType)
  159. {case 1:
  160. if((nType==1)&&(this.bUpdateVariable))
  161. {var strTemp='<input type="text" name="quantity" size="5" value="';strTemp+=((this.bDecimalQuantity)? floatToString(this.objPositions[i].nQuantity,this.nQuantityDecimals,this.strDecimalSep,''): this.objPositions[i].nQuantity);strTemp+='">';strResult+=this.objDataFont.format(strTemp);}else
  162. {strResult+=this.objDataFont.format(((this.bDecimalQuantity)? floatToString(this.objPositions[i].nQuantity,this.nQuantityDecimals,this.strDecimalSep,''): this.objPositions[i].nQuantity))
  163. }break;case 2:
  164. var strStars='';for(s=1;s<=nStars;s++)
  165. {strStars+='*';}strResult+=this.objDataFont.format(this.objPositions[i].strProductName+strStars);break;case 3:
  166. strResult+=this.objDataFont.format(this.objPositions[i].strProductID);break;case 4:
  167. strResult+=this.objDataFont.format(floatToString(this.objPositions[i].fltPrice,this.nDecimals,this.strDecimalSep,this.strThousandSep));if(this.strCurrency2.length>0)
  168. strResult+='<br>'+this.objDataFont.format(floatToString((this.objPositions[i].fltPrice/this.fltExchangeRate),this.nDecimals,this.strDecimalSep,this.strThousandSep));break;case 5:
  169. strResult+=this.objDataFont.format(floatToString(fltAmount,this.nDecimals,this.strDecimalSep,this.strThousandSep));if(this.strCurrency2.length>0)
  170. strResult+='<br>'+this.objDataFont.format(floatToString((fltAmount/this.fltExchangeRate),this.nDecimals,this.strDecimalSep,this.strThousandSep));bAmount=true;if(i==1)
  171. {nColAmount=nColSpan+1;}break;case 6:
  172. strResult+=this.objDataFont.format(this.objPositions[i].strVariants);break;}strResult+='</td>\n';if(bAmount)
  173. {strResult+='<td valign="middle" width="1%">';strResult+=this.objDataFont.format(this.strCurrency1);if(this.strCurrency2.length>0)
  174. strResult+='<br>'+this.objDataFont.format(this.strCurrency2);strResult+='</td>\n';bAmount=false;if(i==1)
  175. {nColSpan++;}}if(i==1)
  176. {nColSpan++;}}if(nType==1)
  177. {if(this.bDelete)
  178. {for(x=1;x<=this.nCartImages;x++)
  179. {if(this.objCartImages[x].nType==1)
  180. {strResult+=this.objCartImages[x].print(this,i);if(i==1)
  181. {nColSpan++;}break;}}}strResult+='</form>';}strResult+='</tr>\n';}else
  182. {strResult+='<input type="hidden" name="Position'+i+'" value="';for(j=1;j<=this.nHeaderFields;j++)
  183. {if(j!=1)
  184. {strResult+='|';}switch(this.objHeaderFields[j].nColumnType)
  185. {case 1:
  186. strResult+=((this.bDecimalQuantity)? floatToString(this.objPositions[i].nQuantity,this.nQuantityDecimals,this.strDecimalSep,''): this.objPositions[i].nQuantity);break;case 2:
  187. strResult+=this.objPositions[i].strProductName;break;case 3:
  188. strResult+=this.objPositions[i].strProductID;break;case 4:
  189. strResult+=floatToString(this.objPositions[i].fltPrice,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1;break;case 5:
  190. strResult+=floatToString(fltAmount,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1;break;case 6:
  191. strResult+=this.objPositions[i].strVariants;break;}}strResult+='">\n';}}if((!this.bTabular)&&(nType!=3))
  192. {strResult+=this.printRule(nColSpan);}if(this.bSum)
  193. {this.fltTotal=fltTotalAmount;if((nColAmount!=0)||(nType==3))
  194. {var bRebate=false;var fltRebate=0;var strTemp='';var bWeb66=false;if(nType==3)
  195. {bWeb66=(this.strFormAction.indexOf('Web66.pl')> -1);}if(nType!=3)
  196. {strResult+=this.printAmount(this.strValue,this.fltTotal,nColSpan,nColAmount);}else if(bWeb66)
  197. {strResult+=printHidden('ctrlAmount',floatToString(this.fltTotal,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1);}for(i=1;i<=this.nRebates;i++)
  198. {bRebate=this.objRebates[i].get(this,fltTotalAmount);if(bRebate)
  199. {fltRebate=this.objRebates[i].fltRebate;strTemp=this.objRebates[i].strName;}}if(fltRebate>0)
  200. {if(nType!=3)
  201. {strResult+=this.printAmount(strTemp,fltRebate,nColSpan,nColAmount);}else
  202. {if(bWeb66)
  203. {strResult+=printHidden('ctrlDiscount','start');}strResult+=printHidden(strTemp,floatToString(fltRebate,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1);}for(v=1;v<=nVATs;v++)
  204. {objVATs[v].fltAmount-=((objVATs[v].fltAmount/this.fltTotal)*fltRebate);}this.fltTotal-=fltRebate;fltTotalAmount=this.fltTotal;if(nType!=3)
  205. {strResult+=this.printAmount(this.strValue,this.fltTotal,nColSpan,nColAmount);}}for(i=1;i<=this.nCharges;i++)
  206. {strTemp=this.objCharges[i].print(this,fltTotalAmount,nColSpan,nColAmount);if(strTemp.length>0)
  207. {fltCurrentVAT=this.objCharges[i].fltVAT;nStars=0;if(fltCurrentVAT!=0)
  208. {bVATAdded=false;for(v=1;v<=nVATs;v++)
  209. {if(objVATs[v].fltValue==fltCurrentVAT)
  210. {objVATs[v].add(this.objCharges[i].fltValue);nStars=(v-1);bVATAdded=true;break;}}if(!bVATAdded)
  211. {objVATs[++nVATs]=new cartVAT(fltCurrentVAT);objVATs[nVATs].add(this.objCharges[i].fltValue);nStars=(nVATs-1);}}if(nType!=3)
  212. {strResult+=strTemp;}else
  213. {if(bWeb66)
  214. {strResult+=printHidden('ctrlCharges','start');bCtrlCharges=true;}strResult+=printHidden(this.objCharges[i].strName,floatToString(this.objCharges[i].fltValue,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1);}}}if(nType>1)
  215. {if(this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge>0)
  216. {this.fltTotal+=this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge;fltCurrentVAT=this.objPaymentOptions[this.nSelectedPayment].fltVAT;nStars=0;if(fltCurrentVAT!=0)
  217. {bVATAdded=false;for(v=1;v<=nVATs;v++)
  218. {if(objVATs[v].fltValue==fltCurrentVAT)
  219. {objVATs[v].add(this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge);nStars=(v-1);bVATAdded=true;break;}}if(!bVATAdded)
  220. {objVATs[++nVATs]=new cartVAT(fltCurrentVAT);objVATs[nVATs].add(this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge);nStars=(nVATs-1);}}if(nType==2)
  221. {strResult+=this.printAmount(this.objPaymentOptions[this.nSelectedPayment].strExtraCharge,this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge,nColSpan,nColAmount);}else if(bWeb66)
  222. {if(!bCtrlCharges)
  223. {strResult+=printHidden('ctrlCharges','start');}strResult+=printHidden(this.objPaymentOptions[this.nSelectedPayment].strExtraCharge,floatToString(this.objPaymentOptions[this.nSelectedPayment].fltExtraCharge,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1);}}}if((strTemp.length>0)&&(nType!=3))
  224. {strResult+=this.printAmount(this.strValue,this.fltTotal,nColSpan,nColAmount);strTemp='';}if(bWeb66)
  225. {strTemp=printHidden('ctrlTaxes','start');}for(i=1;i<=nVATs;i++)
  226. {strTemp+=objVATs[i].print(this,i-1,nColSpan,nColAmount,((bWeb66)? 2 : 1));}if(strTemp.length>0)
  227. {if(nType!=3)
  228. {strResult+=strTemp;}else if(bWeb66)
  229. {strResult+=strTemp;}}if(bWeb66)
  230. {strResult+=printHidden('ctrlTotal',floatToString(this.fltTotal,this.nDecimals,this.strDecimalSep,this.strThousandSep)+' '+this.strCurrency1);}else if(nType!=3)
  231. {strResult+=this.printAmount(this.strTotal,this.fltTotal,nColSpan,nColAmount);}}}return(strResult);}function cartPrintAmount(strCaption,fltAmount,nColSpan,nCol)
  232. {var strResult='';var    strText=this.objDataFont.format(strCaption+':')+'</td>\n';var bLeft=((nColSpan-nCol)<(nCol-1));this.bEven=!this.bEven;if((this.bEven)&&(this.bTabular))
  233. {strResult+='<tr bgcolor="'+this.strBgColor+'">\n';}else
  234. {strResult+='<tr>\n';}if(bLeft)
  235. {strResult+='<td colspan="'+(nCol-1)+'" valign="middle" align="right">';strResult+=strText;}else if(nCol!=1)
  236. {strResult+='<td colspan="'+(nCol-1)+'">'+this.objDataFont.format(' ')+'</td>\n';}strResult+='<td valign="middle" align="right">';strResult+=this.objDataFont.format(floatToString(fltAmount,this.nDecimals,
  237. this.strDecimalSep,this.strThousandSep));if(this.strCurrency2.length>0)
  238. {strResult+='<br>'+this.objDataFont.format(floatToString(
  239. (fltAmount/this.fltExchangeRate),this.nDecimals,this.strDecimalSep,this.strThousandSep));}strResult+='</td>\n';strResult+='<td valign="middle">';strResult+=this.objDataFont.format(this.strCurrency1);if(this.strCurrency2.length>0)
  240. {strResult+='<br>'+this.objDataFont.format(this.strCurrency2);}strResult+='</td>\n';if(!bLeft)
  241. {strResult+='<td colspan="'+(nColSpan-nCol)+'" valign="middle">';strResult+=strText;}strResult+='</tr>\n';if(!this.bTabular)
  242. {strResult+=this.printRule(nColSpan);}return(strResult);}function cartPrintRule(nColSpan)
  243. {var strResult='<tr>\n';strResult+='<td colspan="'+nColSpan+'" valign="middle"><hr></td>\n';strResult+='</tr>\n';return(strResult);}function cartPrintOrderForm(nType,objTarget,nBorder,nWidth,nCellSpacing,nCellPadding)
  244. {var strResult='';var i=0;if(!this.hasPositions())
  245. {return;}if(nType!=3)
  246. {strResult+='<p align="center">\n';if(nType==1)
  247. {strResult+='<form name="orderform">';}strResult+='<table border="'+nBorder+'" width="'+nWidth+'%" cellspacing="'+nCellSpacing+'" cellpadding="'+nCellPadding+'">\n';}if(this.bCookie)
  248. {var objCookie=new web66Cookie('Client');if(nType==1)
  249. {for(i=1;i<=this.nDataFields;i++)
  250. {this.objDataFields[i].strValue=objCookie.get(this.objDataFields[i].strName);}}else if(nType==2)
  251. {for(i=1;i<=this.nDataFields;i++)
  252. {objCookie.set(this.objDataFields[i].strName,this.objDataFields[i].strValue);}}}for(i=1;i<=this.nDataFields;i++)
  253. {strResult+=this.objDataFields[i].print(this,nType);}if(nType!=3)
  254. {strResult+='</table>';if(nType==1)
  255. {strResult+='</form>';}strResult+='</p>\n';objTarget.document.write(strResult);}else
  256. {return(strResult);}}function cartPrintPaymentForm(nType,objTarget,nBorder,nWidth,nCellSpacing,nCellPadding)
  257. {var strResult='';var i=0;var bWeb66=(this.strFormAction.indexOf('Web66.pl')> -1);if(!this.hasPositions())
  258. {return;}if(this.bCookie)
  259. {var objCookie=new web66Cookie('Payment');if(nType==1)
  260. {for(i=1;i<=this.nPaymentFields;i++)
  261. {this.objPaymentFields[i].strValue=objCookie.get(this.objPaymentFields[i].strName);}}else if(nType==2)
  262. {for(i=1;i<=this.nPaymentFields;i++)
  263. {objCookie.set(this.objPaymentFields[i].strName,this.objPaymentFields[i].strValue);}}}if(nType!=3)
  264. {strResult+='<p align="center">\n';if(nType==1)
  265. {strResult+='<form name="paymentform">';}strResult+='<table border="'+nBorder+'" width="'+nWidth+'%" cellspacing="'+nCellSpacing+'" cellpadding="'+nCellPadding+'">\n';}if(nType==1)
  266. {for(i=1;i<=this.nPaymentOptions;i++)
  267. {strResult+=this.objPaymentOptions[i].print(this,nType);for(var j=1;j<=this.nPaymentFields;j++)
  268. {if(this.objPaymentFields[j].strPayment==this.objPaymentOptions[i].strPayment)
  269. {strResult+=this.objPaymentFields[j].print(this,nType);}}}}else
  270. {if(this.nSelectedPayment!=0)
  271. {if((nType==3&&!bWeb66)||(nType==2))
  272. {strResult+=this.objPaymentOptions[this.nSelectedPayment].print(this,nType);}for(var j=1;j<=this.nPaymentFields;j++)
  273. {if(this.objPaymentFields[j].strPayment==this.objPaymentOptions[this.nSelectedPayment].strPayment)
  274. {strResult+=this.objPaymentFields[j].print(this,nType);}}}}if(nType!=3)
  275. {strResult+='</table>';if(nType==1)
  276. {strResult+='</form>';}strResult+='</p>\n';objTarget.document.write(strResult);}else
  277. {return(strResult);}}function cartPrintSubmitForm(objTarget,strCaption,strFax,strRedirect,strSubject,strInfo)
  278. {var bMailTo=(this.strFormAction.indexOf('@')> -1);var bWeb66=(this.strFormAction.indexOf('Web66.pl')> -1);var strResult='';if(!this.hasPositions())
  279. {return;}if((bMailTo)&&(objAgent.bIE)&&(!objAgent.bIE4))
  280. {objTarget.location=strFax;return;}strResult='<form name="submitform" method="post" action="'+this.strFormAction;if(bMailTo)
  281. {strResult+='?subject='+strSubject+'" enctype="text/plain"';}strResult+='" onSubmit="'+this.strObject+'onSubmit(self, \''+strRedirect+'\' , \''+strInfo+'\' , '+bMailTo+');">\n';if(bWeb66)
  282. {strResult+=printHidden('ctrlCurrency',this.strCurrencyCode);strResult+=printHidden('ctrlClient','start');}strResult+=this.printOrderForm(3);if(bWeb66)
  283. {strResult+=printHidden('ctrlPayment',this.objPaymentOptions[this.nSelectedPayment].strPayment);}strResult+=this.printPaymentForm(3);if(bWeb66)
  284. {var strTemp='';var strAlign='';for(var t=1;t<=this.nHeaderFields;t++)
  285. {if(t!=1)
  286. {strTemp+='|';strAlign+='|';}strTemp+=this.objHeaderFields[t].strHeader;strAlign+=this.objHeaderFields[t].nAlign;}strResult+=printHidden('ctrlAlign',strAlign);strResult+=printHidden('ctrlPos',strTemp);}strResult+=this.printCart(3);if(bWeb66&&this.nHiddenFields)
  287. {strResult+=printHidden('ctrlHidden','start');}for(var i=1;i<=this.nHiddenFields;i++)
  288. {strResult+=this.objHiddenFields[i].print();}strResult+='<center><input type="submit" value="'+strCaption+'"></center>\n';strResult+='</form>\n';objTarget.document.write(strResult);}function cartOnSubmit(objTarget,strRedirect,strInfo,bMailTo)
  289. {if(bMailTo)
  290. {if(strInfo.length>0)
  291. {alert(strInfo);}setTimeout('parent.'+objTarget.name+'.location="'+strRedirect+'"',10000);}this.clearCart();return(true);}function cartReload(objWindow)
  292. {objWindow.location.reload();}function cartCalcCharge(strName,fltAmount,fltValue)
  293. {return(0);}function cartCalcRebate(strName,fltAmount,fltValue)
  294. {return(0);}function cartCheckRequired(objTarget)
  295. {var i;var bResult=true;var objElement;for(i=1;i<=this.nDataFields;i++)
  296. {if((this.objDataFields[i].bRequired)&&(this.objDataFields[i].strValue.length==0))
  297. {alert('Es fehlt die Eingabe des Feldes >'+this.objDataFields[i].strCaption+'<');eval('parent.'+objTarget.name+'.document.orderform.'+this.objDataFields[i].strName+'.focus()');bResult=false;break;}}if((bResult)&&(this.nSelectedPayment!=0))
  298. {for(i=1;i<=this.nPaymentFields;i++)
  299. {if(this.objPaymentFields[i].strPayment==this.objPaymentOptions[this.nSelectedPayment].strPayment)
  300. {if((this.objPaymentFields[i].bRequired)&&(this.objPaymentFields[i].strValue.length==0))
  301. {alert('Es fehlt die Eingabe des Feldes >'+this.objPaymentFields[i].strCaption+'<');eval('parent.'+objTarget.name+'.document.paymentform.'+this.objPaymentFields[i].strName+'.focus()');bResult=false;break;}}}}return(bResult);}function cartFont()
  302. {this.strFace='Arial';this.strSize=0;this.strColor='';this.bBold=false;this.bItalic=false;this.bUnderline=false;this.strClass='';this.format=formatFontString;}function formatFontString(strContent)
  303. {var strFont='';if((this.strClass.length>0)&&(objAgent.bCSS))
  304. {strFont='<font class="'+this.strClass+'">'+strContent+'</font>';}else
  305. {strFont='<font face="'+this.strFace+'"';strFont+=(this.strSize.length>0)?(' size="'+this.strSize+'"'):('');strFont+=(this.strColor.length>0)?(' color="'+this.strColor+'"'):('');strFont+='>';strFont+=(this.bBold)?('<b>'):('');strFont+=(this.bItalic)?(''):('');strFont+=(this.bUnderline)?('<u>'):('');strFont+=strContent;strFont+=(this.bUnderline)?('</u>'):('');strFont+=(this.bItalic)?(''):('');strFont+=(this.bBold)?('</b>'):('');strFont+='</font>';}return(strFont);}function cartHeaderField(strHeader,nAlign,nColumnType,nWidth,strClass)
  306. {this.strHeader=strHeader;this.nAlign=nAlign;this.nColumnType=nColumnType;this.nWidth=nWidth;this.strClass=strClass;this.print=cartPrintHeaderField;}function cartPrintHeaderField(objShop)
  307. {var strResult='<th valign="middle"';if(this.nColumnType==5)
  308. strResult+=' colspan="2"';switch(this.nAlign)
  309. {case 1:
  310. strResult+=' align="left"';break;case 2:
  311. strResult+=' align="center"';break;case 3:
  312. strResult+=' align="right"';break;}if(this.nWidth>0)
  313. strResult+=' width="'+this.nWidth+'%"';if((this.strClass.length>0)&&(objAgent.bCSS))
  314. strResult+=' class="'+this.strClass+'"';strResult+='>';strResult+=objShop.objHeaderFont.format(this.strHeader);strResult+='</th>\n';return(strResult);}function cartDataField(strPayment,strName,strCaption,nType,nCols,nRows,bRequired,nPos,varValue)
  315. {this.strPayment=strPayment;this.strName=strName;this.strCaption=strCaption;this.nType=nType;this.nCols=nCols;this.nRows=nRows;this.bRequired=bRequired;this.nPos=nPos;this.strValue='';this.bChecked=false;this.strOptions='';switch(nType)
  316. {case 1:
  317. case 2:
  318. case 3:
  319. this.strValue=varValue;break;case 4:
  320. this.strOptions=varValue;var strArray=((this.strOptions.length>0)?(this.strOptions.split('|')):(''));if(strArray.length>0)
  321. {this.strValue=strArray[0];}break;case 5:
  322. this.bChecked=varValue;break;}this.print=cartPrintDataField;}function cartPrintDataField(objShop,nPrint)
  323. {var strReturn='';var strField=((this.strPayment.length>0)?('objPaymentFields['):('objDataFields['));if(nPrint<3)
  324. {strReturn='<tr>\n';strReturn+='<td valign="middle" align="right" width="20%">\n';strReturn+=objShop.objCaptionFont.format(this.strCaption+':')+'</td>\n';strReturn+='<td valign="middle" width="80%">\n';}if(nPrint==1)
  325. {switch(this.nType)
  326. {case 1:
  327. case 2:
  328. strReturn+='<input type="'+getType(this.nType)+'" name="'+this.strName+'"';strReturn+='" size="'+this.nCols+'" maxlength="'+this.nCols+'" value="'+this.strValue+'"';strReturn+=' onBlur="'+objShop.strObject+strField+this.nPos+'].strValue = this.value;"></td>\n';break;case 3:
  329. strReturn+='<textarea name="'+this.strName+'"';strReturn+='" cols="'+this.nCols+'" rows="'+this.nRows+'"';strReturn+=' onBlur="'+objShop.strObject+strField+this.nPos+'].strValue = this.value;">';strReturn+=this.strValue+'</textarea></td>\n';break;case 4:
  330. var strArray=((this.strOptions.length>0)?(this.strOptions.split('|')):(''));strReturn+='<select name="'+this.strName+'"';strReturn+=' onBlur="'+objShop.strObject+strField+this.nPos+'].strValue = this.options[this.options.selectedIndex].text;">\n';for(var j=0;j<strArray.length;j++)
  331. {strReturn+='<option';strReturn+=((strArray[j]==this.strValue)?(' selected>'):('>'));strReturn+=strArray[j]+'</option>\n';}strReturn+='</select></td>\n';break;case 5:
  332. strReturn+='<input type="'+getType(this.nType)+'" name="'+this.strName+'"';strReturn+=((this.bChecked)?(' checked'):(''));strReturn+=' onClick="'+objShop.strObject+strField+this.nPos+'].bChecked = this.checked;"></td>\n';break;}strReturn+='</tr>\n';}else if(nPrint==2)
  333. {var strTemp='';switch(this.nType)
  334. {case 1:
  335. case 3:
  336. case 4:
  337. strTemp=this.strValue;break;case 2:
  338. for(var i=1;i<=this.strValue.length;i++)
  339. {strTemp+='*';}break;case 5:
  340. strTemp=((this.bChecked)?(objShop.strChecked):(objShop.strNotChecked));break;}strReturn+=objShop.objDataFont.format(strTemp)+'</td>\n';}else if(nPrint==3)
  341. {var strTemp='';switch(this.nType)
  342. {case 1:
  343. case 2:
  344. case 3:
  345. case 4:
  346. strTemp=this.strValue;break;case 5:
  347. strTemp=((this.bChecked)?(objShop.strChecked):(objShop.strNotChecked));break;}strReturn=printHidden(this.strName,strTemp);}return(strReturn);}function cartPaymentOption(strPayment,fltExtraCharge,fltVAT,strExtraCharge,nPos)
  348. {this.strPayment=strPayment;this.fltExtraCharge=fltExtraCharge;this.fltVAT=fltVAT;this.strExtraCharge=strExtraCharge;this.nPos=nPos;this.print=cartPrintPaymentOption;}function cartPrintPaymentOption(objShop,nType)
  349. {var strReturn='';var strTemp='';if(nType<3)
  350. {strReturn='<tr>\n';strReturn+='<td colspan="2" valign="middle">\n';}if(nType==1)
  351. {strReturn+='<input type="radio" name="PaymentOption" value="'+this.nPos+'"';if(objShop.nSelectedPayment==this.nPos)
  352. {strReturn+=' checked';}strReturn+=' onClick="'+objShop.strObject+'nSelectedPayment = '+this.nPos+';"> \n';strTemp=this.strPayment+((this.strExtraCharge)?(' ('+this.strExtraCharge+' '+floatToString(this.fltExtraCharge,objShop.nDecimals,objShop.strDecimalSep,objShop.strThousandSep)+' '+objShop.strCurrency1+')'):(''));strReturn+=objShop.objCaptionFont.format(strTemp)+'</td>\n';strReturn+='</tr>\n';}else if(nType==2)
  353. {strReturn+=objShop.objCaptionFont.format(this.strPayment)+'</td>\n';strReturn+='</tr>\n';}else if(nType==3)
  354. {strReturn=printHidden('Zahlungsweise',this.strPayment+((this.strExtraCharge)?(' ('+this.strExtraCharge+' '+floatToString(this.fltExtraCharge,objShop.nDecimals,objShop.strDecimalSep,objShop.strThousandSep)+' '+objShop.strCurrency1+')'):('')));}return(strReturn);}function cartImage(strImage,nType,strAlt,nWidth,nHeight)
  355. {this.strImage=strImage;this.nType=nType;this.strAlt=strAlt;this.nWidth=nWidth;this.nHeight=nHeight;this.print=cartPrintImage;}function cartPrintImage(objShop,nPos)
  356. {var strResult='<td valign="middle" align="center" width="1%">';strResult+='<a href="javascript:'+objShop.strObject;switch(this.nType)
  357. {case 2:
  358. strResult+='increaseQuantity('+nPos+'); ';break;case 3:
  359. strResult+='decreaseQuantity('+nPos+'); ';break;case 1:
  360. strResult+='deletePosition('+nPos+'); ';break;case 4:
  361. strResult+='updateQuantity('+nPos+', '+'self.document.position'+nPos+'.quantity.value, '+'\''+objShop.strDecimalSep+'\'); ';break;}strResult+=objShop.strObject+'reloadCart(self);">'
  362. strResult+='<img src="'+this.strImage+'" alt="'+this.strAlt+'" border="0"';if(this.nWidth>0)
  363. strResult+=' width="'+this.nWidth+'"';if(this.nHeight>0)
  364. strResult+=' height="'+this.nHeight+'"';strResult+=' hspace="0" vspace="0"></a></td>\n';return(strResult);}function cartCharge(strName,nType,fltValue,fltVAT,fltLimit)
  365. {this.strName=strName;this.nType=nType;this.fltValue=fltValue;this.fltVAT=fltVAT;this.fltLimit=fltLimit;this.print=cartPrintCharge;}function cartPrintCharge(objShop,fltAmount,nColSpan,nCol)
  366. {var strResult='';var bPrint=true;var fltValue=this.fltValue;if(((this.nType==1)||(this.nType==2))&&(this.fltLimit!=0))
  367. {if(fltAmount>=this.fltLimit)
  368. {bPrint=false;}}if(this.nType==3)
  369. {fltValue=objShop.calcCharge(this.strName,fltAmount,fltValue);if(fltValue==0)
  370. {bPrint=false;}}if(bPrint)
  371. {strResult=objShop.printAmount(this.strName,fltValue,nColSpan,nCol);objShop.fltTotal+=fltValue;}return(strResult);}function cartRebate(strName,nType,fltValue,fltLimit)
  372. {this.strName=strName;this.nType=nType;this.fltValue=fltValue;this.fltLimit=fltLimit;this.fltRebate=0;this.get=cartGetRebate;}function cartGetRebate(objShop,fltAmount)
  373. {var bResult=true;if(((this.nType==1)||(this.nType==2))&&(this.fltLimit!=0))
  374. {if(fltAmount<this.fltLimit)
  375. {bResult=false;}}if(this.nType==3)
  376. {this.fltRebate=objShop.calcRebate(this.strName,fltAmount,this.fltValue);if(this.fltRebate==0)
  377. {bResult=false;}}if(bResult)
  378. {if(this.nType==1)
  379. {this.fltRebate=((fltAmount*this.fltValue)/100);}else if(this.nType==2)
  380. {this.fltRebate=this.fltValue;}}return(bResult);}function cartHiddenField(strName,strValue)
  381. {this.strName=strName;this.strValue=strValue;this.print=cartPrintHiddenField;}function cartPrintHiddenField()
  382. {return(printHidden(this.strName,this.strValue));}function cartVAT(fltValue)
  383. {this.strName=fltValue.toString()+"%";this.fltValue=fltValue;this.fltAmount=0;this.add=cartAddVAT;this.print=cartPrintVAT;}function cartAddVAT(fltAmount)
  384. {this.fltAmount+=fltAmount;}function cartPrintVAT(objShop,nStars,nColSpan,nCol,nType)
  385. {var strResult='';var bPrint=true;var strStars='';var fltVAT=0;var fltTemp=(this.fltValue/100);if(this.fltAmount==0)
  386. {bPrint=false;}if(bPrint)
  387. {if(objShop.bVATInclusive)
  388. {fltVAT=(this.fltAmount*(fltTemp/(1+fltTemp)));}else
  389. {fltVAT=(this.fltAmount*fltTemp);}for(var i=1;i<=nStars;i++)
  390. {strStars+='*';}if(nType==1)
  391. {strResult=objShop.printAmount(objShop.strVAT.replace('<VAT>',this.strName)+strStars,fltVAT,nColSpan,nCol);}else
  392. {strResult=printHidden(objShop.strVAT.replace('<VAT>',this.strName),floatToString(fltVAT,objShop.nDecimals,objShop.strDecimalSep,objShop.strThousandSep)+' '+objShop.strCurrency1);}if(!objShop.bVATInclusive)
  393. {objShop.fltTotal+=fltVAT;}}return(strResult);}function cartPosition(strProductID,strProductName,nQuantity,fltMinQuantity,fltMaxQuantity,fltPrice,fltVAT,fltWeight,strVariants)
  394. {this.strProductID=strProductID;this.strProductName=strProductName;this.nQuantity=nQuantity;this.fltMinQuantity=fltMinQuantity;this.fltMaxQuantity=fltMaxQuantity;this.fltPrice=fltPrice;this.fltVAT=fltVAT;this.fltWeight=fltWeight;this.strVariants=strVariants;}function web66Cookie(strName)
  395. {this.strName=strName;this.set=setValue;this.get=getValue;this.del=delValue;}function setValue(strName,strValue)
  396. {var objExpiry=new Date();objExpiry.setTime(objExpiry.getTime()+(1000*60*60*24*365));document.cookie=this.strName+'_'+strName.toLowerCase()+'='+escape(strValue)+';expires='+objExpiry.toGMTString();}function getValue(strName)
  397. {var strSearch=this.strName+'_'+strName.toLowerCase()+'=';var nOffset=0;var nEnd=0;if(document.cookie.length>0)
  398. {nOffset=document.cookie.indexOf(strSearch);if(nOffset!= -1)
  399. {nOffset+=strSearch.length;nEnd=document.cookie.indexOf(';',nOffset);if(nEnd== -1)
  400. nEnd=document.cookie.length;return(unescape(document.cookie.substring(nOffset,nEnd)));}}return("");}function delValue(strName)
  401. {var objExpired=new Date();var strValue=this.get(strName);objExpired.setTime(objExpired.getTime()-1);document.cookie=this.strName+'_'+strName.toLowerCase()+'='+escape(strValue)+';expires='+objExpired.toGMTString();}function getType(nType)
  402. {var strType;switch(nType)
  403. {case 1:
  404. strType='text';break;case 2:
  405. strType='password';break;case 3:
  406. strType='textarea';break;case 4:
  407. strType='select';break;case 5:
  408. strType='checkbox';break;}return(strType);}function stringToFloat(strFloat,strDecimalSep,strThousandSep)
  409. {var i= -1;var strTemp=strFloat;var nLength=strFloat.length;var fltNumber;if(strDecimalSep!='.')
  410. {while((i=strFloat.indexOf(strDecimalSep,i+1))>=0)
  411. strTemp=strTemp.substring(0,i)+'.'+strTemp.substring(i+1,strFloat.length);strFloat=strTemp;i= -1;}if(strThousandSep!='')
  412. {while((i=strFloat.indexOf(strThousandSep,i+1))>=0)
  413. {if(nLength-(i+1)<=2)
  414. break;strTemp=strTemp.substring(0,i)+strTemp.substring(i+1,strFloat.length);}}fltNumber=parseFloat(strTemp);if(isNaN(fltNumber))
  415. fltNumber=0;return(fltNumber);}function floatToString(fltNumber,nDecimals,strDecimalSep,strThousandSep)
  416. {var strFloat='';var strTemp='';var i=0;var j=0;if(isNaN(fltNumber))
  417. return(strFloat+=' ');if(fltNumber==0)
  418. {strTemp='0'+strDecimalSep;for(i=1;i<=nDecimals;i++)
  419. strTemp+='0';}else
  420. {strFloat+=Math.round(fltNumber*Math.pow(10,nDecimals));if(nDecimals>0)
  421. {strTemp=strFloat.substring(0,strFloat.length-nDecimals)+strDecimalSep+strFloat.substring(strFloat.length-nDecimals,strFloat.length);}else
  422. {strTemp=strFloat;}if((fltNumber<1)&&(fltNumber>=0))
  423. strTemp='0'+strTemp;else if((fltNumber<0)&&(fltNumber> -1))
  424. strTemp='-0'+strTemp.substr(1);}if(strThousandSep!='')
  425. {for(i=strFloat.length-nDecimals,j=0;i>0;i--,j++)
  426. {if((j%3==0)&&(j>0))
  427. strTemp=strTemp.substring(0,i)+strThousandSep+strTemp.substring(i,strTemp.length);}}return(strTemp);}function printHidden(strName,strValue)
  428. {return('<input type="hidden" name="'+strName+'" value="'+strValue+'">\n');}function replaceString(strSearch,strReplace)
  429. {var nIndex=0;var strTemp='';nIndex=this.indexOf(strSearch);if(nIndex>=0)
  430. {strTemp=this.substring(0,nIndex)+strReplace+this.substring(nIndex+strSearch.length,this.length);}else
  431. strTemp=this;return(strTemp);}String.prototype.replace=replaceString;