﻿/*
 *
 *
 * Possible values:
 *      - English   displays as "42 feet"
 *      - Metric    displays as "42 meters"
 *              * Of course the metric and english values would be different
 *                I'm just too lazy to do the conversion for this example.
 *                Although it's ironic I made such a long comment about it.
 */

var EnglishUnits = "English";
var MetricUnits  = "Metric";

// Instead of setting this directly, use SwitchUnitOfMeasure
var UnitOfMeasure = EnglishUnits; // default to English unit of measure. This is reset in GoogleMapsInit.js's Initialize()

function SwitchUnitOfMeasure(UnitType)  /* (see constants above for valid UnitType values) */
{
    // Set the unit type
    UnitOfMeasure=UnitType;
    
    // That was easy, now we have to make sure the correct radio button is checked
    $get("radEnglishUnitOfMeasure").checked = UnitType == EnglishUnits;
    $get("radMetricUnitOfMeasure").checked = UnitType == MetricUnits;
    
    // Now we have to update all form items that display the unit type
    UpdateDistanceDisplay();
    
    // Refresh the map too, because we want our distance markers to update
    RefreshMap(LastCursorPosition);
}