var totals = {};
function updatePrices(el) {
   value = el.value;
   if (value <0 || isNaN(value)) return;
   name = el.name;
   switch (name) {
      case 'numBooths':
         if (value > 1) price = (prices.booths[2] * value);
         else price = (prices.booths[1] * value);
         totals.booths = price;
         break;
      case 'numCorners':
         totals.corners = (prices.corners * value);
         break;
      case 'numDrapes':
         totals.drapes = (prices.drape * value);
         break;
      case 'numTables':
         totals.tables = (prices.tables.early * value);
         break;
      case 'numPower':
         totals.power = (prices.power * value);
         break;
      case 'numFloorSat':
         totals.floorSat = (prices.floor.sat * value);
         break;
      case 'numFloorSun':
         totals.floorSun = (prices.floor.sun * value);
         break;
   }
   doTotals();
}

function doTotals() {
   var elSubTotal   = document.getElementById('subTotalBox');
   var elTotalGst   = document.getElementById('totalGstBox');
   var elGrandTotal = document.getElementById('grandTotalBox');
   var total = 0.0;
   for (x in totals) {
      tot = parseFloat(totals[x]);
      if (!isNaN(tot)) {
         total += tot;
         totGst = total * .13;
      }
   }
   elSubTotal.innerHTML = printf('%.02f',total);
   elTotalGst.innerHTML = printf('%.02f',totGst);
   elGrandTotal.innerHTML = printf('%.02f',(total + totGst));
}