//**********************************************************
// CONSTANTS for fitness pages
// These are constant values that do not change while the 
// code is running, user's can't change (or see) these 
// values.  
// If you should ever need to change any of these values
// you can change them in this file and the rest of the
// code will be oblivious to the change with the exception
// of the sex and units.  Those repy on the values of the
// radio buttons on the screens matching these values.
// INCLUDES: 
// This file is used by most other files so in the 
// list of includes it should always come first.
//**********************************************************

// testing rountine to be removed after installation
function testConst ()
{
//#top testConst

   confirm ("testing constants.js");

} //#end testConst

// sex, these match the values of the cooresponding 
// radio buttons on the screens
var MALE = 0;
var FEMALE = 1;

// units, these match the values of the cooresponding 
// radio buttons on the screens
var US = 0;
var METRIC = 1;

// weight units
var POUNDS = 0;
var KILOS = 1;

// distance units
var INCHES = 0;
var CM = 1;
var METERS = 1;

//**********************************************************
// constants used for body fat calculations
//**********************************************************
// Body Fat percent estimate calculation
// female
// x1 / 
//      (x2 - (x3 * abdomen)
//          + (x4 * abdomen squared)
//          - (x5 * hips)
//          + (x6 * height)
//          - (x7 * age))
//    - x8 = body fat % (female)
// male
// x1 / 
//      (x9 + (x10 * weight)
//          - (x11 * iliac)
//          - (x12 * hips)
//          - (x13 * abdomen))
//    - x8 = body fat % (male)

// the numerator in the body fat calculation, x1
var BF_NUMERATOR = 495;

// the number being subtracted from the output
// of the division equation in the body fat calculation,
// x8
var BF_SUBTRACTOR = 450;

// the constant used in the body fat calculation that
// all other values are subtracted from, for a woman, x2
var BF_F_SUBTRACTOR = 1.168297;

// the constant used in the body fat calculation to
// multiply by the abdomen, for a woman, x3
var BF_F_ABDOMEN = 0.002824;

// the constant used in the body fat calculation to
// multiply by the abdomen squared, for a woman, x4
var BF_F_ABDOMEN_SQUARED = 0.0000122098;

// the constant used in the body fat calculation to
// multiply by the hips, for a woman, x5
var BF_F_HIPS = 0.000733128;

// the constant used in the body fat calculation to
// multiply by the height, for a woman, x6
var BF_F_HEIGHT = 0.000510477;

// the constant used in the body fat calculation to
// multiply by the age, for a woman, x7
var BF_F_AGE = 0.000216161;

// the constant used in the body fat calculation that
// all other values are subtracted from, 
// for a man, x9
var BF_M_ADDER = 1.21142;

// the constant used in the body fat calculation to
// multiply by the weight, for a man, x10
var BF_M_WEIGHT = 0.00085;

// the constant used in the body fat calculation to
// multiply by the iliac, for a man, x11
var BF_M_ILIAC = 0.00050;

// the constant used in the body fat calculation
// multiply by the hips, for a man, x12
var BF_M_HIPS = 0.00061;

// the constant used in the body fat calculation
// multiply by the abdomen, for a man, x13
var BF_M_ABDOMEN = 0.00138;

//**********************************************************
// constants used for maximal oxygen uptake calculations
//**********************************************************
// maximal oxygen uptake calculation
// female
// x1  
//    - (x2 * age)
//    - (x3 * weight)
//    - (x4 * walk time)
//    - (x5 * heart rate)
//    =  VOx max (female)
// male
// x6  
//    - (x2 * age)
//    - (x3 * weight)
//    - (x4 * walk time)
//    - (x5 * heart rate)
//    =  VOx max (female)

// the number everything else is subtracted from in the 
// maximal oxygen uptake calculation, for a woman, x1
var MOU_F_SUBTRACTOR = 132.85;

// the number everything else is subtracted from in the 
// maximal oxygen uptake calculation, for a woman, x6
var MOU_M_SUBTRACTOR = 139.168;

// the constant multiplied by the age in the maximal 
// oxygen uptake calculation, for men and women, x2
var MOU_AGE = 0.388;

// the constant multiplied by the weight in the maximal 
// oxygen uptake calculation, for men and women, x3
var MOU_WEIGHT = 0.077;

// the constant multiplied by the miles walked in the maximal 
// oxygen uptake calculation, for men and women, x4
var MOU_WALK_TIME = 3.265;

// the constant multiplied by the miles walked in the maximal 
// oxygen uptake calculation, for men and women, x5
var MOU_EX_HEART_RATE = 0.156;

//**********************************************************
// constants used for max/min range values for all fields
//**********************************************************
// no fields may have a value as low as 0
var ABSOLUTE_MIN_VALUE = 0;

// age, these defined the range for age, in years
var MIN_AGE = 12;       
var MAX_AGE = 110;

// weight, these defined the range for age,
// represent kilos
var MIN_WEIGHT = 27;     // approx 60 lbs
var MAX_WEIGHT = 227;    // approx 500 lbs

// exercise heart rate, these defined the range for heart
// rate, represent beats per minute
var MIN_HEART_RATE = 60;
var MAX_HEART_RATE = 220;

// walk time, these defined the range for walk time,
// represent minutes
var MIN_WALK_TIME = 4;
var MAX_WALK_TIME = 60;

// waist, these defined the range for waist,
// represent cm
var MIN_WAIST = 38.1;     // 15 inches
var MAX_WAIST = 381;      // 150 inches

// hips, these defined the range for hips,
// represent cm
var MIN_HIPS = 38.1;      // 15 inches
var MAX_HIPS = 381;       // 150 inches

// height, these defined the range for height,
// represent cm
var MIN_HEIGHT = 122;     // 48"
var MAX_HEIGHT = 229;     // 90"

// abdomen, these defined the range for abdomen,
// represent cm
var MIN_ABDOMEN = 38.1;   // 15 inches
var MAX_ABDOMEN = 381;    // 150 inches

// iliac, these defined the range for iliac,
// represent cm
var MIN_ILIAC = 38.1;     // 15 inches
var MAX_ILIAC = 381;      // 150 inches

// target heart rate multipliers
var TARGET_HEART_RATE_LOW = .60;
var TARGET_HEART_RATE_HIGH = .85;
