     $('#notifications').removeAttr 'checked'
   notificationDuration = utils.get 'notificationDuration'
   timeInSecs = 0
-  timeInSecs = notificationDuration / 1000 if notificationDuration > timeInSecs
+  timeInSecs = notificationDuration * .001 if notificationDuration > timeInSecs
   $('#notificationDuration').val timeInSecs
 
 # Update the toolbar behaviour section of the options page with the current

  icon = ico for ico in icons when not icon or ico.size < icon.size
  return icon

#### TODO: START: Convert to CoffeeScript

/**
 * <p>Reads the imported data created by {@link options.createImport} and
 * extracts all valid imported features.</p>
 * <p>Where the feature will overwrite an existing feature, only fields
 * with valid values will be accepted with exception to protected fields
 * (i.e. on read-only features).</p>
 * <p>Where the feature is new default values will replace any fields with
 * invalid values assigned to them.</p>
 * @param {Object} importData The data parsed from the imported string.
 * @param {Object[]} importData.templates The features to be extracted and
 * validated.
 * @param {String} importData.version The version of this extension used to
 * export the data currently being imported.
 * @returns {Object} An object containing the list of features extracted
 * from the imported data, if any.
 * @since 0.2.0.0
 * @private
 */
readImport: function (importData) {
    var data = {
            features: []
        },
        existing = {},
        feature = {},
        names = [];
    for (var i = 0; i < importData.templates.length; i++) {
        existing = {};
        feature = importData.templates[i];
        if (options.validateImportedFeature(feature)) {
            if (options.isNameAvailable(feature.name, names)) {
                // Attempts to create and add new feature
                feature = options.addImportedFeature(feature);
                if (feature) {
                    data.features.push(feature);
                    names.push(feature.name);
                }
            } else {
                // Attempts to update previously imported feature
                for (var j = 0; j < data.features.length; j++) {
                    if (data.features[j].name === feature.name) {
                        existing = options.updateImportedFeature(feature,
                                data.features[j]);
                        data.features[j] = existing;
                        break;
                    }
                }
                if (!existing.name) {
                    // Attempts to derive existing feature from options
                    existing = options.deriveFeature(
                            $('#features option[value="' + feature.name +
                            '"]'));
                    // Attempts to update derived feature
                    if (existing) {
                        existing = options.updateImportedFeature(feature,
                                existing);
                        data.features.push(existing);
                        names.push(existing.name);
                    }
                }
            }
        }
    }
    return data;
},

/**
 * <p>Toggles the acccessibility of the toolbar feature details.</p>
 * @since 0.3.0.0
 * @private
 */
toggleToolbarFeature: function () {
    if ($('#toolbarPopup').is(':checked')) {
        $('#toolbarFeatureName_txt, ' +
                '#toolbarFeatureDetails_txt').addClass('disabled');
        $('#toolbarFeatureName, #toolbarFeatureDetails').attr('disabled',
                'disabled');
    } else {
        $('#toolbarFeatureName_txt, ' +
                '#toolbarFeatureDetails_txt').removeClass('disabled');
        $('#toolbarFeatureName, ' +
                '#toolbarFeatureDetails').removeAttr('disabled');
    }
},

/**
 * <p>Updates the specified &lt;option&gt; element that represents a
 * feature with values taken from the available fields.</p>
 * @param {jQuery} opt The jQuery wrapped &lt;option&gt; to be
 * updated.
 * @since 0.1.0.3
 * @private
 */
updateFeature: function (opt) {
    if (opt.length) {
        opt.data('content', $('#feature_template').val());
        opt.data('enabled', String($('#feature_enabled').is(':checked')));
        opt.data('image', $('#feature_image option:selected').val());
        opt.data('shortcut',
                $('#feature_shortcut').val().trim().toUpperCase());
        opt.text($('#feature_title').val().trim());
        opt.val($('#feature_name').val().trim());
        return opt;
    }
},

/**
 * <p>Updates the existing feature with information extracted from the
 * imported feature provided.</p>
 * <p>The feature provided is not altered in anyw way and the fields of the
 * existing feature are only changed if the new values are valid.</p>
 * <p>Protected fields are only updated if the existing feature is not
 * read-only and the new value is valid.</p>
 * @param {Object} feature The imported feature on which the existing
 * feature should be modified to reflect.
 * @param {Object} existing The existing feature which should be modified
 * so that its fields reflect that of the import feature.
 * @returns {Object} The existing feature with the modified fields.
 * @since 0.2.0.0
 * @private
 */
updateImportedFeature: function (feature, existing) {
    var bg = chrome.extension.getBackgroundPage();
    // Ensures read-only templates are protected
    if (!existing.readOnly) {
        existing.content = feature.content;
        // Only updates valid titles
        if (feature.title.length > 0 && feature.title.length <= 32) {
            existing.title = feature.title;
        }
    }
    existing.enabled = feature.enabled;
    // Only updates image if identifier exists
    for (var i = 0; i < bg.ext.images.length; i++) {
        if (bg.ext.images[i].id === feature.image) {
            existing.image = feature.image;
            break;
        }
    }
    // Only updates valid shortcuts
    if (options.isShortcutValid(feature.shortcut)) {
        existing.shortcut = feature.shortcut;
    }
    return existing;
},

/**
 * <p>Updates the selection of features in the toolbar behaviour section
 * to reflect that available in the templates section.</p>
 * @since 0.3.0.0
 * @private
 */
updateToolbarFeatures: function () {
    var features = [],
        toolbarFeatures = $('#toolbarFeatureName'),
        toolbarFeatureName = utils.get('toolbarFeatureName'),
        lastSelectedFeature = toolbarFeatures.find('option:selected'),
        lastSelectedFeatureName = '';
    if (lastSelectedFeature.length) {
        lastSelectedFeatureName = lastSelectedFeature.val();
    }
    toolbarFeatures.find('option').remove();
    $('#features option').each(function () {
        var $this = $(this),
            feature = {
                name: $this.val(),
                selected: false,
                title: $this.text()
            };
        if (lastSelectedFeatureName) {
            if (feature.name === lastSelectedFeatureName) {
                feature.selected = true;
            }
        } else if (feature.name === toolbarFeatureName) {
            feature.selected = true;
        }
        features.push(feature);
    });
    features.sort(function (a, b) {
        return a.title > b.title;
    });
    var option;
    for (var i = 0; i < features.length; i++) {
        option = $('<option/>', {
            text: features[i].title + ' (' + features[i].name + ')',
            value: features[i].name
        });
        if (features[i].selected) {
            option.attr('selected', 'selected');
        }
        toolbarFeatures.append(option);
    }
},

#### TODO: END: Convert to CoffeeScript

#### Options page setup

options = window.options =

  #### Public functions

  # Initialize the options page.  
  # This will involve inserting and configuring the UI elements as well as

        $('#moveUp_btn').removeAttr 'disabled'
      # Disable the *Down* control since the selected option is at the bottom
      # of the list.
      if opt.is ':last-child'
        $('#moveDown_btn').attr 'disabled', 'disabled'
      else
        $('#moveDown_btn').removeAttr 'disabled'
