var NewsletterSignOut = new Class({
	Implements: [Options, Events, Log],
	Extends: AccountLogin,
	
	// Variables
	noAccountForm: null,

	// Class instances


	initialize: function( name, element, options )
	{
		this.enableLog();
		//this.disableLog();
		this.log("NewsletterSignOut::initialize(" + name + ", " + element + ", " + options + ")");

		// Invoke parent method
		this.parent( name, element, options );

		// Init forms
//		this.initAccountForm();
		this.initNoAccountForm();
	},

	/*
	 * Init account form
	 */
	/*
	initAccountForm: function()
	{
		this.log("NewsletterSignOut::initAccountForm()");

		// Forgotten password
		this.forgottenPassword = this.element.getElement('.account .forgotten-password');
		this.forgottenPassword.fx = new Fx.Morph(this.forgottenPassword, {
			duration: 500,
			transition: Fx.Transitions.Quad.easeOut,
			link: 'cancel'
		});

		var options = {
			showLoader: true,
			allowStatus: true,
			formErrorMessage: {
				allow: true,
				container: this.element.getElement('.account .form-message-container'),
				allowClose: false
			}
		};

		var elementOptions = {
			hintText: 'naam@domein.nl'
		};

		var form = new Form($('account-sign-out-form'), options);

		var emailElement = new FormElement(form, 'email', elementOptions);
		emailElement.addValidation(Form.REGEX_EMAIL, 'Vul je e-mail adres in');
		form.addElement(emailElement);

		var passwordElement = new FormElement(form, 'password', {});
		passwordElement.addValidation(Form.REGEX_PASSWORD, 'Vul je wachtwoord in');
		form.addElement(passwordElement);

		// Add buttons
		var submitButton = new FormSubmitButton(form, '.submit', {showLoader: true});
		form.addButton(submitButton);

		// Save form
		this.accountForm = form;

		this.accountForm.addEvent('onError', function() {

			if(passwordElement.validate() !== true)
			{
				this.forgottenPassword.fx.start({
					'background-color': '#ff6c00'
				});
			}
			else
			{
				this.forgottenPassword.fx.start({
					'background-color': '#595959'
				});
			}

		}.bind(this));
	},
	*/

	/*
	 * Init no account form
	 */
	initNoAccountForm: function()
	{
		this.log("NewsletterSignOut::initNoAccountForm()");

		var options = {
			showLoader: true,
			allowStatus: true,
			formErrorMessage: {
				allow: true,
				container: this.element.getElement('.no-account .form-message-container'),
				allowClose: false
			}
		};

		var elementOptions = {
			hintText: 'naam@domein.nl'
		};

		var form = new Form($('no-account-sign-out-form'), options);

		var emailElement = new FormElement(form, 'email', elementOptions);
		emailElement.addValidation(Form.REGEX_EMAIL, 'Vul je e-mail adres in');
		form.addElement(emailElement);

		// Add buttons
		var submitButton = new FormSubmitButton(form, '.submit', {showLoader: true});
		form.addButton(submitButton);

		// Save form
		this.noAccountForm = form;
	}

});
