Ajax.InPlaceAdvancedEditor = Class.create(Ajax.InPlaceEditor, {
    createEditField: function() {
        var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
        var fld;
          fld = document.createElement('textarea');
          fld.id = this.options.formId+'-tiny_mce';
          fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
          fld.cols = this.options.cols || 40;
        fld.name = this.options.paramName;
        fld.value = text; // No HTML breaks conversion anymore
        fld.className = 'editor_field';
        if (this.options.submitOnBlur)
          fld.onblur = this._boundSubmitHandler;
        this._controls.editor = fld;
        if (this.options.loadTextURL)
          this.loadExternalText();
        this._form.appendChild(this._controls.editor);
    },
  enterEditMode: function(e) {
    if (this._saving || this._editing) return;
    this._editing = true;
    this.triggerCallback('onEnterEditMode');
    if (this.options.externalControl)
      this.options.externalControl.hide();
    this.element.hide();
    this.createForm();
    this.element.parentNode.insertBefore(this._form, this.element);
    tinyMCE.execCommand('mceAddControl', false, this.options.formId + '-tiny_mce');
    if (!this.options.loadTextURL)
      this.postProcessEditField();
    if (e) Event.stop(e);
  },
  removeForm: function() {
    if (!this._form) return;
    tinyMCE.execCommand('mceRemoveControl', false, this.options.formId + '-tiny_mce');
    this._form.remove();
    this._form = null;
    this._controls = { };
  }
}); 