var spc_email_regex = /^[a-z0-9,!#\$%&\'\*\+\/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&\'\*\+\/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$/i;

$( document ).ready( function() {

	$( 'form' ).submit( function() {

		var field;

		// The user's email address is required.
		field = $( '#email' );
		if( $.trim( field.val() ) == '' ) {
			alert( 'Your email address is required.' );
			field.focus();
			return false;
		} else if( spc_email_regex.test( $.trim( field.val() ) ) == false ) {
			alert( 'Your email address does not appear to be properly formatted. Please make sure it is typed correctly.' );
			field.focus();
			return false;
		}

		$.blockUI( { message: '<h1>Processing...</h1>', css: { backgroundColor: '#34689a', color: '#fff', border: '2px solid #679bcd', fontWeight: 'bold', padding: '5px' } } );

		return true;

	} );

	$( window ).unload( function() {
		$.unblockUI();
	} );

} );