Design = function() {
	return {
		init: function() {
			Ext.get('top-logo').addClassOnOver('top-logo-hover');
			var productListItems = Ext.select('.product-list-item');
			productListItems.addClassOnOver('product-list-item-hover');
			Ext.EventManager.addListener('top-search-field-input', 'focus', function(e) {
				var t = e.getTarget();
				if (t.value == t.getAttribute('emptyText')) t.value = '';
			});
			Ext.EventManager.addListener('top-search-field-input', 'blur', function(e) {
				var t = e.getTarget();
				if (t.value == '') t.value = t.getAttribute('emptyText');
			});
			Ext.EventManager.addListener('top-search-field-input', 'keydown', function(e) {
				if (e.getKey() == e.ENTER) {
					document.searchform.submit();
				}
			});
		}
	}
}();
Ext.onReady(Design.init, Design);

ImgCarrousel = function() {
	return {
		init: function() {
			this.ct = Ext.get('img-carrousel');
			if (!this.ct) return;
			this.activeIndex = 0;
			this.startTimer();
		},
		startTimer: function() {
			if (Ext.isIE) this.getActiveEl().dom.style.filter = '';
			window.setTimeout(this.next.createDelegate(this), 7*1000);
		},
		getActiveEl: function() {
			return Ext.get(this.ct.dom.childNodes[this.activeIndex]);
		},
		next: function() {
			var nextIndex = this.activeIndex+1;
			if (nextIndex >= this.ct.dom.childNodes.length) {
				nextIndex = 0;
			}
			var prevEl = this.getActiveEl();
			prevEl.hide({
				duration: 1,
				callback: function() {
					if (Ext.isIE) prevEl.dom.style.filter = '';
				}
			});
			this.activeIndex = nextIndex;
			var activeEl = this.getActiveEl();
			if (Ext.isIE) activeEl.dom.style.visibility = 'visible';
			activeEl.show({
				duration: 1,
				callback: this.startTimer,
				scope: this
			});
		}
	}
}();
Ext.onReady(ImgCarrousel.init, ImgCarrousel);
