var selectRedirect = Class.create({
	initialize:function(element){
		this.element=element;
		
		$(this.element).observe('click',this.redirectPage.bind(this))
	},
	
	redirectPage: function(){
		if ($(this.element).selectedIndex != 0){
			location=$(this.element).options[$(this.element).selectedIndex].value;
		}
	}
})

var tabSet = Class.create({
	initialize:function(tabName){
		this.tabName = tabName;
		this.currentTab = null;
		
		$$('.'+this.tabName).each(function(element){
			if (!(this.currentTab)){
				this.currentTab	= element;
				$(element.identify()+'_button').addClassName('selected');
			} else {
				element.hide();
			}
		});
	},
	
	openTab:function(tab){
		$$('.'+this.tabName).each(function(element){
			if (element.identify() == tab) {
				element.show();
				$(element.identify()+'_button').addClassName('selected');
			} else {
				element.hide();
				$(element.identify()+'_button').removeClassName('selected');
			}
		});
	}
})

function switchView(div,view){
	if ($(div)){
		if(view == 'grid'){
			$(div).removeClassName('productList');
			$(div).addClassName('productGrid');
		} else if(view == 'list'){
			$(div).addClassName('productList');
			$(div).removeClassName('productGrid');
		}
	}
}