function editComment(_comment_id)
{
	// Save Old Content
	$('#comment_' + _comment_id.toString()).data('old_content', $('#comment_' + _comment_id.toString() + ' .forumText').html());
	
	// We need to get the BB code for this comment
	$.get('/ajax/forums/edit-comment/' + _comment_id.toString() + '/', function(data){
		$('#comment_' + _comment_id.toString() + ' .forumText').html(data);
	
		if($('#edit_comment_' + _comment_id.toString()) == null)
		{
			// There was an error
			return;
		}
		$('#edit_comment_' + _comment_id.toString()).tinymce({
			// Location of TinyMCE script
			script_url : '/static/tiny_mce/tiny_mce.js',

			// General options
			theme : "advanced",
			mode : "none",
			plugins : "bbcode",
			theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,removeformat,cleanup,code",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "bottom",
			theme_advanced_toolbar_align : "center",
			//theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
			content_css : "/templates/default/stylesheets/bbcode.css",
			entity_encoding : "raw",
			add_unload_trigger : false,
			//remove_linebreaks : false,
			inline_styles : false,
			force_p_newlines : false,
			force_br_newlines : false,
			remove_linebreaks : false,
			convert_newlines_to_brs : false,

			convert_fonts_to_spans : false
			// }
		});
	});
}

function saveCommentEdit(_comment_id)
{
	tinyMCE.triggerSave();
	
	var _body = $('#edit_comment_' + _comment_id.toString()).val();
	
	$.post('/ajax/forums/save-comment/' + _comment_id.toString() + '/'
		,{ body: _body }
		,function(data){
			data = data + '<br /><br /><em class="editSaved">Your post has been saved!</em>';
			$('#comment_' + _comment_id.toString() + ' .forumText').html(data);
			setTimeout("$('.editSaved').fadeOut();", 2000);
			
	});
}

function cancelCommentEdit(_comment_id)
{
	$('#comment_' + _comment_id.toString()  + ' .forumText').html($('#comment_' + _comment_id.toString()).data('old_content'));
}

function forumShowMoreInfo(_comment_id)
{
	if($('#more_' + _comment_id.toString()).css('display') != 'block')
	{
		$('#more_' + _comment_id.toString()).fadeIn('fast');
	}
	else
	{
		$('#more_' + _comment_id.toString()).fadeOut('fast');
	}
}

