function updatePrice(id) {
  var curform = document.getElementById('frm'+id);
  var numoptlists = curform.getElementsByTagName('fieldset').length;
  var addprice = 0;
  for (i=0; i<numoptlists; i++) {
    var optlist = curform.getElementsByTagName('fieldset')[i];
    var numoptions = optlist.getElementsByTagName('input').length;
    var baseprice = curform.getElementsByTagName('input')[0].value;
    for (j=0; j<numoptions/2; j++) {
      var curprice = optlist.getElementsByTagName('input')[2*j];
      var curoption = optlist.getElementsByTagName('input')[2*j+1];
      if (curprice.value!=0 && curoption.checked==true) { addprice += parseInt(curprice.value); }
    }
  }
  var txtprice = document.getElementById('price'+id);
  var totprice = ((parseInt(baseprice) + parseInt(addprice))/100).toString();
  if (totprice.indexOf('.') == -1) { totprice += '.00'; }
  if (totprice.indexOf('.') == totprice.length-2) { totprice += '0'; }
  txtprice.innerHTML = '£&nbsp;' + totprice;
  return;
}

function updateTotalPrice(id, ptype) {
  var curform = document.getElementById('frm'+id);
  var subtotal = document.getElementById('subtotal').value;
  var pprice = 0;

  if (ptype==1) { // Postal service
    var numopts = curform['postalservice'].length;
    if (numopts == undefined) {
      if (curform['postalservice'].checked) {
        ppriceid = curform['postalservice'].value;
        pprice = document.getElementById('postal'+ppriceid).value;
      }
    } else {
      for (i=0; i<numopts; i++) {
        if (curform['postalservice'][i].checked) {
          ppriceid = curform['postalservice'][i].value;
          pprice = document.getElementById('postal'+ppriceid).value;
          break;
        }
      }
    }
  }
  var totprice = ((parseInt(subtotal) + parseInt(pprice))/100).toString();
  if (totprice.indexOf('.') == -1) { totprice += '.00'; }
  if (totprice.indexOf('.') == totprice.length-2) { totprice += '0'; }
  var txtprice = document.getElementById('txtprice');
  txtprice.innerHTML = '£&nbsp;' + totprice; 
  return; 
}