if (typeof(newsletterSubscriptionObject) == 'undefined') 
{
    newsletterSubscriptionObject = function(objectName, useAlertResponse)
    {
    	this.objectName       = objectName;
    	this.useAlertResponse = useAlertResponse; 
    }
}
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(); 
	$.post(rootUrl + 'wsdl/newsletter_new.xml.php', { 
		    	action: 'addNewsletterSubscriber', 
		  		email: email 
		  },
		  function(responseData) { 
		  		currentObject.onGetResponse(responseData); 
		  },
		  "json");
}
newsletterSubscriptionObject.prototype.onGetResponse = function(responseData)
{
	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);
		} 
	}
}