<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2006 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate the results from the vo2 max step test -->
<!-- Required by: stepvo2max.htm -->
<!-- Copyright Brian Mackenzie 2006 -->

function pcalculate()
{
  var dist = document.perform.dist.value;
  var gender = document.perform.gender.options[document.perform.gender.selectedIndex].value;

  dist = dist *1;

  if (gender=="Male")
    {
      vo2=111.33-(0.42*dist);
    }

  if (gender=="Female")
    {
      vo2=65.81-(0.1847*dist);
    }

  document.perform.assess.value = nt2dp(vo2,2);
}

function pclear()
{
  document.perform.assess.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);
}