
$(document).ready(function() {
    $("#hero div").css("display", "none");
    display_active_content($("#hero-navigation .active"));

    $("#hero-navigation li a").click(function(e) {
        if ($(this).parent() !== $("#hero-navigation .active")) {
            remove_active_content($("#hero-navigation .active"));
            display_active_content($(this).parent());
            e.preventDefault();
        }
    });

    function display_active_content(object) {
        if (object.attr("class") !== "active") {
            object.addClass("active");
        }
        var active_content = object.attr("id").replace("hero-navigation-", "");
        $("#hero-" + active_content + ", #hero-" + active_content + " div").css("display", "block");
    }

    function remove_active_content(object) {
        object.removeClass("active");
        var deactive_content = object.attr("id").replace("hero-navigation-", "");
        $("#hero-" + deactive_content + ", #hero-" + deactive_content + " div").css("display", "none");
    }

});
