var RefinementViewAllButton = Class.create({
	element: null,
	viewMore: null,

	initialize: function(el) {
		if (el) {
			this.element = el;
			var id = el.id.replace('viewAllRef_', '');

			this.viewMore = $('viewMoreRef_' + id);
			el.observe('click', this.clickHandler.bind(this));
		}
	},
	
	clickHandler: function(ev) {
		if (this.viewMore) {
			this.element.hide();
			this.viewMore.addClassName('showMore');
		}
	}
});
RefinementViewAllButton.init = function() {
	$$('#filter .refViewAllBtn').each(function(el) {
		new RefinementViewAllButton(el);
	});
}

document.observe('dom:loaded', function() {
	RefinementViewAllButton.init();
	
	$$('.productmini .selColor .colorSwatch img.swatch').each(function(e) {
		e.onerror = function(ev) {
			this.onerror = null;
			this.src = staticRoot + 'images/colorswatchnotavailable.gif';
		};
	});
});