<!-- Author: Brian Mackenzie -->
<!-- Date: 23rd April 2006 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate time for a distance using 2 given distances and times  -->
<!-- Required by: racecalc.htm -->
<!-- Copyright Brian Mackenzie 2006 -->

function calpoly2()
{
  var b7 = document.speed2.dist11.value;
  var b8 = document.speed2.dist12.value;
  var d7 = document.speed2.time11.value;
  var d8 = document.speed2.time12.value;
  var d13 = document.speed2.dist13.value;

  e5=((d7*b8)-(d8*b7))/(b8-b7)+(d13*((d7-d8)/(b7-b8)));

  document.speed2.time13.value = nt2dp(e5,2);
}

function valclear2()
{
  document.speed2.time13.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);
}