function post_to_board( mingle_url, owner_id, author_id, message, controller )
{
  jQuery.ajax( {
    type: "POST",
    url: mingle_url,
    data: "controller=" + controller + "&action=post&owner_id=" + owner_id + "&author_id=" + author_id + "&message=" + escape(message),
    success: function(html) {
      jQuery('.mngl-board').replaceWith(html);
    }
  });
  
  if( owner_id == author_id )
  {
    jQuery('.profile-status').replaceWith('<div class="profile-status">'+message+'</div>');
  }
}

function comment_on_post( mingle_url, author_id, board_post_id, message, controller )
{
  jQuery.ajax( {
    type: "POST",
    url: mingle_url,
    data: "controller=" + controller + "&action=comment&author_id=" + author_id + "&board_post_id=" + board_post_id + "&message=" + escape(message),
    success: function(html) {
      jQuery('.mngl-board').replaceWith(html);
    }
  });
}

function delete_board_post( mingle_url, board_post_id, controller )
{
  if(confirm("Are you sure you want to delete this post?"))
  {
    jQuery.ajax( {
      type: "POST",
      url: mingle_url,
      data: "controller=" + controller + "&action=delete_post&board_post_id=" + board_post_id,
      success: function(html) {
        jQuery('.mngl-board').replaceWith(html);
      }
    });
  }
}

function delete_board_comment( mingle_url, board_comment_id, controller )
{
  if(confirm("Are you sure you want to delete this comment?"))
  {
    jQuery.ajax( {
      type: "POST",
      url: mingle_url,
      data: "controller=" + controller + "&action=delete_comment&board_comment_id=" + board_comment_id,
      success: function(html) {
        jQuery('.mngl-board').replaceWith(html);
      }
    });
  }
}

function toggle_comment_form( update_id )
{
  jQuery('#mngl-board-comment-list-' + update_id).show();
  jQuery('#mngl-comment-form-' + update_id).toggle();
  jQuery('#mngl-fake-board-comment-' + update_id).toggle();
  jQuery('#mngl-board-comment-input-' + update_id).focus();
}

function show_board_post_form()
{
  jQuery('#mngl-fake-board-post-form').toggle();
  jQuery('#mngl-board-post-form').toggle();
  jQuery('#mngl-board-post-input').focus();
}

function toggle_hidden_comments(board_post_id)
{
  jQuery('.mngl-hidden-comment-'+board_post_id).show();
  jQuery('#mngl-show-hidden-comments-'+board_post_id).hide();
}