var valuta="EUR ";var valuta2="US$ ";var exch=0.754603079;var SecVal=0;var sepmigl=".";var sepdec=",";var PutDec=1;var PutDec2=1;function MettiPunti(b){var a="";var d=b+"s";var c=d.length-1;d=d.substring(0,c);while(c>3){a=sepmigl+d.substring(c-3,c)+a;d=d.substring(0,c-3);c=d.length}a=d+a;return(a)}function alterError(value){if(PutDec!=0){if(value<=0.99){newPounds="0"}else{newPounds=parseInt(value)}newPence=Math.round((value-newPounds)*100);if(newPence==100){newPence=0;newPounds++}if(eval(newPence)<=9){newPence="0"+newPence}newString=MettiPunti(newPounds);if(eval(newPence)!=0){newString=newString+sepdec+newPence}else{newString=newString+sepdec+"00"}}else{newPounds=Math.round(value);newString=MettiPunti(newPounds)}return(newString)}function ScriviTotale(){index=document.cookie.indexOf("eDbasket");countbegin=(document.cookie.indexOf("=",index)+1);countend=document.cookie.indexOf(";",index);if(countend==-1){countend=document.cookie.length}fulllist=document.cookie.substring(countbegin,countend);totprice=0;totiva=0;Tot="Totale:";Eur="€";itemlist=0;for(var i=0;i<=fulllist.length;i++){if(fulllist.substring(i,i+1)=="["){itemstart=i+1;thisitem=1}else{if(fulllist.substring(i,i+1)=="]"){itemend=i;thequantity=fulllist.substring(itemstart,itemend);itemtotal=0;itemtotal=(eval(theprice*thequantity));itemtotaliva=0;itemtotaliva=(eval(ivaitem*thequantity));temptotal=itemtotal*100;totprice=totprice+itemtotal;totiva=totiva+itemtotaliva;itemlist=itemlist+1}else{if(fulllist.substring(i,i+1)=="|"){if(thisitem==1){theitem=fulllist.substring(itemstart,i)}if(thisitem==2){option1=fulllist.substring(itemstart,i)}if(thisitem==3){option2=fulllist.substring(itemstart,i)}if(thisitem==4){option3=fulllist.substring(itemstart,i)}if(thisitem==5){pesoitem=fulllist.substring(itemstart,i)}if(thisitem==6){theprice=fulllist.substring(itemstart,i)}if(thisitem==7){ivaitem=fulllist.substring(itemstart,i)}thisitem++;itemstart=i+1}}}}document.write(Tot+" "+alterError(totprice)+Eur)}function ScriviIva(){index=document.cookie.indexOf("eDbasket");countbegin=(document.cookie.indexOf("=",index)+1);countend=document.cookie.indexOf(";",index);if(countend==-1){countend=document.cookie.length}fulllist=document.cookie.substring(countbegin,countend);totprice=0;totiva=0;itemlist=0;for(var i=0;i<=fulllist.length;i++){if(fulllist.substring(i,i+1)=="["){itemstart=i+1;thisitem=1}else{if(fulllist.substring(i,i+1)=="]"){itemend=i;thequantity=fulllist.substring(itemstart,itemend);itemtotal=0;itemtotal=(eval(theprice*thequantity));itemtotaliva=0;itemtotaliva=(eval(ivaitem*thequantity));temptotal=itemtotal*100;totprice=totprice+itemtotal;totiva=totiva+itemtotaliva;itemlist=itemlist+1}else{if(fulllist.substring(i,i+1)=="|"){if(thisitem==1){theitem=fulllist.substring(itemstart,i)}if(thisitem==2){option1=fulllist.substring(itemstart,i)}if(thisitem==3){option2=fulllist.substring(itemstart,i)}if(thisitem==4){option3=fulllist.substring(itemstart,i)}if(thisitem==5){pesoitem=fulllist.substring(itemstart,i)}if(thisitem==6){theprice=fulllist.substring(itemstart,i)}if(thisitem==7){ivaitem=fulllist.substring(itemstart,i)}thisitem++;itemstart=i+1}}}}document.write(valuta+alterError(totiva))}function ScriviQuantita(){index=document.cookie.indexOf("eDbasket");countbegin=(document.cookie.indexOf("=",index)+1);countend=document.cookie.indexOf(";",index);if(countend==-1){countend=document.cookie.length}fulllist=document.cookie.substring(countbegin,countend);totprice=0;totiva=0;totQuant=0;Quant="Prodotti:";itemlist=0;for(var i=0;i<=fulllist.length;i++){if(fulllist.substring(i,i+1)=="["){itemstart=i+1;thisitem=1}else{if(fulllist.substring(i,i+1)=="]"){itemend=i;thequantity=fulllist.substring(itemstart,itemend);totQuant=totQuant+thequantity*1;itemtotal=0;itemtotal=(eval(theprice*thequantity));itemtotaliva=0;itemtotaliva=(eval(ivaitem*thequantity));temptotal=itemtotal*100;totprice=totprice+itemtotal;totiva=totiva+itemtotaliva;itemlist=itemlist+1}else{if(fulllist.substring(i,i+1)=="|"){if(thisitem==1){theitem=fulllist.substring(itemstart,i)}if(thisitem==2){option1=fulllist.substring(itemstart,i)}if(thisitem==3){option2=fulllist.substring(itemstart,i)}if(thisitem==4){option3=fulllist.substring(itemstart,i)}if(thisitem==5){pesoitem=fulllist.substring(itemstart,i)}if(thisitem==6){theprice=fulllist.substring(itemstart,i)}if(thisitem==7){ivaitem=fulllist.substring(itemstart,i)}thisitem++;itemstart=i+1}}}}document.write(Quant+" "+totQuant)};
