<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate the results from the Jumps Decathlon -->
<!-- Required by: jumpsdec.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function quad1calculate()
{
  var jj1 = document.quad1.jj1.value;
  var jj2 = document.quad1.jj2.value;
  var jj3 = document.quad1.jj3.value;
  var jj4 = document.quad1.jj4.value;
  var jj5 = document.quad1.jj5.value;
  var jj6 = document.quad1.jj6.value;
  var jj7 = document.quad1.jj7.value;
  var jj8 = document.quad1.jj8.value;
  var jj9 = document.quad1.jj9.value;
  var jj10 = document.quad1.jj10.value;

  var jp1 = -19.40182+(jj1*34.38485)+(jj1*jj1*-0.636364);
  var jp2 = -35.50103+(jj2*12.53057)+(jj2*jj2*0.0344445);
  var jp3 = -45.46265+(jj3*12.876771)+(jj3*jj3*-0.129795);
  var jp4 = -52.96077+(jj4*10.128824)+(jj4*jj4*-0.018391);
  var jp5 = -74.64828+(jj5*12.458996)+(jj5*jj5*-0.174359);
  var jp6 = -68.09148+(jj6*12.173418)+(jj6*jj6*-0.136018);
  var jp7 = -56.97374+(jj7*10.563032)+(jj7*jj7*-0.095043);
  var jp8 = -55.31376+(jj8*7.5941124)+(jj8*jj8*-0.044598);
  var jp9 = 99.540643+(jj9*4.2533081)+(jj9*jj9*-1.512287);
  var jp10 = -13.07164+(jj10*2.9149238)+(jj10*jj10*1.73309);
  var tp = jp1+jp2+jp3+jp4+jp5+jp6+jp7+jp8+jp9+jp10;

  document.quad1.jp1.value = nt2dp(jp1,2);
  document.quad1.jp2.value = nt2dp(jp2,2);
  document.quad1.jp3.value = nt2dp(jp3,2);
  document.quad1.jp4.value = nt2dp(jp4,2);
  document.quad1.jp5.value = nt2dp(jp5,2);
  document.quad1.jp6.value = nt2dp(jp6,2);
  document.quad1.jp7.value = nt2dp(jp7,2);
  document.quad1.jp8.value = nt2dp(jp8,2);
  document.quad1.jp9.value = nt2dp(jp9,2);
  document.quad1.jp10.value = nt2dp(jp10,2);
  document.quad1.tp.value = nt2dp(tp,2);
}

function valclear()
{
  document.quad1.jp1.value = "";
  document.quad1.jp2.value = "";
  document.quad1.jp3.value = "";
  document.quad1.jp4.value = "";
  document.quad1.jp5.value = "";
  document.quad1.jp6.value = "";
  document.quad1.jp7.value = "";
  document.quad1.jp8.value = "";
  document.quad1.jp9.value = "";
  document.quad1.jp10.value = "";
  document.quad1.tp.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);
}