<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->

<!-- Function:  calculate results from the 10 stride test -->

<!-- Required by: 10stride.htm -->

<!-- Copyright Brian Mackenzie 2004 -->

function calculate()

{
  var time = document.stride.time.value;
  var distance = document.stride.distance.value;
  r1=distance/time;
  r2=distance/10;
  r3=10/time;
  document.stride.r1.value = nt2dp(r1,2);
  document.stride.r2.value = nt2dp(r2,2);
  document.stride.r3.value = nt2dp(r3,2);
}

function valclear()

{
  document.stride.r1.value = "";
  document.stride.r2.value = "";
  document.stride.r3.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);
}