<!-- Author: Brian Mackenzie -->
<!-- Date: 23rd April 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate times for the 400m  -->
<!-- Required by: pred400.htm -->
<!-- Copyright Brian Mackenzie 2004 -->


function cale()
{
  var time = document.strid.timee.value;

  r1 = (time * 2) * 1.1;

<!-- The decimal values have been determined from the 100m splits 1988 Olympics 400m -->
<!-- See Athletics Coach Vol 28 No 2 page 13 -->
  
  r100 = r1 * 0.25352;
  r200 = r1 * 0.23309;
  r300 = r1 * 0.24442;
  r400 = r1 * 0.26897;

  document.strid.r1e.value = nt2dp(r1,2);
  document.strid.r100e.value = nt2dp(r100,2);
  document.strid.r200e.value = nt2dp(r100+r200,2);
  document.strid.r300e.value = nt2dp(r100+r200+r300,2);
  document.strid.r400e.value = nt2dp(r100+r200+r300+r400,2);
}

function valcleare()
{
  document.strid.r1e.value = "";
  document.strid.r100e.value = "";
  document.strid.r200e.value = "";
  document.strid.r300e.value = "";
  document.strid.r400e.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);
}