UCLU.email = {
	init: function() {
		YAHOO.util.Event.addListener('email-subscribe-button', 'click', function() {
			if (!confirm('Subscribe to our mailing list?')) return;
			
			var img = document.createElement('img');
			img.src = '../styling/i/progress.gif';
			img.width  = '24';
			img.height = '24';
			img.style.paddingLeft = '4px';
			
			this.appendChild(img);
			
			community.callCustomMethod('POST', 'list-subscribe', {
				success: function(o, response) {
					UCLU.util.remove(img);
					
					if (response.subscribed == false)
						alert('You are already subscribed to our list.');
					else
						alert('You have been added to our list.');
				}
			}, '<xml><listname>' + UCLU.email.listName + '</listname></xml>');
		});
	}
}

UCLU.email.init();