$(function() {
    $(".tabpanel").each(function() {
        var tabpanelId = $(this).attr('id');
        //$("#"+tabpanelId+" ul.panel li.content:not("+$("#"+tabpanelId+" ul.tab li a.selected").attr("href")+")").hide();
        $("#"+tabpanelId+" ul.panel li#"+$("#"+tabpanelId+" ul.tab li a.selected").attr("href")).show();
        $("#"+tabpanelId+" ul.tab li a").click(function() {
            $("#"+tabpanelId+" ul.tab li a").removeClass("selected");
            $(this).addClass("selected");
            $("#"+tabpanelId+" ul.panel li.content").hide();
            $($(this).attr("href")).show();
            return false;
        });
    });
});

$.event.add(window, "load", function() {
    var boxHeight = 0;
    
    $('#b4 li a').each(function() {
        $this = $(this);
        if ($this.outerHeight() > boxHeight) {
            boxHeight = $this.outerHeight();
        }
    });

    $('#b4 li a').css('height', boxHeight);
});
