<!-- For mob_wars_tools.php -->
<!-- saved from url=(0030)http://www.sciencebuddies.org/ -->
<!-- old browsers can\'t handle JavaScript functions so comment them out
/* CalculateSum: this function has 3 arguments:
   Atext, Btext and form. It converts Atext and Btext to
   numbers using the built-in JavaScript "parseFloat" method.
   It then uses the form argument to output the sum of the
   numbers to the form\'s Answer field. Notice that the
   function does *not* need to know the the names of the
   form\'s input fields. Those values are passed as arguments.
   It does need to know that the form has a field named
   "Answer" so that it can put the result there. */

function CalculateSum(Atext, Btext, form)
{
var A = parseFloat(Atext);
var B = parseFloat(Btext);
form.Answer.value = (Math.round((A + B)/3)) *10;
}

/* ClearForm: this function has 1 argument: form.
   It clears the input and answer fields on the form.
   It needs to know the names of the INPUT elements in order
   to do this. */

function ClearForm(form)
{
form.input_A.value = "";
form.input_B.value = "";
form.Answer.value = "";
}
