var SignUp =
{
	originalText: null,
	targetBox: null,
	verifyBox: null,

	init: function()
	{
		SignUp.targetBox = $('#email-f');
		SignUp.verifyBox = $('#email-h');
		SignUp.originalText = SignUp.targetBox.val();
		SignUp.targetBox.parent().bind('submit', SignUp.submit);
		SignUp.targetBox.bind('focus', SignUp.clear);
		SignUp.targetBox.bind('blur', SignUp.reset);
	},

	clear: function(event)
	{
		//	Only clear the search string if the user
		//	has not previously entered anything.
		if (this.value == SignUp.originalText) {
			this.value = '';
		}
	},

	reset: function(event)
	{
		//	Only reset the search string if there was
		//	nothing entered into the search box.
		if (!this.value) {
			this.value = SignUp.originalText;
		}
	},

	submit: function(event)
	{
		var signUpEmpty = !SignUp.targetBox.val();
		var signUpTextIsOrig = (SignUp.targetBox.val() == SignUp.originalText);
		if (signUpEmpty || signUpTextIsOrig) {
			event.preventDefault();
			alert('Please enter your email address!');
			SignUp.targetBox.focus();
		}

		SignUp.verifyBox.val(SignUp.targetBox.val());
	}
};

$(document).ready(SignUp.init);
