 jQuery(document).ready(function($){
			Cufon.replace('.product-selector-title');
			Cufon.replace('.product-selector-adlib');
			Cufon.replace('#learn-more-product-selector');

	var topSelector = $('#top-category-selector');

	// init the product list
	$('#products-list').isotope({
	  // options
	  itemSelector : '.image, #learn-more-container'
	});

	// attach the selector handlers
	topSelector.change(function() {
		if (topSelector.val() == '-') {
			category = 3;
		} else {
			category = topSelector.val();
		}

		// filter out others using isotope
		$('#products-list').isotope({ filter: '.category-' + category + ', #learn-more-container' });

		// populate the next ad lib sentence (or dont)
		if (category == 3 || category == 13 || category == 14) { // 3 is the root, 13/14 have no subcategories
			$('.product-selector-adlib-2').hide('fast');
			$('.product-selector-adlib-2').children().hide('fast');

			// highlight remaining choices
			$('#learn-more-product-selector').fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
		} else { 
			$('.product-selector-adlib-2').children().hide('fast');
			$('.product-selector-adlib-2').show('fast');
			$('.secondary-selector-' + category).show('fast');
		}
		
	});

	$('.secondary-selector').change(function() {
		if ($(this).val() == '-') {
			$(this).val('-');
			// filter out others using isotope
			$('#products-list').isotope({ filter: '.category-' + topSelector.val() + ', #learn-more-container' });		
		} else {
			// filter out others using isotope
			$('#products-list').isotope({ filter: '.category-' + $(this).val() + ', #learn-more-container'});

			// highlight remaining choices
			$('#learn-more-product-selector').fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
		}
		
	});
	
});

