var LoginZone = new Class({

	container: null,
	fail: null,
	gotoURL: null,

	initialize: function(options) {
		this.form = $(options.id);
		this.fail = options.fail;
		this.gotoURL = options.gotoURL;
		if (!this.form) {
			return;
		}
		this.form.getElements('input,button').each(function(el) {
			el.erase('disabled');
		});
		var $this= this;
		this.form.addEvent('submit', function(event) {
			event.stop();
			$this.login();
		});
	},

	login: function() {
		var $this = this;
		$this.form.set('action', '/?module=loginzone&action=login').set('send', {
			'onRequest': function() {

			},
			'onComplete': function(response) {
				if (response == '1') {
					document.location = $this.gotoURL != null ? $this.gotoURL : document.location;
				} else {
					alert($this.fail);
				}
			}
		});
		$this.form.send();
	}




});

