
function build_toggle_callback(target_name, normal_state, other_state)
{
    $(target_name).toggle(
        function () {
            $(this).addClass(other_state);
            $(this).removeClass(normal_state);
        },
        function () {
            $(this).addClass(normal_state);
            $(this).removeClass(other_state);
        }
    );
}

$(document).ready(function() {
    // build_toggle_callback(".img-in-post", "img-in-post-small", "img-in-post-normal");
    build_toggle_callback(".spoiler", "spoiler-collapsed", "spoiler-expanded");
});


