Qs_Form_Element_FckEditor = { editors: {}, options: {}, elementOptions: {}, init: function (id, options) { Qs_Form_Element_FckEditor.setElementOptions(id, options); if (typeof options.mode != 'undefined' && options.mode == 'edit') { Qs_Form_Element_FckEditor.setEditMode(id); } }, getElementOptions: function (id) { if (typeof Qs_Form_Element_FckEditor.elementOptions[id] == 'undefined') { return null; } return Qs_Form_Element_FckEditor.elementOptions[id]; }, getElementOption: function (id, name) { var options = Qs_Form_Element_FckEditor.getElementOptions(id); if (options) { if (typeof options[name] != 'undefined') { return options[name]; } } return null; }, setElementOption: function (id, name, value) { var options = Qs_Form_Element_FckEditor.getElementOptions(id); if (options) { options[name] = value; } else { Qs_Form_Element_FckEditor.elementOptions[id] = {name: value}; } }, setElementOptions: function (id, options) { Qs_Form_Element_FckEditor.elementOptions[id] = options; }, initEditor: function (id) { if (typeof Qs_Form_Element_FckEditor.editors[id] != 'undefined') { return false; } Qs_Form_Element_FckEditor.editors[id] = new FCKeditor(id); var options = Qs_Form_Element_FckEditor.getElementOption(id, 'editorOptions'); for (var i in options) { var value = options[i]; Qs_Form_Element_FckEditor.editors[id][i] = value; } }, setEditMode: function (id) { Qs_Form_Element_FckEditor.initEditor(id); Qs_Form_Element_FckEditor.editors[id].ReplaceTextarea(); Qs_Form_Element_FckEditor.elementOptions[id].mode = 'edit'; $('#' + id + '-element').attr('class', 'fckeditor_edit'); return false; } }