<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate the results from the  Hexagonal Obstacle Test -->
<!-- Required by: hexagonal.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function pcalculate4()

{
var time = document.stork.time.value;
var gender = document.stork.gender4.options[document.stork.gender4.selectedIndex].value;

if (gender=="Male")
  {
   if (time>20) time = 20;    
   points = 10 - ((time-9.0)/1.1);
  }

if (gender=="Female")
  {
    if (time>25) time = 25;    
    points = 10 - ((time-9.0)/1.6);
  }
document.stork.score.value = nt2dp(points,2);
}

function pclear4()
{
   document.stork.score.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);
}