function calc (form) {
var S, StandDev, PercRegress, Zscore
S=form.Sex.options[form.Sex.selectedIndex].value
  if (S == "Male") {
     form.PopulationAverage.value =
     Math.round(66.81*Math.pow(10,-0.009241*form.Age.value))
}
  if (S == "Female") {
     form.PopulationAverage.value =
     Math.round(66.864*Math.pow(10,-0.011029*form.Age.value))
}
  if (form.Repetitions.value<=form.PopulationAverage.value) {
     StandDev =6.5
}
  if (form.Repetitions.value>form.PopulationAverage.value) {
     StandDev =7.5
}
Zscore = (form.Repetitions.value-form.PopulationAverage.value)/StandDev
PercRegress = 0.49402+0.44379*Math.abs(Zscore)-0.082675*Math.pow(Math.abs(Zscore),2)-0.021233*Math.pow(Math.abs(Zscore),3)+0.0060829*Math.pow(Math.abs(Zscore),4)
  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"
}
}
