Ext.define("IceCap.overrides.Component", {
	override: "Ext.Component",

	compatibility: [
		"5.1.0"
	],

	constructor: function(o_config) {

		var i_self = this;

		o_config = o_config || {};

		if (!i_self.name && !o_config.name) {

			i_self.itemId = !Ext.isEmpty(i_self.itemId) ? i_self.itemId : i_self.id || o_config.id;

			delete i_self.id;
			delete o_config.id;
		}

		if (o_config.config) {
			var o_options = i_self.options || o_config.options || {};

			Ext.apply(o_options, {
				config: o_config.config
			});

			delete o_config.config;
			o_config.options = o_options;
		}

		i_self.callParent([o_config]);
	},

	getTabIndex: function() {

		var i_self = this;
		var i_element;
		var index = i_self.tabIndex;
		var n_elemenIndex = 0;

		if (!i_self.focusable) {
			return;
		}

		i_element = i_self.getFocusEl();

		if (i_element) {

			if (i_element.isComponent) {
				index = i_element.getTabIndex();
			}
			else if (i_element.isElement) {
				n_elemenIndex = i_element.getAttribute(Ext.Element.tabIndexAttributeName);
			}
		}

		if (n_elemenIndex != index) {
			i_self.setTabIndex(index);
		}

		return index;
	}
});

Ext.define("IceCap.overrides.Component6", {
	override: "Ext.Component",

	compatibility: [
		"6.6.0"
	],

	constructor: function(o_config) {

		var i_self = this;

		o_config = o_config || {};

		if (!i_self.name && !o_config.name) {

			i_self.itemId = !Ext.isEmpty(i_self.itemId) ? i_self.itemId : i_self.id || o_config.id;

			delete i_self.id;
			delete o_config.id;
		}

		if (o_config.config) {
			var o_options = i_self.options || o_config.options || {};

			Ext.apply(o_options, {
				config: o_config.config
			});

			delete o_config.config;
			o_config.options = o_options;
		}

		i_self.callParent([o_config]);
	}
});

Ext.define("IceCap.overrides.form.field.Checkbox", {

	override: "Ext.form.field.Checkbox",

	constructor: function(o_config) {

		var i_self = this;

		Ext.apply(i_self, {
			inputValue: i_self.trueValue || o_config.trueValue || "on",
			uncheckedValue: i_self.falseValue || o_config.falseValue || ""
		});

		i_self.callOverridden([o_config]);
	}

});

Ext.define("IceCap.overrides.ux.container.GMapPanel", {
	override: "IceCap.ux.container.GMapPanel",

	constructor: function(o_config) {

		var i_self = this;

		Ext.apply(o_config, {
			api: "//maps.googleapis.com/maps/api/js?key=AIzaSyDfisl2DOtruUbjdljWnPtRLUs1pSJug90"
		});

		i_self.callParent([o_config]);
	}
});
