var Signup = {
  fullname_desc: { id: 'user_fullname', not_empty: true },
  email_desc: { id: 'user_email', not_empty: true, is_email: true },
  password_desc: { id: 'user_password', not_empty: true, is_password: true },
  password_confirmation_desc: { id: 'user_password_confirmation', not_empty: true, should_confirm: 'user_password' },

  Form: Behavior.create({
    onsubmit: function() {
      if (this.element.hasClassName('with-validation-desc')) {
        var fields_desc = [
          { id: this.element.down('.user-fullname').id, not_empty: true },
          { id: this.element.down('.user-email').id, is_email: true }
        ];
      } else {
        var fields_desc = [
          Signup.fullname_desc,
          Signup.email_desc,
          Signup.password_desc,
          Signup.password_confirmation_desc
        ];
      }

      return Validators.validate_fields(fields_desc).all();
    }
  }),

  validate_fullname: function() {
    return Validators.validate_fields([Object.extend({dont_focus: true}, Signup.fullname_desc)]).all();
  },

  validate_password: function() {
    return Validators.validate_fields([Object.extend({dont_focus: true}, Signup.password_desc)]).all();
  },

  validate_password_confirmation: function() {
    return Validators.validate_fields([Object.extend({dont_focus: true}, Signup.password_confirmation_desc)]).all();
  },

  validate_email: function() {
    return Validators.validate_fields([Object.extend({dont_focus: true}, Signup.email_desc)]).all();
  }

};
