bgneal@89: $(document).ready(function() {
bgneal@89:    var postText = $('#id_body');
bgneal@89:    var postButton = $('#forums-reply-post');
bgneal@89:    postButton.click(function () {
bgneal@89:       var text = $.trim(postText.val());
bgneal@89:       if (text.length == 0) {
bgneal@89:          alert('Please enter some reply text.');
bgneal@89:          return false;
bgneal@89:       }
bgneal@89:       $(this).attr('disabled', 'disabled').val('Posting reply...');
bgneal@89:       $.ajax({
bgneal@89:          url: '/forums/quick-reply/', 
bgneal@89:          type: 'POST',
bgneal@89:          data: {
bgneal@89:          body : postText.val(),
bgneal@89:          topic_id : $('#id_topic_id').val()
bgneal@89:          },
bgneal@89:          dataType: 'html',
bgneal@89:          success: function (data, textStatus) {
bgneal@89:             postText.val('');
bgneal@89:             $('#forum-topic tr:last').after(data);
bgneal@89:             var lastTr = $('#forum-topic tr:last');
bgneal@89:             lastTr.hide();
bgneal@89:             lastTr.fadeIn(3000);
bgneal@89:             postButton.removeAttr('disabled').val('Submit Reply');
bgneal@89:          },
bgneal@89:          error: function (xhr, textStatus, ex) {
bgneal@89:             alert('Oops, an error occurred. Please reload the page and try again.');
bgneal@89:             postButton.removeAttr('disabled').val('Submit Reply');
bgneal@89:          }
bgneal@89:          });
bgneal@89:       return false;
bgneal@89:    });
bgneal@95:    $('#id_body').markItUp(mySettings);
bgneal@89: });