if (typeof(newsletterSubscriptionObject) == 'undefined') 
{
    newsletterSubscriptionObject = function(objectName, useAlertResponse, ajaxEventUID)
    {
    	this.objectName       = objectName;
    	this.useAlertResponse = useAlertResponse; 
    	this.ajaxEventUID     = ajaxEventUID;
    }
}
newsletterSubscriptionObject.prototype.init = function()
{
	var currentObject     = this;		
	this.defaultValue     = $('#' + this.objectName + '_Email').val();	
	this.loaderHtml       = $('#' + this.objectName + '_Messagebox').html();
	$('#' + this.objectName + '_Messagebox').html('');		
	$('#' + this.objectName + '_Messagebox').show();		
	$('#' + this.objectName + '_Email').toggleVal();	
	$('#' + this.objectName + '_Submit').click(function() { currentObject.submit() } );
	$('#' + this.objectName + '_Email').setEnterHandler(function() { currentObject.submit() } );		    
}
newsletterSubscriptionObject.prototype.submit = function()
{
	var currentObject = this;
	$('#' + this.objectName + '_Body').hide();		
	$('#' + this.objectName + '_Messagebox').show();		
	$('#' + this.objectName + '_Messagebox').html(this.loaderHtml);
	var email = $('#' + this.objectName + '_Email').val(); 
	
	var postData = { __callHandler: 'addNewsletterSubscriber', 
	  		         email: email 
	}; 
	postData[currentObject.objectName + '__ajaxEventUID'] = this.ajaxEventUID;
	
	$.post(selfUrl, postData,	
	function(responseData) { 
  		currentObject.onGetResponse(responseData); 
	},
	'json');
}
newsletterSubscriptionObject.prototype.onGetResponse = function(responseData)
{
    if ((typeof(showAJAXDebugInfo) != 'undefined') && responseData.PHPAJAXDebug != null) 
    {
        showAJAXDebugInfo(responseData.PHPAJAXDebug.Info, responseData.PHPAJAXDebug.Owner);
    }
	
	if (responseData.Response.Code == 1)
	{
		$('#' + this.objectName + '_Body').show();		
		$('#' + this.objectName + '_Messagebox').hide();		
		alert(responseData.Response.Message);
	}
	else
	{
		$('#' + this.objectName + '_Email').val(this.defaultValue);
		if (!this.useAlertResponse)
		{
			$('#' + this.objectName + '_Messagebox').html(responseData.Response.Message);		
		}
		else
		{
			$('#' + this.objectName + '_Body').show();		
			$('#' + this.objectName + '_Messagebox').hide();		
			alert(responseData.Response.Message);
		} 
	}
}