/*

   StatMath()

   The .checked value and the skill points are passed into the function.

   Function that calculates skill points of the checked boxes when they are
   selected or deselected.  The T/F value is the value the box is being changed
   to. False is when the item is deselected. True is when the item is selected.

   It checks to see if there is sufficent points to be able to select a skill,
   returns false to the .checked object and displays an alert if there is
   insufficent points.
   If there is sufficent points, it uses a subtraction to calculate points, and
   returns true to the .checked object.
   if unchecking the skill, it adds points to the skill points using a ++ and a
   loop (this is due to the fact that HTML does not define wether or not an
   object is a string or a numeric) and returns a false to the .checked object.

*/

function StatMath(TFValue,Points)
{
   if (TFValue==true)
   {
/*      if (window.document.PSTPChars.SkillPTS.value == 0)
      {
         window.alert('You do not have enough points.');
         UpdateSKLPts();
         return false;
      }
*/
      if (window.document.PSTPChars.SkillPTS.value >= Points)
      {
         window.document.PSTPChars.SkillPTS.value=window.document.PSTPChars.SkillPTS.value-Points;
         UpdateSKLPts();
         return true;
      }
      if (window.document.PSTPChars.SkillPTS.value < Points)
      {
         window.alert('You do not have enough points.');
         UpdateSKLPts();
         return false;
      }
      UpdateSKLPts();
      return;
   }
   if (TFValue==false)
   {
      for(bla=1;bla<=Points;bla++)
      {
         window.document.PSTPChars.SkillPTS.value++;
         UpdateSKLPts();
      }
      UpdateSKLPts();
      return false;
   }
   UpdateSKLPts();
   return;
}


