<!--
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='£' + newPounds + '.' + newPence + '';
        } else {
            newString='£' + newPounds + '';
        }
        return (newString);
    }


    function goBuy() {
        ilist='';
        index=document.cookie.indexOf('TheBasket');
        countbegin=(document.cookie.indexOf('=', index)+1);
        countend=document.cookie.indexOf(';',index);
        if(countend==-1) { countend=document.cookie.length; }
        fulllist=document.cookie.substring(countbegin,countend);
        for(var i=0; i<= fulllist.length;i++) {
            if(fulllist.substring(i,i+1)=='[') {
                itemstart=i;
            } else if (fulllist.substring(i,i+1)==']') {
                itemend=i+1;
                ilist=ilist+fulllist.substring(itemstart,itemend);
            }
        }
        ilist=changeSpaces(ilist);
        self.location='https://www.secure-server-hosting.com/secutran/secureforms/sh209649/NewlonBuy.htm?items='+ilist+'&TTT='+TTT+'&postage='+postage+'&orderid='+orderid;
    }

    function changeSpaces(tstring) {
        nstring='';
        for (var i=0; i <= tstring.length; i++) {
            if (tstring.charAt(i)==' ') { nstring=nstring+'^';
            } else { nstring=nstring+tstring.charAt(i); }
        }
        return nstring;
    }

    function showBasket() {
        index = document.cookie.indexOf('TheBasket');
        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;
        document.writeln('<form name="basketform">');
        document.writeln('<table cols=8 border=0 width="850">');
        document.writeln('<tr bgcolor="transparent"><td align=left width="50"><b><div class="smalltext">Ref</div></b></td><td align=left width="280"><b><div class="smalltext">Product Title</div></b></td><td align=left width="280"><b><div class="smalltext">Item</div></b></td><td align=left width="50"><b><div class="smalltext">Qty</div></b></td><td align=left width="40"><b><div class="smalltext">Update</div></b></td><td align=right width="50"><b><div class="smalltext">Cost</div></b></td><td align=right width="50"><b><div class="smalltext">Total</div></b></td><td width="50"><b><div class="smalltext"><center>Action</center></div></b></td></tr>');
        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));
                temptotal=itemtotal*100;
                totprice=totprice+itemtotal;
                itemlist=itemlist+1;
                document.writeln('<tr><td align=left><div class="smalltext">'+field1+'&nbsp;</div></td><td align=left><div class="smalltext">'+field4+'&nbsp;</div></td><td align=left><div class="smalltext">'+field5+'&nbsp;</div></td><td align=left>&nbsp;<INPUT TYPE=TEXT NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=3 div class="smalltext"></div></td><td align=left>&nbsp;<input type="button" class="smalltext" name="update" value="Update" onClick="updateBasket();"></div></td><td align=right><div class="smalltext">&nbsp;'+presentValue(eval(theprice))+'</div></td><td align=right><div class="smalltext">&nbsp;'+presentValue(itemtotal)+'</div></td><td><input type="button" class="smalltext" name="remove'+itemlist+'" value="Remove" onClick="removeItem('+itemlist+');"></td></tr>');
            } else if (fulllist.substring(i,i+1)=='|') {
                if (thisitem==1) field1 = fulllist.substring(itemstart,i);
                if (thisitem==2) theprice = fulllist.substring(itemstart,i);
                if (thisitem==3) thetax = fulllist.substring(itemstart,i);
                if (thisitem==4) field4 = fulllist.substring(itemstart,i);
                if (thisitem==5) field5 = fulllist.substring(itemstart,i);
                if (thisitem==6) field6 = fulllist.substring(itemstart,i);
                thisitem++;
                itemstart=i+1;
            }
        }
        document.writeln('<tr><td align="right" colspan="6"><div class="smalltext"><b>Total:</b></div></td><td align="right" colspan="1"><div class="smalltext">&nbsp;'+presentValue(totprice)+'</div></td><td></td></tr>');
        document.writeln('</table>');
        document.writeln('</form>');
    }
	
	function showsmallBasket() {
        index = document.cookie.indexOf('TheBasket');
        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;
		theq=0;
        document.writeln('<form name="basketform">');
        document.writeln('<table cols=4 border=0 width="130">');
        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));
                temptotal=itemtotal*100;
                totprice=totprice+itemtotal;
                itemlist=itemlist+1;
				theq=eval(theq)+eval(thequantity);
            } else if (fulllist.substring(i,i+1)=='|') {
                if (thisitem==1) field1 = fulllist.substring(itemstart,i);
                if (thisitem==2) theprice = fulllist.substring(itemstart,i);
                if (thisitem==3) thetax = fulllist.substring(itemstart,i);
                if (thisitem==4) field4 = fulllist.substring(itemstart,i);
                if (thisitem==5) field5 = fulllist.substring(itemstart,i);
                if (thisitem==6) field6 = fulllist.substring(itemstart,i);
                thisitem++;
                itemstart=i+1;
            }
        }
        document.writeln('<tr><td colspan=1><div class="smalltext"><strong>Items</strong>&nbsp;'+theq+'</div></td><td colspan=2><div class="smalltext"><b>Total</b></div></td><td align=left colspan="3"><div class="smalltext">&nbsp;'+presentValue(totprice)+'</div></td><td colspan=4><a href="basket.php" class="smalltext">Basket</a></td><td></td></tr>');
        document.writeln('</table>');
        document.writeln('</form>');
    }

    function removeItem(itemno) {
		var offsettime = +1;
now = new Date();
hour = now.getHours();
now.setHours(hour + offsettime);
        newItemList=null;
        itemlist=0;
        for(var i=0;i<=fulllist.length;i++) {
            if (fulllist.substring(i,i+1)=='[') {
                itemstart=i+1;
            } else if (fulllist.substring(i,i+1)==']') {
                itemend=i;
                theitem = fulllist.substring(itemstart,itemend);
                itemlist=itemlist+1;
                if(itemlist != itemno) {
                    newItemList = newItemList+'['+fulllist.substring(itemstart,itemend)+']';
                }
            }
        }
        index = document.cookie.indexOf('TheBasket');
        document.cookie='TheBasket='+newItemList+'; expires='+now.toGMTString()+'';
        self.location = 'basket.php';
    }

    function clearBasket() {
        if (confirm('Are you sure you wish to clear the basket?')) {
            index=document.cookie.indexOf('TheBasket');
            document.cookie='TheBasket=.';
            self.location='basket.php';
        }
    }

    function updateBasket() {
		var offsettime = +1;
now = new Date();
hour = now.getHours();
now.setHours(hour + offsettime);
        newItemList=null;
        itemlist=0;
        for(var i=0;i<=fulllist.length; i++) {
            if(fulllist.substring(i,i+1)=='[') {
                thisitem=1;
                itemstart=i+1;
                fullstart=i+1;
            } else if(fulllist.substring(i,i+1)==']') {
                itemend=i;
                itemlist++;
                thiselement='quant'+itemlist;
                newItemList=newItemList+'['+field1+'|'+field2+'|'+field3+'|'+field4+'|'+field5+'|'+field6+'|'+document.basketform.elements[thiselement].value+']';
            } else if(fulllist.substring(i,i+1)=='|') {
                if (thisitem==1) field1 = fulllist.substring(itemstart,i);
                if (thisitem==2) field2 = fulllist.substring(itemstart,i);
                if (thisitem==3) field3 = fulllist.substring(itemstart,i);
                if (thisitem==4) field4 = fulllist.substring(itemstart,i);
                if (thisitem==5) field5 = fulllist.substring(itemstart,i);
                if (thisitem==6) field6 = fulllist.substring(itemstart,i);
                thisitem++;
                itemstart=i+1;
            }
        }
        index=document.cookie.indexOf('TheBasket');
        document.cookie='TheBasket='+newItemList+'; expires='+now.toGMTString()+'';
        self.location='basket.php';
    }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
