$(document).ready(function()
{
	$('input#submitmucomment').click(function()
	{
		$('span#commentresult').html('Sending...');
		$('textarea#commentreply').attr('disabled', 'disabled');
		$.post('/strategy_process.php',
		{
			action: 'postmucomment',
			comment: $('textarea#commentreply').val(),
			matchupid: $('input#matchupid').val()
		},
		function(xmlResult)
		{
			var commentResult = $('sresult', xmlResult);
			var commentStatus = commentResult.attr('status');
			var commentError = commentResult.attr('error');
			
			if (commentStatus)
			{
				var newComment = commentResult.attr('comment');
				$('thead#replyheader').before(newComment);
				$('span#commentresult').html(commentStatus);
				$('textarea#commentreply').val('');
			}
			
			if (commentError)
				$('span#commentresult').html(commentError);
			$('textarea#commentreply').attr('disabled', '');
		});
	
	});
	
	$('input#submitcomment').click(function()
	{
		$('span#commentresult').html('Sending...');
		$('textarea#commentreply').attr('disabled', 'disabled');
		$.post('/strategy_process.php',
		{
			action: 'postcomment',
			comment: $('textarea#commentreply').val(),
			stratid: $('input#stratid').val()
		},
		function(xmlResult)
		{
			var commentResult = $('sresult', xmlResult);
			var commentStatus = commentResult.attr('status');
			var commentError = commentResult.attr('error');
			
			if (commentStatus)
			{
				var newComment = commentResult.attr('comment');
				$('thead#replyheader').before(newComment);
				$('span#commentresult').html(commentStatus);
				$('textarea#commentreply').val('');
			}
			
			if (commentError)
				$('span#commentresult').html(commentError);
			$('textarea#commentreply').attr('disabled', '');
		});
	
	});
});