$(function () {
    function initTabs(tabs) {
        var tabsBox = $("div.tabs-container > div", tabs),
            buttons = $("ul.tabNavigation a", tabs);
        
        tabsBox.hide().filter(":first").show();
        
        buttons.click(function () {
            tabsBox.hide();
            $(this.hash, tabs).fadeIn("slow", function () {
                tabsBox.filter(this.hash).show();
            });
            buttons.removeClass("selected");
            $(this).addClass("selected");
            return false;
        });
        
        buttons.filter(":first").click();
        buttons.append("<em></em>");
    }
    
    $('.tabs').each(function (i, elem) {
        initTabs($(elem));
    });
});