// 035: Copyright Dreamteam Design Ltd 1997 - No alteration of this code is permitted
var gPageDir=window.location.href.substring(0,window.location.href.lastIndexOf('/')+1);var gDiscount=0;var freeS=-1;var shipLabel='';var productDiscountImage='';
function productObj(){;this.pUniqueIdent='';this.pQty=0;this.pName='Apples';this.pCode='app1';this.pDiscount='';this.pDiscType='';this.pDiscTrig='';this.pRetailPrice='';this.pOfferMsg='';this.pConfirmMsg='';this.pTrigOnce='';this.pPercent='';this.pAmount='';this.pBilling='';this.pDelivery='';this.pAllowAll='';this.pTrigAmount=0;this.p2='app1';this.p3='app1';this.p4='app1';this.p5='app1';this.p6='app1';this.p7='app1';this.p8='app1';this.p9='app1';this.p10='app1';this.pImage='';this.pLink='';};
function basketObj(){;};var myBasket=new basketObj();e.Product_Schema='';
function _productLine(pObj){;if(!pObj){;return '';};var normalCharge= parseFloat(pObj.pRetailPrice) * parseFloat(pObj.pQty);var amountOff=parseFloat(pObj.pRetailPrice);var howManyTimes=parseFloat(pObj.pQty) / parseFloat(pObj.pDiscTrig);if(howManyTimes>=1){;if(pObj.pTrigOnce=='-1')howManyTimes=1;};var totalReduction=0;var discType='';if(howManyTimes>=1){;if(pObj.pAllowAll=='-1'){;howManyTimes=parseFloat(pObj.pQty);};if(pObj.pDiscType=='1'){;totalReduction=amountOff * Math.floor(howManyTimes) * -1;discType='FREE';};if(pObj.pDiscType=='2'&&isNaN(pObj.pAmount)==false){;if(pObj.pAmount.indexOf('-')!=-1){;amountOff= parseFloat(pObj.pAmount);}else if(pObj.pAmount.indexOf('+')!=-1){;amountOff= parseFloat(pObj.pAmount);}else if(pObj.pAmount!=''){;amountOff=(amountOff - parseFloat(pObj.pAmount))*-1;};totalReduction=amountOff * Math.floor(howManyTimes);discType='AMOUNTOFF';};if(pObj.pDiscType=='3'&&isNaN(pObj.pPercent)==false){;if(pObj.pPercent.indexOf('-')!=-1){;amountOff= (amountOff * (parseFloat(pObj.pPercent)/100));}else if(pObj.pPercent.indexOf('+')!=-1){;amountOff= (amountOff * (parseFloat(pObj.pPercent)/100));}else if(pObj.pPercent!=''){;};totalReduction=amountOff * Math.floor(howManyTimes);discType='PERCENTAGEOFF';};if(pObj.pDiscType=='4'){;discType='GIFTDECLARATION';};/*;var tempAcum=0;if(pObj.pAllowAll=='-1'){;if(pObj.pDiscType=='2'&&isNaN(pObj.pAmount)==false){;if(pObj.pAmount.indexOf('-')!=-1){;amountOff= parseFloat(pObj.pAmount);}else if(pObj.pAmount.indexOf('+')!=-1){;amountOff= parseFloat(pObj.pAmount);}else if(pObj.pAmount!=''){;amountOff=(amountOff - parseFloat(pObj.pAmount))*-1;};totalReduction=amountOff * Math.floor(howManyTimes);totalReduction=amountOff * Math.floor(parseFloat(pObj.pQty));discType='AMOUNTOFF';if(parseFloat(pObj.pQty)>=parseFloat(pObj.pDiscTrig)){;alert('discount applies:'+pObj.pName+' amount:'+totalReduction);};};}; */;pObj.pTrigAmount=Math.floor(howManyTimes);e.Product_Schema+='[group]Product Group';e.Product_Schema+='[id]0';e.Product_Schema+='[id]'+productDiscountImage+pObj.pName+' ('+pObj.pCode+') - '+pObj.pOfferMsg;e.Product_Schema+='[id]_active=true_override=false_type=a_product_startDate=_endDate=_msg1=_msg2=_switch=0_redirect=_billing='+pObj.pBilling+'_delivery='+pObj.pDelivery+'_';e.Product_Schema+='[schema]'+pObj.pConfirmMsg+' (x'+pObj.pTrigAmount+')';e.Product_Schema+='[rule]'+discType;e.Product_Schema+='[rule]function zClass(ST){return '+totalReduction+'};zClass(e._ST);';e.Product_Schema+='[rules]';if(pObj.pBilling!=''){;if(e._selCountry!=pObj.pBilling){;return'';};};if(pObj.pDelivery!=''){;if(e._selCountry2){;if(e._selCountry2!=pObj.pDelivery){;return'';};}else{;if(e._selCountry!=pObj.pDelivery){;return'';};};};if(Math.floor(howManyTimes)==0){;return pObj.pOfferMsg + '\n' + pObj.pTrigAmount;}else{;return '';};}else{;return pObj.pOfferMsg;};};
function _basketObj(){;e.Product_Schema='';for (var s in myBasket){;_productLine(myBasket[s]);};myBasket=new basketObj();};
function checkoutInit(){;e.execCom='';var sel=window.document.getElementById('Location');if(sel){;if(e.orderLoaded==0){;if(e._selCountry!=''){;defaultLoc=e._selCountry;};e.orderLoaded=-1;for(count=0;count!=sel.options.length;count++){;if(sel.options[count].text==defaultLoc){;sel.selectedIndex=count;};};e.locChange=-2;sel.onchange();e.locChange=0;};};sel=window.document.getElementById('Type');if(sel){;if(e._typeSel!=-1&&orderStatus==0){;sel.selectedIndex=e._typeSel;};};var sel=window.document.checkout_form.Delivery_Country;if(sel){;if(sel&&e._selCountry2!=''){;for(count=0;count!=sel.options.length;count++){;if(sel.options[count].text==e._selCountry2){;sel.selectedIndex=count;};};};};e.orderLoaded=-1;};
function _valVat(field){;if(e.Vat_Number!=''){;alert(label22);e.Vat_Number='';location.reload();return;};if(confirm(label21+'\n\n'+window.document.getElementById('VAT_Number').value)==true){;e.Vat_Number=window.document.getElementById('VAT_Number').value;}else{;e.Vat_Number='';};location.reload();};
function createArray(n,ini){;this.size=n;for(i=1;i<=n;i++){;this[i]=ini;};return this;};
function colDisp(value,arg,cls){;if(isNaN(value)==true){;xStr+='<TD '+tag(table1)+' ALIGN=right class="Td_Col_Totals '+cls+'">'+oFont3+value;return;};var splitP=value;var normP=value;if(cls==undefined){;cls='Row_Total';}else{;cls=cls+'_Value';};if(''+value!=unescape(label38)){;splitP=priceDisp(money(value*e.splitRate,2,''),1,0);normP=priceDisp(money(value,2,''),0,0);};if(e.splitRate!=1){;if(value==0)splitP='-0.00';xStr+='</TD><TD '+tag(table1)+' ALIGN=right class="'+cls+'">'+oFont3+splitP;if(WPSpecial==false){;xStr+='</TD><TD '+tag(table2)+' ALIGN=right class="'+cls+'">'+oFont3+normP;};}else{;xStr+='<TD '+tag(table1)+' ALIGN=right class="Td_Col_Totals '+cls+'">'+oFont3+normP;};};
function addTax(str,arg,tax){;_progBar('addTax{}','checkout:');if(str<0)tax='n/a';var yPrice=0;if(arg==-1)yPrice=(parseFloat(str)/100)*whatTax(tax);return parseFloat(str)+yPrice;};
function whatTax(str){;_progBar('whatTax{}','checkout:');if(allowTax==0)return '0';if(countryName=='United States of America'){;};if(oldTaxMethod==true){;if(((countryName==selCountry)||(globalTax.indexOf(selCountry)!=-1))&&str!='(default)'){;var a1=taxGroups.indexOf(str);for(cnt=0;cnt<listArg;cnt++){;var a2=taxGroups.indexOf(':',a1);var a3=taxGroups.indexOf(':',a2+1);a1=a3;};var a4=taxGroups.substring(a2+1,a3);return a4;}else{;return VAT;};}else{;if(allowTax==0)return '0';if(e._delCountry==''&&e._selCountry==''){;}else{;if(!e._delCountry){;if(e._selCountry=='')e._selCountry=defaultLoc;};if(e._delCountry==''){;if(e._selCountry=='')e._selCountry=defaultLoc;};};if(!e._delCountry)e._delCountry=e._selCountry;if(!e._selCountry2)e._delCountry=e._selCountry;if(e._delCountry=='')return '0';var taxToApply=defaultTax;var attractTax=false;if(countryName==e._delCountry){;taxToApply=countryTax;attractTax=true;}else if(globalTax.indexOf(e._delCountry)!=-1){;var pos=globalTax.indexOf(e._delCountry);if(pos==''&&pos!=0)pos=-1;if(pos!=-1){;var newTax=globalTax.substring(pos);taxToApply=parseFloat(newTax.substring(newTax.indexOf(':')+1,newTax.indexOf('~')));attractTax=true;};};if(attractTax==true){;if(str!='(default)'){;if(taxGroups.indexOf(str+':')!=-1){;var b1=taxGroups.split(str+':')[1].split(':')[0];taxToApply=b1;}else{;if(str=='Zero_Rate'){;str='Zero_Rated';}else if(str=='Zero_Rated'){;str='Zero_Rate';};if(taxGroups.indexOf(str+':')!=-1){;var b1=taxGroups.split(str+':')[1].split(':')[0];taxToApply=b1;}else{;alert('Tax group '+str+' is not recognised');alert(taxGroups);};};};};return taxToApply;};};
function checkOptions(count){;_progBar('checkOptions{}','checkout:');count++;if(itemNo[count].indexOf('|')!=-1&&itemNo[count]!=''){;if(itemNo[count].indexOf(hChar)==0){;xStr+=oFont4+remSp(unescape(itemNo[count].substring(0,itemNo[count].indexOf('|'))),'')+sChar;hidd+=remSp(itemNo[count].substring(0,itemNo[count].indexOf('|')),'')+sChar;};}else{;if(itemNo[count].indexOf(hChar)==0&&itemNo[count]!=''){;xStr+=oFont4+remSp(unescape(itemNo[count]),'')+sChar;hidd+=remSp(itemNo[count],'')+sChar;};};while(itemNo[count]!=']'&&itemNo[count]!='>'){;if(itemNo[count].indexOf('*')!=-1&&itemNo[count]!=''){;if(itemNo[count].indexOf('|')!=-1){;var chrS='';itemDet=itemNo[count].split('|');if(xType=='@'){;kitMasterQty=orderQty;if(itemDet[13])kitTni=itemDet[13];gCalcM=itemDet[15];kitTwi=itemDet[3];chrS=itemDet[14];gPriceA=itemDet[14];gPriceAI=(gPriceA/100)*whatTax(itemNo[fieldCount-25]);gPriceAI=parseFloat(gPriceA)+parseFloat(gPriceAI);}else{;if(xType=='*'){;kitMasterQty=0;};if(e._validMem==-1&&itemDet[4]!=''){chrS=itemDet[4]}else{chrS=itemDet[2]};cStr+=cStr1+itemDet[0].substring(1)+'<br> ';};if(chrS=='')chrS='0';var UIdent=itemNo[1]+'|'+itemNo[2];if(e.orderLoaded==-1){;if(itemNo[fieldCount-22]!='0|0|0|0|0'){;if(xType=='*'){;if(myBasket[UIdent]){;var nQty=0;nQty=parseFloat(myBasket[UIdent].pQty);nQty+=parseFloat(orderQty);if(kitMasterQty>0){;nQty=nQty*kitMasterQty;};myBasket[UIdent].pQty=nQty;if(parseFloat(myBasket[UIdent].pRetailPrice)>parseFloat(itemDet[2])){;myBasket[UIdent].pRetailPrice=itemDet[2];};}else{;var newProduct=new productObj();newProduct.pUniqueIdent=UIdent;newProduct.pRetailPrice=itemDet[2];var nQty=orderQty;if(kitMasterQty>0){;nQty=nQty*kitMasterQty;};newProduct.pQty=nQty;newProduct.pName=itemDet[0];newProduct.pCode=itemDet[1];newProduct.p2=itemDet[2];newProduct.p3=itemDet[3];newProduct.p4=itemDet[4];newProduct.p5=itemDet[5];newProduct.p6=itemDet[6];newProduct.p7=itemDet[7];newProduct.p8=itemDet[8];newProduct.p9=itemDet[9];newProduct.p10=itemDet[10];newProduct.pDiscount=itemNo[fieldCount-22];var dArry=itemNo[fieldCount-22].split('|');newProduct.pDiscTrig=dArry[1];newProduct.pOfferMsg=dArry[2];newProduct.pConfirmMsg=dArry[3];newProduct.pDiscType=dArry[4];newProduct.pTrigOnce=dArry[5];newProduct.pAmount=dArry[6];newProduct.pPercent=dArry[7];newProduct.pBilling=dArry[8];newProduct.pDelivery=dArry[9];newProduct.pAllowAll=dArry[10];var arr=activeList[posit].split('~');newProduct.pImage=arr[arr.length-4];newProduct.pLink=arr[0];myBasket[newProduct.pUniqueIdent]=newProduct;};};};};charge+=parseFloat(chrS);if(gCalcM==2&&xType!='@'){;vatable=0;}else{;vatable=(charge/100)*whatTax(itemNo[fieldCount-25]);if(xType=='!'){;vatable=vatable*kitMasterQty;};};xStr+=oFont4+eChar+remSp(unescape(itemDet[0].substring(1)),'')+'<span class="Component_Options"><br /><!--COMPONENTS--></span>';if(multiLineCount==0){;autoID=itemDet[11];itemcode=itemDet[1];perWeight=itemDet[3];hidd+=remSp(itemDet[0].substring(1),'')+'~';};multiLine+='@'+itemNo[fieldCount]+'~'+remSp(itemDet[0].substring(1),'')+'~~~'+itemDet[1]+' ['+itemDet[11]+']~'+orderQty+'~'+itemDet[2]+'~#';if(myBasket[UIdent]){;hidd+='[ Unit Price ]...'+money(itemDet[2],2,'')+' [ Unit Tax ]...'+money(vatable,2,'')+' [ Tax Rate ]...'+whatTax(itemNo[fieldCount-25])+'% [ Tax Group ]...'+itemNo[fieldCount-25]+' [ Product Discount ]...'+myBasket[UIdent].pOfferMsg+' [ Trigger Qty ]...'+myBasket[UIdent].pDiscTrig+' [ Trigger Code ]...'+myBasket[UIdent].pUniqueIdent+'\n ';}else{;hidd+='[ Unit Price ]...'+money(itemDet[2],2,'')+' [ Unit Tax ]...'+money(vatable,2,'')+' [ Tax Rate ]...'+whatTax(itemNo[fieldCount-25])+'% [ Tax Group ]...'+itemNo[fieldCount-25]+'\n ';};if(itemNo[15]!='')hidd+='Options: '+repC(itemNo[15],'<br />',' ');multiLineCount++;}else{;var tmp=itemNo[count].split('`')[0].substring(1);xStr+=oFont4+eChar+remSp(unescape(tmp),'')+'<BR>';hidd+=remSp(tmp,'')+'~';if(xType!='@'){;if(itemNo[count].substring(1)!='')cStr+=cStr3+tmp+'<br> ';};};};count++;};return count;};
function updateTot(){;_updateTot();};
function _updateTot(){;_progBar('_updateTot{}','checkout:');if(kitOveride!=-1&&add2Bsk==false){;var str=replaceE('Kit_Price_Exc_Vat¬<!--Kit_Price_Exc_Vat-->^Kit_Price_Inc_Vat¬<!--Kit_Price_Inc_Vat-->^Kit_Base_Price¬<!--Kit_Base_Price-->^Kit_Price_Adjust¬<!--Kit_Price_Adjust-->^Kit_Price_Adjust_Inc_Vat¬<!--Kit_Price_Adjust_Inc_Vat-->^Kit_Base_Price_Inc_Vat¬<!--Kit_Base_Price_Inc_Vat-->^');var pharr=str.split('^');var count=0;while(count!=pharr.length-1){;var bskF=window.document.getElementsByName(pharr[count].split('¬')[0]);if(bskF){;var incount=0;while(incount!=bskF.length){;var tmp=pharr[count].split('¬')[1];tmp=popTemp(tmp);bskF[incount].innerHTML=replaceC(tmp);incount++;};};count++;};};add2Bsk=false;};
function _saveBasket(){;_progBar('_saveBasket{}','checkout:');if(list[0]!=1){;var dataStr='';for(pos=1;pos<list[0];pos++){;dataStr+=list[pos]+'#';};top.window.name=window.location.href+'[|]'+gPag+'X'+g
