/**
 * @filename TimezoneFormField.js
 * 
 * @description Class to get timezone drop down 
 * 
 * @author Devon Lindse
 *
 * Copyright(c) 2008, Garmin International
 */
Ext.namespace("Garmin", "Garmin.form");
Garmin.form.TimezoneFormField = {
	/**
	 * 
	 * @param {Object} Ext.form.ComboBox config
	 * 
	 * @return {Ext.form.ComboBox}
	 */
	getTimeZonesCombo: function(config) {
		var store = this._getTimeZonesStore();
		var combo = new Ext.form.ComboBox(Ext.apply(config,Ext.apply(ActivityFormFieldsConstants.COMBO_BOX_DEFAULT_CONFIG_OPTIONS, {
				name: 'timeZoneField',
				emptyText: bundle_resource.pick_time,
		        store: store,
				mode: 'local',
		        displayField:'defaultDisplay',
				valueField:'key'
			}))
		);
		return combo;
	},

	/**
	 * 
	 * @return {Ext.data.Store}
	 */
	_getTimeZonesStore : function() {
		var timeZoneData = TIME_ZONES_JSON;

		var store = new Ext.data.JsonStore({
			data: timeZoneData,
		    root: 'dictionary',
			id: 'key',
			fields: [
	            {name: 'key'},
	            {name: 'defaultDisplay', mapping: 'abbr'},
	            {name: 'isDefault'}
	        ]
		});
		return store;
	}
};