function submitSignup ( ) 
{ 
	$j( '#newsletter-signup div.error' ).hide( );

	// validate form
	var email = $j( '#enter-your-email' ).val( ).trim( );
	var email_regex = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;
	if ( 0 == email.length || !email_regex.test( email ) )
	{
		$j( '#newsletter-invalid' ).slideDown( );
		return false;
	}

	if ( show_extra_info_form )
	{
		birthdate = Date.UTC( $j( '#date_of_birth_year' ).val( ),
			$j( '#date_of_birth_month' ).val( ),
			$j( '#date_of_birth_day' ).val( ) );
		today = new Date( );
		age = Math.floor( ( ( today - birthdate ) / 1000 ) / ( 60 * 60 * 24 * 365 ) );
		
		if ( age < 14 )
		{
			$j( '#too-young' ).slideDown( );
			$j( 'select[name="date_of_birth[year]"]' ).addClass( 'error' );
			$j( 'select[name="date_of_birth[month]"]' ).addClass( 'error' );
			$j( 'select[name="date_of_birth[day]"]' ).addClass( 'error' );
			return false;
		}
		else if ( age < 18 && 'ME' == $j( '#location-state' ).val( ) )
		{
			$j( '#too-young-for-maine' ).slideDown( );
			$j( 'select[name="date_of_birth[year]"]' ).addClass( 'error' );
			$j( 'select[name="date_of_birth[month]"]' ).addClass( 'error' );
			$j( 'select[name="date_of_birth[day]"]' ).addClass( 'error' );
			return false;
		}
	}

	$j.ajax( { 
		type: 'get',
		url: '/site/addNewsletterSubscription',
		data: $j( '#news-signup' ).serialize( ),
		success: function ( data ) { 
			if ( 1 == data )
			{
				$j( '#newsletter-success' ).slideDown( );
			}
			else
			{
				$j( '#newsletter-failure' ).slideDown( );
			}
		},
		error: function ( ) { 
			$j( '#newsletter-failure' ).slideDown( );
		}
	} );
}

$j( function ( ) { 
	$j( '#enter-your-email' ).focus( function ( ) { 
		if ( 'Enter Your Email' == $j( this ).val( ) )
			$j( this ).val( '' );

		if ( show_extra_info_form )
			$j( '#newsletter-extra-info' ).slideDown( );
	} );	

	$j( '#enter-your-email' ).blur( function ( ) { 
		if ( 0 == $j( this ).val( ).trim( ).length )
			$j( this ).val( 'Enter Your Email' );
	} );	
} );
