$(document).ready(function() {
    $('.comment, .add-comment').hide();
    $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth:19, dragMaxHeight:69});

    $('a.show-comments-link').click(function() {
        $(this).parents('.post-comments').find('.add-comment').hide();
        $(this).parents('.post-comments').find('.comment').toggle(function() {
           $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth:19, dragMaxHeight:69});
        });
        return false;
    });

    $('a.add-comment-link').click(function() {
        $(this).parents('.post-comments').find('.comment').hide();
        $(this).parents('.post-comments').find('.add-comment').toggle(function() {
            $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth:19, dragMaxHeight:69});
        });
        return false;
    });

    $('.post-comments :submit').livequery('click', function() {
       var data = $(this).parents('form').serialize();
       var action = $(this).parents('form').attr('action');
       $.post(action, data, function(data) {
           alert(data);
       }, 'text');
       return false;
    });

});

