document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown=right;
	
function right(e) 
{
	if (navigator.appName == 'Netscape' &&
		(e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' &&
		(event.button == 2 || event.button == 3)) {
		alert("© Soneka 2000-2007 : Please don't copy our site content.");
		return false;
	} return true;
}

basketCost = 0;
basketNum = 0;
inBasket = "";
basketArray = new Array();
order = "";
basketString = "";

<!-- CODE ADDED 10-04-05 -->
function decPlace(price)
{

   if((price.toString()).indexOf(".") == -1)
   {
      price = price.toString() + ".00";
   }
   else
   {

      strPrice = price.toString();
      priceArray = strPrice.split(".");

      if(priceArray[1].length == 1)
      {
         price = priceArray[0] + "." + priceArray[1] + "0";
      }
   }

   return price;

}

<!-- CODE ADDED 10-04-05 -->
function readCookie()
{

   if((document.cookie).indexOf("GENBASKET") != -1)
   {
   
       orderArray = document.cookie.split(";");

       for(j=0; j<orderArray.length; j++)
       {
		  if(orderArray[j].indexOf("GENBASKET") != -1)
		  {
		     order = orderArray[j];
		  }
       }

       fullArray = ((order.split("="))[1]).split("#");
       artArray = new Array();
       placeInArray = 0;

	   for(p=0; p<fullArray.length; p++)
	   {
	      if(fullArray[p] != "")
	      {
	      artArray[placeInArray] = fullArray[p];
	      placeInArray++;
	      }
	   }

	   for(k=0; k<artArray.length; k++)
	   {

	   basketArray[k] = artArray[k];


          if((artArray[k].split('/'))[0] != "")
          {
	      basketNum += parseInt((artArray[k].split('/'))[2]);
	      
	      costArray = new Array();
	      costArray = ((artArray[k].split('/'))[1]).split(':');
	      
	      //basketCost = (parseFloat(basketCost) + parseFloat(costArray[1]));
	      basketCost = (parseFloat(basketCost) + (parseFloat(costArray[1])*parseInt((artArray[k].split('/'))[2])));
	      
	      }

	      if((artArray[k].split('/'))[0] != "")
	      {

		basketString = '<table>';
		basketString += '<tr><td><span class="bolder">BASKET CONTAINS</span> ' + basketNum + ' item(s)</td></tr>';
		basketString += '<tr><td><span class="bolder">BASKET COST</span> &pound;' + basketCost.toFixed(2) + '</td></tr>';
		basketString += '<tr><td><a href="basket.php" class="cartLink">VIEW BASKET</a> | <a href="checkout.php" class="cartLink">CHECKOUT</a></td></tr>';
		basketString += '</table>';
	      
	      }

	   }

      document.getElementById("BAG").innerHTML = basketString;
      writeCookie();
   }
}
<!-- -->

function updateBag()
{

   orderArray = document.cookie.split(";");

   for(j=0; j<orderArray.length; j++)
   {
	  if(orderArray[j].indexOf("GENBASKET") != -1)
	  {
		 order = orderArray[j];
	  }
   }

   fullArray = ((order.split("="))[1]).split("#");
   artArray = new Array();
   placeInArray = 0;

   for(p=0; p<fullArray.length; p++)
   {
	  if(fullArray[p] != "")
	  {
	  artArray[placeInArray] = fullArray[p];
	  placeInArray++;
	  }
   }

   for(k=0; k<artArray.length; k++)
   {
   
	  pid = document.getElementById('PRICEID' + k).value;
	  	  
	  //alert("PID: " + pid);
	  //contents of basket item/pid:cost/quantity   
   
   
          if((artArray[k].split('/'))[0] != "")
          {
          quantityValue = "QUANT" + k;
          
	thingyArray = new Array();
	thingyArray = pid.split('/');

	cost = 0;
	pid2 = 0;

	for(i=0; i<thingyArray.length; i++)
	{

	//thingyArray IS pid#quantity#cost

	blingyArray = thingyArray[i].split('#');

	   if(document.getElementById(quantityValue).value >= blingyArray[1])
	   {
	  
	   
	   //alert("BLING ARRAY: " + blingyArray[0] + " - " + blingyArray[1] + " - " + blingyArray[2]);

	   cost = blingyArray[2];
	   pid2 = blingyArray[0];
	   }

	}          
          
          
	  basketArray[k] = (artArray[k].split('/'))[0] + "/" + pid2 + ":" + cost + "/" + document.getElementById(quantityValue).value;
	  }

   }

   writeCookie();
   window.location.href="basket.php";

}

function removeItem(arrayNumber)
{
      
  //alert(basketArray[arrayNumber]);
  basketArray[arrayNumber] = "undefined";

  writeCookie();
  window.location.href="basket.php";

}


function writeCookie()
{
arrayContent = 0;

chocChipCookie = "GENBASKET=";

	for(i=0; i<basketArray.length; i++)
	{

	   if(basketArray[i] != "undefined")
	   {
           chocChipCookie += basketArray[i] + "#"
           arrayContent++;
	   }
	}
	
	chocChipCookie += ";path=/";

    if(arrayContent != 0)
    {
    document.cookie = chocChipCookie;
    }
    else
    {
    var kill_time = new Date("February 11, 1975");
    document.cookie = "GENBASKET=;expires=" + kill_time.toGMTString() + ";path=/";
    }

}

function emptyBag()
{
    var kill_time = new Date("February 11, 1975");
    document.cookie = "GENBASKET=;expires=" + kill_time.toGMTString() + ";path=/";
 
    window.location.href="basket.php";
}
