<!-- Author: Brian Mackenzie -->
<!-- Date: 11th March 2004 -->
<!-- Version: 1.0 -->
<!-- Function:  Calculate the results from the PWC170 test -->
<!-- Required by: pwc170.htm -->
<!-- Copyright Brian Mackenzie 2004 -->

function pcw170calculate()
{
  var t1 = document.pcw170.t1.value;
  var t2 = document.pcw170.t2.value;
  var t3 = document.pcw170.t3.value;
  var t4 = document.pcw170.t4.value;

  var tp1 = ((t2*t3)-(t4*t1))/(t3-t1);
  var tp2 = 170*((t2-t4)/(t1-t3));
  var tp = tp1+tp2

  document.pcw170.tp.value = nt2dp(tp,2);
}

function valclear()
{
  document.pcw170.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);
}