
function updateBodyFatPercentEstUnitsChanged ()
{ 


   var theForm = getForm ();


   if (theForm.unitsRB[US].checked)
   {
      if (!theForm.weightRB[POUNDS].checked)
      {
         theForm.weightRB[POUNDS].checked = true;  
         if (theForm.weightTF.value != "")
         {
            weight = theForm.weightTF.value;
            theForm.weightTF.value = kilosToPoundsRounded (weight, 1);
         }
      }  

      if (!theForm.heightRB[INCHES].checked)
      {
         theForm.heightRB[INCHES].checked = true;  
         if (theForm.heightTF.value != "")
         {
            height = theForm.heightTF.value;
            theForm.heightTF.value = cmToInchesRounded (height, 1);
         }
      }  

      if (!theForm.hipsRB[INCHES].checked)
      {
         theForm.hipsRB[INCHES].checked = true; 
         if (theForm.hipsTF.value != "")
         {
            hips = theForm.hipsTF.value;
            theForm.hipsTF.value = cmToInchesRounded (hips, 1);
         }
      }  

      if (!theForm.iliacRB[INCHES].checked)
      {
         theForm.iliacRB[INCHES].checked = true; 
         if (theForm.iliacTF.value != "")
         {
            iliac = theForm.iliacTF.value;
            theForm.iliacTF.value = cmToInchesRounded (iliac, 1);
         } 
      }  
      
      if (!theForm.abdomenRB[INCHES].checked)
      {
         theForm.abdomenRB[INCHES].checked = true; 
         if (theForm.abdomenTF.value != "") 
         {
            abdomen = theForm.abdomenTF.value;
	    theForm.abdomenTF.value = cmToInchesRounded (abdomen, 1);
         }
      }  

   }  
   else
   {
      if (!theForm.weightRB[KILOS].checked)
      { 
         theForm.weightRB[KILOS].checked = true;  
         if (theForm.weightTF.value != "")
         {
            weight = poundsToKilos (theForm.weightTF.value);
            theForm.weightTF.value = roundFloat (weight, 1);
         }
      }

      if (!theForm.heightRB[CM].checked)
      {
         theForm.heightRB[CM].checked = true;
         if (theForm.heightTF.value != "")
         {
            theForm.heightTF.value = inchesToCmRounded (theForm.heightTF.value, 1);
         }
      }

      if (!theForm.hipsRB[CM].checked)
      {
         theForm.hipsRB[CM].checked = true;  
         if (theForm.hipsTF.value != "")
            theForm.hipsTF.value = inchesToCmRounded (theForm.hipsTF.value, 1);
      }

      if (!theForm.iliacRB[CM].checked)
      {
        theForm.iliacRB[CM].checked = true;
        if (theForm.iliacTF.value != "")
           theForm.iliacTF.value = inchesToCmRounded (theForm.iliacTF.value, 1);
      }

      if (!theForm.abdomenRB[CM].checked)
      {
        theForm.abdomenRB[CM].checked = true;
         if (theForm.abdomenTF.value != "")
           theForm.abdomenTF.value = inchesToCmRounded (theForm.abdomenTF.value, 1);
      }

   }  

} 


function cantUpdateBodyFatPercentEstUnits (aButton)
{ 


   var theForm = getForm ();


   if (aButton[US].checked)
   {

      aButton[METRIC].checked = true;
   } 
   else
   {
     
      aButton[US].checked = true;
   } 
   
   confirm ("All units of measure must be either US or METRIC.  \nIf you would like to change them, check the appropriate units button");
}


function updateBodyFatDistUnitsChanged ()
{ 


   var theForm = getForm ();


   if (theForm.unitsRB[US].checked)
   {
      if (!theForm.hipsRB[INCHES].checked)
      {
         theForm.hipsRB[INCHES].checked = true;  
         if (theForm.hipsTF.value != "")
            theForm.hipsTF.value = theForm.hipsTF.value / 2.54;
      }

      if (!theForm.waistRB[INCHES].checked)
      {
         theForm.waistRB[INCHES].checked = true;  
         if (theForm.waistTF.value != "")
            theForm.waistTF.value = theForm.waistTF.value / 2.54;
      }

   }
   else
   {
      if (!theForm.hipsRB[CM].checked)
      {
         theForm.hipsRB[CM].checked = true;  
         if (theForm.hipsTF.value != "")
            theForm.hipsTF.value = theForm.hipsTF.value * 2.54;
      }

      if (!theForm.waistRB[CM].checked)
      {
         theForm.waistRB[CM].checked = true;  
         if (theForm.waistTF.value != "")
            theForm.waistTF.value = theForm.waistTF.value * 2.54;
      }

   }

}  


function updateBodyMassIndexUnitsChanged ()
{ 


   var theForm = getForm ();


   if (theForm.unitsRB[US].checked)
   {
      if (!theForm.weightRB[POUNDS].checked)
      {
         theForm.weightRB[POUNDS].checked = true;  
         if (theForm.weightTF.value != "")
            theForm.weightTF.value = theForm.weightTF.value * 2.2;
      }

      if (!theForm.heightRB[INCHES].checked)
      {
         theForm.heightRB[INCHES].checked = true;  
         if (theForm.heightTF.value != "")
            theForm.heightTF.value = theForm.heightTF.value / 2.54;
      }

   } 
   else
   {
      if (!theForm.weightRB[CM].checked)
      {
         theForm.weightRB[CM].checked = true;  
         if (theForm.weightTF.value != "")
            theForm.weightTF.value = theForm.weightTF.value / 2.2;
      }

      if (!theForm.heightRB[CM].checked)
      {
         theForm.heightRB[CM].checked = true;  
         if (theForm.heightTF.value != "")
            theForm.heightTF.value = theForm.heightTF.value * 2.54;
      }

   } 

}  


function updateMaxOxygenUptakeUnitsChanged ()
{ 


   var theForm = getForm ();


   if (theForm.unitsRB[US].checked)
   {
      if (!theForm.weightRB[POUNDS].checked)
      {
         theForm.weightRB[POUNDS].checked = true;  
         if (theForm.weightTF.value != "")
            theForm.weightTF.value = theForm.weightTF.value * 2.2;
      }

   } 
   else
   {
      if (!theForm.weightRB[CM].checked)
      {
         theForm.weightRB[CM].checked = true;  
         if (theForm.weightTF.value != "")
            theForm.weightTF.value = theForm.weightTF.value / 2.2;
      }

   } 

}  


function clearBodyMassIndexScreen ()
{


   var theForm = getForm ();

   theForm.weightTF.value = "";
   theForm.heightTF.value = "";

   theForm.bmiTF.value = "";

}


function clearBodyFatDistScreen ()
{


   var theForm = getForm ();

   theForm.hipsTF.value = "";
   theForm.waistTF.value = "";

   theForm.bfdTF.value = "";

} 


function clearBodyFatPercentEstScreen ()
{


   var theForm = getForm ();

   theForm.hipsTF.value = "";
   theForm.abdomenTF.value = "";
   theForm.ageTF.value = "";
   theForm.iliacTF.value = "";
   theForm.heightTF.value = "";
   theForm.weightTF.value = "";

   theForm.bfpTF.value = "";
}


function clearMaxOxygenUptakeScreen ()
{


   var theForm = getForm ();

   theForm.weightTF.value = "";
   theForm.ageTF.value = "";
   theForm.walkTimeTF.value = "";
   theForm.exHeartRateTF.value = "";

   theForm.mouTF.value = "";

}


function clearTargetHeartRateScreen ()
{


   var theForm = getForm ();

   theForm.ageTF.value = "";

   theForm.thrlTF.value = "";
   theForm.thrhTF.value = "";

} 
