function OnAddCommentSuccess ( oResponse )
{
	ShowMessage ( 'Your comment has been added', 'Your comment has been added successfully.' );
}

function OnAddCommentFailure ( oResponse )
{
	ShowMessage ( 'Adding your comment failed', 'There was an error while adding your comment. ' +
		'As a result, your comment has not been saved.' );
}

function OnCommentButtonClick ( oEvent )
{
	if ( s_sMediaName != null )
	{
		var btnB = document.getElementById ( 'btnAddComment' );

		if ( ( btnB != null ) && ( btnB.disabled ) )
			return;
		
		var txtT = document.getElementById ( 'txtComment' );

		if ( txtT != null )
		{
			var sComment = txtT.value;

			if ( sComment.length > 0 )
			{
				txtT.readOnly = true;

				if ( btnB != null )
					btnB.disabled = true;
				
				StartWSCall ( 'Services/CommentWebService.asmx/Add',
					'sMediaName=' + s_sMediaName + '&sComment=' + escape ( sComment ),
					OnAddCommentSuccess, OnAddCommentFailure );
			}
			else
				ShowMessage ( 'No comment to add', 'Please enter a comment first.' );
		}
	}
}

function OnCommentInputKeyPress ( oEvent )
{
	if ( !OnTextBoxKeyPress ( oEvent ) )
		return ( false );

	return ( true );
}
