var tx_photobookcommon_pi1 = {
	getFormData: function(element, callOptions) {
		var inputs = Form.Methods.getInputs(element, 'text', 'tx_photobookcommon_pi1[email]');
		if (inputs.length && inputs[0].value.strip()) {
			var data = Form.Methods.serialize(element, { submit: false });
			if (data) {
				callOptions.usePost = true;
				callOptions.noCache = true;
				callOptions.parameters = data;
			}
		} else {
			callOptions.exit = true;
		}
	},

	behaviourFieldFocus: function(event) {
		var field = $('tx-photobookcommon-pi1-email');
		if (field && field.value == field.defaultValue) {
			field.value = '';
		}
	},

	behaviourFieldBlur: function(event) {
		var field = $('tx-photobookcommon-pi1-email');
		if (field && !field.value.strip().length) {
			field.value = field.defaultValue;
		}
	}
};

// Register event handler for blur and focus events on the input field:
Event.observe(
	window,
	'load',
	function () {
		Event.observe($('tx-photobookcommon-pi1-email'), 'focus', tx_photobookcommon_pi1.behaviourFieldFocus);
		Event.observe($('tx-photobookcommon-pi1-email'), 'blur', tx_photobookcommon_pi1.behaviourFieldBlur);
	}
);
