window.addEvent('domready', function() {
	$$('input[type=text].placeholder').each(function(inputBox) {
		var inputDefaultText = inputBox.value;
		if (!inputDefaultText) {
			inputBox.value = (inputDefaultText = 'Please enter your email address');
		}
		inputBox.addClass('empty');
		inputBox.addEvent('focus', function() {
			if (inputBox.hasClass('empty')) {
				inputBox.value = '';
				inputBox.removeClass('empty')
			} else {
				inputBox.select();
			}
		});
		inputBox.addEvent('blur', function() {
			if (!inputBox.value.trim()) {
				inputBox.value = inputDefaultText;
				inputBox.addClass('empty');
			}
		});
		var inputBoxForm = inputBox.getParent('form');
		if (inputBoxForm) {
			inputBoxForm.addEvent('submit', function() {
				if (inputBox.hasClass('empty')) inputBox.value = '';
			});
		}
	});
});
