$(document).ready(function() {
    $(".event-interval").each(function() {
        var current_event = this;
        $(current_event).find(".action_show_hide").click(function(event) {
            event.preventDefault();
            var occurrences_closed = ($(current_event).find(".coming_occurrences").css("display")=="none");
            var text_show = $(current_event).find(".action_show_hide_text_show");
            var text_hide = $(current_event).find(".action_show_hide_text_hide");
            $(current_event).find(".coming_occurrences").slideToggle('fast');
            if (occurrences_closed) {
                $(text_show).hide();
                $(text_hide).show();
            } else {
                $(text_show).show();
                $(text_hide).hide();
            }
        });

    });
});
