<!--

function updatePrice()
{
  var quantity = Math.abs(document.quantity.prodCount.value);

  if (document.quantity.prodDelv.value == 0) /* UK Delivery */
  {
    if (quantity == 1) 
    { 
      prodPrice = toPounds(prod1_price + prod1_uk_delv);
      prodDesc = prod1_desc + "<br>(Delivery, UK)";
      prodCode = prod1_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod1_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod1_uk_delv);
    }
    else if (quantity == 2) 
    { 
      prodPrice = toPounds(prod2_price + prod2_uk_delv);
      prodDesc = prod2_desc + "<br>(Delivery, UK)";
      prodCode = prod2_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod2_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod2_uk_delv);
    }
    else // 3 + 1 Free 
    { 
      prodPrice = toPounds(prod3_price + prod3_uk_delv);
      prodDesc = prod3_desc + "<br>(Delivery, UK)";
      prodCode = prod3_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod3_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod3_uk_delv);
    }
  }
  else /* non-UK Delivery */
  {
    if (quantity == 1) 
    {
      prodPrice = toPounds(prod1_price + prod1_world_delv);
      prodDesc = prod1_desc + "<br>(Delivery, World)";
      prodCode = prod1_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod1_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod1_world_delv);
    }
    else if (quantity == 2) 
    { 
      prodPrice = toPounds(prod2_price + prod2_world_delv);
      prodDesc = prod2_desc + "<br>(Delivery, World)";
      prodCode = prod2_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod2_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod2_world_delv);
    }
    else 
    { 
      prodPrice = toPounds(prod3_price + prod3_world_delv);
      prodDesc = prod3_desc + "<br>(Delivery, World)";
      prodCode = prod3_code;
  
      /* Update text boxes showing costs */
      document.quantity.prodCost.value = " £ " + toPounds(prod3_price);
      document.quantity.postageCost.value = " £ " + toPounds(prod3_world_delv);
    }
  }
  
  return true;
}

function toPounds(costInPence)
{
  var pounds = Math.floor(costInPence / 100);
  var pence = costInPence % 100;
  var poundString = "";

  poundString = pounds + ".";

  if (pence < 10)
  {
    poundString = poundString + "0" + pence;
  }
  else
  {
    poundString = poundString + pence;
  }

  return poundString;
}

//-->
