<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate times for the ironman  -->
<!-- Required by: ironman.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function speedcalculate()
{
  var pb = document.speed.pb.value;
  var pbh = document.speed.pbh.value;
  var pbdistance = document.speed.pbdistance.value;
  var distance = document.speed.distance.value;
  var effort = document.speed.effort.value;

  t1 = ((pbh * 60) + Math.round(pb)) / pbdistance;
  t2 = t1 * distance * (1 +(effort / 100));
  t3 = Math.floor(t2/60);
  t4 = t2 - (t3*60);

  document.speed.timeh.value = t3;
  document.speed.time.value = nt2dp(t4,1);
}

function valclear()
{
  document.speed.time.value = "";
  document.speed.timeh.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);
}