(function(){tinymce.create("tinymce.plugins.Save",{init:function(b,c){var a=this;a.editor=b;b.addCommand("mceSave",a._save,a);b.addCommand("mceCancel",a._cancel,a);b.addButton("save",{title:"save.save_desc",cmd:"mceSave"});b.addButton("cancel",{title:"save.cancel_desc",cmd:"mceCancel"});b.onNodeChange.add(a._nodeChange,a);b.addShortcut("ctrl+s",b.getLang("save.save_desc"),"mceSave")},getInfo:function(){return{longname:"Save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(c,b,a){var c=this.editor;if(c.getParam("save_enablewhendirty")){b.setDisabled("save",!c.isDirty());b.setDisabled("cancel",!c.isDirty())}},_save:function(){var a=this.editor,d,c,b,e;d=tinymce.DOM.get(a.id).form||tinymce.DOM.getParent(a.id,"form");if(a.getParam("save_enablewhendirty")&&!a.isDirty()){return}tinyMCE.triggerSave();if(c=a.getParam("save_onsavecallback")){if(a.execCallback("save_onsavecallback",a)){a.startContent=tinymce.trim(a.getContent({format:"raw"}));a.nodeChanged()}return}if(d){a.isNotDirty=true;if(d.onsubmit==null||d.onsubmit()!=false){d.submit()}a.nodeChanged()}else{a.windowManager.alert("Error: No form element found.")}},_cancel:function(){var b=this.editor,a,c=tinymce.trim(b.startContent);if(a=b.getParam("save_oncancelcallback")){b.execCallback("save_oncancelcallback",b);return}b.setContent(c);b.undoManager.clear();b.nodeChanged()}});tinymce.PluginManager.add("save",tinymce.plugins.Save)})();