// JavaScript Document

// Image Pop
 
PositionX = 100;
PositionY = 100;
defaultWidth  = 800;
defaultHeight = 600;
var AutoClose = false;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width+15,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src="'+imageURL+'" style="display:block"></body></html>');
close();  
}}

//JSHOP

today=new Date();
today.setTime(today.getTime() + (3600000));
today=today.toGMTString();
currentdate=new Date();
currentdate=currentdate.toLocaleString();
index = document.cookie.indexOf('TheBasketName');

if (index > -1) {
   countbegin=(document.cookie.indexOf('=',index)+1);
   countend=document.cookie.indexOf(';',index);
   if(countend==-1) {
      fulllist='';
   } else {
      fulllist=document.cookie.substring(countbegin,countend);
   }
} else {
   fulllist='';
}

if(fulllist.length < 1) {
   document.cookie='TheBasketCode=.; expires='+today;
   document.cookie='TheBasketName=.; expires='+today;
   document.cookie='TheBasketWeight=.; expires='+today;
   document.cookie='TheBasketTaxable=.; expires='+today;
   document.cookie='TheBasketPrice=.; expires='+today;
   document.cookie='TheBasketExtraFields=.; expires='+today;
   document.cookie='TheBasketAdvanced=.; expires='+today;
   document.cookie='TheBasketQuantity=.; expires='+today;
   document.cookie='TheCurrency=1; expires=Friday, 31-Dec-2010 08:00:00 GMT';
   document.cookie='JShopReferrer=.; expires='+today;
}

currencyCode = new Array(1); currencyName = new Array(1); currencyDecimals = new Array(1); currencyPre = new Array(1); currencyMiddle = new Array(1); currencyPost = new Array(1); 
currencyCode[1]='GBP'; currencyName[1]='United Kingdom Pounds'; currencyDecimals[1]='2'; currencyPre[1]='£'; currencyMiddle[1]='.'; currencyPost[1]=''; 



function goBuy() {
	ilist='';
	ilist=ilist+retrieveCookie('TheBasketCode',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketName',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketWeight',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketTaxable',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketPrice',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketExtraFields',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketAdvanced',0,0)+'^';
	ilist=ilist+retrieveCookie('TheBasketQuantity',0,0)+'^';
	ilist=ilist+retrieveCookie('TheCurrency',0,0)+'^';
	ilist=ilist+retrieveCookie('JShopReferrer',0,0)+'^';
	ilist=changeUnwanted(ilist);
	ilist=escape(ilist);
	ilist=changePercent(ilist);
	top.name=ilist;
	top.location='buy.asp';
}



function changeUnwanted(tstring) {
    nstring='';
    for (var i=0; i <= tstring.length; i++) {
        nchar=tstring.charAt(i);
        if (nchar=='*') { nchar='!&1'; }
        if (nchar=='+') { nchar='!&2'; }
        if (nchar=='@') { nchar='!&3'; }
        if (nchar=='.') { nchar='!&4'; }
        if (nchar=='/') { nchar='!&5'; }
        if (nchar=='-') { nchar='!&6'; }
        nstring=nstring+nchar;
    }
    return nstring;
}

function changePercent(tstring) {
    nstring='';
    for (var i=0; i <= tstring.length; i++) {
        nchar=tstring.charAt(i);
        if (nchar=='%') { nchar='_'; }
        nstring=nstring+nchar;
    }
    return nstring;
}

function showPrice(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    thisitem=0;
    itemstart=0;
    theprice=0;
    for (var i=0; i<pricestring.length; i++) {
       if (pricestring.substring(i,i+1)=='~') {
          thisitem++;
          if (thisitem==eval(theCurrency)) {
             theprice=pricestring.substring(itemstart,i);
          }
          itemstart=i+1;
       }
    }
    return presentValue(theprice,currencyDecimals[theCurrency],currencyPre[theCurrency],currencyMiddle[theCurrency],currencyPost[theCurrency]);
}

function showPriceSingle(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    return presentValue(pricestring,currencyDecimals[theCurrency],currencyPre[theCurrency],currencyMiddle[theCurrency],currencyPost[theCurrency]);
}

function showPricePlain(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    return presentValue(pricestring,currencyDecimals[theCurrency],'',currencyMiddle[theCurrency],'');
}

function getPrice(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    thisitem=0;
    itemstart=0;
    theprice=0;
    for (var i=0; i<pricestring.length; i++) {
       if (pricestring.substring(i,i+1)=='~') {
          thisitem++;
          if (thisitem==eval(theCurrency)) {
             theprice=pricestring.substring(itemstart,i);
          }
          itemstart=i+1;
       }
    }
    return theprice;
}

function presentValue(value,dp,pt,mt,at) {
	if(value<=0.9999) {
		newPounds='0';
	} else {
		newPounds=parseInt(value);
	}
	dec='1';
	for (var i=1; i<=dp;i++) {
		dec=dec+'0';
	}
	if (value>0) {
		newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
	} else {
		newPence=0;
	}
	compstring='9';
	for (var i=1; i <=dp-1;i++) {
		if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
		compstring=compstring+'9';
	}
	if (dp>0) {
		if (newPence==eval(dec)) { newPounds++; newPence=0; }
		newString=pt+newPounds+mt+newPence+at;
	} else {
		newString=pt+newPounds+at;
	}
	return (newString);
}

function retrieveCookie(thecookie,thenumber,theadditional) {
    index = document.cookie.indexOf(thecookie);
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    fulllist=document.cookie.substring(countbegin,countend);
    if (thenumber==0) { return fulllist; }
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
           itemvalue=fulllist.substring(itemstart,i);
           if (thisitem==thenumber) {
                if (theadditional==0) {
                    return itemvalue;
                } else {
                    itemstarttwo=0;
                    thisitemtwo=0;
                    for (var j=0; j<itemvalue.length; j++) {
                        if (itemvalue.substring(j,j+1)=='~') {
                            thisitemtwo++;
                            itemvaluetwo=itemvalue.substring(itemstarttwo,j);
                            if (thisitemtwo==theadditional) {
                                return itemvaluetwo;
                            }
                            itemstarttwo=j+1;
                        }
                    }
                }
            }
            itemstart=i+1;
        }
    }
    return '';
}

function addToCookie(thecookie,thevalue) {
    fulllist=retrieveCookie(thecookie,0,0);
    if (fulllist=='.') { fulllist=''; }
    fulllist=fulllist+thevalue+'|';
    document.cookie=thecookie+'='+fulllist+'; expires='+today;
}

function removeFromCookie(thecookie,thenumber) {
    fulllist=retrieveCookie(thecookie,0,0);
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
            itemvalue=fulllist.substring(itemstart,i);
            if (thisitem!=thenumber) {
                newcookie=newcookie+itemvalue+'|';
            }
            itemstart=i+1;
        }
    }
    if (newcookie=='') { newcookie='.'; }
    document.cookie=thecookie+'='+newcookie+'; expires='+today;
}

function changeCookieValue(thecookie,thenumber,thevalue) {
    fulllist=retrieveCookie(thecookie,0,0);
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
            itemvalue=fulllist.substring(itemstart,i);
            if (thisitem==thenumber) {
                itemvalue=thevalue;
            }
            newcookie=newcookie+itemvalue+'|';
            itemstart=i+1;
        }
    }
    document.cookie=thecookie+'='+newcookie+'; expires='+today;
}

function retrieveCookieCount(thecookie) {
   fulllist=retrieveCookie(thecookie,0,0);
   thisitem=0; newcookie=''; itemstart=0;
   for(var i=0; i<fulllist.length;i++) {
    if (fulllist.substring(i,i+1)=='|') {
        thisitem++;
        itemstart=i+1;
    }
   }
   return thisitem;
}

function showCurrency() {   index = document.cookie.indexOf('TheCurrency');   countbegin=(document.cookie.indexOf('=',index)+1);   countend=document.cookie.indexOf(';',index);   if(countend==-1) { countend=document.cookie.length; }   theCurrency=document.cookie.substring(countbegin,countend);   document.basketform.selectcurrency.selectedIndex=theCurrency-1;}function checkAdvanced(adv,advField0,advField1,advField2,advField3,advField4,advField5,advField6,advField7,advField8) {
     newAdv='';advlist=0;
    for (var j=0;j<=adv.length;j++) {
            if (adv.substring(j,j+1) == '{') {
            thisadv=1;
            advstart=j+1;
        } else if (adv.substring(j,j+1) == '}') {
            advend=j;
            advPrice=adv.substring(advstart,advend);
            advlist++; applicable=true;
            if (field0!='none' && advField0 != field0) applicable=false;
            if (field1!='none' && advField1 != field1) applicable=false;
            if (field2!='none' && advField2 != field2) applicable=false;
            if (field3!='none' && advField3 != field3) applicable=false;
            if (field4!='none' && advField4 != field4) applicable=false;
            if (field5!='none' && advField5 != field5) applicable=false;
            if (field6!='none' && advField6 != field6) applicable=false;
            if (field7!='none' && advField7 != field7) applicable=false;
            if (field8!='none' && advField8 != field8) applicable=false;
            if (applicable==true) {
                newAdv = newAdv+ '{'+field0+'!'+field1+'!'+field2+'!'+field3+'!'+field4+'!'+field5+'!'+field6+'!'+field7+'!'+field8+'!'+advFrom+'!'+advTo+'!'+advPrice+'}'
            }
        } else if (adv.substring(j,j+1)=='!') {
            if (thisadv==1) field0 = adv.substring(advstart, j);
            if (thisadv==2) field1 = adv.substring(advstart, j);
            if (thisadv==3) field2 = adv.substring(advstart, j);
            if (thisadv==4) field3 = adv.substring(advstart, j);
            if (thisadv==5) field4 = adv.substring(advstart, j);
            if (thisadv==6) field5 = adv.substring(advstart, j);
            if (thisadv==7) field6 = adv.substring(advstart, j);
            if (thisadv==8) field7 = adv.substring(advstart, j);
            if (thisadv==9) field8 = adv.substring(advstart, j);
            if (thisadv== 10) advFrom=adv.substring(advstart,j);
            if (thisadv== 11) advTo=adv.substring(advstart,j);
            thisadv++;advstart=j+1;
        }
    }
    if (newAdv=='') newAdv='none';
    return newAdv;
}

function buyItem(newCode,newItem,newPrice,newTaxable,newWeight,newField0,newField1,newField2,newField3,newField4,newField5,newField6,newField7,newField8,newAP,newQuantity) {
	if(newQuantity<=0) {
		rc = alert('The quantity entered is incorrect');
	} else {
		if (confirm('Add '+newQuantity+' x '+newItem+' to basket? ')) {
			 if (newAP!='none') {
				 newAP=checkAdvanced(newAP,newField0,newField1,newField2,newField3,newField4,newField5,newField6,newField7,newField8);
			 }
			 amended = false;
			 newItemList=''; itemlist=0;
			 for (var i=1;i<=retrieveCookieCount('TheBasketCode');i++) {
				  theCode=retrieveCookie('TheBasketCode',i,0);
				  theItem=retrieveCookie('TheBasketName',i,0);
				  theQuantity=retrieveCookie('TheBasketQuantity',i,0);
						  theField0 = retrieveCookie('TheBasketExtraFields',i,1);
						  theField1 = retrieveCookie('TheBasketExtraFields',i,2);
						  theField2 = retrieveCookie('TheBasketExtraFields',i,3);
						  theField3 = retrieveCookie('TheBasketExtraFields',i,4);
						  theField4 = retrieveCookie('TheBasketExtraFields',i,5);
						  theField5 = retrieveCookie('TheBasketExtraFields',i,6);
						  theField6 = retrieveCookie('TheBasketExtraFields',i,7);
						  theField7 = retrieveCookie('TheBasketExtraFields',i,8);
						  theField8 = retrieveCookie('TheBasketExtraFields',i,9);
				  if (theCode==newCode && theItem==newItem  && theField0 == newField0 && theField1 == newField1 && theField2 == newField2 && theField3 == newField3 && theField4 == newField4 && theField5 == newField5 && theField6 == newField6 && theField7 == newField7 && theField8 == newField8) {
					   amended=true;
					   tempquantity=eval(theQuantity)+eval(newQuantity);
					   changeCookieValue('TheBasketQuantity',i,tempquantity);
				  }
			 }
			 if (amended==false) {
				addToCookie('TheBasketCode',newCode);
				addToCookie('TheBasketName',newItem);
				addToCookie('TheBasketPrice',newPrice);
				addToCookie('TheBasketWeight',newWeight);
				addToCookie('TheBasketTaxable',newTaxable);
				addToCookie('TheBasketExtraFields',newField0+'~'+newField1+'~'+newField2+'~'+newField3+'~'+newField4+'~'+newField5+'~'+newField6+'~'+newField7+'~'+newField8+'~');
				addToCookie('TheBasketAdvanced',newAP);
				addToCookie('TheBasketQuantity',newQuantity);
			 }
		 }
	 }
 }



function showBasket() {
   sepchar='"';
   totprice=0;
   document.writeln('<table width="100%" border=0 cellpadding=5 cellspacing=1>');
   document.writeln('<tr class="baskettop">');
   document.writeln("<td>Code</td>");
   document.writeln("<td>Name</td>");
   document.writeln("<td>Colour</td>");
   document.writeln("<td>Size</td>");
   document.writeln("<td>Neck</td>");
   document.writeln("<td>Chest</td>");
   document.writeln("<td>Cup</td>");
   document.writeln("<td>Waist</td>");
   document.writeln("<td>Hips</td>");
   document.writeln("<td>Style</td>");
   document.writeln("<td>Option</td>");
   document.writeln("<td>Quantity</td>");
   document.writeln("<td>Total</td>");
   document.writeln("<td>Remove</td>");
   document.writeln("</tr>");
   for (var i=1;i<=retrieveCookieCount('TheBasketCode');i++) {
       theCode=retrieveCookie('TheBasketCode',i,0);
       theName=retrieveCookie('TheBasketName',i,0);
       theWeight=retrieveCookie('TheBasketWeight',i,0);
       theTaxable=retrieveCookie('TheBasketTaxable',i,0);
       thePrice=retrieveCookie('TheBasketPrice',i,0);
       theField1=retrieveCookie('TheBasketExtraFields',i,1);
       theField2=retrieveCookie('TheBasketExtraFields',i,2);
       theField3=retrieveCookie('TheBasketExtraFields',i,3);
       theField4=retrieveCookie('TheBasketExtraFields',i,4);
       theField5=retrieveCookie('TheBasketExtraFields',i,5);
       theField6=retrieveCookie('TheBasketExtraFields',i,6);
       theField7=retrieveCookie('TheBasketExtraFields',i,7);
       theField8=retrieveCookie('TheBasketExtraFields',i,8);
       theField9=retrieveCookie('TheBasketExtraFields',i,9);
       theAP=retrieveCookie('TheBasketAdvanced',i,0);
       theQuantity=retrieveCookie('TheBasketQuantity',i,0);
       if (theAP!='none') {
           tempprice=getAdvanced(theAP,theQuantity);
           if (tempprice>'') { thePrice=tempprice; }
       }
       itemtotal=eval(theQuantity)*eval(getPrice(thePrice));
       totprice=totprice+itemtotal;
       document.writeln("<td>"+theCode+"</td>");
       document.writeln("<td>"+theName+"</td>");
       document.writeln("<td>"+theField1+"</td>");
       document.writeln("<td>"+theField2+"</td>");
       document.writeln("<td>"+theField3+"</td>");
       document.writeln("<td>"+theField4+"</td>");
       document.writeln("<td>"+theField5+"</td>");
       document.writeln("<td>"+theField6+"</td>");
       document.writeln("<td>"+theField7+"</td>");
       document.writeln("<td>"+theField8+"</td>");
       document.writeln("<td>"+theField9+"</td>");
       document.writeln("<td><input type=text name='quant"+i+"' value='"+theQuantity+"' size=3></td>");
       document.writeln("<td>"+showPriceSingle(itemtotal)+"</td>");
       document.writeln("<td><a href='javascript:removeItem("+i+");'><img src='images/remove.gif' border=0 alt='remove'></a></td>");
       document.writeln("</tr><tr><td colspan=14 style='height:1px;background-color:#9966cc;padding:0px;'></td></tr>");
   }
   document.writeln("<tr>");
   document.writeln("<td align='right' colspan=12><img src='images/total.gif' border=0  alt='total goods'></td>");
   document.writeln("<td>"+showPriceSingle(totprice)+"</td>");
   document.writeln("<td>&nbsp;</td>");
   document.writeln("</tr>");
   document.writeln("<tr><td colspan=14 align='center'><a href='javascript:clearBasket();'><img src='images/clear.gif' border=0  alt='clear'></a>&nbsp;");
   document.writeln("<a href='javascript:updateBasket();'><img src='images/update.gif' border=0  alt='update'></a></td></tr>");
   document.writeln("</table><br>");
}

function showBasketTotal() {

   totprice=0;shippingtotal=0;taxtotalone=0;taxtotaltwo=0;ordertotal=0;taxablestandard=0;taxablesecond=0;taxable=0;totalforshipping=0;

    document.writeln('<table width="100%" border=0 cellpadding=5 cellspacing=1>');
   document.writeln('<tr class="baskettop">');
   document.writeln("<td>Code</td>");
   document.writeln("<td>Name</td>");
   document.writeln("<td>Colour</td>");
   document.writeln("<td>Size</td>");
   document.writeln("<td>Neck</td>");
   document.writeln("<td>Chest</td>");
   document.writeln("<td>Cup</td>");
   document.writeln("<td>Waist</td>");
   document.writeln("<td>Hips</td>");
   document.writeln("<td>Style</td>");
   document.writeln("<td>Option</td>");
   document.writeln("<td>Quantity</td>");
   document.writeln("<td align='right'>Total</td>");
   document.writeln("</tr>");
   for (var i=1;i<=retrieveCookieCount('TheBasketCode');i++) {
       theCode=retrieveCookie('TheBasketCode',i,0);
       theName=retrieveCookie('TheBasketName',i,0);
       theWeight=retrieveCookie('TheBasketWeight',i,0);
       theTaxable=retrieveCookie('TheBasketTaxable',i,0);
       thePrice=retrieveCookie('TheBasketPrice',i,0);
       theField1=retrieveCookie('TheBasketExtraFields',i,1);
       theField2=retrieveCookie('TheBasketExtraFields',i,2);
       theField3=retrieveCookie('TheBasketExtraFields',i,3);
       theField4=retrieveCookie('TheBasketExtraFields',i,4);
       theField5=retrieveCookie('TheBasketExtraFields',i,5);
       theField6=retrieveCookie('TheBasketExtraFields',i,6);
       theField7=retrieveCookie('TheBasketExtraFields',i,7);
       theField8=retrieveCookie('TheBasketExtraFields',i,8);
       theField9=retrieveCookie('TheBasketExtraFields',i,9);
       theAP=retrieveCookie('TheBasketAdvanced',i,0);
       theQuantity=retrieveCookie('TheBasketQuantity',i,0);
       if (theAP!='none') {
           tempprice=getAdvanced(theAP,theQuantity);
           if (tempprice>'') { thePrice=tempprice; }
       }
       itemtotal=eval(theQuantity)*eval(getPrice(thePrice));
       totprice=totprice+itemtotal;
       if (theTaxable==0) taxablestandard=taxablestandard+itemtotal;
       if (theTaxable==1) taxablesecond=taxablesecond+itemtotal;
       totalforshipping=totalforshipping+itemtotal;
       document.writeln("<td>"+theCode+"</td>");
       document.writeln("<td>"+theName+"</td>");
       document.writeln("<td>"+theField1+"</td>");
       document.writeln("<td>"+theField2+"</td>");
       document.writeln("<td>"+theField3+"</td>");
       document.writeln("<td>"+theField4+"</td>");
       document.writeln("<td>"+theField5+"</td>");
       document.writeln("<td>"+theField6+"</td>");
       document.writeln("<td>"+theField7+"</td>");
       document.writeln("<td>"+theField8+"</td>");
       document.writeln("<td>"+theField9+"</td>");
       document.writeln("<td>"+theQuantity+"</td>");
       singlefield=singlefield+":"+theCode+" "+theName+", Color-"+theField1+", Size-"+theField2+", Neck-"+theField3+", Chest-"+theField4+", Cup-"+theField5+", Waist-"+theField6+", Hips-"+theField7+", Style-"+theField8+", DColor-"+theField9+":"+theQuantity+":"+showPriceSingle(getPrice(thePrice))+":----:"+showPriceSingle(getPrice(thePrice))+":"+showPriceSingle(itemtotal)+"";
       document.writeln("<td align='right'>"+showPriceSingle(itemtotal)+"</td>");
       document.writeln("</tr>");
       document.writeln("</tr><tr><td colspan=13 style='height:1px;background-color:#9966cc;padding:0px;'></td></tr>");
   }
   alltheitems=i-1;
	basketitemstotal=alltheitems;
   document.writeln("<tr>");
   document.writeln("<td align='right' colspan=12><input type=hidden name='ShoppingBasket' value='"+singlefield+"'><img src='images/total.gif' border=0  alt='total goods'></td>");
   document.writeln("<td align=right>"+showPriceSingle(totprice)+"<input type=hidden name='Goods_Total' value='"+showPriceSingle(totprice)+"'></td>");
   document.writeln("</tr>");
   document.writeln("<tr>");
   document.writeln("<td colspan=12 align='right'><img src='images/shipping.gif' border=0  alt='shipping'></td>");
   document.writeln("<td align=right><input class='basketinput' type=text size=8 name=showshipping value="+showPriceSingle(0)+"></font><input type=hidden name='shippingcharge'><input type=hidden name='Name"+(alltheitems+1)+"' value='X, Shipping, '><input type=hidden name='Quantity"+(alltheitems+1)+"' value='1'><input type=hidden name='Price"+(alltheitems+1)+"' value='0'><input type=hidden name='Item Total"+(alltheitems+1)+"' value='0'></td>");
   document.writeln("</tr>");
   document.writeln("<tr>");
   document.writeln("<td colspan=12 align='right'><img src='images/ordertotal.gif' border=0  alt='order total'></td>");
   document.writeln("<td align=right><input class='basketinput' type=text size=8 name=showtotal value="+showPriceSingle(totprice)+"></font><input type=hidden name='Amount' value='"+showPriceSingle(totprice)+"'></td>");
   document.writeln("</tr>");
   document.writeln("</table>");
basketitemstotal++;
singlefield=basketitemstotal+singlefield;
document.basketform.ShoppingBasket.value = singlefield;
}

function removeItem(itemno) {
	if (confirm('Are you sure you want to remove this item?')) {
	removeFromCookie('TheBasketCode',itemno);
	removeFromCookie('TheBasketName',itemno);
	removeFromCookie('TheBasketWeight',itemno);
	removeFromCookie('TheBasketTaxable',itemno);
	removeFromCookie('TheBasketPrice',itemno);
	removeFromCookie('TheBasketExtraFields',itemno);
	removeFromCookie('TheBasketAdvanced',itemno);
	removeFromCookie('TheBasketQuantity',itemno);
	self.location = 'basket.asp';
	}
}

function clearBasket() {
	if (confirm('Are you sure you wish to clear the basket?')) {
		index=document.cookie.indexOf('TheBasket');
		document.cookie='TheBasketCode=.; expires='+today;
		document.cookie='TheBasketName=.; expires='+today;
		document.cookie='TheBasketWeight=.; expires='+today;
		document.cookie='TheBasketTaxable=.; expires='+today;
		document.cookie='TheBasketPrice=.; expires='+today;
		document.cookie='TheBasketExtraFields=.; expires='+today;
		document.cookie='TheBasketAdvanced=.; expires='+today;
		document.cookie='TheBasketQuantity=.; expires='+today;
		self.location='basket.asp';
	}
}

function changeCurrency(num) {
	 index=document.cookie.indexOf('TheCurrency');
	 document.cookie='TheCurrency='+(num+1)+'; expires=Friday, 31-Dec-2010 08:00:00 GMT';
	 self.location='basket.asp';
}

function updateBasket() {
	newItemList='';
	itemlist=0;
	for (var i=1;i<=retrieveCookieCount('TheBasketCode');i++) {
		if (!isNaN(document.basketform.elements['quant'+i].value)) {
			changeCookieValue('TheBasketQuantity',i,eval(document.basketform.elements['quant'+i].value));
		}
	}
	self.location='basket.asp';
}

function mailto(domain,user) 
    { 
        document.location.href = "mailto:" + user + "@" + domain; 
    }