<!-- Author: Brian Mackenzie -->
<!-- Date: 4th August 2006 -->
<!-- Version: 2.0 -->
<!-- Function:  calculates general aerobic trainig distances and times  -->
<!-- Required by: testprep.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function tpcalculate()
{
var tdist = document.tp.dist.value;
var ttimem = document.tp.ttimem.value;
var ttimes = document.tp.ttimes.value;
var units = document.tp.units.options[document.tp.units.selectedIndex].value;

if (units == 'miles') tdist = tdist*1.609;
tdist = tdist * 1000;

ttimem = ttimem * 60;
ttimes = ttimes *1;
ttime = ttimem+ttimes;
ttime = ttime* 0.95;

t200 = Math.round(ttime / tdist * 200);
r200 = Math.ceil(tdist /200);
t400 = Math.round(ttime / tdist * 400);
r400 = Math.ceil(tdist /400);
t600 = Math.round(ttime / tdist * 600);
r600 = Math.ceil(tdist /600);
t800 = Math.round(ttime / tdist * 800);
r800 = Math.ceil(tdist /800);
document.tp.t200.value = t200;
document.tp.r200.value = r200; 
document.tp.t400.value = t400;
document.tp.r400.value = r400;
document.tp.t600.value = t600;
document.tp.r600.value = r600;
document.tp.t800.value = t800;
document.tp.r800.value = r800; 
}

function vclear()
{
document.tp.t200.value = "";
document.tp.r200.value = "";
document.tp.t400.value = "";
document.tp.r400.value = "";
document.tp.t600.value = "";
document.tp.r600.value = "";
document.tp.t800.value = "";
document.tp.r800.value = "";
}