$(document).ready(function() {
    // Set the left-hand navigation product category label to be the same text as what's in the "on" secondary nav element
    var on = $("#SecondLevelSubNavContainer li.on:first");
    if (on != null) {
        var lhnCatLink = $("#productCategoryLabel a");
        if (lhnCatLink != null) {
            lhnCatLink.text(on.text());
            var onLink = $("a:first", on);
            lhnCatLink.attr("href", onLink.attr("href"));
        }
    }
});

$(window).load(function() {
    resizeCentralNav();
});

function resizeCentralNav() {
    // Resize the central nav cells so that each row's cell is the height of the tallest cell in that row
    var containers = $(".productFamilyCentralMenu");
    $.each(containers, function(i){
	    var cells = $(this).find(".centralMenuCell");
	    for (var i = 0; i < cells.length; i += 2) {
		var maxHeight = $(cells[i]).height();
		if (i + 1 < cells.length)
		    maxHeight = Math.max(maxHeight, $(cells[i + 1]).height());
		$(cells[i]).height(maxHeight + 1);
		if (i + 1 < cells.length)
		    $(cells[i + 1]).height(maxHeight + 1);
	    }  
    });
  
}