$(document).ready(function(){

	//Remove text from input box
	$("#newsletter-email").focus( function() {
		if ( $(this).val() == 'your email address' ) {
			$(this).val('');
			$(this).removeClass('grey');
		}
		return false;
	});

	$("#newsletter-form").submit( function() {
		newsletterSubscribe();
		return false;
	});
	
	//Submit email address to list
	$("#newsletter-submit").click( function() {
		newsletterSubscribe();
		return false;
	});
});

function newsletterSubscribe() {
	$.getJSON(
		'~gateway/newsletter.cfc',
		{ method: 'subscribe', email: $('#newsletter-email').val() },
		function(data) {
			//Set new value
			alert( data.MSG );
			
			if ( data.SUCCESS == 1 ) {
				$('#newsletter-email').val('');
			}
		}
	);
}