<!-- Do not copy any part of this script without permission; James T. Griffing, MS, BS; http://www.exrx.net //--><!-- 
function calc (form) {
var S, W, WA, WB, LmA, LmB, VOAbs, StandDev, PercRegress, Zscore, PE
W=form.Weight.value/form.WeightUnit.options[form.WeightUnit.selectedIndex].value
S=form.Sex.options[form.Sex.selectedIndex].value
WA=form.WorkA.value/form.WorkUnit.options[form.WorkUnit.selectedIndex].value
WB=form.WorkB.value/form.WorkUnit.options[form.WorkUnit.selectedIndex].value
LmA=0.32643+0.55275*WA+0.014429*Math.pow(WA,2)+0.00025271*Math.pow(WA,3)
LmB=0.32643+0.55275*WB+0.014429*Math.pow(WB,2)+0.00025271*Math.pow(WB,3)
VOAbs=LmB+((LmB-LmA)/(form.HeartRateB.value-form.HeartRateA.value))*(220-form.Age.value-form.HeartRateB.value)
form.VOMax.value = VOAbs*1000/W
form.METs.value = form.VOMax.value/3.5
  if (S == "Male") {
     form.PopulationAverage.value =
     51.86-0.28*form.Age.value
}
  if (S == "Female") {
     form.PopulationAverage.value =
     41.435-0.23*form.Age.value
}
  if (S == "Male") {
     StandDev ="6"
}
  if (S == "Female") {
     StandDev ="5.5"
}
Zscore = (form.VOMax.value-form.PopulationAverage.value)/StandDev
PE= Math.exp(-1.8355027*(Math.abs(Zscore)-0.23073201))
PercRegress= -0.41682992*(PE-1)/(PE+1)+0.58953708
  if (Zscore > 0) {
     form.Score.value =
     Math.round(PercRegress*100)
}
  if (Zscore <= 0) {
     form.Score.value =
     Math.round((1-PercRegress)*100)
}
  if (Zscore >= 1) {
     form.Rating.value ="Excellent"
}
  if (Zscore < 1 && Zscore >= 0.5) {
     form.Rating.value ="Good"
}
  if (Zscore < 0.5 && Zscore >= -0.5) {
     form.Rating.value ="Average"
}
  if (Zscore < -0.5 && Zscore >= -1) {
     form.Rating.value ="Fair"
}
  if (Zscore < -1) {
     form.Rating.value ="Poor"
}
}
//--> 
