<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->

<!-- Function:  Calculate the results from the Balke Traedmill protocol -->

<!-- Required by: balketread.htm -->

<!-- Copyright Brian Mackenzie 2004 -->


function vo2maxcalculate()

{
  var time = document.vo2max.time.value;
  var vo2m = 1.444*time +14.99;
  var vo2w = 1.38*time + 5.22;
  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);
}