<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate times for the half marathon and marathon -->
<!-- Required by: all marathon and half marathon programs-->
<!-- Copyright Brian Mackenzie 2004 -->

function speedcalculate(rdist)
{
  var target = document.speed.target.value;
  t1 = (target/rdist)* 0.95;
  min1 = Math.floor(t1);
  sec1 = (t1-min1)*60; 
  t2 = target/rdist;
  min2 = Math.floor(t2);
  sec2 = (t2-min2) * 60;

  document.speed.t1.value = Math.round(min1);
  document.speed.t3.value = Math.round(sec1);
  document.speed.t2.value = Math.round(min2);
  document.speed.t4.value = Math.round(sec2);
}

function valclear1()
{
  document.speed.t1.value = "";
  document.speed.t2.value = "";
  document.speed.t3.value = "";
  document.speed.t4.value = "";
}

function timecalculate()
{
  var dist1 = document.time.dist1.value;
  var dist2 = document.time.dist2.value;
  var time1 = document.time.time1.value;
  
  var race = time1 * Math.pow((dist2/dist1),1.07);
  document.time.race.value = Math.round(race);
}

function valclear()
{
  document.time.race.value = "";
}