today=new Date();today.setTime(today.getTime() + (3600000));today=today.toGMTString();currentdate=new Date();currentdate=currentdate.toLocaleString();index = document.cookie.indexOf('VivaBasketCode');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='VivaBasketCode=.; expires='+today;   document.cookie='VivaBasketName=.; expires='+today;   document.cookie='VivaBasketWeight=.; expires='+today;   document.cookie='VivaBasketTaxable=.; expires='+today;   document.cookie='VivaBasketPrice=.; expires='+today;   document.cookie='VivaBasketExtraFields=.; expires='+today;   document.cookie='VivaBasketAdvanced=.; expires='+today;   document.cookie='VivaBasketQuantity=.; expires='+today;   document.cookie='TheCurrency=1; expires=Friday, 31-Dec-2010 08:00:00 GMT';   document.cookie='JShopReferrer=.; expires='+today;}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 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 buyItem(newCode,newItem,newPrice,newTaxable,newWeight,newField0,newField1,newAP,newQuantity) {		if(newQuantity == '0') {            rc = alert('Please enter the quantity required');				} else if(newPrice == 'Type' || newPrice == null) {            rc = alert('Please enter the type required');				} else if(newField0 == 'Size') {            rc = alert('Please enter the size required');		} else if(newField0 == 'Colour') {			rc = alert('Please enter the colour required');				} else if(newField1 == 'Size') {			rc = alert('Please enter the size required');		        } else {                 if (newAP!='none') {                     newAP=checkAdvanced(newAP,newField0,newField1);                 }                 amended = false;                 newItemList=''; itemlist=0;                 for (var i=1;i<=retrieveCookieCount('VivaBasketCode');i++) {                      theCode=retrieveCookie('VivaBasketCode',i,0);                      theItem=retrieveCookie('VivaBasketName',i,0);                      theQuantity=retrieveCookie('VivaBasketQuantity',i,0);                              theField0 = retrieveCookie('VivaBasketExtraFields',i,1);                              theField1 = retrieveCookie('VivaBasketExtraFields',i,2);                      if (theCode==newCode && theItem==newItem  && theField0 == newField0 && theField1 == newField1) {                           amended=true;                           tempquantity=eval(theQuantity)+eval(newQuantity);                           changeCookieValue('VivaBasketQuantity',i,tempquantity);                      }                 }                 if (amended==false) {                    addToCookie('VivaBasketCode',newCode);                    addToCookie('VivaBasketName',newItem);                    addToCookie('VivaBasketPrice',newPrice);                    addToCookie('VivaBasketWeight',newWeight);                    addToCookie('VivaBasketTaxable',newTaxable);                    addToCookie('VivaBasketExtraFields',newField0+'~'+newField1+'~');                    addToCookie('VivaBasketAdvanced',newAP);                    addToCookie('VivaBasketQuantity',newQuantity);                 }		 alert(newQuantity+' x '+newItem+' added to basket')         }     }function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.0  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 && document.getElementById) x=document.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}var chasm = screen.availWidth;var mount = screen.availHeight;function OpenSizes() {	window.open('sizes.htm','SizesWindow','width=590,height=220,left=' + ((chasm - 570 - 10) * .5) + ',top=' + ((mount - 270 - 30) * .5) + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no');}function OpenPrice() {	window.open('price.htm','PriceWindow','width=300,height=410,left=' + ((chasm - 270 - 10) * .5) + ',top=' + ((mount - 310 - 30) * .5) + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no');}function OpenInfo(ifile,ix,iy,iscroll) {	window.open(ifile,"InfoWindow","width="+ix+",height="+iy+",left=" + ((chasm - ix - 10) * .5) + ",top=" + ((mount - iy - 30) * .5) + ",directories=no,location=no,menubar=no,scrollbars="+iscroll+",status=no,titlebar=no,toolbar=no");}var win;var wOpen = 0;function ViewImage(ifile,ix,iy,ititle) { var sWidth, sHeight;win = window.open("","imageviewer","width="+ix+",height="+iy+",left=" + ((chasm - 270 - 10) * .5) + ",top=" + ((mount - 310 - 30) * .5) + ",menubar=no,toolbar=no");if (wOpen > 0) {	win.close();	setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);	wOpen = 0;	return;}	else {	wOpen = 1;}win.document.open();win.document.write("<html><head><title>"+ititle+"</title>");win.document.write("</head><body onLoad='window.focus()'>");win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');win.document.write("<img src="+ifile+"></div></body></html>");win.document.close();}