if(!window.Login)
  var Login = Class.create();

Object.extend(Login.prototype, {
	initialize: function(login, password, button){
		this.pre_key = 0;
		this.login = login;
		this.password = password;
		this.button = button;
	},
	enable: function () {
		this.login.show();
		this.password.show();
		try {
			this.login.focus();
			this.login.select();
		} catch(ex) {
		};
	},
	press_login: function(e) {
		if(e.keyCode == 13 && this.pre_key != 40 && this.pre_key != 13) {
			this.password.focus();
			this.password.select();
		} else if(e.keyCode == 13 && this.pre_key == 13) {
			this.login.form.submit();
		};
	this.pre_key = e.keyCode;
	},
	press_password: function(e) {
		if(e.keyCode == 13) this.logon();
	},
	logon: function() {
		this.login.form.submit()
	}
});
