Design = function() {
	return {
		init: function() {
			this.currencyEl = Ext.get('top-currency');
			if (this.currencyEl) {
				this.currencyList = Ext.get('currency-list-layer');
				this.currencyEl.addClassOnOver('top-select-hover');
				this.currencyEl.on('click', this.showList, this);
				this.currencyEl.unselectable();
			}
		},
		showList: function(e) {
			this.hideLists();
			var el = Ext.fly(e.getTarget());
			var list, alignEl;
			if (e.getTarget().id == this.currencyEl.id || e.within(this.currencyEl)) {
				list = this.currencyList;
				alignEl = this.currencyEl;
			} else {
				return;
			}
			this.onListShow.defer(1, this);
			list.setStyle('width', '');
			list.setWidth(Math.max(list.getWidth(), alignEl.getWidth()));
			list.alignTo(alignEl, 'tl-bl', [0,-1]);
			list.show();
		},
		onListShow: function() {
			Ext.get(document.body).on('click', this.onDocClick, this);
		},
		hideLists: function() {
			Ext.get(document.body).un('click', this.onDocClick, this);
			if (this.currencyList) this.currencyList.hide();
		},
		onDocClick: function(e) {
			var el = Ext.fly(e.getTarget());
			if (el.findParent('.top-select-list', 5)) return;
			this.hideLists();
		}
	}
}();
Ext.onReady(Design.init, Design);