
	$(function() {
	
		$('#sign-up').click(function(e) {
			
			e.preventDefault();
			
			var emailValue = $('input#email-field').val();
			if ( emailValue != "" ) {
			
				$.post('http://twss.macfanatic.net/admin/includes/modules/twss/pages/pre_launch_notify.php', { email:emailValue }, function(response) {
			
					if ( !response.error ) {
						
						$('#content-teaser').fadeOut('slow', function() {
							$(this)
								.css("background-image", "none")
								.html(
									 '<div id="success-message">'+
									 "<h2>Thanks for registering.</h2>"+
									 "<p>You're going to love That's What She Said Jokes.</p>"+
									 "<p>Keep a look out on your inbox ("+emailValue+") and I'll let you know as soon as you can get the app in the store.</p>"+
									 "<p>In the meantime, follow me on twitter (<a href='http://twitter.com/macfanatic' title='Mac Fanatic on Twitter'>@macfanatic</a>) or check out my blog for Mac news and development rumblings at <a href='http://www.macfanatic.net/blog/' title='Mac Fanatic Blog'>http://www.macfanatic.net/blog/</a></p>"+
									 "<p>Thanks!</p>"+
									 "</div>"
							).fadeIn('slow');
						});
				
					} else presentError();
			
				}, "json");
				
			} else presentError();
							
		});
		
		
		function presentError() {
			$('input#email-field').flashField({times:2, color1:"#F0F099", color2:"#335679"}, function() {
				$('input#email-field').css("backgroundColor", "transparent");
				$('input#email-field').focus();
			});
		}
	
	});