function sortNumber(a,b){return a - b;}
function maxHeight() {
    var heights = new Array();
    $('.productdisplay').each(function(){
        $(this).css('height', 'auto');
        heights.push($(this).height());
        heights = heights.sort(sortNumber).reverse();
        $(this).css('height', heights[0]);
    });        
}


$(document).ready(function() {
    maxHeight();
	
	$("#sidebar h4").css("cursor", "pointer").append("<span></span>");
	$(".wpsc_categorisation_group").hide();
	//$(".wpsc_categorisation_group").first().addClass("open").show();
	
	$("#sidebar h4").click(
	function(){
        if (!$(this).hasClass("open")) {
            $(this).removeClass("open");
        	$(".wpsc_categorisation_group").hide();
    		$(this).next().toggle();
        }
    },
    function(){
        if (!$(this).hasClass("open")) {
            $(this).addClass("open");
            $(".wpsc_categorisation_group").hide();
        }                       
    },
    
    function(){	}
	);
	
	
	/*
	function(){
		$(this).removeClass("open");
		$(this).addClass("open");

		$("h4 span").html(" ");
		$("h4.open span").html(" ");

		$(".wpsc_categorisation_group").hide();
		$(this).next().toggle();
	
	});*/
	$("h4 span").html(" ");
})
