// KSP Category Page JavaScript

if(ksp) {
}else{
	var ksp={};
}

ksp.comboData = []

Event.observe(window, 'load', function() {
	
	// control the shown mini-family of products based on the combo box
	if($('mini-family-selector')){
		$('mini-family-selector').lid = ''
		var combo = new Df.Combo('mini-family-selector',{
			data: ksp.comboData,
			listClassName: 'miniFamList',
			onUpdate: function(e){
				if($('mini-family-selector').lid != ''){ $($('mini-family-selector').lid).removeClassName('shown') }
				$(e.currentValue.replace('subCatOpt','miniFamily')).addClassName('shown')
				$('mini-family-selector').lid = e.currentValue.replace('subCatOpt','miniFamily')
				$('mini-family-viewAll').href = '/family/index.jsp?categoryId=' + e.currentValue.replace('subCatOpt','')
			}
		})
		combo.setCurrentIndex(0)
		
		// used to resize the combo box width to match the width of the option list
		var offset = -6
		$('mini-family-selector').setStyle({width: $$('div.miniFamList')[0].scrollWidth + offset + 'px'})
	}
})

