//**********************************************************
// CONVERSION functions to convert between different units of
// measure
// These functions are used by other javascript and should
// not be needed by you directly so you should never even
// care that they exist, other than to include them in your
// html file.
// INCLUDES:  
// These functions are used by screens.js and displays.js
// so this file must be included before those files.
//**********************************************************

// testing rountine to be removed after installation
function testConv ()
{
//#top testConv

   confirm ("testing conversions.js");

}  //#end testConv

/**
 * Convert inches to meters
 *
 * @param inches the inch measurement to be converted to meters
 * @return the input number in meters
 */
function inchesToMeters (inches)
{
//#top inchesToMeters

   var answer = 0;

   answer = inchesToCm (inches);

   if (!answer == 0)
   {
      answer = answer / 100;
   }

   return answer;

}  //#end inchesToMeters

/**
 * Convert inches to meters
 *
 * @param inches the inch measurement to be converted to meters
 * @param places the number of places to round this conversion to
 * @return the input number in meters
 */
function inchesToMetersRounded (inches, places)
{
//#top inchesToMetersRounded

   var answer = 0;

   answer = roundFloat (inchesToMeters (inches), places);

   return answer;

}  //#end inchesToMetersRounded

/**
 * Convert inches to centimeters
 *
 * @param inches the inch measurement to be converted to centimeters
 * @return the input number in meters
 */
function inchesToCm (inches)
{
//#top inchesToCm

   return inches * 2.54;

}  //#end inchesToCm

/**
 * Convert inches to centimeters
 *
 * @param inches the inch measurement to be converted to centimeters
 * @param places the number of places to round this conversion to
 * @return the input number in meters
 */
function inchesToCmRounded (inches, places)
{
//#top inchesToCmRounded

   return roundFloat ((inches * 2.54), places);

}  //#end inchesToCmRounded

/**
 * Convert centimeters to inches
 *
 * @param cm the centemeter measurement to be converted to inches
 * @return the input number in inches
 */
function cmToInches (cm)
{
//#top cmToInches

   return cm / 2.54;

}  //#end cmToInches

/**
 * Convert centimeters to inches
 *
 * @param cm the centemeter measurement to be converted to inches
 * @param places the number of places to round this conversion to
 * @return the input number in inches
 */
function cmToInchesRounded (cm, places)
{
//#top cmToInchesRounded

   return roundFloat ((cm / 2.54), places);

}  //#end cmToInchesRounded

/**
 * Convert meters to inches
 *
 * @param meters the meter measurement to be converted to inches
 * @return the input number in inches
 */
function metersToInches (meters)
{
//#top metersToInches

   return (meters / 100) / 2.54;

}  //#end metersToInches


/**
 * Convert meters to inches
 *
 * @param meters the meter measurement to be converted to inches
 * @param places the number of places to round this conversion to
 * @return the input number in inches
 */
function metersToInchesRounded (meters, places)
{
//#top metersToInchesRounded

   return roundFloat ( ((meters / 100) / 2.54), places);

}  //#end metersToInchesRounded

/**
 * Convert kilos to pounds
 *
 * @param kilos the kilo weight to be converted to pounds
 * @return the input number in kilos
 */
function kilosToPounds (kilos)
{
//#top kilosToPounds

   return kilos * 2.2;
   
}  //#end kilosToPounds


/**
 * Convert kilos to pounds
 *
 * @param kilos the kilo weight to be converted to pounds
 * @param places the number of places to round this conversion to
 * @return the input number in kilos
 */
function kilosToPoundsRounded (kilos, places)
{
//#top kilosToPoundsRounded

   return roundFloat ((kilos * 2.2), places);
   
}  //#end kilosToPoundsRounded

/**
 * Convert pounds to kilos
 *
 * @param pounds the pound weight to be converted to kilos
 * @return the input number in poundss
 */
function poundsToKilos (pounds)
{
//#top poundsToKilos

   return pounds / 2.2;

}  //#end poundsToKilos

/**
 * Convert pounds to kilos
 *
 * @param pounds the pound weight to be converted to kilos
 * @param places the number of places to round this conversion to
 * @return the input number in poundss
 */
function poundsToKilosRounded (pounds, places)
{
//#top poundsToKilosRounded

   return roundFloat ((pounds / 2.2), places);

}  //#end poundsToKilosRounded
