function presentValue(value) {
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=2;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((value+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=2-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (2>0) {
            newString='&pound;' + newPounds + '.' + newPence + '';
        } else {
            newString='&pound;' + newPounds + '';
        }
        return (newString);
    }

 function BasketSummary() {

	 thisitem=1;
     currency=1;
     postageprice=3.95;
     grandtotal=3.95;
     index=document.cookie.indexOf('TiffanyRoseCart');
     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;totprice2=0;shippingtotal=0;shippingtotal2=0;taxtotalone=0;taxtotalone2=0;taxtotaltwo=0;taxtotaltwo2=0;ordertotal=0;ordertotal2=0;
     taxablestandard=0;taxablesecond=0;taxable=0;
     itemlist=0;
	 var thisitem;
	 var itemstart;
	 
     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;itemtotal2=0;
             itemtotal=(eval(theprice*thequantity));
             temptotal=itemtotal*100;
             totprice=totprice+itemtotal;
	     	grandtotal=totprice+postageprice;
             itemlist=itemlist+1;

             } else if (fulllist.substring(i,i+1)=='|') {
                 if (thisitem==1) theCode=fulllist.substring(itemstart,i);
                 if (thisitem==2) theSKU=fulllist.substring(itemstart,i);
                 if (thisitem==3) theitem=fulllist.substring(itemstart,i);
                 if (thisitem== 4) theprice=fulllist.substring(itemstart,i);
               thisitem++; itemstart=i+1;
             }

         }
 
	var GoodsTotal = (eval(grandtotal-postageprice));
	var GoodsRounded = Math.round(GoodsTotal*100)/100

 if (itemlist==1) 
 	{
	var ItemPlural = "item"
	}

 if (itemlist>1) 
 	{
	var ItemPlural = "items"
	}
	
 if (totprice!=0) 
	{ 
     document.writeln(+itemlist+' '+ItemPlural+'<br>'+presentValue(eval(totprice))+'<br>');
	}

 if (totprice==0) 
	{ 
	     document.writeln('No items<br>');
	}
}

BasketSummary();