function startCalc(id) {

  interval = setInterval("calc(" +id +")", 1);
}

function calc(id) {

  denom = document.getElementById('denom[' +id +']').value;
  qty = document.getElementById('qty[' +id +']').value;
  
  amt = denom * qty;
  
  if(isNaN(amt)) {
  	amt = 0;
  }
  
  document.getElementById('amt[' +id +']').value = amt;
  
  // total up all 'amt' columns
  totalRows = document.getElementById('denomCount').value;
  total = 0;
  
  for(i=0; i<totalRows; i++) {
    total += parseInt(document.getElementById('amt[' +i +']').value);
  }
  
  if(total <1 || total == null) {
    total = 0;
  }
  else if(isNaN(total)) {
    total = 0;
  }
  
  document.getElementById('total_amt').value = total;
}

function stopCalc() {
  clearInterval(interval);
}


