function resetProductTables() {
	$('table.productPreview tr.productData').hide();
	$('table.productPreview tr.toggler').removeClass('active');
}

function vAlignImages() {
	$("td.categoryImage").each(function(i) {
		var tdheight = $(this).height();
		var imgheight = $(this).find("a.main img").height();
		var imgpadding = (tdheight - imgheight) / 2;
		
		$(this).find("a.main img").css('padding-top', imgpadding+'px');
		$(this).find("a.main img").css('padding-bottom', imgpadding+'px');
	});
}

$(document).ready(function() {
	vAlignImages();
	
	$('table.productPreview tr.toggler td.toggler').click(function(){
	    $(this).parents('tr').toggleClass('active').next("tr.productData").toggle().siblings("tr.productData").hide().prev('tr.toggler').removeClass('active');
	});
	
	resetProductTables();
});
