<!-- Author: Brian Mackenzie -->
<!-- Date: 2nd August 2004 -->
<!-- Version: 2.0 - correct to equation - 14.76 changed to 14.8-->

<!-- Function:  Calculate the results from the Bruce treadmill test -->

<!-- Required by: bruce.htm -->

<!-- Copyright Brian Mackenzie 2004 -->


function vo2maxcalculate()
{
  a = document.vo2max.mins.value;
  b = document.vo2max.secs.value;
  time = (a*1)+(b/60);
  var vo2m = 14.8 - (1.379*time) + (0.451*time*time) - (0.012*time*time*time);
  var vo2w = 4.38*time - 3.9;

  document.vo2max.vo2m.value = nt2dp(vo2m,2);
  document.vo2max.vo2w.value = nt2dp(vo2w,2);
}

function vo2clear()
{
  document.vo2max.vo2m.value = "";
  document.vo2max.vo2w.value = "";
}

function nt2dp(num,dp)
{
<!-- rounds num to dp decimal places -->
  num=num*1+(0.55/Math.pow(10,dp));
  if (dp>0) dp=dp+1;
  b=Math.floor(num).toString().length+dp;
  return num.toString().substr(0,b);
}