document.write("<script language='Javascript'>")
document.write(unescape("//%20This%20mmCalc%20Function%20goes%20through%20each%20field%20in%20a%20form%0D%0A//%20checks%20if%20productX%20has%20a%20value%2C%20if%20so%20it%20builds%20the%20cart%0D%0A//%20and%20totals%20the%20price.%20If%20productX%20does%20not%20have%20a%20value%0D%0A//%20no%20price%20is%20shown%20and%20the%20customer%20is%20told%20to%20select%20a%20value%0D%0A//%20Also%20validates%20form%0D%0A%0D%0A//%20Version%202.31%0D%0A%0D%0Afunction%20mmCalc%28thatForm%29%7B%0D%0A%09var%20intFormFields%2C%20intNumberDropDowns%2C%20curPriceArray%2C%20strProductElement%2C%20intUnits%3B%0D%0A%09var%20strProductList%2C%20intUserID%2C%20intFormUserID%2C%20strPriceBandsArray%2C%20intPriceBands%2C%20strPriceBandsDivisionsArray%3B%0D%0A%09var%20blnPriceBands%20%3D%20false%3B%0D%0A%09var%20blnPriceBandsUpper%20%3D%20false%3B%0D%0A%09var%20blnElementInvalid%20%3D%20false%3B%0D%0A%09var%20strLocalMainProductName%20%3D%20strMainProductName%3B%0D%0A%09if%20%28strLocalMainProductName%20%3D%3D%20null%29%20%7BstrLocalMainProductName%20%3D%20thatForm.strMainProductName.value%7D%3B%0D%0A%09var%20blnSubmit%20%3D%20false%3B%0D%0A%09var%20strOtherCurrencySymbol%20%3D%20%27%27%3B%0D%0A%09if%28thatForm.strOtherCurrencySymbol%29%7BstrOtherCurrencySymbol%20%3D%20thatForm.strOtherCurrencySymbol.value%7D%3B%0D%0A%09var%20curPriceOtherCurrencyRate%20%3D%201%3B%0D%0A%09if%28thatForm.dbOtherCurrencyRate%29%7BcurPriceOtherCurrencyRate%20%3D%20thatForm.dbOtherCurrencyRate.value%7D%3B%0D%0A%09%0D%0A%09if%28arguments.length%3E1%29%7BblnSubmit%20%3D%20true%3B%7D%0D%0A%09%0D%0A%09intNumberDropDowns%20%3D%20parseInt%28thatForm.elements%5B%27numberSelections%27%5D.value%29%3B%0D%0A%09intFormFields%20%3D%20thatForm.elements.length%3B%0D%0A%09intNumberDropDowns%20+%3D%201%3B%0D%0A%0D%0A%09curPrice%20%3D%200%3B%0D%0A%09intUnits%20%3D%200%3B%0D%0A%09strProductList%20%3D%20%22%22%3B%0D%0A%09intUserID%20%3D%20%2285130629%22%3B%0D%0A%09intFormUserID%20%3D%20thatForm.userid.value%3B%0D%0A%09%0D%0A%09%09//%20Checks%20userid%20valid%0D%0A%09if%20%28intFormUserID%20%21%3D%20intUserID%29%7B%0D%0A%09%09thatForm.strMessage.value%3D%22Please%20use%20correct%20User%20ID%20%22+intUserID%3B%0D%0A%09%09thatForm.curCost.value%3D%22%22%3B%0D%0A%09%09return%20false%3B%0D%0A%09%7D%0D%0A%09%0D%0A%09//%20Calculates%20quantity%20bands%20if%20present%0D%0A%09for%20%28i%3D0%3Bi%3CintFormFields%3Bi++%29%7B%0D%0A%09%09if%20%28thatForm.elements%5Bi%5D.name.indexOf%28%27qtyBands%27%29%20%3E%20-1%29%7B%0D%0A%09%09%0D%0A%09%09%09strPriceBandsArray%20%3D%20thatForm.elements%5Bi%5D.value.split%28%22%7E%22%29%3B%0D%0A%09%09%09intPriceBands%20%3D%20strPriceBandsArray.length%3B%0D%0A%09%09%09if%20%28intPriceBands%20%3E%200%29%20%7B%0D%0A%09%09%09%09blnPriceBands%20%3D%20true%3B%0D%0A%09%09%09%7Delse%7B%0D%0A%09%09%09%09break%3B%09%09%09%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09var%20intQtyArray%20%3D%20new%20Array%28intPriceBands-1%29%3B%0D%0A%09%09%09var%20curPriceArray%20%3D%20new%20Array%28intPriceBands-1%29%3B%0D%0A%0D%0A%09%09%09//%20Create%20price%20and%20strProductList%0D%0A%09%09%09for%20%28p%3D0%3Bp%3CintPriceBands%3Bp++%29%7B%0D%0A%09%09%09%09strPriceBandsDivisionsArray%20%3D%20strPriceBandsArray%5Bp%5D.split%28%22%3A%22%29%3B%0D%0A%09%09%09%09intQtyArray%5Bp%5D%20%3D%20strPriceBandsDivisionsArray%5B0%5D%20-%200%3B%0D%0A%09%09%09%09curPriceArray%5Bp%5D%20%3D%20strPriceBandsDivisionsArray%5B1%5D%20-%200%3B%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09break%3B%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09//%20Is%20upper%20limit%20set%3F%0D%0A%09for%20%28i%3D0%3Bi%3CintFormFields%3Bi++%29%7B%0D%0A%09%09if%20%28thatForm.elements%5Bi%5D.name.indexOf%28%27qtyBandsRoundUp%27%29%20%3E%20-1%29%7B%0D%0A%09%09%09blnPriceBandsUpper%20%3D%20thatForm.elements%5Bi%5D.value.toUpperCase%28%29%3B%0D%0A%09%09%09if%20%28blnPriceBandsUpper%20%3D%3D%20%27TRUE%27%29%7B%0D%0A%09%09%09%09blnPriceBandsUpper%20%3D%20true%3B%0D%0A%09%09%09%7Delse%7B%0D%0A%09%09%09%09blnPriceBandsUpper%20%3D%20false%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A//%20Calculates%20price%20if%20price%20bands%20given%0D%0Avar%20intCurrentQtyCheck%20%3D%20-1%3B%0D%0A%09%09%09%0D%0Afor%20%28j%3D0%3Bj%3CintPriceBands%3Bj++%29%7B%0D%0A%09if%20%28%28thatForm.qty.value%20%3E%20intCurrentQtyCheck%29%20%26%26%20%28thatForm.qty.value%20%3C%3D%20intQtyArray%5Bj%5D%29%29%7B%0D%0A%09%09curPrice%20%3D%20curPriceArray%5Bj%5D%3B%0D%0A%09%09if%20%28blnPriceBandsUpper%29%20%7B%0D%0A%09%09%09thatForm.qty.value%20%3D%20intQtyArray%5Bj%5D%3B%0D%0A%09%09%7D%09%0D%0A%09%09break%3B%0D%0A%09%7D%0D%0A%09intCurrentQtyCheck%20%3D%20intQtyArray%5Bj%5D%3B%0D%0A%7D%0D%0A%0D%0Aif%20%28blnPriceBands%20%3D%3D%20true%20%26%26%20curPrice%20%3D%3D%200%29%7B%0D%0A%09curPrice%20%3D%20curPriceArray%5BintPriceBands-1%5D%3B%0D%0A%09curPriceArray%5Bj%5D%20%3D%20curPrice%3B%0D%0A%09if%20%28blnPriceBandsUpper%29%20%7B%0D%0A%09%09thatForm.qty.value%20%3D%20intQtyArray%5BintPriceBands-1%5D%3B%0D%0A%09%09intQtyArray%5Bj%5D%20%3D%20intQtyArray%5BintPriceBands-1%5D%3B%0D%0A%09%7D%0D%0A%7D%0D%0A%0D%0A%09if%20%28blnPriceBands%20%3D%3D%20false%29%7B%0D%0A%0D%0A%09%09//%20Checks%20each%20productX%20drop-down%0D%0A%09%09for%20%28var%20i%20%3D%201%3B%20i%3CintFormFields%3B%20i++%29%20%7B%0D%0A%0D%0A%09%09%09//%20Gets%20price%20and%20name%20of%20product%0D%0A%09%09%09%0D%0A%09%09%09//%20Checks%20if%20element%20is%20checkbox%20and%20adds%20to%20price%20if%20checked%0D%0A%09%09%09if%20%28thatForm.elements%5Bi%5D.type%3D%3D%27checkbox%27%29%7B%0D%0A%09%09%09%09if%20%28thatForm.elements%5Bi%5D.checked%29%7B%0D%0A%09%09%09%09%09strProductElement%20%3D%20thatForm.elements%5Bi%5D.value%3B%0D%0A%09%09%09%09%7Delse%7B%0D%0A%09%09%09%09%09strProductElement%20%3D%20%22%3A0.00%22%3B%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7Delse%7B%0D%0A%09%09%09%09strProductElement%20%3D%20thatForm.elements%5Bi%5D.value%3B%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09if%20%28thatForm.elements%5Bi%5D.name.indexOf%28%27productItem%27%29%20%3E%20-1%29%7B%0D%0A%09%09%09%09strProductElement%20%3D%20strProductElement%20+%20%22%3A0.00%22%3B%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09if%20%28thatForm.elements%5Bi%5D.name.indexOf%28%27productItemRequired%27%29%20%3E%20-1%29%7B%0D%0A%09%09%09%09strProductElement%20%3D%20strProductElement%20+%20%22%3A0.00%22%3B%0D%0A%09%09%09%09if%20%28thatForm.elements%5Bi%5D.value%3D%3D%27%27%29%20%7BblnElementInvalid%20%3D%20true%3B%7D%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09if%20%28thatForm.elements%5Bi%5D.disabled%3D%3Dfalse%29%7B%09%09%0D%0A%09%09%09%09curPriceArray%20%3D%20strProductElement.split%28%22%3A%22%29%3B%0D%0A%09%09%09%09if%20%28curPriceArray%5B1%5D%21%3Dnull%20%26%26%20isNaN%28curPriceArray%5B1%5D%29%3D%3Dfalse%29%20%7BcurPrice%20+%3D%20parseFloat%28curPriceArray%5B1%5D%29%7D%3B%0D%0A%09%09%09%09if%20%28curPriceArray%5B1%5D%21%3Dnull%20%26%26%20isNaN%28curPriceArray%5B1%5D%29%3D%3Dfalse%29%20%7B%0D%0A%09%09%09%09%0D%0A%09%09%09%09%09if%20%28trim%28curPriceArray%5B0%5D%29%21%3D%27%27%29%20%7B%0D%0A%09%09%09%09%09%09strProductList%20%3D%20strProductList%20+%20strProductDelimeter%20+%20%22%20%22%20+%20curPriceArray%5B0%5D%3B%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09//%20Gets%20units%20per%20options%0D%0A%09%09%09if%20%28curPriceArray%5B2%5D%21%3D%20null%29%20intUnits%20+%3D%20parseFloat%28curPriceArray%5B2%5D%29%3B%0D%0A%09%09%0D%0A%09%09%09for%20%28var%20p%20%3D%201%3B%20p%3CintNumberDropDowns%3B%20p++%29%20%7B%09%09%09%09%09%09%0D%0A%09%09%09%09if%20%28%28thatForm.elements%5Bi%5D.name.indexOf%28%27product%27+p%29%20%3E%20-1%29%29%20%7B%0D%0A%09%09%09%09%09%0D%0A%09%09%09%09%09//%20Ensures%20product%20type%20is%20selected%0D%0A%09%09%09%09%09if%20%28%28thatForm.elements%5Bi%5D.value%20%3D%3D%20%22%22%29%29%20%7B%0D%0A%09%09%09%09%09%09thatForm.strMessage.value%3DstrTellCustomer%3B%0D%0A%09%09%09%09%09%09thatForm.curCost.value%3D%22%22%3B%0D%0A%09%09%09%09%09%09return%20false%3B%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%20%0D%0A%09//%20Creates%20price%20for%20product%0D%0A%0D%0A%09curPrice%20%3D%20Math.ceil%28curPrice/.05%29%3B%0D%0A%09curPrice*%3D.05%3B%0D%0A%09curDisplayPrice%20%3D%20currency%28curPrice*thatForm.qty.value%29%3B%0D%0A%09curPriceOtherCurrencyRate%20%20%3D%20currency%28curDisplayPrice*curPriceOtherCurrencyRate%29%3B%0D%0A%0D%0A%09//%20Displays%20price%0D%0A%09thatForm.curCost.value%20%3D%20strCurrency+curDisplayPrice%3B%0D%0A%09thatForm.price.value%20%3D%20curPrice%3B%0D%0A%09if%20%28strOtherCurrencySymbol%20%21%3D%20%27%27%29%7B%0D%0A%09%09thatForm.strMessage.value%20%3D%20%22%28Approx.%20Total%20%22+strOtherCurrencySymbol+curPriceOtherCurrencyRate+%22%29%22%3B%0D%0A%09%7Delse%7B%0D%0A%09%09thatForm.strMessage.value%20%3D%20%22Total%22%3B%0D%0A%09%7D%0D%0A%09%0D%0A%09if%20%28blnPriceBands%29%20%7B%0D%0A%09%09thatForm.strMessage.value%3D%22Total%20@%20%22+strCurrency+curPriceArray%5Bj%5D+%22%20per%20item%22%3B%0D%0A%09%09if%20%28blnPriceBandsUpper%29%20%7BthatForm.strMessage.value%3DthatForm.strMessage.value+%27%20in%20packs%20of%20%27+intQtyArray%5Bj%5D%7D%0D%0A%0D%0A%09%7D%0D%0A%09%0D%0A%09//%20Updates%20Mals%20Units%20field%0D%0A%09thatForm.units.value%20%3D%20intUnits%3B%0D%0A%09%0D%0A%09//%20Updates%20Mals%20product%20field%0D%0A%09strProductList%20%3D%20strLocalMainProductName%20+%20strProductList%3B%0D%0A%09if%20%28blnPriceBands%29%20%7BstrProductList%20%3D%20thatForm.product.value%3B%7D%0D%0A%09strProductList%20%3D%20cleanProduct%28strProductList%29%3B%0D%0A%09thatForm.product.value%20%3D%20strProductList%3B%0D%0A%09%0D%0A%09//%20Submits%20form%20%28if%20applicable%29%20if%20all%20required%20fields%20have%20a%20value%0D%0A%09if%20%28blnSubmit%29%7B%0D%0A%09%09if%28blnElementInvalid%29%7B%0D%0A%09%09%09alert%28strRequiredFieldText%29%3B%0D%0A%09%09%09return%20false%3B%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09return%20true%3B%0D%0A%7D%0D%0A%0D%0Afunction%20cleanProduct%28strProduct%29%7B%0D%0A%09//%20Gets%20rid%20of%20all%20%5BstrArrayNames%5D%20if%20used%20in%20%0D%0A%09//%20conjunction%20with%20Dynamic%20List%20Script%0D%0A%09//%20Also%2C%20gets%20rid%20of%20%28strImageName%29%20if%20used%20in%0D%0A%09//%20conjunction%20with%20Image%20Options%20Script%0D%0A%09%0D%0A%09var%20intArrayNameStart%20%3D%200%3B%0D%0A%09var%20intArrayNameEnd%20%3D%200%3B%20%0D%0A%09var%20strProductTemp%20%3D%20%22%22%3B%0D%0A%09var%20strProductTempDelete%20%3D%20%22%22%3B%0D%0A%09%0D%0A%09strProductTemp%20%3D%20strProduct%3B%0D%0A%09%0D%0A%09//%20Loops%20each%20text%20character%20in%20string%20and%20removes%20%5Barraynames%5D%0D%0A%09for%20%28var%20i%3D0%3Bi%3CstrProduct.length%3Bi++%29%7B%0D%0A%09%09if%20%28strProduct.substring%28i%2C%20i+1%29%3D%3D%27%5B%27%29%7BintArrayNameStart%20%3D%20%28i%29%7D%3B%0D%0A%09%09if%20%28strProduct.substring%28i%2C%20i+1%29%3D%3D%27%5D%27%29%7BintArrayNameEnd%20%3D%20%28i+1%29%7D%3B%0D%0A%09%09%0D%0A%09%09if%20%28intArrayNameEnd%3E0%29%7B%0D%0A%09%09%09strProductTempDelete%20%3D%20strProduct.substring%28intArrayNameStart%2C%20intArrayNameEnd%29%3B%0D%0A%09%09%09strProductTemp%20%3D%20strProductTemp.replace%28strProductTempDelete%2C%20%22%22%29%3B%0D%0A%09%09%09intArrayNameEnd%20%3D%200%3B%0D%0A%09%09%09intArrayNameStart%20%3D%200%3B%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09for%20%28var%20i%3D0%3Bi%3CstrProduct.length%3Bi++%29%7B%0D%0A%09%09if%20%28strProduct.substring%28i%2C%20i+1%29%3D%3D%27%28%27%29%7BintArrayNameStart%20%3D%20%28i%29%7D%3B%0D%0A%09%09if%20%28strProduct.substring%28i%2C%20i+1%29%3D%3D%27%29%27%29%7BintArrayNameEnd%20%3D%20%28i+1%29%7D%3B%0D%0A%09%09%0D%0A%09%09if%20%28intArrayNameEnd%3E0%29%7B%0D%0A%09%09%09strProductTempDelete%20%3D%20strProduct.substring%28intArrayNameStart%2C%20intArrayNameEnd%29%3B%0D%0A%09%09%09strProductTemp%20%3D%20strProductTemp.replace%28strProductTempDelete%2C%20%22%22%29%3B%0D%0A%09%09%09intArrayNameEnd%20%3D%200%3B%0D%0A%09%09%09intArrayNameStart%20%3D%200%3B%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%09return%20strProductTemp%3B%0D%0A%7D%0D%0A%0D%0Afunction%20currency%28dbAmount%29%20%7B%20%0D%0A%09//%20returns%20the%20amount%20in%20the%20.99%20format%20%0D%0A%09dbAmount%20-%3D%200%3B%20%0D%0A%09dbAmount%20%3D%20%28Math.round%28dbAmount*100%29%29/100%3B%20%0D%0A%09return%20%28dbAmount%20%3D%3D%20Math.floor%28dbAmount%29%29%20%3F%20dbAmount%20+%20%27.00%27%20%3A%20%28%20%28dbAmount*10%20%3D%3D%20Math.floor%28dbAmount*10%29%29%20%3F%20dbAmount%20+%20%270%27%20%3A%20dbAmount%29%3B%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20trim%28strText%29%20%7B%20%0D%0A%20%20%20%20//%20this%20will%20get%20rid%20of%20leading%20spaces%20%0D%0A%20%20%20%20while%20%28strText.substring%280%2C1%29%20%3D%3D%20%27%20%27%29%20%0D%0A%20%20%20%20%20%20%20%20strText%20%3D%20strText.substring%281%2C%20strText.length%29%3B%0D%0A%0D%0A%20%20%20%20//%20this%20will%20get%20rid%20of%20trailing%20spaces%20%0D%0A%20%20%20%20while%20%28strText.substring%28strText.length-1%2CstrText.length%29%20%3D%3D%20%27%20%27%29%0D%0A%20%20%20%20%20%20%20%20strText%20%3D%20strText.substring%280%2C%20strText.length-1%29%3B%0D%0A%0D%0A%20%20%20return%20strText%3B%0D%0A%7D%0D%0A%0D%0Afunction%20getIndex%28thatForm%2C%20thatElement%29%20%7B%0D%0A%09var%20intFormFields%20%3D%20thatForm.elements.length%3B%0D%0A%20%20%20%20for%20%28var%20i%3D0%3Bi%3CintFormFields%3Bi++%29%7B%0D%0A%20%20%20%20%20%20%20%20if%20%28thatElement%20%3D%3D%20thatForm.elements%5Bi%5D%29%20return%20i%3B%0D%0A%09%7D%0D%0A%20%20%20%20return%20-1%3B%0D%0A%7D%0D%0A"));
document.write("</script>")