

function RemoveWatchedUserWidget(userId)
{
	this.id = 'removeWatchedUserWidget';
	this.removeWatchedUserUrl = 'http://'+getHost()+'/removewatcheduser';
	this.userId = userId;
	
	RemoveWatchedUserWidget.prototype.removeWatchedUser = function(watchedUserId) {
			var self = this;
			var params = "userId="+this.userId+"&watchedUserId="+watchedUserId;
			var ajaxRequest = new Ajax.Request(
				this.removeWatchedUserUrl+'?'+params,
				{
					method: 'post', 
					asynchronous: true,
					onComplete: function(request, responseHeader){
							self.completeRemoveWatchedUser(request, responseHeader);
							},
					onException: function(request, responseHeader){
							self.reportException(request, responseHeader);
							},
					onFailure: function(request, responseHeader){
							self.reportError(request, responseHeader);
							}
			});
	}

	RemoveWatchedUserWidget.prototype.onFormSubmit = function(form, submitButtonText) {
		form.submit.disabled = true;
		if (submitButtonText != '') form.submit.value = submitButtonText;
	}
	
	RemoveWatchedUserWidget.prototype.completeRemoveWatchedUser = function(request, responseHeader) {
		var result = request.responseText;
		if (result != OPERATION_SUCCESSFUL) {
			var message = "Sorry, an error occurred whilst trying to remove the person from your people list.";
			showErrorAlert(message);
		}	
		window.location.reload();			
	}
		
	
	RemoveWatchedUserWidget.prototype.reportException = function(request, responseHeader)
	{
		LOG.error('reportException:\n\nresponseHeader = ' + responseHeader + '\n\nrequest = ' + request + '\n\nrequest.responseText = ' + request.responseText);
	}
	
	RemoveWatchedUserWidget.prototype.reportError = function(request, responseHeader)
	{
		LOG.error('reportError:\n\nresponseHeader = ' + responseHeader + '\n\nrequest = ' + request + '\n\nrequest.responseText = ' + request.responseText);
	}
	
}