<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate the results from the 60m test -->
<!-- Required by: speed60.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function calculate()
{
  var time = document.stride.time.value;

  r1=7.3829894+(time*-0.431975)+(time*time*0.1394189);
  r2=13.795573+(time*-0.720532)+(time*time*0.2806044);

  document.stride.r1.value = nt2dp(r1,2);
  document.stride.r2.value = nt2dp(r2,2);
}

function valclear()
{
  document.stride.r1.value = "";
  document.stride.r2.value = "";
}

function p100calc()
{
  var t100 = document.pred.t100.value;

  c1=-0.904251+(0.3894074*t100)+(t100*t100*0.0054527);
  c2=-5.321233+(1.535573*t100)+(t100*t100*-0.038825);
  c3=-1.689993+(0.3338059*t100)+(t100*t100*0.0078765);

  document.pred.p1.value = nt2dp(c1,2);
  document.pred.p2.value = nt2dp(c2,2);
  document.pred.p3.value = nt2dp(c3,2);
}

function pclear()
{
  document.pred.p1.value = "";
  document.pred.p2.value = "";
  document.pred.p3.value = "";
}

function p200calc()
{
  var t100 = document.pred2.t100.value;

  c1=-0.580576+(0.1770093*t100)+(t100*t100*0.001451);
  c2=-4.308771+(0.6897561*t100)+(t100*t100*-0.008317);
  c3=-1.633722+(0.1728836*t100)+(t100*t100*0.0015404);

  document.pred2.p1.value = nt2dp(c1,2);
  document.pred2.p2.value = nt2dp(c2,2);
  document.pred2.p3.value = nt2dp(c3,2);
}

function p1clear()
{
  document.pred2.p1.value = "";
  document.pred2.p2.value = "";
  document.pred2.p3.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);
}