]> git.mxchange.org Git - friendica.git/commitdiff
update tinymce to 3.5b2 to fix issues with FF 11 and pasting into code blocks
authorfriendica <info@friendica.com>
Wed, 21 Mar 2012 03:47:31 +0000 (20:47 -0700)
committerfriendica <info@friendica.com>
Wed, 21 Mar 2012 03:47:31 +0000 (20:47 -0700)
300 files changed:
library/mcefixes/plugins.bbcode.editor_plugin_src.js [new file with mode: 0755]
library/mcefixes/themes.advanced.img.icons.gif [new file with mode: 0755]
library/mcefixes/themes.advanced.skins.default.dialog.css [new file with mode: 0755]
library/mcefixes/themes.advanced.skins.default.ui.css [new file with mode: 0755]
library/tinymce/changelog.txt [changed mode: 0755->0644]
library/tinymce/examples/accessibility.html [new file with mode: 0644]
library/tinymce/examples/css/content.css [changed mode: 0755->0644]
library/tinymce/examples/css/word.css [changed mode: 0755->0644]
library/tinymce/examples/custom_formats.html [changed mode: 0755->0644]
library/tinymce/examples/full.html [changed mode: 0755->0644]
library/tinymce/examples/index.html [changed mode: 0755->0644]
library/tinymce/examples/lists/image_list.js [changed mode: 0755->0644]
library/tinymce/examples/lists/link_list.js [changed mode: 0755->0644]
library/tinymce/examples/lists/media_list.js [changed mode: 0755->0644]
library/tinymce/examples/lists/template_list.js [changed mode: 0755->0644]
library/tinymce/examples/media/logo.jpg [changed mode: 0755->0644]
library/tinymce/examples/media/logo_over.jpg [changed mode: 0755->0644]
library/tinymce/examples/media/sample.avi [changed mode: 0755->0644]
library/tinymce/examples/media/sample.dcr [changed mode: 0755->0644]
library/tinymce/examples/media/sample.flv [new file with mode: 0644]
library/tinymce/examples/media/sample.mov [changed mode: 0755->0644]
library/tinymce/examples/media/sample.ram [changed mode: 0755->0644]
library/tinymce/examples/media/sample.rm [changed mode: 0755->0644]
library/tinymce/examples/media/sample.swf [changed mode: 0755->0644]
library/tinymce/examples/menu.html [changed mode: 0755->0644]
library/tinymce/examples/simple.html [changed mode: 0755->0644]
library/tinymce/examples/skins.html [changed mode: 0755->0644]
library/tinymce/examples/templates/layout1.htm [changed mode: 0755->0644]
library/tinymce/examples/templates/snippet1.htm [changed mode: 0755->0644]
library/tinymce/examples/translate.html [deleted file]
library/tinymce/examples/word.html [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/langs/en.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/license.txt [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/css/advhr.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/js/rule.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advhr/rule.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/css/advimage.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/image.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/img/sample.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/css/advlink.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin_src.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/emotions.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-cool.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-cry.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-frown.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-smile.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-wink.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-yell.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/js/emotions.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/dialog.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/img/example.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/js/dialog.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/langs/en.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/template.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/media/css/content.css [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/css/media.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/img/flash.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/flv_player.swf [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/quicktime.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/realmedia.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/shockwave.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/trans.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/img/windowsmedia.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/media/js/embed.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/js/media.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/media.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/pagebreak/css/content.css [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/trans.gif [deleted file]
library/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/js/pastetext.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/js/pasteword.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/pastetext.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/paste/pasteword.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/preview/example.html [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/preview/jscripts/embed.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/preview/preview.html [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/css/searchreplace.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/js/searchreplace.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/searchreplace/searchreplace.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/spellchecker/css/content.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/spellchecker/img/wline.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/css/props.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/js/props.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/props.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/style/readme.txt [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/cell.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/css/cell.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/css/row.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/css/table.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/js/merge_cells.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/js/row.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/js/table.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/merge_cells.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/row.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/table/table.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/blank.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/css/template.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/js/template.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/template/template.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/visualblocks/css/visualblocks.css [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin_src.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/abbr.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/acronym.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/attributes.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/cite.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/popup.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/del.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/ins.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/cite.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/del.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/js/ins.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/about.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/anchor.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/charmap.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/image.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/colorpicker.jpg [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/flash.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/icons.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/iframe.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/pagebreak.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/quicktime.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/realmedia.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/shockwave.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/trans.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/video.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/img/windowsmedia.gif [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/about.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/anchor.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/charmap.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/color_picker.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/image.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/langs/en.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/link.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/shortcuts.htm [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/buttons.png [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/items.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/progress.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/ui.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/content.css [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/advanced/source_editor.htm [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/editor_template.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/img/icons.gif [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/langs/en.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/skins/default/content.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/skins/default/ui.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/skins/o2k7/content.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/themes/simple/skins/o2k7/ui.css [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/tiny_mce.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/tiny_mce_popup.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/tiny_mce_src.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/utils/editable_selects.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/utils/form_utils.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/utils/mctabs.js [changed mode: 0755->0644]
library/tinymce/jscripts/tiny_mce/utils/validate.js [changed mode: 0755->0644]

diff --git a/library/mcefixes/plugins.bbcode.editor_plugin_src.js b/library/mcefixes/plugins.bbcode.editor_plugin_src.js
new file mode 100755 (executable)
index 0000000..183f2bc
--- /dev/null
@@ -0,0 +1,258 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.BBCodePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this, dialect = ed.getParam('bbcode_dialect', 'dfrn').toLowerCase();\r
+\r
+                       ed.onBeforeSetContent.add(function(ed, o) {\r
+                               o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+                       });\r
+\r
+                       ed.onPostProcess.add(function(ed, o) {\r
+                               if (o.set)\r
+                                       o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+\r
+                               if (o.get)\r
+                                       o.content = t['_' + dialect + '_html2bbcode'](o.content);\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'BBCode Plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               // HTML -> BBCode in DFRN dialect\r
+               _dfrn_html2bbcode : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+                       function rep(re, str) {\r
+\r
+                               //modify code to keep stuff intact within [code][/code] blocks\r
+                               //Waitman Gobble NO WARRANTY\r
+\r
+\r
+                               var o = new Array();\r
+                               var x = s.split("[code]");\r
+                               var i = 0;\r
+\r
+                               var si = "";\r
+                               si = x.shift();\r
+                               si = si.replace(re,str);\r
+                               o.push(si);\r
+\r
+                               for (i = 0; i < x.length; i++) {\r
+                                       var no = new Array();\r
+                                       var j = x.shift();\r
+                                       var g = j.split("[/code]");\r
+                                       no.push(g.shift());\r
+                                       si = g.shift();\r
+                                       si = si.replace(re,str);\r
+                                       no.push(si);\r
+                                       o.push(no.join("[/code]"));\r
+                               }\r
+\r
+                               s = o.join("[code]");\r
+\r
+                       };\r
+\r
+\r
+\r
+\r
+                       /* oembed */\r
+                       function _h2b_cb(match) {\r
+                               /*\r
+                               function s_h2b(data) {\r
+                                               match = data;\r
+                               }\r
+                               $.ajax({\r
+                                       type:"POST",\r
+                                       url: 'oembed/h2b',\r
+                                       data: {text: match},\r
+                                       async: false,\r
+                                       success: s_h2b,\r
+                                       dataType: 'html'\r
+                               });\r
+                               */\r
+                               \r
+                               var f, g, tof = [], tor = [];\r
+                               var find_spanc = /<span [^>]*class *= *[\"'](?:[^\"']* )*oembed(?: [^\"']*)*[\"'][^>]*>(.*?(?:<span[^>]*>(.*?)<\/span *>)*.*?)<\/span *>/ig;\r
+                               while (f = find_spanc.exec(match)) {\r
+                                       var find_a = /<a([^>]* rel=[\"']oembed[\"'][^>]*)>.*?<\/a *>/ig;\r
+                                       if (g = find_a.exec(f[1])) {\r
+                                               var find_href = /href=[\"']([^\"']*)[\"']/ig;\r
+                                               var m2 = find_href.exec(g[1]);\r
+                                               if (m2[1]) {\r
+                                                       tof.push(f[0]);\r
+                                                       tor.push("[EMBED]" + m2[1] + "[/EMBED]");\r
+                                               }\r
+                                       }\r
+                               }\r
+                               for (var i = 0; i < tof.length; i++) match = match.replace(tof[i], tor[i]);\r
+                               \r
+                               return match;\r
+                       }\r
+                       if (s.indexOf('class="oembed')>=0){\r
+                               //alert("request oembed html2bbcode");\r
+                               s = _h2b_cb(s);\r
+                       }\r
+                       \r
+                       /* /oembed */\r
+\r
+\r
+                       // example: <strong> to [b]\r
+                       rep(/<a class=\"bookmark\" href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[bookmark=$1]$2[/bookmark]");\r
+                       rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
+                       rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
+                       rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
+                       rep(/<font>(.*?)<\/font>/gi,"$1");\r
+                       rep(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");\r
+                       rep(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");\r
+\r
+                       rep(/<ul class=\"listbullet\" style=\"list-style-type\: circle\;\">(.*?)<\/ul>/gi,"[list]$1[/list]");\r
+                       rep(/<ul class=\"listnone\" style=\"list-style-type\: none\;\">(.*?)<\/ul>/gi,"[list=]$1[/list]");\r
+                       rep(/<ul class=\"listdecimal\" style=\"list-style-type\: decimal\;\">(.*?)<\/ul>/gi,"[list=1]$1[/list]");\r
+                       rep(/<ul class=\"listlowerroman\" style=\"list-style-type\: lower-roman\;\">(.*?)<\/ul>/gi,"[list=i]$1[/list]");\r
+                       rep(/<ul class=\"listupperroman\" style=\"list-style-type\: upper-roman\;\">(.*?)<\/ul>/gi,"[list=I]$1[/list]");\r
+                       rep(/<ul class=\"listloweralpha\" style=\"list-style-type\: lower-alpha\;\">(.*?)<\/ul>/gi,"[list=a]$1[/list]");\r
+                       rep(/<ul class=\"listupperalpha\" style=\"list-style-type\: upper-alpha\;\">(.*?)<\/ul>/gi,"[list=A]$1[/list]");\r
+                       rep(/<li>(.*?)<\/li>/gi,'[li]$1[/li]');\r
+\r
+                       rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");\r
+                       rep(/<\/(strong|b)>/gi,"[/b]");\r
+                       rep(/<(strong|b)>/gi,"[b]");\r
+                       rep(/<\/(em|i)>/gi,"[/i]");\r
+                       rep(/<(em|i)>/gi,"[i]");\r
+                       rep(/<\/u>/gi,"[/u]");\r
+                       rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");\r
+                       rep(/<u>/gi,"[u]");\r
+                       rep(/<blockquote[^>]*>/gi,"[quote]");\r
+                       rep(/<\/blockquote>/gi,"[/quote]");\r
+                       rep(/<hr \/>/gi,"[hr]");\r
+                       rep(/<br \/>/gi,"\n\n");\r
+                       rep(/<br\/>/gi,"\n\n");\r
+                       rep(/<br>/gi,"\n");\r
+                       rep(/<p>/gi,"");\r
+                       rep(/<\/p>/gi,"\n");\r
+                       rep(/&nbsp;/gi," ");\r
+                       rep(/&quot;/gi,"\"");\r
+                       rep(/&lt;/gi,"<");\r
+                       rep(/&gt;/gi,">");\r
+                       rep(/&amp;/gi,"&");\r
+\r
+                       return s; \r
+               },\r
+\r
+               // BBCode -> HTML from DFRN dialect\r
+               _dfrn_bbcode2html : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+\r
+                        function rep(re, str) {\r
+\r
+                                //modify code to keep stuff intact within [code][/code] blocks\r
+                                //Waitman Gobble NO WARRANTY\r
+\r
+\r
+                                var o = new Array();\r
+                                var x = s.split("[code]");\r
+                                var i = 0;\r
+\r
+                                var si = "";\r
+                                si = x.shift();\r
+                                si = si.replace(re,str);\r
+                                o.push(si);\r
+\r
+                                for (i = 0; i < x.length; i++) {\r
+                                        var no = new Array();\r
+                                        var j = x.shift();\r
+                                        var g = j.split("[/code]");\r
+                                        no.push(g.shift());\r
+                                        si = g.shift();\r
+                                        si = si.replace(re,str);\r
+                                        no.push(si);\r
+                                        o.push(no.join("[/code]"));\r
+                                }\r
+\r
+                                s = o.join("[code]");\r
+\r
+                        };\r
+\r
+\r
+\r
+\r
+\r
+                       // example: [b] to <strong>\r
+                       rep(/\n/gi,"<br />");\r
+                       rep(/\[b\]/gi,"<strong>");\r
+                       rep(/\[\/b\]/gi,"</strong>");\r
+                       rep(/\[i\]/gi,"<em>");\r
+                       rep(/\[\/i\]/gi,"</em>");\r
+                       rep(/\[u\]/gi,"<u>");\r
+                       rep(/\[\/u\]/gi,"</u>");\r
+                       rep(/\[hr\]/gi,"<hr />");\r
+                       rep(/\[bookmark=([^\]]+)\](.*?)\[\/bookmark\]/gi,"<a class=\"bookmark\" href=\"$1\">$2</a>");\r
+                       rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
+                       rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
+                       rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");\r
+                       rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
+\r
+                       rep(/\[list\](.*?)\[\/list\]/gi, '<ul class="listbullet" style="list-style-type: circle;">$1</ul>');\r
+                       rep(/\[list=\](.*?)\[\/list\]/gi, '<ul class="listnone" style="list-style-type: none;">$1</ul>');\r
+                       rep(/\[list=1\](.*?)\[\/list\]/gi, '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>');\r
+                       rep(/\[list=i\](.*?)\[\/list\]/gi,'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>');\r
+                       rep(/\[list=I\](.*?)\[\/list\]/gi, '<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>');\r
+                       rep(/\[list=a\](.*?)\[\/list\]/gi, '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>');\r
+                       rep(/\[list=A\](.*?)\[\/list\]/gi, '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>');\r
+                       rep(/\[li\](.*?)\[\/li\]/gi, '<li>$1</li>');\r
+                       rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");\r
+                       rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");\r
+                       rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");\r
+                       rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");\r
+\r
+                       /* oembed */\r
+                       function _b2h_cb(match, url) {\r
+                               url = bin2hex(url);\r
+                               function s_b2h(data) {\r
+                                               match = data;\r
+                               }\r
+                               $.ajax({\r
+                                       url: 'oembed/b2h?url=' + url,\r
+                                       async: false,\r
+                                       success: s_b2h,\r
+                                       dataType: 'html'\r
+                               });\r
+                               return match;\r
+                       }\r
+                       s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);\r
+                       \r
+                       /* /oembed */\r
+\r
+                       return s; \r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);\r
+})();\r
diff --git a/library/mcefixes/themes.advanced.img.icons.gif b/library/mcefixes/themes.advanced.img.icons.gif
new file mode 100755 (executable)
index 0000000..efb356c
Binary files /dev/null and b/library/mcefixes/themes.advanced.img.icons.gif differ
diff --git a/library/mcefixes/themes.advanced.skins.default.dialog.css b/library/mcefixes/themes.advanced.skins.default.dialog.css
new file mode 100755 (executable)
index 0000000..f012226
--- /dev/null
@@ -0,0 +1,117 @@
+/* Generic */\r
+body {\r
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;\r
+scrollbar-3dlight-color:#F0F0EE;\r
+scrollbar-arrow-color:#676662;\r
+scrollbar-base-color:#F0F0EE;\r
+scrollbar-darkshadow-color:#DDDDDD;\r
+scrollbar-face-color:#E0E0DD;\r
+scrollbar-highlight-color:#F0F0EE;\r
+scrollbar-shadow-color:#F0F0EE;\r
+scrollbar-track-color:#F5F5F5;\r
+background:#F0F0EE;\r
+padding:0;\r
+margin:8px 8px 0 8px;\r
+}\r
+\r
+html {background:#F0F0EE;}\r
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+textarea {resize:none;outline:none;}\r
+a:link, a:visited {color:black;}\r
+a:hover {color:#2B6FB6;}\r
+.nowrap {white-space: nowrap}\r
+\r
+/* Forms */\r
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}\r
+legend {color:#2B6FB6; font-weight:bold;}\r
+label.msg {display:none;}\r
+label.invalid {color:#EE0000; display:inline;}\r
+input.invalid {border:1px solid #EE0000;}\r
+input {background:#FFF; border:1px solid #CCC;}\r
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+input, select, textarea {border:1px solid #808080;}\r
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+.input_noborder {border:0;}\r
+\r
+/* Buttons */\r
+#insert, #cancel, input.button, .updateButton {\r
+border:0; margin:0; padding:0;\r
+font-weight:bold;\r
+width:94px; height:26px;\r
+background:url(img/buttons.png) 0 -26px;\r
+cursor:pointer;\r
+padding-bottom:2px;\r
+float:left;\r
+}\r
+\r
+#insert {background:url(img/buttons.png) 0 -52px}\r
+#cancel {background:url(img/buttons.png) 0 0; float:right}\r
+\r
+/* Browse */\r
+a.pickcolor, a.browse {text-decoration:none}\r
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}\r
+.mceOldBoxModel a.browse span {width:22px; height:20px;}\r
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}\r
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}\r
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}\r
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}\r
+a.pickcolor:hover span {background-color:#B2BBD0;}\r
+a.pickcolor:hover span.disabled {}\r
+\r
+/* Charmap */\r
+table.charmap {border:1px solid #AAA; text-align:center}\r
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}\r
+#charmap a {display:block; color:#000; text-decoration:none; border:0}\r
+#charmap a:hover {background:#CCC;color:#2B6FB6}\r
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}\r
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}\r
+\r
+/* Source */\r
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}\r
+.mceActionPanel {margin-top:5px;}\r
+\r
+/* Tabs classes */\r
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}\r
+.tabs ul {margin:0; padding:0; list-style:none;}\r
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}\r
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}\r
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}\r
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}\r
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}\r
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}\r
+\r
+/* Panels */\r
+.panel_wrapper div.panel {display:none;}\r
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}\r
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}\r
+\r
+/* Columns */\r
+.column {float:left;}\r
+.properties {width:100%;}\r
+.properties .column1 {}\r
+.properties .column2 {text-align:left;}\r
+\r
+/* Titles */\r
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}\r
+h3 {font-size:14px;}\r
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}\r
+\r
+/* Dialog specific */\r
+#link .panel_wrapper, #link div.current {height:125px;}\r
+#image .panel_wrapper, #image div.current {height:200px;}\r
+#plugintable thead {font-weight:bold; background:#DDD;}\r
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}\r
+#plugintable {width:96%; margin-top:10px;}\r
+#pluginscontainer {height:290px; overflow:auto;}\r
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}\r
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}\r
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}\r
+#colorpicker #light div {overflow:hidden;}\r
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}\r
+#colorpicker .panel_wrapper div.current {height:175px;}\r
+#colorpicker #namedcolors {width:150px;}\r
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
+#colorpicker #colornamecontainer {margin-top:5px;}\r
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}\r
diff --git a/library/mcefixes/themes.advanced.skins.default.ui.css b/library/mcefixes/themes.advanced.skins.default.ui.css
new file mode 100755 (executable)
index 0000000..5f1f964
--- /dev/null
@@ -0,0 +1,213 @@
+/* Reset */\r
+.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}\r
+.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}\r
+.defaultSkin table td {vertical-align:middle}\r
+\r
+/* Containers */\r
+.defaultSkin table {direction:ltr; background:#FFF}\r
+.defaultSkin iframe {display:block; background:#FFF}\r
+.defaultSkin .mceToolbar {height:26px}\r
+.defaultSkin .mceLeft {text-align:left}\r
+.defaultSkin .mceRight {text-align:right}\r
+\r
+/* External */\r
+.defaultSkin .mceExternalToolbar {position:absolute; border:2px solid #CCC; border-bottom:0; display:none;}\r
+.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}\r
+.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}\r
+\r
+/* Layout */\r
+.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}\r
+.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}\r
+.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}\r
+.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}\r
+.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top}\r
+.defaultSkin .mceIframeContainer { /*border-top:1px solid #CCC; border-bottom:1px solid #CCC */ border: none;}\r
+.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}\r
+.defaultSkin .mceStatusbar div {float:left; margin:2px}\r
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}\r
+.defaultSkin .mceStatusbar a:hover {text-decoration:underline}\r
+.defaultSkin table.mceToolbar {margin-left:3px}\r
+.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}\r
+.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}\r
+.defaultSkin td.mceCenter {text-align:center;}\r
+.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}\r
+.defaultSkin td.mceRight table {margin:0 0 0 auto;}\r
+\r
+/* Button */\r
+.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:10px}\r
+.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}\r
+.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}\r
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.defaultSkin .mceButtonLabeled {width:auto}\r
+.defaultSkin .mceButtonLabeled span.mceIcon {float:left}\r
+.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}\r
+.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888}\r
+\r
+/* Separator */\r
+.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}\r
+\r
+/* ListBox */\r
+.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}\r
+.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}\r
+.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}\r
+.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}\r
+.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}\r
+.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}\r
+.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}\r
+.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}\r
+.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}\r
+.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}\r
+\r
+/* SplitButton */\r
+.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}\r
+.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}\r
+.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}\r
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}\r
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}\r
+.defaultSkin .mceSplitButton span.mceOpen {display:none}\r
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}\r
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}\r
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}\r
+.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}\r
+\r
+/* ColorSplitButton */\r
+.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}\r
+.defaultSkin .mceColorSplitMenu td {padding:2px}\r
+.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}\r
+.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}\r
+.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}\r
+.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}\r
+.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}\r
+.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}\r
+.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}\r
+\r
+/* Menu */\r
+.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8}\r
+.defaultSkin .mceNoIcons span.mceIcon {width:0;}\r
+.defaultSkin .mceNoIcons a .mceText {padding-left:10px}\r
+.defaultSkin .mceMenu table {background:#FFF}\r
+.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}\r
+.defaultSkin .mceMenu td {height:20px}\r
+.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}\r
+.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}\r
+.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}\r
+.defaultSkin .mceMenu pre.mceText {font-family:Monospace}\r
+.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}\r
+.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}\r
+.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}\r
+.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}\r
+.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}\r
+.defaultSkin .mceMenuItemDisabled .mceText {color:#888}\r
+.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}\r
+.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}\r
+.defaultSkin .mceMenu span.mceMenuLine {display:none}\r
+.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}\r
+\r
+/* Progress,Resize */\r
+.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}\r
+.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}\r
+\r
+/* Formats */\r
+.defaultSkin .mce_formatPreview a {font-size:10px}\r
+.defaultSkin .mce_p span.mceText {}\r
+.defaultSkin .mce_address span.mceText {font-style:italic}\r
+.defaultSkin .mce_pre span.mceText {font-family:monospace}\r
+.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}\r
+.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}\r
+.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}\r
+.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}\r
+.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}\r
+.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}\r
+\r
+/* Theme */\r
+.defaultSkin span.mce_bold {background-position:0 0}\r
+.defaultSkin span.mce_italic {background-position:-60px 0}\r
+.defaultSkin span.mce_underline {background-position:-140px 0}\r
+.defaultSkin span.mce_strikethrough {background-position:-120px 0}\r
+.defaultSkin span.mce_undo {background-position:-160px 0}\r
+.defaultSkin span.mce_redo {background-position:-100px 0}\r
+.defaultSkin span.mce_cleanup {background-position:-40px 0}\r
+.defaultSkin span.mce_bullist {background-position:-20px 0}\r
+.defaultSkin span.mce_numlist {background-position:-80px 0}\r
+.defaultSkin span.mce_justifyleft {background-position:-460px 0}\r
+.defaultSkin span.mce_justifyright {background-position:-480px 0}\r
+.defaultSkin span.mce_justifycenter {background-position:-420px 0}\r
+.defaultSkin span.mce_justifyfull {background-position:-440px 0}\r
+.defaultSkin span.mce_anchor {background-position:-200px 0}\r
+.defaultSkin span.mce_indent {background-position:-400px 0}\r
+.defaultSkin span.mce_outdent {background-position:-540px 0}\r
+.defaultSkin span.mce_link {background-position:-500px 0}\r
+.defaultSkin span.mce_unlink {background-position:-640px 0}\r
+.defaultSkin span.mce_sub {background-position:-600px 0}\r
+.defaultSkin span.mce_sup {background-position:-620px 0}\r
+.defaultSkin span.mce_removeformat {background-position:-580px 0}\r
+.defaultSkin span.mce_newdocument {background-position:-520px 0}\r
+.defaultSkin span.mce_image {background-position:-380px 0}\r
+.defaultSkin span.mce_help {background-position:-340px 0}\r
+.defaultSkin span.mce_code {background-position:-260px 0}\r
+.defaultSkin span.mce_hr {background-position:-360px 0}\r
+.defaultSkin span.mce_visualaid {background-position:-660px 0}\r
+.defaultSkin span.mce_charmap {background-position:-240px 0}\r
+.defaultSkin span.mce_paste {background-position:-560px 0}\r
+.defaultSkin span.mce_copy {background-position:-700px 0}\r
+.defaultSkin span.mce_cut {background-position:-680px 0}\r
+.defaultSkin span.mce_blockquote {background-position:-220px 0}\r
+.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}\r
+.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}\r
+.defaultSkin span.mce_forecolorpicker {background-position:-720px 0}\r
+.defaultSkin span.mce_backcolorpicker {background-position:-760px 0}\r
+\r
+/* Plugins */\r
+.defaultSkin span.mce_advhr {background-position:-0px -20px}\r
+.defaultSkin span.mce_ltr {background-position:-20px -20px}\r
+.defaultSkin span.mce_rtl {background-position:-40px -20px}\r
+.defaultSkin span.mce_emotions {background-position:-60px -20px}\r
+.defaultSkin span.mce_fullpage {background-position:-80px -20px}\r
+.defaultSkin span.mce_fullscreen {background-position:-100px -20px}\r
+.defaultSkin span.mce_iespell {background-position:-120px -20px}\r
+.defaultSkin span.mce_insertdate {background-position:-140px -20px}\r
+.defaultSkin span.mce_inserttime {background-position:-160px -20px}\r
+.defaultSkin span.mce_absolute {background-position:-180px -20px}\r
+.defaultSkin span.mce_backward {background-position:-200px -20px}\r
+.defaultSkin span.mce_forward {background-position:-220px -20px}\r
+.defaultSkin span.mce_insert_layer {background-position:-240px -20px}\r
+.defaultSkin span.mce_insertlayer {background-position:-260px -20px}\r
+.defaultSkin span.mce_movebackward {background-position:-280px -20px}\r
+.defaultSkin span.mce_moveforward {background-position:-300px -20px}\r
+.defaultSkin span.mce_media {background-position:-320px -20px}\r
+.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}\r
+.defaultSkin span.mce_pastetext {background-position:-360px -20px}\r
+.defaultSkin span.mce_pasteword {background-position:-380px -20px}\r
+.defaultSkin span.mce_selectall {background-position:-400px -20px}\r
+.defaultSkin span.mce_preview {background-position:-420px -20px}\r
+.defaultSkin span.mce_print {background-position:-440px -20px}\r
+.defaultSkin span.mce_cancel {background-position:-460px -20px}\r
+.defaultSkin span.mce_save {background-position:-480px -20px}\r
+.defaultSkin span.mce_replace {background-position:-500px -20px}\r
+.defaultSkin span.mce_search {background-position:-520px -20px}\r
+.defaultSkin span.mce_styleprops {background-position:-560px -20px}\r
+.defaultSkin span.mce_table {background-position:-580px -20px}\r
+.defaultSkin span.mce_cell_props {background-position:-600px -20px}\r
+.defaultSkin span.mce_delete_table {background-position:-620px -20px}\r
+.defaultSkin span.mce_delete_col {background-position:-640px -20px}\r
+.defaultSkin span.mce_delete_row {background-position:-660px -20px}\r
+.defaultSkin span.mce_col_after {background-position:-680px -20px}\r
+.defaultSkin span.mce_col_before {background-position:-700px -20px}\r
+.defaultSkin span.mce_row_after {background-position:-720px -20px}\r
+.defaultSkin span.mce_row_before {background-position:-740px -20px}\r
+.defaultSkin span.mce_merge_cells {background-position:-760px -20px}\r
+.defaultSkin span.mce_table_props {background-position:-980px -20px}\r
+.defaultSkin span.mce_row_props {background-position:-780px -20px}\r
+.defaultSkin span.mce_split_cells {background-position:-800px -20px}\r
+.defaultSkin span.mce_template {background-position:-820px -20px}\r
+.defaultSkin span.mce_visualchars {background-position:-840px -20px}\r
+.defaultSkin span.mce_abbr {background-position:-860px -20px}\r
+.defaultSkin span.mce_acronym {background-position:-880px -20px}\r
+.defaultSkin span.mce_attribs {background-position:-900px -20px}\r
+.defaultSkin span.mce_cite {background-position:-920px -20px}\r
+.defaultSkin span.mce_del {background-position:-940px -20px}\r
+.defaultSkin span.mce_ins {background-position:-960px -20px}\r
+.defaultSkin span.mce_pagebreak {background-position:0 -40px}\r
+.defaultSkin span.mce_restoredraft {background-position:-20px -40px}\r
+.defaultSkin span.mce_spellchecker {background-position:-540px -20px}\r
old mode 100755 (executable)
new mode 100644 (file)
index bcd3f29..ec71207
@@ -1,3 +1,456 @@
+Version 3.5b2 (2012-03-15)\r
+       Rewrote the enter key logic to normalize browser behavior.\r
+       Fixed so enter within PRE elements produces a BR and shift+enter breaks/end the PRE. Can be disabled using the br_in_pre option.\r
+       Fixed bug where the selection wouldn't be correct after applying formatting and having the caret at the end of the new format node.\r
+       Fixed bug where the noneditable plugin would process contents on raw input calls for example on undo/redo calls.\r
+       Fixed bug where WebKit could produce an exception when a bookmark was requested when there wasn't a proper selection.\r
+       Fixed bug where WebKit would fail to open the image dialog since it would be returning false for a class name instead of a string.\r
+       Fixed so alignment and indentation works properly when forced_root_blocks is set to false. It will produce a DIV by default.\r
+Version 3.5b1 (2012-03-08)\r
+       Added new event class that is faster and enables support for faking events.\r
+       Added new self_closing_elements, short_ended_elements, boolean_attributes, non_empty_elements and block_elements options to control the HTML Schema.\r
+       Added new schema option and support for the HTML5 schema.\r
+       Added new visualblocks plugin that shows html5 blocks with visual borders.\r
+       Added new types and selector options to make it easier to create editor instances with different configs.\r
+       Added new preview of formatting options in various listboxes.\r
+       Added new preview_styles option that enables control over what gets previewed.\r
+       Fixed bug where content css would be loaded twice into iframe. \r
+       Fixed bug where start elements with only whitespace in the attribute part wouldn't be correctly parsed.\r
+       Fixed bug where the advlink dialog would produce an error about the addSelectAccessibility function not being defined.\r
+       Fixed bug where the caret would be placed at an incorrect position if span was removed by the invalid_elements setting.\r
+       Fixed bug where elements inside a white space preserve element like pre didn't inherit the behavior while parsing.\r
+Version 3.4.9.x (2012-02-xx)\r
+       Improved behaviour of backspacing into a table to be consistant across browsers and disable backspace when cursor immediately follows a table.\r
+       Improved edit CSS style plugin for single and multiple block selection and provide option to apply style to only selected text.\r
+       Fixed bug in Chrome where moving caret down in table and pasting throws errors.\r
+       Corrected reference to TinyMCE trim function.\r
+       Fixed bug where Ignore All in IE did not remove the underline from the selected word.\r
+       Fixed bug in html source editor word wrap option not wrapping text in Webkit browsers.\r
+       Fixed bug where it was possible to insert an invalid colour in the color pop-up dialog.\r
+       Fixed bug in Webkit where if anchor is on last line by itself caret can not be placed after it.\r
+Version 3.4.9 (2012-02-23)\r
+       Added settings to wordcount plugin to configure update rate and checking wordcount on backspace and delete using wordcount_update_rate and wordcount_update_on_delete.\r
+       Fixed bug in Webkit and IE where deleting empty paragraphs would remove entire editor contents.\r
+       Fixed bug where pressing enter on end of list item with a heading would create a new item with heading. \r
+       Fixed edit css style dialog text-decoration none checkbox so it disables other text-decoration options when enabled.\r
+       Fixed bug in Gecko where undo wasn't added when focus was lost.\r
+       Fixed bug in Gecko where shift-enter in table cell ending with BR doesn't move caret to new line.\r
+       Fixed bug where right-click on formatted text in IE selected the entire line.\r
+       Fixed bug where text ending with space could not be unformatted in IE.\r
+       Fixed bug where caret formatting would be removed when moving the caret when a selector expression was used.\r
+       Fixed bug where formatting would be applied to the body element when all contents where selected and format had both inline and selector parts.\r
+       Fixed bug where the media plugin would throw errors if you had iframe set as an invalid element in config.\r
+       Fixed bug where the caret would be placed at the top of the document if you inserted a table and undo:ed that operation. Patch contributed by Wesley Walser.\r
+       Fixed bug where content css files where loaded twice into the iframe.\r
+       Fixed so elements with comments would be trated as non empty elements. Patch contributed by Arjan Scherpenisse.\r
+Version 3.4.8 (2012-02-02)\r
+       Fixed bug in IE where selected text ending with space cannot be formatted then formatted again to get original text.\r
+       Fixed bug in IE where images larger than editor area were being deselected when toolbar buttons are clicked.\r
+       Fixed bug where wrong text align buttons are active when multiple block elements are selected.\r
+       Fixed bug where selected link not showing in target field of link dialog in some selection cases.\r
+       Use settings for remove_trailing_br so this can be turned off instead of hard coding the value.\r
+       Fixed bug in IE where the media plugin displayed null text when some values aren't filled in.\r
+       Added API method 'onSetAttrib' that fires when the attribute value on a node changes.\r
+       Fix font size dropdown value not being updated when text already has a font size in the advanced template.\r
+       Fixed bug in IE where IE doesn't use ARIA attributes properly on options - causing labels to be read out 2 times.\r
+       Fixed bug where caret cannot be placed after table if table is at end of document in IE.\r
+       Fixed bug where adding range isn't always successful so we need to check range count otherwise an exception can occur.\r
+       Added spacebar onclick handler to toolbar buttons to ensure that the accessibility behaviour works correctly.\r
+       Fixed bug where a stranded bullet point would get created in WebKit.\r
+       Fixed bug where selecting text in a blockquote and pressing backspace toggles the style.\r
+       Fixed bug where pressing enter from a heading in IE, the resulting P tag below it shares the style property. \r
+       Fix white space in between spans from being deleted. \r
+       Fixed bug where scrollbars where visible in the character map dialog on Gecko.\r
+       Fixed issue with missing translation for one of the emoticons.\r
+       Fixed bug where dots in id:s where causing problems. Patch provided by Abhishek Dev.\r
+       Fixed bug where urls with an at sign in the path wouldn't be parsed correctly. Patch contributed by Jason Grout.\r
+       Fixed bug where Opera would remove the first character of a inline formatted word if you pressed backspace.\r
+       Fixed bugs with the autoresize plugin on various browsers and removed the need for the throbber.\r
+       Fixed performance issue where the contextmenu plugin would try to remove the menu even if it was removed. Patch contributed by mhu.\r
+Version 3.4.7 (2011-11-03)\r
+       Modified the caret formatting behavior to word similar to common desktop wordprocessors like Word or Libre Office.\r
+       Fixed bug in Webkit - Cursor positioning does not work vertically within a table cell with multiple lines of text.\r
+       Fixed bug in IE where Inserting a table in IE8 places cursor in the second cell of the first row.\r
+       Fixed bug in IE where editor in a frame doesn't give focus to the toolbar using ALT-F10.\r
+       Fix for webkit and gecko so that deleting bullet from start of list outdents inner list items and moves first item into paragraph.\r
+       Fix new list items in IE8 not displayed on a new line when list contains nested list items.\r
+       Clear formatting in table cell breaks the cell.\r
+       Made media type list localisable.\r
+       Fix out of memory error when using prototype in media dialog.\r
+       Fixed bug where could not add a space in the middle of a th cell.\r
+       Fixed bug where adding a bullet between two existing bullets adds an extra one\r
+       Fixed bug where trying to insert a new entry midway through a bulleted list fails dismally when the next entry is tabbed in.\r
+       Fixed bug where pressing enter on an empty list item does not outdent properly in FF\r
+       Fixed bug where adding a heading after a list item in a table cell changes all styles in that cell\r
+       Fixed bug where hitting enter to exit from a bullet list moves cursor to the top of the page in Firefox.\r
+       Fixed bug where pressing backspace would not delete HRs in Firefox and IE when next to an empty paragraph.\r
+       Fixed bug where deleting part of the link text can cause a link with no destination to be saved.\r
+       Fixed bug where css style border widths wasn't handled correctly in table dialog.\r
+       Fixed bug where parsing invalid html contents on IE or WebKit could produce an infinite loop.\r
+       Fixed bug where scripts with custom script types wasn't properly passed though the editor.\r
+       Fixed issue where some Japanese kanji characters wasn't properly entity encoded when numeric entity mode was enabled.\r
+       Made emoticons dialog use the keyboard naviation.\r
+       Added navigation instructions to the symbols dialog.\r
+       Added ability to set default values for the media plugin.\r
+       Added new font_size_legacy_values option for converting old font element sizes to span with font-size properties.\r
+       Fixed bug where the symbols dialog was not accessible.\r
+       Added quirk for IE ensuring that the body of the document containing tinyMCE has a role="application" for accessibility.\r
+       Fixed bug where the advanced color picker wasn't working properly on FF 7.\r
+       Fixed issue where the advanced color picker was producing uppercase hex codes.\r
+       Fixed bug where IE 8 could throw exceptions if the contents contained resizable content elements.\r
+       Fixed bug where caret formatting wouldn't be correctly applied to previous sibling on WebKit.\r
+       Fixed bug where the select boxes for font size/family would loose it's value on WebKit due to recent iOS fixes.\r
+Version 3.4.6 (2011-09-29)\r
+       Fixed bug where list items were being created for empty divs.\r
+       Added support in Media plugin for audio media using the embed tag\r
+       Fixed accessibility bugs in WebKit and IE8 where toolbar items were not being read.\r
+       Added new use_accessible_selects option to ensure accessible list boxes are used in all browsers (custom widget in firefox native on other browsers)\r
+       Fixed bug where classid attribute was not being checked from embed objects.\r
+       Fixed bug in jsrobot tests with intermittently failing.\r
+       Fixed bug where anchors wasn't updated properly if you edited them using IE 8.\r
+       Fixed bug where input method on WebKit on Mac OS X would fail to initialize when sometimes focusing the editor.\r
+       Fixed bug where it wasn't possible to select HR elements on WebKit by simply clicking on them.\r
+       Fixed bug where the media plugin wouldn't work on IE9 when not using the inlinepopups plugin.\r
+       Fixed bug where hspace,vspace,align and bgcolor would be removed from object elements in the media plugin.\r
+       Fixed bug where the new youtube format wouldn't be properly parsed by the media plugin.\r
+       Fixed bug where the style attribute of layers wasn't properly updated on IE and Gecko.\r
+       Fixed bug where editing contents in a layer would fail on Gecko since contentEditable doesn't inherit properly.\r
+       Fixed bug where IE 6/7 would produce JS errors when serializing contents containing layers.\r
+Version 3.4.5 (2011-09-06)\r
+       Fixed accessibility bug in WebKit where the right and left arrow keys would update native list boxes.\r
+       Added new whitespace_elements option to enable users to specify specific elements where the whitespace is preserved.\r
+       Added new merge_siblings option to formats. This option makes it possible to disable the auto merging of siblings when applying formats.\r
+       Fixed bug in IE where trailing comma in paste plugin would cause plugin to not run correctly.\r
+       Fixed bug in WebKit where console messages would be logged when deleting an empty document.\r
+       Fixed bug in IE8 where caret positioned is on list item instead of paragraph when outdent splits the list\r
+       Fixed bug with image dialogs not inserting an image if id was omitted from valid_elements.\r
+       Fixed bug where the selection normalization logic wouldn't properly handle image elements in specific config cases.\r
+       Fixed bug where the map elements coords attribute would be messed up by IE when serializing the DOM.\r
+       Fixed bug where IE wouldn't properly handle custom elements when the contents was serialized.\r
+       Fixed bug where you couldn't move the caret in Gecko if you focused the editor using the API or a UI control.\r
+       Fixed bug where adjacent links would get merged on IE due to bugs in their link command.\r
+       Fixed bug where the color split buttons would loose the selection on IE if the editor was placed in a frame/iframe.\r
+       Fixed bug where floated images in WebKit wouldn't get properly linked.\r
+       Fixed bug where the fullscreen mode in a separate window wasn't forced into IE9+ standards mode.\r
+       Fixed bug where pressing enter in an empty editor on WebKit could produce DIV elements instead of P.\r
+       Fixed bug where spans would get removed incorrectly when merging two blocks on backspace/delete on WebKit.\r
+       Fixed bug where the editor contents wouldn't be completely removed on backspace/delete on WebKit.\r
+       Fixed bug where the fullpage plugin wouldn't properly render style elements in the head on IE 6/7.\r
+       Fixed bug where the nonbreaking_force_tab option in the nonbreaking plugin wouldn't work on Gecko/WebKit.\r
+       Fixed bug where the isDirty state would become true on non IE browsers if there was an table at the end of the contents.\r
+       Fixed bug where entities wasn't properly encoded on WebKit when pasting text as plain text.\r
+       Fixed bug where empty editors would produce an exception of valid_elements didn't include body and forced_root_blocks where disabled.\r
+       Fixed bug where the fullscreen mode wouldn't retain the header/footer in the fullpage plugin.\r
+       Fixed issue where the plaintext_mode and plaintext_mode_sticky language keys where swapped.\r
+Version 3.4.4 (2011-08-04)\r
+       Added new html5 audio support. Patch contributed by Ronald M. Clifford.\r
+       Added mute option for video elements and preload options for video/audio patch contributed by Dmitry Kalinkin.\r
+       Fixed selection to match visual selection before applying formatting changes.\r
+       Fixed browser specific bugs in lists for WebKit and IE.\r
+       Fixed bug where IE would scroll the window if you closed an inline dialog that was larger than the viewport. Patch by Laurence Keijmel.\r
+       Fixed bug where pasting contents near a span element could remove parts of that span. Patch contributed by Wesley Walser.\r
+       Fixed bug where formatting change would be lost after pressing enter.\r
+       Fixed bug in WebKit where deleting across blocks would add extra styles.\r
+       Fixed bug where moving cursor vertically in tables in WebKit wasn't working.\r
+       Fixed bug in IE where deleting would cause error in console.\r
+       Fixed bug where the formatter was not applying formats across list elements.\r
+       Fixed bug where the wordcount plugin would try and update the wordcount if tinymce had been destroyed.\r
+       Fixed bug where tabfocus plugin would attempt to focus elements not displayed when their parent element was hidden.\r
+       Fixed bug where the contentEditable state would sometimes be removed if you deleted contents in Gecko.\r
+       Fixed bug where inserting contents using mceInsertContent would fail if "span" was disabled in valid_elements.\r
+       Fixed bug where initialization might fail if some resource on gecko wouldn't load properly and fire the onload event.\r
+       Fixed bug where ctrl+7/8/9 keys wouldn't properly add the specific formats associated with them.\r
+       Fixed bug where the HTML tags wasn't properly closed in the style plugins properties dialog.\r
+       Fixed bug where the list plugin would produce an exception if the user tried to delete an element at the very first location.\r
+Version 3.4.3.2 (2011-06-30)\r
+       Fixed bug where deleting all of a paragraph inside a table cell would behave badly in webkit.\r
+       Fixed bugs in tests in firefox5 and WebKit.\r
+       Fixed bug where selection of table cells would produce an exception on Gecko.\r
+       Fixed bug where the caret wasn't properly rendered on Gecko when the editor was hidden.\r
+       Fixed bug where pasting plain text into WebKit would produce a pre element it will now produce more semantic markup.\r
+       Fixed bug where selecting list type formats using the advlist plugin on IE8 would loose editor selection.\r
+       Fixed bug where forced root blocks logic wouldn't properly pad elements created if they contained data attributes.\r
+       Fixed bug where it would remove all contents of the editor if you inserted an image when not having a caret in the document.\r
+       Fixed bug where the YUI compressor wouldn't properly encode strings with only a quote in them.\r
+       Fixed bug where WebKit on iOS5 wouldn't call nodeChanged when the selection was changed.\r
+       Fixed bug where mceFocus command wouldn't work properly on Gecko since it didn't focus the body element.\r
+       Fixed performance issue with the noneditable plugin where it would enable/disable controls to often.\r
+Version 3.4.3.1 (2011-06-16)\r
+       Fixed bug where listboxes were not being handled correctly by JAWS in firefox with the o2k7 skin.\r
+       Fixed bug where custom buttons were not being rendered correctly when in high contrast mode.\r
+       Added support for iOS 5 that now supporting contentEditable in it's latest beta.\r
+       Fixed bug where urls in style attributes with a _ character followed by a number would cause incorrect output.\r
+       Fixed bug where custom_elements option wasn't working properly on IE browsers.\r
+       Fixed bug where custom_elements marked as block elements wouldn't get correctly treated as block elements.\r
+       Fixed bug where attributes with </> wasn't properly encoded as XML entities.\r
+Version 3.4.3 (2011-06-09)\r
+       Fixed bug where deleting backwards before an image into a list would put the cursor in the wrong location.\r
+       Fixed bug where styles plugin would not apply styles across multiple selected block elements correctly.\r
+       Fixed bug where cursor would jump to start of document when selection contained empty table cells in IE8.\r
+       Fixed bug where applied styles wouldn't be kept if you pressed enter twice to produce two paragraphs.\r
+       Fixed bug where a ghost like caret would appear on Gecko when pressing enter while having a text color applied.\r
+       Fixed bug where IE would produce absolute urls if you inserted a image/link and reloaded the page.\r
+       Fixed bug where applying a heading style to a list item would cascade style to children list items.\r
+       Fixed bug where Editor loses focus when backspacing and changing styles in WebKit.\r
+       Fixed bug where exception was thrown in tinymce.util.URI when parsing a relative URI and no base_uri setting was provided.\r
+       Fixed bug where alt-f10 was not always giving focus to the toolbar on Safari.\r
+       Added new 'allow_html_in_named_anchor' option to allow html to occur within a named anchor tag.  Use at own risk.\r
+       Added plugin dependency support.  Will autoload plugins specified as a dependency if they haven't been loaded.\r
+       Fixed bug where the autolink plugin didn't work with non-English keyboards when pressing ).\r
+       Added possibility to change properties of all table cells in a column.\r
+       Added external_image_list option to get images list from user-defined variable or function.\r
+       Fixed bug where the autoresize plugin wouldn't reduce the editors height on Chrome.\r
+       Fixed bug where table size inputs were to small for values with size units.\r
+       Fixed bug where table cell/row size input values were not validated.\r
+       Fixed bug where menu item line-height would be set to wrong value by external styles.\r
+       Fixed bug where hasUndo() would return wrong answer.\r
+       Fixed bug where page title would be set to undefined by fullpage plugin.\r
+       Fixed bug where HTML5 video properties were not updated in embedded media settings.\r
+       Fixed bug where HTML comment on the first line would cause an error.\r
+       Fixed bug where spellchecker menu was positioned incorrectly on IE.\r
+       Fixed bug where breaking out of list elements on WebKit would produce a DIV instead of P after the list.\r
+       Fixed bug where pasting from Word in IE9 would add extra BR elements when text was word wrapped.\r
+       Fixed bug where numeric entities with leading zeros would produce incorrect decoding.\r
+       Fixed bug where hexadecimal entities wasn't properly decoded.\r
+       Fixed bug where bookmarks wasn't properly stored/restored on undo/redo.\r
+       Fixed bug where the mceInsertCommand didn't retain the values of links if they contained non url contents.\r
+       Fixed bug where the valid_styles option wouldn't be properly used on styles for specific elements.\r
+       Fixed so contentEditable is used for the body of the editor if it's supported.\r
+       Fixed so trailing BR elements gets removed even when forced_root_blocks option was set to false/null.\r
+       Fixed performance issue with mceInsertCommand and inserting very simple contents.\r
+       Fixed performance issue with older IE version and huge documents by optimizing the forced root blocks logic.\r
+       Fixed performance issue with table plugin where it checked for selected cells to often.\r
+       Fixed bug where creating a link on centered/floated image would produce an error on WebKit browsers.\r
+       Fixed bug where Gecko would remove single paragraphs if there where contents before/after it.\r
+       Fixed bug where the scrollbar would move up/down when pasting contents using the paste plugin.\r
+Version 3.4.2 (2011-04-07)\r
+       Added new 'paste_text_sticky_default' option to paste plugin, enables you to set the default state for paste as plain text.\r
+       Added new autoresize_bottom_margin option to autoresize plugin that enables you to add an extra margin at the bottom. Patch contributed by Andrew Ozz.\r
+       Rewritten the fullpage plugin to handle style contents better and have a more normalized behavior across browsers.\r
+       Fixed bug where contents inserted with mceInsertContent wasn't parsed using the default dom parser.\r
+       Fixed bug where blocks containing a single anchor element would be treated as empty.\r
+       Fixed bug where merging of table cells on IE 6, 7 wouldn't look correctly until the contents was refreshed.\r
+       Fixed bug where context menu wouldn't work properly on Safari since it was passing out the ctrl key as pressed.\r
+       Fixed bug where image border color/style values were overwritten by advimage plugin.\r
+       Fixed bug where setting border in advimage plugin would throw error in IE.\r
+       Fixed bug where empty anchors list in link settings wasn't hidden.\r
+       Fixed bug where xhtmlextras popups were missing localized popup-size parameters.\r
+       Fixed bug where the context menu wouldn't select images on WebKit browsers.\r
+       Fixed bug where paste plugin wouldn't properly extract the contents on WebKit due to recent changes in browser behavior.\r
+       Fixed bug where focus of the editor would get on control contents on IE lost due to a bug in the ColorSplitButton control.\r
+       Fixed bug where contextmenu wasn't disabled on noneditable elements.\r
+       Fixed bug where getStyle function would trigger error when called on element without style property.\r
+       Fixed bug where editor fail to load if Javascript Compressor was used.\r
+       Fixed bug where list-style-type=lower-greek would produce errors in IE<8.\r
+       Fixed bug where spellchecker plugin would produce errors on IE6-7.\r
+       Fixed bug where theme_advanced_containers configuration option causes error.\r
+       Fixed bug where the mceReplaceContent command would produce an error since it didn't correctly handle a return value.\r
+       Fixed bug where you couldn't enter float point values for em in dialog input fields since it wouldn't be considered a valid size.\r
+       Fixed bug in xhtmlxtras plugin where it wasn't possible to remove some attributes in the attributes dialog.\r
+Version 3.4.1 (2011-03-24)\r
+       Added significantly improved list handling via the new 'lists' plugin.\r
+       Added 'autolink' plugin to enable automatically linking URLs. Similar to the behavior IE has by default.\r
+       Added 'theme_advanced_show_current_color' setting to enable the forecolor and backcolor buttons to continuously show the current text color.\r
+       Added 'contextmenu_never_use_native' setting to disable the ctrl-right-click showing the native browser context menu behaviour.\r
+       Added 'paste_enable_default_filters' setting to enable the default paste filters to be disabled.\r
+       Fixed bug where selection locations on undo/redo didn't work correctly on specific contents.\r
+       Fixed bug where an exception would be trown on IE when loading TinyMCE inside an iframe.\r
+       Fixed bug where some ascii numeric entities wasn't properly decoded.\r
+       Fixed bug where some non western language codes wasn't properly decoded/encoded.\r
+       Fixed bug where undo levels wasn't created when deleting contents on IE.\r
+       Fixed bug where the initial undo levels bookmark wasn't updated correctly.\r
+       Fixed bug where search/replace wouldn't be scoped to editor instances on IE8.\r
+       Fixed bug where IE9 would produce two br elements after block elements when pasting.\r
+       Fixed bug where IE would place the caret at an incorrect position after a paste operation.\r
+       Fixed bug where a paste operation using the keyboard would add an extra undo level.\r
+       Fixed bug where some attributes/elements wasn't correctly filtered when invalid contents was inserted.\r
+       Fixed bug where the table plugin couldn't correctly handle invalid table structures.\r
+       Fixed bug where charset and title of the page were handled incorrectly by the fullpage plugin.\r
+       Fixed bug where toggle states on some of the list boxes didn't update correctly.\r
+       Fixed bug where sub/sub wouldn't work correctly when done as a caret action in Chrome 10.\r
+       Fixed bug where the constrain proportions checkbox wouldn't work in the media plugin.\r
+       Fixed bug where block elements containing trailing br elements wouldn't treated properly if they where invalid.\r
+       Fixed bug where the color picker dialog wouldn't be rendered correctly when using the o2k7 theme.\r
+       Fixed bug where setting border=0 using advimage plugin invalid style attribute content was created in Chrome.\r
+       Fixed bug with references to non-existing images in css of fullpage plugin.\r
+       Fixed bug where item could be unselected in spellchecker's language selector.\r
+       Fixed bug where some mispelled words could be not highlighted using spellchecker plugin.\r
+       Fixed bug where spellchecking would merge some words on IE.\r
+       Fixed bug where spellchecker context menu was not always positioned correctly.\r
+       Fixed bug with empty anchors list in advlink popup when Invisible Elements feature was disabled.\r
+       Fixed bug where older IE versions wouldn't properly handle some elements if they where placed at the top of editor contents.\r
+       Fixed bug where selecting the whole table would enable table tools for cells and rows.\r
+       Fixed bug where it wasn't possible to replace selected contents on IE when pasting using the paste plugin.\r
+       Fixed bug where setting text color in fullpage plugin doesn't work.\r
+       Fixed bug where the state of checkboxes in media plugin wouldn't be set correctly.\r
+       Fixed bug where black spade suit character was not included in special character selector.\r
+       Fixed bug where setting invalid values for table cell size would throw an error in IE.\r
+       Fixed bug where spellchecking would remove whitespace characters from PRE block in IE.\r
+       Fixed bug where HR was inserted inside P elements instead of splitting them.\r
+       Fixed bug where extra, empty span tags were added when using a format with both selector and inline modes.\r
+       Fixed bug where bullet lists weren't always detected correctly.\r
+       Fixed bug where deleting some paragraphs on IE would cause an exception.\r
+       Fixed bug where the json encoder logic wouldn't properly encode \ characters.\r
+       Fixed bug where the onChange event would be fired when the editor was first initialized.\r
+       Fixed bug where mceSelected wouldn't be removed properly from output even if it's an internal class.\r
+       Fixed issue with table background colors not being transparent. This improves compliance with users browser color preferences.\r
+       Fixed issue where styles were not included when using the full page plugin.\r
+       Fixed issue where drag/drop operations wasn't properly added to the undo levels.\r
+       Fixed issue where colors wasn't correctly applied to elements with underline decoration.\r
+       Fixed issue where deleting some paragraphs on IE would cause an exception.\r
+Version 3.4 (2011-03-10)\r
+       Added accessibility example with various accessibility options contributed by Ephox.\r
+       Fixed bug where attributes wasn't properly handled in the xhtmlxtras plugin.\r
+       Fixed bug where the image.htm had some strange td artifacts probably due to auto merging.\r
+       Fixed bug where the ToolbarGroup had an missing reference to this in it's destroy method.\r
+       Fixed bug with the resizeBy function in the advanced theme where it was scaled by the wrong parent.\r
+       Fixed bug where an exception would be thrown by the element if the page was served in xhtml mode.\r
+       Fixed bug where mceInsertContent would throw an exception when page was served in xhtml mode.\r
+       Fixed bug where you couldn't select a forground/background color when page was served in xhtml mode.\r
+       Fixed bug where the editor would scroll to the toolbar when clicked due to a call to focus in ListBox.\r
+       Fixed bug where pages with rtl dir wouldn't render split buttons correctly when using the o2k7 theme.\r
+       Fixed bug where anchor elements with names wasn't properly collapsed as they where in 3.3.x.\r
+       Fixed bug where WebKit wouldn't properly handle image selection if it was done left to right.\r
+       Fixed bug where the formatter would align images when the selection range was collapsed.\r
+       Fixed bug where the image button would be active when the selection range was collapsed.\r
+       Fixed bug where the element_format option wasn't used by the new (X)HTML serializer logic.\r
+       Fixed bug where the table cell/row dialogs would produce empty attributes.\r
+       Fixed bug where the tfoot wouldn't be added to the top of the table.\r
+       Fixed bug where the formatter would merge siblings with white space between them.\r
+       Fixed bug where pasting headers and paragraphs would produce an extra paragraph.\r
+       Fixed bug where the ColorSplitButton would throw an exception if you clicked out side a color.\r
+       Fixed bug where IE9 wouldn't properly produce new paragraphs on enter if the current paragraph had formatting.\r
+       Fixed bug where multiple BR elements at end of block elements where removed.\r
+       Fixed bug where fullscreen plugin wouldn't correctly display the edit area on IE6 for long pages.\r
+       Fixed bug where paste plugin wouldn't properly encode raw entities when pasting in plain text mode.\r
+       Fixed bug where the search/replace plugin wouldn't work correctly on IE 9.\r
+       Fixed so the drop menus doesn't get an outline border visible when focused, patch contributed by Ephox.\r
+       Fixed so the values entered in the color picker are forced to hex values.\r
+       Removed dialog workaround for IE 9 beta since the RC is now out and people should upgrade.\r
+       Removed obsolete calls in various plugins to the mceBeginUndoLevel command.\r
+Version 3.4b3 (2011-02-10)\r
+       Added WAI-ARIA support for the main UI and dialogs this feature was contributed by Ephox.\r
+       Added iframe support to media plugin in order to handle the new YouTube HTML5 video formats.\r
+       Fixed bug where anchors would wrap the text contents after it due to a bug in the DomParser logic.\r
+       Fixed bug where the selected state wouldn't be removed on ListBox controls when a menu item was selected.\r
+       Fixed bug where IE could throw an unspecified error exception when the getBookmark logic was executed.\r
+       Fixed bug where IE would throw an invalid argument error when focus was applied to an empty editor instance.\r
+       Fixed bug where applying inline format wouldn't work if the start cell in the selection was empty.\r
+       Fixed bug where auto detection logic for YouTube and Google Video wouldn't work in the new media plugin.\r
+       Fixed bug where td elements would get a colspan/rowspan of 1 when created by the table plugin.\r
+       Fixed bug where removal/padding of empty elements wasn't handled correctly.\r
+       Fixed bug where internal elements would show up in element path.\r
+       Fixed bug where internal elements would get serialized as valid output.\r
+       Fixed bug where color wasn't correctly applied to anchor elements.\r
+       Fixed bug where float option in the style plugin dialog wouldn't be handled correctly on WebKit.\r
+       Fixed bug where the tinymce.dom.TreeWalker prev function wouldn't walk the DOM correctly.\r
+       Fixed bug where mceInsertContent command could produce empty block elements after the inserted content.\r
+       Fixed bug where mceInsertContent command wouldn't apply visual aids on tables and similar elements.\r
+       Fixed bug where empty block elements would get double br bogus elements in them.\r
+       Fixed bug where the color menu wouldn't apply the color correctly on IE when the viewport was to small.\r
+       Fixed bug where right clicking out side the body element of the editor iframe would prevent paste from working on IE.\r
+       Fixed bug where the onContextMenu event wouldn't fire correctly on IE if you clicked out side the body element.\r
+       Fixed bug where the onContextMenu event wouldn't fire correctly on modern Opera versions that now support it by default.\r
+       Fixed bug where legacy content wasn't converted correctly when inserted using mceInsertContent or through the source dialog.\r
+       Fixed bug where resizing images or tables wouldn't update the style attribute correctly or leave data-mce prefixed attributes.\r
+       Fixed bug where adding links wouldn't work correctly when using TinyMCE jQuery version with jQuery 1.5.\r
+       Fixed bug where single quotes inside param elements wasn't treated correctly by the media plugin.\r
+       Fixed bug where pasting plain text in WebKit wouldn't work correctly. It will now auto detect the WebKit bug and use plain text mode.\r
+       Fixed bug where the DomParser would fail to move out invalid elements within invalid elements on complex contents.\r
+       Fixed bug where paste as plain text would not decode html entities properly.\r
+       Fixed bug where large paragraphs would cause incorrect scrolling behavior if you would split them using enter.\r
+       Fixed bug where the SaxParser wouldn't properly parse some specific short ended elements.\r
+       Fixed so mceReplaceContent supports caret position and makes sure that the contents inserted gets validated.\r
+       Fixed so unnecessary traling br elements in blocks gets removed on Gecko/WebKit when using mceInsertContent command.\r
+       Moved some plugin css contents into the skin content css files to reduce the number of http requests.\r
+       Moved some plugin specific images into the theme img directory since they can then be shared.\r
+Version 3.4b2 (2011-01-13)\r
+       Added new custom flash player, this player supports mp4 and flv and has skin support.\r
+       Fixed so mceInsertContent handles context correctly to enforce valid nesting of elements.\r
+       Fixed bug where scrolling would become jerky on IE on some contents.\r
+       Fixed bug where paste as plain text would throw exception of missing entities setting.\r
+       Fixed bug where anchor nodes where removed by the new serializer engine.\r
+       Fixed bug where IE would crash if when backspace where used on some specific contents.\r
+       Fixed bug where pasting of plain text in WebKit would result in merging of text lines.\r
+       Fixed bug where it wasn't possible to delete images or tables using backspace on IE9.\r
+       Fixed bug where urls in styles would generate a JS error due to incorrect scope.\r
+       Fixed bug where copy paste from Java applications would produce extra contents in FF on Mac.\r
+       Fixed bug where the verify_html option wouldn't allow all elements and attributes.\r
+Version 3.4b1 (2010-12-20)\r
+       Added new serialization engine that increases performance and enforces valid output according to the specified schema settings.\r
+       Added new HTML parser logic used by the serialization engine and can handle malformed html contents.\r
+       Added new valid_children config option, enables more fine grain control of elements can be inside other elements.\r
+       Added new entities encoding logic boost performance and will only encode entities based on context i.e. attributes/text nodes.\r
+       Added new protect setting that enables users to protect template items from being removed by the serializer logic.\r
+       Added new {$caret} marker for the mceInsertContent command. Makes it possible to move the caret to a specific position when inserting contents.\r
+       Added new validation of anchor names. Only valid W3C names will be accepted.\r
+       Replaced the internal _mce_ prefixed attributes to the more standard HTML5 data-mce- prefix. This will also resolve future browser santiaztion issues.\r
+       Fixed bug where the paste plugin wouldn't convert Word lists with more than 9 items to real ol lists. Patch contributed by Mike (yogaboy).\r
+       Fixed bug where clicking on a format title would produce errors if the current selection didn't have any formats.\r
+       Fixed bug where paste of simple texts wouldn't work correctly in Gecko using the paste plugin since it keeps block formatting.\r
+       Fixed bug where confirm dialogs didn't display correctly due to resent IE9 fixes.\r
+       Fixed bug where spaces in URLs wouldn't be properly encoded to %20 if the user entered them in the link dialogs. Patch contributed by Ephox.\r
+       Fixed bug where the image alignment buttons wouldn't reposition the resize handles on FF due to a browser issue. Patch contributed by Ephox.\r
+       Fixed bug where the compareBoundaryPoints method of the IE Range class didn't work correctly. Patch contributed by Ephox.\r
+       Fixed bug where selection of elements using double click wouldn't select the clicked element but rather the parent node on FF. Patch contributed by Ephox.\r
+       Fixed bug where IE would scroll the user to the current selection causing parent document to scroll as well. Patch contributed by Ephox.\r
+       Fixed bug where style compression would incorrectly compress items with different values. It now only compresses if the values are the same. Patch contributed by Ephox.\r
+       Fixed bug where FF would add non breaking spaces outside TD elements if formatting was applied to table cells. Patch contributed by Ephox.\r
+       Fixed bug where the caret position would be lost on WebKit browsers if you pasted images multiple times. Patch contributed by Ephox.\r
+       Fixed bug where non word contents like * would be counted as words in the wordcount pluging. Patch contributed by David Balatero.\r
+       Fixed bug where the toggle absolute button in the layer plugin wouldn't remove the existing internal style attribute first.\r
+       Fixed bug where the autosave plugin would generate an exception on IE if the user had disabled userdata persistence.\r
+       Fixed bug where the paste plugin would remove dashed classes on IE since the regexps didn't include that character.\r
+       Fixed bug where applying text color would not add spans inside link elements. This is needed due to CSS style inheritance.\r
+       Fixed bug where applying block formats to empty elements wouldn't render correctly on IE.\r
+       Fixed bug where the searchreplace plugin would add a f or r character when shortcuts where used on IE while using default dialogs.\r
+       Fixed bug where Opera wouldn't load scripts correctly since the onreadystate would fire even though the script wasn't loaded.\r
+       Fixed issue where &nbsp; wouldn't be handled correctly in the bbcode plugin if entity_encoding was set to raw.\r
+       Fixed issue where contents would flicker since the content css files where asynchronously loaded.\r
+       Fixed bug where WebKit wouldn't create links on images with a float style.\r
+Version 3.3.9.3 (2010-12-20)\r
+       Fixed issue where WebKit wouldn't correctly apply ins/del in xhtmlxtras plugin.\r
+       Fixed bug where paste as plaintext on WebKit wouldn't produce br and p elements correctly.\r
+       Fixed bug where the confirm dialog texts would be incorrectly placed due to recent IE 9 workarounds in the window.css.\r
+       Fixed bug where applying text color would not add spans inside link elements. This is needed due to CSS style inheritance.\r
+Version 3.3.9.2 (2010-09-29)\r
+       Fixed bug where placing the caret in IE 9 beta 1 would not work correctly if you clicked out side the document body element.\r
+       Fixed bug where IE 9 beta 1 wouldn't resize the editor correctly since the events didn't fire as previous versions did.\r
+       Fixed bug where FF would produce an error message when being rendered inside a hidden div element.\r
+       Fixed bug where resize logic could produce a cookie with a width/height less than the size of the container.\r
+       Fixed bug where content_css wouldn't populate the styles dropdown correctly.\r
+Version 3.3.9.1 (2010-09-23)\r
+       Fixed bug where WebKit browsers wouldn't activate the image button when images where selected.\r
+       Fixed bug where Opera Presto 10.60 deletes elements when restoring bookmarks.\r
+       Fixed bug where IE9 beta1 doesn't handle regexp replacement values correctly.\r
+       Fixed bug where IE9 beta1 didn't render the inline dialogs correctly due to a bug with CSS clip.\r
+       Fixed bug where IE9 beta1 would produce error messages on load since they removed the document.recalc method.\r
+       Fixed bug where IE9 beta1 would produce <html xmlns=""> since they haven't implemented document.implementation.createDocument correctly.\r
+       Fixed bug where IE9 beta1 would searchreplace doesn't work since their native DOM Range doesn't have a find method.\r
+       Fixed bug where IE9 beta1 would render the source view incorrectly due to incorrect viewport size measurements.\r
+       Fixed bug where IE9 beta1 would crash when running the basic functionality unit tests.\r
+       Fixed bug where IE9 beta1 would wrap elements in blocks correctly due to changes to the selection object.\r
+       Fixed bug where IE9 beta1 would fail to insert contents since they havn't implemented the createContextualFragment method in their DOM Range.\r
+       Fixed bug where IE9 beta1 would fail to handle image selection since they currently doesn't support control selections in their DOM Range.\r
+       Fixed bug where IE9 beta1 would fail to load scripts since they fire the onload event before the scripts are parsed and executed.\r
+Version 3.3.9 (2010-09-08)\r
+       Fixed bug where inserting table rows into a table with subtable would produce an incorrect column count.\r
+       Fixed bug where the selection of cells in a table with subtables could produce invalid selections.\r
+       Fixed bug where the table plugin would produce a script error if you tried to move the caret before a first child table.\r
+       Fixed bug where the keep_styles feature on IE would move the caret to an incorrect location at the end of list blocks.\r
+       Fixed so attributes from legacy elements such as font gets retained when they get converted to spans.\r
+       Fixed minor issue where the select boxes wouldn't be set the not set by default in the table dialog.\r
+Version 3.3.8 (2010-06-30)\r
+       On IE8+ and FireFox 3.5+, dragging an image now correctly adds an undo\r
+       event.\r
+       Fixed bug where WebKit would not move the caret to a correct position after a paste operation.\r
+       Fixed bug where WebKit would produce a div wrapper element when pasting some contents.\r
+       Fixed bug where the visual chars and nonbreaking plugin wouldn't show nbsp elements correctly.\r
+       Fixed bug where the format states would be enabled even after the format was removed.\r
+       Fixed bug where the delete key would move the caret to an incorrect position.\r
+       Fixed bug where it wasn't possible to toggle of the current font size/family/style by clicking the title item.\r
+       Fixed bug where the abbr element wouldn't get serialized correctly on IE6.\r
+       Fixed so that the examples checks if they are executed from the local file system since that might not work properly.\r
 Version 3.3.7 (2010-06-10)\r
        Fixed bug where context menu would produce an error on IE if you right clicked twice and left clicked once.\r
        Fixed bug where resizing of the window on WebKit browsers in fullscreen mode wouldn't position the statusbar correctly.\r
diff --git a/library/tinymce/examples/accessibility.html b/library/tinymce/examples/accessibility.html
new file mode 100644 (file)
index 0000000..6905940
--- /dev/null
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<title>Full featured example</title>\r
+\r
+<!-- TinyMCE -->\r
+<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>\r
+<script type="text/javascript">\r
+       tinyMCE.init({\r
+               // General options\r
+               mode : "textareas",\r
+               theme : "advanced",\r
+               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",\r
+\r
+               // Theme options\r
+               theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
+               theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",\r
+               theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",\r
+               theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",\r
+               theme_advanced_toolbar_location : "top",\r
+               theme_advanced_toolbar_align : "left",\r
+               theme_advanced_statusbar_location : "bottom",\r
+               theme_advanced_resizing : true,\r
+\r
+               // Example content CSS (should be your site CSS)\r
+               // using false to ensure that the default browser settings are used for best Accessibility\r
+               // ACCESSIBILITY SETTINGS
+               content_css : false,\r
+               // Use browser preferred colors for dialogs.
+               browser_preferred_colors : true,\r
+               detect_highcontrast : true,\r
+\r
+               // Drop lists for link/image/media/template dialogs\r
+               template_external_list_url : "lists/template_list.js",\r
+               external_link_list_url : "lists/link_list.js",\r
+               external_image_list_url : "lists/image_list.js",\r
+               media_external_list_url : "lists/media_list.js",\r
+\r
+               // Style formats\r
+               style_formats : [\r
+                       {title : 'Bold text', inline : 'b'},\r
+                       {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},\r
+                       {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},\r
+                       {title : 'Example 1', inline : 'span', classes : 'example1'},\r
+                       {title : 'Example 2', inline : 'span', classes : 'example2'},\r
+                       {title : 'Table styles'},\r
+                       {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}\r
+               ],\r
+\r
+               // Replace values for the template plugin\r
+               template_replace_values : {\r
+                       username : "Some User",\r
+                       staffid : "991234"\r
+               }\r
+       });\r
+</script>\r
+<!-- /TinyMCE -->\r
+\r
+</head>\r
+<body>\r
+\r
+<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">\r
+       <div>\r
+               <h3>Full featured example, with Accessibility settings enabled</h3>\r
+\r
+               <p>\r
+                       This page has got the TinyMCE set up to work with configurations related to accessiblity enabled.\r
+                       In particular
+                       <ul>
+                       <li>the <strong>content_css</strong> is set to false, to ensure that all default browser styles are used, </li>
+                       <li>the <strong>browser_preferred_colors</strong> dialog option is used to ensure that default css is used for dialogs, </li>
+                       <li>and the <strong>detect_highcontrast</strong> option has been set to ensure that highcontrast mode in Windows browsers
+                       is detected and the toolbars are displayed in a high contrast mode.</li>
+                       </ul>
+               </p>\r
+\r
+               <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->\r
+               <div>\r
+                       <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">\r
+                               &lt;p&gt;\r
+                                       This is some example text that you can edit inside the &lt;strong&gt;TinyMCE editor&lt;/strong&gt;.\r
+                               &lt;/p&gt;\r
+                               &lt;p&gt;\r
+                               Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros.\r
+                               &lt;/p&gt;\r
+                       </textarea>\r
+               </div>\r
+\r
+               <br />\r
+               <input type="submit" name="save" value="Submit" />\r
+               <input type="reset" name="reset" value="Reset" />\r
+       </div>\r
+</form>\r
+\r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
+</body>\r
+</html>
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7c475b1..ba9d1eb
@@ -10,7 +10,7 @@
                // General options\r
                mode : "textareas",\r
                theme : "advanced",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",\r
+               plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
                <input type="reset" name="reset" value="Reset" />\r
        </div>\r
 </form>\r
-\r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index 0b24b6e..84b76ca
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
 <title>Full featured example</title>\r
-\r
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />\r
 <!-- TinyMCE -->\r
 <script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>\r
 <script type="text/javascript">\r
                // General options\r
                mode : "textareas",\r
                theme : "advanced",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",\r
+               plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
                theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",\r
                theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",\r
-               theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",\r
+               theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",\r
                theme_advanced_toolbar_location : "top",\r
                theme_advanced_toolbar_align : "left",\r
                theme_advanced_statusbar_location : "bottom",\r
@@ -52,7 +52,7 @@
 <!-- /TinyMCE -->\r
 \r
 </head>\r
-<body>\r
+<body role="application">\r
 \r
 <form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">\r
        <div>\r
                </div>\r
 \r
                <!-- Some integration calls -->\r
-               <a href="javascript:;" onmousedown="tinyMCE.get('elm1').show();">[Show]</a>\r
-               <a href="javascript:;" onmousedown="tinyMCE.get('elm1').hide();">[Hide]</a>\r
-               <a href="javascript:;" onmousedown="tinyMCE.get('elm1').execCommand('Bold');">[Bold]</a>\r
-               <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').getContent());">[Get contents]</a>\r
-               <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent());">[Get selected HTML]</a>\r
-               <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent({format : 'text'}));">[Get selected text]</a>\r
-               <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getNode().nodeName);">[Get selected element]</a>\r
-               <a href="javascript:;" onmousedown="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');">[Insert HTML]</a>\r
-               <a href="javascript:;" onmousedown="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');">[Replace selection]</a>\r
+               <a href="javascript:;" onclick="tinyMCE.get('elm1').show();return false;">[Show]</a>\r
+               <a href="javascript:;" onclick="tinyMCE.get('elm1').hide();return false;">[Hide]</a>\r
+               <a href="javascript:;" onclick="tinyMCE.get('elm1').execCommand('Bold');return false;">[Bold]</a>\r
+               <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').getContent());return false;">[Get contents]</a>\r
+               <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getContent());return false;">[Get selected HTML]</a>\r
+               <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getContent({format : 'text'}));return false;">[Get selected text]</a>\r
+               <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getNode().nodeName);return false;">[Get selected element]</a>\r
+               <a href="javascript:;" onclick="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');return false;">[Insert HTML]</a>\r
+               <a href="javascript:;" onclick="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');return false;">[Replace selection]</a>\r
 \r
                <br />\r
                <input type="submit" name="save" value="Submit" />\r
        </div>\r
 </form>\r
 \r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 3a3836c..2e04958
@@ -6,5 +6,9 @@ var tinyMCEMediaList = [
        // Name, URL\r
        ["Some Flash", "media/sample.swf"],\r
        ["Some Quicktime", "media/sample.mov"],\r
-       ["Some AVI", "media/sample.avi"]\r
+       ["Some AVI", "media/sample.avi"],\r
+       ["Some RealMedia", "media/sample.rm"],\r
+       ["Some Shockwave", "media/sample.dcr"],\r
+       ["Some Video", "media/sample.mp4"],\r
+       ["Some FLV", "media/sample.flv"]\r
 ];
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/library/tinymce/examples/media/sample.flv b/library/tinymce/examples/media/sample.flv
new file mode 100644 (file)
index 0000000..799d137
Binary files /dev/null and b/library/tinymce/examples/media/sample.flv differ
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index a65c310..e48650a
@@ -13,5 +13,6 @@ a {display:block;}
 <a href="skins.html" target="main">Skin support</a>\r
 <a href="word.html" target="main">Word processor</a>\r
 <a href="custom_formats.html" target="main">Custom formats</a>\r
+<a href="accessibility.html" target="main">Accessibility Options</a>\r
 </body>\r
-</html>
\ No newline at end of file
+</html>\r
old mode 100755 (executable)
new mode 100644 (file)
index c378398..70720ca
        <input type="submit" name="save" value="Submit" />\r
        <input type="reset" name="reset" value="Reset" />\r
 </form>\r
-\r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index a398172..c150858
@@ -12,7 +12,7 @@
                mode : "exact",\r
                elements : "elm1",\r
                theme : "advanced",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
+               plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
@@ -47,7 +47,7 @@
                elements : "elm2",\r
                theme : "advanced",\r
                skin : "o2k7",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
+               plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
@@ -83,7 +83,7 @@
                theme : "advanced",\r
                skin : "o2k7",\r
                skin_variant : "silver",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
+               plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
                theme : "advanced",\r
                skin : "o2k7",\r
                skin_variant : "black",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
+               plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",\r
        <input type="submit" name="save" value="Submit" />\r
        <input type="reset" name="reset" value="Reset" />\r
 </form>\r
-\r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/library/tinymce/examples/translate.html b/library/tinymce/examples/translate.html
deleted file mode 100755 (executable)
index bdd8ac5..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
-<title>Full featured example</title>\r
-<style>\r
-body {font-family:Arial,Verdana; font-size: 12px;}\r
-</style>\r
-\r
-<!-- TinyMCE -->\r
-<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>\r
-<script type="text/javascript">\r
-       tinyMCE.init({\r
-               // General options\r
-               mode : "textareas",\r
-               theme : "advanced",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",\r
-\r
-               // Theme options\r
-               theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",\r
-               theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",\r
-               theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",\r
-               theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",\r
-               theme_advanced_toolbar_location : "top",\r
-               theme_advanced_toolbar_align : "left",\r
-               theme_advanced_path_location : "bottom",\r
-               theme_advanced_resizing : true,\r
-\r
-               // Example content CSS (should be your site CSS)\r
-               content_css : "css/content.css",\r
-\r
-               // Drop lists for link/image/media/template dialogs\r
-               template_external_list_url : "lists/template_list.js",\r
-               external_link_list_url : "lists/link_list.js",\r
-               external_image_list_url : "lists/image_list.js",\r
-               media_external_list_url : "lists/media_list.js",\r
-\r
-               // Replace values for the template plugin\r
-               template_replace_values : {\r
-                       username : "Some User",\r
-                       staffid : "991234"\r
-               },\r
-\r
-               // Enable translation mode\r
-               translate_mode : true,\r
-               language : "en"\r
-       });\r
-</script>\r
-<!-- /TinyMCE -->\r
-\r
-</head>\r
-<body>\r
-\r
-<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">\r
-       <h3>Translation</h3>\r
-\r
-       <p>This page enables you to translate TinyMCE by using XML files.</p>\r
-       <p>Steps to translate:</p>\r
-       <ol>\r
-               <li>Download one of the language XML files from the TinyMCE site.</li>\r
-               <li>Place it in /jscripts/tiny_mce/langs directory, for example /jscripts/tiny_mce/langs/sv.xml.</li>\r
-               <li>Change the language init option in this file to match the XML file code. For example: sv</li>\r
-               <li>TinyMCE will now use the XML file instead of the .js versions.</li>\r
-               <li>Modify the XML file until everything is translated</li>\r
-               <li>Modify the author information, this is optional.</li>\r
-               <li>Upload the XML file to the TinyMCE site to share it with others.</li>\r
-               <li>You can now download the .js versions of the language pack from the TinyMCE site.</li>\r
-       </ol>\r
-\r
-       <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">\r
-               &lt;p&gt;\r
-                       This is some example text that you can edit inside the &lt;strong&gt;TinyMCE editor&lt;/strong&gt;.\r
-               &lt;/p&gt;\r
-               &lt;p&gt;\r
-               Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros.\r
-               &lt;/p&gt;\r
-       </textarea>\r
-</form>\r
-\r
-</body>\r
-</html>\r
old mode 100755 (executable)
new mode 100644 (file)
index f778f98..d827b6f
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
 <title>Word processor example</title>\r
-\r
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />\r
 <!-- TinyMCE -->\r
 <script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>\r
 <script type="text/javascript">\r
@@ -10,7 +10,8 @@
                // General options\r
                mode : "textareas",\r
                theme : "advanced",\r
-               plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
+               skin : "o2k7",\r
+               plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",\r
 \r
                // Theme options\r
                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",\r
        <input type="submit" name="save" value="Submit" />\r
        <input type="reset" name="reset" value="Reset" />\r
 </form>\r
-\r
+<script type="text/javascript">\r
+if (document.location.protocol == 'file:') {\r
+       alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\r
+}\r
+</script>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index ea4a1b0..19324f7
@@ -1,170 +1 @@
-tinyMCE.addI18n({en:{\r
-common:{\r
-edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",\r
-apply:"Apply",\r
-insert:"Insert",\r
-update:"Update",\r
-cancel:"Cancel",\r
-close:"Close",\r
-browse:"Browse",\r
-class_name:"Class",\r
-not_set:"-- Not set --",\r
-clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",\r
-clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",\r
-popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",\r
-invalid_data:"Error: Invalid values entered, these are marked in red.",\r
-more_colors:"More colors"\r
-},\r
-contextmenu:{\r
-align:"Alignment",\r
-left:"Left",\r
-center:"Center",\r
-right:"Right",\r
-full:"Full"\r
-},\r
-insertdatetime:{\r
-date_fmt:"%Y-%m-%d",\r
-time_fmt:"%H:%M:%S",\r
-insertdate_desc:"Insert date",\r
-inserttime_desc:"Insert time",\r
-months_long:"January,February,March,April,May,June,July,August,September,October,November,December",\r
-months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",\r
-day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",\r
-day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"\r
-},\r
-print:{\r
-print_desc:"Print"\r
-},\r
-preview:{\r
-preview_desc:"Preview"\r
-},\r
-directionality:{\r
-ltr_desc:"Direction left to right",\r
-rtl_desc:"Direction right to left"\r
-},\r
-layer:{\r
-insertlayer_desc:"Insert new layer",\r
-forward_desc:"Move forward",\r
-backward_desc:"Move backward",\r
-absolute_desc:"Toggle absolute positioning",\r
-content:"New layer..."\r
-},\r
-save:{\r
-save_desc:"Save",\r
-cancel_desc:"Cancel all changes"\r
-},\r
-nonbreaking:{\r
-nonbreaking_desc:"Insert non-breaking space character"\r
-},\r
-iespell:{\r
-iespell_desc:"Run spell checking",\r
-download:"ieSpell not detected. Do you want to install it now?"\r
-},\r
-advhr:{\r
-advhr_desc:"Horizontal rule"\r
-},\r
-emotions:{\r
-emotions_desc:"Emotions"\r
-},\r
-searchreplace:{\r
-search_desc:"Find",\r
-replace_desc:"Find/Replace"\r
-},\r
-advimage:{\r
-image_desc:"Insert/edit image"\r
-},\r
-advlink:{\r
-link_desc:"Insert/edit link"\r
-},\r
-xhtmlxtras:{\r
-cite_desc:"Citation",\r
-abbr_desc:"Abbreviation",\r
-acronym_desc:"Acronym",\r
-del_desc:"Deletion",\r
-ins_desc:"Insertion",\r
-attribs_desc:"Insert/Edit Attributes"\r
-},\r
-style:{\r
-desc:"Edit CSS Style"\r
-},\r
-paste:{\r
-paste_text_desc:"Paste as Plain Text",\r
-paste_word_desc:"Paste from Word",\r
-selectall_desc:"Select All",\r
-plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.",\r
-plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode."\r
-},\r
-paste_dlg:{\r
-text_title:"Use CTRL+V on your keyboard to paste the text into the window.",\r
-text_linebreaks:"Keep linebreaks",\r
-word_title:"Use CTRL+V on your keyboard to paste the text into the window."\r
-},\r
-table:{\r
-desc:"Inserts a new table",\r
-row_before_desc:"Insert row before",\r
-row_after_desc:"Insert row after",\r
-delete_row_desc:"Delete row",\r
-col_before_desc:"Insert column before",\r
-col_after_desc:"Insert column after",\r
-delete_col_desc:"Remove column",\r
-split_cells_desc:"Split merged table cells",\r
-merge_cells_desc:"Merge table cells",\r
-row_desc:"Table row properties",\r
-cell_desc:"Table cell properties",\r
-props_desc:"Table properties",\r
-paste_row_before_desc:"Paste table row before",\r
-paste_row_after_desc:"Paste table row after",\r
-cut_row_desc:"Cut table row",\r
-copy_row_desc:"Copy table row",\r
-del:"Delete table",\r
-row:"Row",\r
-col:"Column",\r
-cell:"Cell"\r
-},\r
-autosave:{\r
-unload_msg:"The changes you made will be lost if you navigate away from this page.",\r
-restore_content:"Restore auto-saved content.",\r
-warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?."\r
-},\r
-fullscreen:{\r
-desc:"Toggle fullscreen mode"\r
-},\r
-media:{\r
-desc:"Insert / edit embedded media",\r
-edit:"Edit embedded media"\r
-},\r
-fullpage:{\r
-desc:"Document properties"\r
-},\r
-template:{\r
-desc:"Insert predefined template content"\r
-},\r
-visualchars:{\r
-desc:"Visual control characters on/off."\r
-},\r
-spellchecker:{\r
-desc:"Toggle spellchecker",\r
-menu:"Spellchecker settings",\r
-ignore_word:"Ignore word",\r
-ignore_words:"Ignore all",\r
-langs:"Languages",\r
-wait:"Please wait...",\r
-sug:"Suggestions",\r
-no_sug:"No suggestions",\r
-no_mpell:"No misspellings found."\r
-},\r
-pagebreak:{\r
-desc:"Insert page break."\r
-},\r
-advlist:{\r
-types:"Types",\r
-def:"Default",\r
-lower_alpha:"Lower alpha",\r
-lower_greek:"Lower greek",\r
-lower_roman:"Lower roman",\r
-upper_alpha:"Upper alpha",\r
-upper_roman:"Upper roman",\r
-circle:"Circle",\r
-disc:"Disc",\r
-square:"Square"\r
-}}});
\ No newline at end of file
+tinyMCE.addI18n({en:{common:{"more_colors":"More Colors...","invalid_data":"Error: Invalid values entered, these are marked in red.","popup_blocked":"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.","clipboard_no_support":"Currently not supported by your browser, use keyboard shortcuts instead.","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","not_set":"-- Not Set --","class_name":"Class",browse:"Browse",close:"Close",cancel:"Cancel",update:"Update",insert:"Insert",apply:"Apply","edit_confirm":"Do you want to use the WYSIWYG mode for this textarea?","invalid_data_number":"{#field} must be a number","invalid_data_min":"{#field} must be a number greater than {#min}","invalid_data_size":"{#field} must be a number or percentage",value:"(value)"},contextmenu:{full:"Full",right:"Right",center:"Center",left:"Left",align:"Alignment"},insertdatetime:{"day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","inserttime_desc":"Insert Time","insertdate_desc":"Insert Date","time_fmt":"%H:%M:%S","date_fmt":"%Y-%m-%d"},print:{"print_desc":"Print"},preview:{"preview_desc":"Preview"},directionality:{"rtl_desc":"Direction Right to Left","ltr_desc":"Direction Left to Right"},layer:{content:"New layer...","absolute_desc":"Toggle Absolute Positioning","backward_desc":"Move Backward","forward_desc":"Move Forward","insertlayer_desc":"Insert New Layer"},save:{"save_desc":"Save","cancel_desc":"Cancel All Changes"},nonbreaking:{"nonbreaking_desc":"Insert Non-Breaking Space Character"},iespell:{download:"ieSpell not detected. Do you want to install it now?","iespell_desc":"Check Spelling"},advhr:{"delta_height":"","delta_width":"","advhr_desc":"Insert Horizontal Line"},emotions:{"delta_height":"","delta_width":"","emotions_desc":"Emotions"},searchreplace:{"replace_desc":"Find/Replace","delta_width":"","delta_height":"","search_desc":"Find"},advimage:{"delta_width":"","image_desc":"Insert/Edit Image","delta_height":""},advlink:{"delta_height":"","delta_width":"","link_desc":"Insert/Edit Link"},xhtmlxtras:{"attribs_delta_height":"","attribs_delta_width":"","ins_delta_height":"","ins_delta_width":"","del_delta_height":"","del_delta_width":"","acronym_delta_height":"","acronym_delta_width":"","abbr_delta_height":"","abbr_delta_width":"","cite_delta_height":"","cite_delta_width":"","attribs_desc":"Insert/Edit Attributes","ins_desc":"Insertion","del_desc":"Deletion","acronym_desc":"Acronym","abbr_desc":"Abbreviation","cite_desc":"Citation"},style:{"delta_height":"","delta_width":"",desc:"Edit CSS Style"},paste:{"plaintext_mode_stick":"Paste is now in plain text mode. Click again to toggle back to regular paste mode.","plaintext_mode":"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.","selectall_desc":"Select All","paste_word_desc":"Paste from Word","paste_text_desc":"Paste as Plain Text"},"paste_dlg":{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."},table:{"merge_cells_delta_height":"","merge_cells_delta_width":"","table_delta_height":"","table_delta_width":"","cellprops_delta_height":"","cellprops_delta_width":"","rowprops_delta_height":"","rowprops_delta_width":"",cell:"Cell",col:"Column",row:"Row",del:"Delete Table","copy_row_desc":"Copy Table Row","cut_row_desc":"Cut Table Row","paste_row_after_desc":"Paste Table Row After","paste_row_before_desc":"Paste Table Row Before","props_desc":"Table Properties","cell_desc":"Table Cell Properties","row_desc":"Table Row Properties","merge_cells_desc":"Merge Table Cells","split_cells_desc":"Split Merged Table Cells","delete_col_desc":"Delete Column","col_after_desc":"Insert Column After","col_before_desc":"Insert Column Before","delete_row_desc":"Delete Row","row_after_desc":"Insert Row After","row_before_desc":"Insert Row Before",desc:"Insert/Edit Table"},autosave:{"warning_message":"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?","restore_content":"Restore auto-saved content.","unload_msg":"The changes you made will be lost if you navigate away from this page."},fullscreen:{desc:"Toggle Full Screen Mode"},media:{"delta_height":"","delta_width":"",edit:"Edit Embedded Media",desc:"Insert/Edit Embedded Media"},fullpage:{desc:"Document Properties","delta_width":"","delta_height":""},template:{desc:"Insert Predefined Template Content"},visualchars:{desc:"Show/Hide Visual Control Characters"},spellchecker:{desc:"Toggle Spell Checker",menu:"Spell Checker Settings","ignore_word":"Ignore Word","ignore_words":"Ignore All",langs:"Languages",wait:"Please wait...",sug:"Suggestions","no_sug":"No Suggestions","no_mpell":"No misspellings found.","learn_word":"Learn word"},pagebreak:{desc:"Insert Page Break for Printing"},advlist:{types:"Types",def:"Default","lower_alpha":"Lower Alpha","lower_greek":"Lower Greek","lower_roman":"Lower Roman","upper_alpha":"Upper Alpha","upper_roman":"Upper Roman",circle:"Circle",disc:"Disc",square:"Square"},colors:{"333300":"Dark olive","993300":"Burnt orange","000000":"Black","003300":"Dark green","003366":"Dark azure","000080":"Navy Blue","333399":"Indigo","333333":"Very dark gray","800000":"Maroon",FF6600:"Orange","808000":"Olive","008000":"Green","008080":"Teal","0000FF":"Blue","666699":"Grayish blue","808080":"Gray",FF0000:"Red",FF9900:"Amber","99CC00":"Yellow green","339966":"Sea green","33CCCC":"Turquoise","3366FF":"Royal blue","800080":"Purple","999999":"Medium gray",FF00FF:"Magenta",FFCC00:"Gold",FFFF00:"Yellow","00FF00":"Lime","00FFFF":"Aqua","00CCFF":"Sky blue","993366":"Brown",C0C0C0:"Silver",FF99CC:"Pink",FFCC99:"Peach",FFFF99:"Light yellow",CCFFCC:"Pale green",CCFFFF:"Pale cyan","99CCFF":"Light sky blue",CC99FF:"Plum",FFFFFF:"White"},aria:{"rich_text_area":"Rich Text Area"},wordcount:{words:"Words:"},visualblocks:{desc:'Show/hide block elements'}}});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 873bfd8..0c3bf15
@@ -1,5 +1 @@
-tinyMCE.addI18n('en.advhr_dlg',{\r
-width:"Width",\r
-size:"Height",\r
-noshade:"No shadow"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index fc37b2a..843e1f8
@@ -8,43 +8,44 @@
        <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
        <link href="css/advhr.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body>\r
+<body role="application">\r
 <form onsubmit="AdvHRDialog.update();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>\r
                </ul>\r
        </div>\r
 \r
        <div class="panel_wrapper">\r
                <div id="general_panel" class="panel current">\r
-                       <table border="0" cellpadding="4" cellspacing="0">\r
-                    <tr>\r
-                        <td><label for="width">{#advhr_dlg.width}</label></td>\r
-                        <td class="nowrap">\r
-                            <input id="width" name="width" type="text" value="" class="mceFocus" />\r
-                            <select name="width2" id="width2">\r
-                                <option value="">px</option>\r
-                                <option value="%">%</option>\r
-                            </select>\r
-                        </td>\r
-                    </tr>\r
-                    <tr>\r
-                        <td><label for="size">{#advhr_dlg.size}</label></td>\r
-                        <td><select id="size" name="size">\r
-                            <option value="">Normal</option>\r
-                            <option value="1">1</option>\r
-                            <option value="2">2</option>\r
-                            <option value="3">3</option>\r
-                            <option value="4">4</option>\r
-                            <option value="5">5</option>\r
-                        </select></td>\r
-                    </tr>\r
-                    <tr>\r
-                        <td><label for="noshade">{#advhr_dlg.noshade}</label></td>\r
-                        <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>\r
-                    </tr>\r
-            </table>\r
+                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                       <tr role="group" aria-labelledby="width_label">\r
+                                               <td><label id="width_label" for="width">{#advhr_dlg.width}</label></td>\r
+                                               <td class="nowrap">\r
+                                                       <input id="width" name="width" type="text" value="" class="mceFocus" />\r
+                                                       <span style="display:none;" id="width_unit_label">{#advhr_dlg.widthunits}</span>\r
+                                                       <select name="width2" id="width2" aria-labelledby="width_unit_label">\r
+                                                               <option value="">px</option>\r
+                                                               <option value="%">%</option>\r
+                                                       </select>\r
+                                               </td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td><label for="size">{#advhr_dlg.size}</label></td>\r
+                                               <td><select id="size" name="size">\r
+                                                       <option value="">{#advhr_dlg.normal}</option>\r
+                                                       <option value="1">1</option>\r
+                                                       <option value="2">2</option>\r
+                                                       <option value="3">3</option>\r
+                                                       <option value="4">4</option>\r
+                                                       <option value="5">5</option>\r
+                                               </select></td>\r
+                                       </tr>\r
+                                       <tr>\r
+                                               <td><label for="noshade">{#advhr_dlg.noshade}</label></td>\r
+                                               <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>\r
+                                       </tr>\r
+                       </table>\r
                </div>\r
        </div>\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 4c7a9c3..d613a61
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 2625dd2..d2678cb
@@ -14,7 +14,7 @@
                        // Register commands\r
                        ed.addCommand('mceAdvImage', function() {\r
                                // Internal image object like a flash placeholder\r
-                               if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)\r
+                               if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)\r
                                        return;\r
 \r
                                ed.windowManager.open({\r
old mode 100755 (executable)
new mode 100644 (file)
index 79cff3f..ed16b3d
        <script type="text/javascript" src="js/image.js"></script>\r
        <link href="css/advimage.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="advimage" style="display: none">\r
-    <form onsubmit="ImageDialog.insert();return false;" action="#"> \r
+<body id="advimage" style="display: none" role="application" aria-labelledby="app_title">\r
+       <span id="app_title" style="display:none">{#advimage_dlg.dialog_title}</span>\r
+       <form onsubmit="ImageDialog.insert();return false;" action="#"> \r
                <div class="tabs">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>\r
-                               <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>\r
+                               <li id="appearance_tab" aria-controls="appearance_panel"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
                                <fieldset>\r
                                                <legend>{#advimage_dlg.general}</legend>\r
 \r
-                                               <table class="properties">\r
+                                               <table role="presentation" class="properties">\r
                                                        <tr>\r
                                                                <td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>\r
-                                                               <td colspan="2"><table border="0" cellspacing="0" cellpadding="0">\r
+                                                               <td colspan="2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                                        <tr> \r
-                                                                         <td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" /></td> \r
-                                                                         <td id="srcbrowsercontainer">&nbsp;</td>\r
+                                                                               <td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" aria-required="true" /></td> \r
+                                                                               <td id="srcbrowsercontainer">&nbsp;</td>\r
                                                                        </tr>\r
-                                                                 </table></td>\r
+                                                               </table></td>\r
                                                        </tr>\r
                                                        <tr>\r
                                                                <td><label for="src_list">{#advimage_dlg.image_list}</label></td>\r
@@ -60,7 +61,7 @@
                                <fieldset>\r
                                        <legend>{#advimage_dlg.tab_appearance}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr> \r
                                                        <td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td> \r
                                                        <td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();"> \r
                                                        </td>\r
                                                </tr>\r
 \r
-                                               <tr>\r
+                                               <tr role="group" aria-labelledby="widthlabel">\r
                                                        <td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>\r
                                                        <td class="nowrap">\r
-                                                               <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" /> x \r
-                                                               <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" /> px\r
+                                                               <span style="display:none" id="width_voiceLabel">{#advimage_dlg.width}</span>\r
+                                                               <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" aria-labelledby="width_voiceLabel" /> x \r
+                                                               <span style="display:none" id="height_voiceLabel">{#advimage_dlg.height}</span>\r
+                                                               <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" aria-labelledby="height_voiceLabel" /> px\r
                                                        </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
                                                        <td>&nbsp;</td>\r
-                                                       <td><table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td><table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>\r
                                                                                <td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>\r
                                <fieldset>\r
                                        <legend>{#advimage_dlg.swap_image}</legend>\r
 \r
-                                       <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" />\r
+                                       <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" aria-controls="onmouseoversrc onmouseoutsrc" />\r
                                        <label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
                                                        <tr>\r
                                                                <td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td> \r
-                                                               <td><table border="0" cellspacing="0" cellpadding="0"> \r
+                                                               <td><table role="presentation" border="0" cellspacing="0" cellpadding="0"> \r
                                                                        <tr> \r
-                                                                         <td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td> \r
-                                                                         <td id="onmouseoversrccontainer">&nbsp;</td>\r
+                                                                               <td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td> \r
+                                                                               <td id="onmouseoversrccontainer">&nbsp;</td>\r
                                                                        </tr>\r
-                                                                 </table></td>\r
+                                                               </table></td>\r
                                                        </tr>\r
                                                        <tr>\r
                                                                <td><label for="over_list">{#advimage_dlg.image_list}</label></td>\r
                                                        </tr>\r
                                                        <tr> \r
                                                                <td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td> \r
-                                                               <td class="column2"><table border="0" cellspacing="0" cellpadding="0"> \r
+                                                               <td class="column2"><table role="presentation" border="0" cellspacing="0" cellpadding="0"> \r
                                                                        <tr> \r
-                                                                         <td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td> \r
-                                                                         <td id="onmouseoutsrccontainer">&nbsp;</td>\r
+                                                                               <td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td> \r
+                                                                               <td id="onmouseoutsrccontainer">&nbsp;</td>\r
                                                                        </tr> \r
-                                                                 </table></td> \r
+                                                               </table></td> \r
                                                        </tr>\r
                                                        <tr>\r
                                                                <td><label for="out_list">{#advimage_dlg.image_list}</label></td>\r
                                <fieldset>\r
                                        <legend>{#advimage_dlg.misc}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td> \r
                                                        <td><input id="id" name="id" type="text" value="" /></td> \r
 \r
                                                <tr>\r
                                                        <td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>\r
-                                                       <td><table border="0" cellspacing="0" cellpadding="0">\r
+                                                       <td><table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                                        <tr>\r
-                                                                         <td><input id="longdesc" name="longdesc" type="text" value="" /></td>\r
-                                                                         <td id="longdesccontainer">&nbsp;</td>\r
+                                                                               <td><input id="longdesc" name="longdesc" type="text" value="" /></td>\r
+                                                                               <td id="longdesccontainer">&nbsp;</td>\r
                                                                        </tr>\r
-                                                               </table></td> \r
+                                                       </table></td> \r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
                        <input type="submit" id="insert" name="insert" value="{#insert}" />\r
                        <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
                </div>\r
-    </form>\r
+       </form>\r
 </body> \r
 </html> \r
old mode 100755 (executable)
new mode 100644 (file)
index 3bda86a..546b69c
@@ -9,13 +9,13 @@ var ImageDialog = {
        },\r
 \r
        init : function(ed) {\r
-               var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();\r
+               var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');\r
 \r
                tinyMCEPopup.resizeToInnerSize();\r
                this.fillClassList('class_list');\r
-               this.fillFileList('src_list', 'tinyMCEImageList');\r
-               this.fillFileList('over_list', 'tinyMCEImageList');\r
-               this.fillFileList('out_list', 'tinyMCEImageList');\r
+               this.fillFileList('src_list', fl);\r
+               this.fillFileList('over_list', fl);\r
+               this.fillFileList('out_list', fl);\r
                TinyMCE_EditableSelects.init();\r
 \r
                if (n.nodeName == 'IMG') {\r
@@ -142,7 +142,7 @@ var ImageDialog = {
                }\r
 \r
                tinymce.extend(args, {\r
-                       src : nl.src.value,\r
+                       src : nl.src.value.replace(/ /g, '%20'),\r
                        width : nl.width.value,\r
                        height : nl.height.value,\r
                        alt : nl.alt.value,\r
@@ -171,12 +171,18 @@ var ImageDialog = {
                if (el && el.nodeName == 'IMG') {\r
                        ed.dom.setAttribs(el, args);\r
                } else {\r
-                       ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});\r
-                       ed.dom.setAttribs('__mce_tmp', args);\r
-                       ed.dom.setAttrib('__mce_tmp', 'id', '');\r
+                       tinymce.each(args, function(value, name) {\r
+                               if (value === "") {\r
+                                       delete args[name];\r
+                               }\r
+                       });\r
+\r
+                       ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});\r
                        ed.undoManager.add();\r
                }\r
 \r
+               tinyMCEPopup.editor.execCommand('mceRepaint');\r
+               tinyMCEPopup.editor.focus();\r
                tinyMCEPopup.close();\r
        },\r
 \r
@@ -285,7 +291,7 @@ var ImageDialog = {
        fillFileList : function(id, l) {\r
                var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
 \r
-               l = window[l];\r
+               l = typeof(l) === 'function' ? l() : window[l];\r
                lst.options.length = 0;\r
 \r
                if (l && l.length > 0) {\r
@@ -359,7 +365,7 @@ var ImageDialog = {
        },\r
 \r
        updateStyle : function(ty) {\r
-               var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});\r
+               var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});\r
 \r
                if (tinyMCEPopup.editor.settings.inline_styles) {\r
                        // Handle align\r
@@ -378,14 +384,27 @@ var ImageDialog = {
 \r
                        // Handle border\r
                        if (ty == 'border') {\r
+                               b = img.style.border ? img.style.border.split(' ') : [];\r
+                               bStyle = dom.getStyle(img, 'border-style');\r
+                               bColor = dom.getStyle(img, 'border-color');\r
+\r
                                dom.setStyle(img, 'border', '');\r
 \r
                                v = f.border.value;\r
                                if (v || v == '0') {\r
                                        if (v == '0')\r
-                                               img.style.border = '0';\r
-                                       else\r
-                                               img.style.border = v + 'px solid black';\r
+                                               img.style.border = isIE ? '0' : '0 none none';\r
+                                       else {\r
+                                               if (b.length == 3 && b[isIE ? 2 : 1])\r
+                                                       bStyle = b[isIE ? 2 : 1];\r
+                                               else if (!bStyle || bStyle == 'none')\r
+                                                       bStyle = 'solid';\r
+                                               if (b.length == 3 && b[isIE ? 0 : 2])\r
+                                                       bColor = b[isIE ? 0 : 2];\r
+                                               else if (!bColor || bColor == 'none')\r
+                                                       bColor = 'black';\r
+                                               img.style.border = v + 'px ' + bStyle + ' ' + bColor;\r
+                                       }\r
                                }\r
                        }\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index f493d19..5f122e2
@@ -1,43 +1 @@
-tinyMCE.addI18n('en.advimage_dlg',{\r
-tab_general:"General",\r
-tab_appearance:"Appearance",\r
-tab_advanced:"Advanced",\r
-general:"General",\r
-title:"Title",\r
-preview:"Preview",\r
-constrain_proportions:"Constrain proportions",\r
-langdir:"Language direction",\r
-langcode:"Language code",\r
-long_desc:"Long description link",\r
-style:"Style",\r
-classes:"Classes",\r
-ltr:"Left to right",\r
-rtl:"Right to left",\r
-id:"Id",\r
-map:"Image map",\r
-swap_image:"Swap image",\r
-alt_image:"Alternative image",\r
-mouseover:"for mouse over",\r
-mouseout:"for mouse out",\r
-misc:"Miscellaneous",\r
-example_img:"Appearance preview image",\r
-missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.",\r
-dialog_title:"Insert/edit image",\r
-src:"Image URL",\r
-alt:"Image description",\r
-list:"Image list",\r
-border:"Border",\r
-dimensions:"Dimensions",\r
-vspace:"Vertical space",\r
-hspace:"Horizontal space",\r
-align:"Alignment",\r
-align_baseline:"Baseline",\r
-align_top:"Top",\r
-align_middle:"Middle",\r
-align_bottom:"Bottom",\r
-align_texttop:"Text top",\r
-align_textbottom:"Text bottom",\r
-align_left:"Left",\r
-align_right:"Right",\r
-image_list:"Image list"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index b78e82f..9ca955c
@@ -30,8 +30,6 @@ function init() {
 \r
        document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');\r
        document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');\r
-       document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');\r
-       document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');\r
        document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');\r
 \r
        // Link list\r
@@ -41,6 +39,13 @@ function init() {
        else\r
                document.getElementById("linklisthrefcontainer").innerHTML = html;\r
 \r
+       // Anchor list\r
+       html = getAnchorListHTML('anchorlist','href');\r
+       if (html == "")\r
+               document.getElementById("anchorlistrow").style.display = 'none';\r
+       else\r
+               document.getElementById("anchorlistcontainer").innerHTML = html;\r
+\r
        // Resize some elements\r
        if (isVisible('hrefbrowser'))\r
                document.getElementById('href').style.width = '260px';\r
@@ -49,6 +54,13 @@ function init() {
                document.getElementById('popupurl').style.width = '180px';\r
 \r
        elm = inst.dom.getParent(elm, "A");\r
+       if (elm == null) {\r
+               var prospect = inst.dom.create("p", null, inst.selection.getContent());\r
+               if (prospect.childNodes.length === 1) {\r
+                       elm = prospect.firstChild;\r
+               }\r
+       }\r
+\r
        if (elm != null && elm.nodeName == "A")\r
                action = "update";\r
 \r
@@ -360,20 +372,22 @@ function setAttrib(elm, attrib, value) {
 }\r
 \r
 function getAnchorListHTML(id, target) {\r
-       var inst = tinyMCEPopup.editor;\r
-       var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i;\r
-       var html = "";\r
-\r
-       html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" o2nfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value=';\r
-       html += 'this.options[this.selectedIndex].value;">';\r
-       html += '<option value="">---</option>';\r
+       var ed = tinyMCEPopup.editor, nodes = ed.dom.select('a'), name, i, len, html = "";\r
 \r
-       for (i=0; i<nodes.length; i++) {\r
-               if ((name = inst.dom.getAttrib(nodes[i], "name")) != "")\r
+       for (i=0, len=nodes.length; i<len; i++) {\r
+               if ((name = ed.dom.getAttrib(nodes[i], "name")) != "")\r
                        html += '<option value="#' + name + '">' + name + '</option>';\r
        }\r
 \r
-       html += '</select>';\r
+       if (html == "")\r
+               return "";\r
+\r
+       html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'\r
+               + ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'\r
+               + '>'\r
+               + '<option value="">---</option>'\r
+               + html\r
+               + '</select>';\r
 \r
        return html;\r
 }\r
@@ -389,7 +403,6 @@ function insertAction() {
 \r
        // Remove element if there is no href\r
        if (!document.forms[0].href.value) {\r
-               tinyMCEPopup.execCommand("mceBeginUndoLevel");\r
                i = inst.selection.getBookmark();\r
                inst.dom.remove(elm, 1);\r
                inst.selection.moveToBookmark(i);\r
@@ -398,12 +411,10 @@ function insertAction() {
                return;\r
        }\r
 \r
-       tinyMCEPopup.execCommand("mceBeginUndoLevel");\r
-\r
        // Create new anchor elements\r
        if (elm == null) {\r
                inst.getDoc().execCommand("unlink", false, null);\r
-               tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});\r
+               tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});\r
 \r
                elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});\r
                for (i=0; i<elementArray.length; i++)\r
@@ -425,7 +436,7 @@ function insertAction() {
 \r
 function setAllAttribs(elm) {\r
        var formObj = document.forms[0];\r
-       var href = formObj.href.value;\r
+       var href = formObj.href.value.replace(/ /g, '%20');\r
        var target = getSelectValue(formObj, 'targetlist');\r
 \r
        setAttrib(elm, 'href', href);\r
@@ -477,7 +488,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
        var html = "";\r
 \r
        html += '<select id="' + elm_id + '" name="' + elm_id + '"';\r
-       html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';\r
+       html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value=';\r
        html += 'this.options[this.selectedIndex].value;';\r
 \r
        if (typeof(onchange_func) != "undefined")\r
@@ -499,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) {
        var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');\r
        var html = '';\r
 \r
-       html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';\r
+       html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';\r
        html += 'this.options[this.selectedIndex].value;">';\r
        html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';\r
        html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';\r
old mode 100755 (executable)
new mode 100644 (file)
index c71ffbd..3169a56
@@ -1,52 +1 @@
-tinyMCE.addI18n('en.advlink_dlg',{\r
-title:"Insert/edit link",\r
-url:"Link URL",\r
-target:"Target",\r
-titlefield:"Title",\r
-is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",\r
-is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",\r
-list:"Link list",\r
-general_tab:"General",\r
-popup_tab:"Popup",\r
-events_tab:"Events",\r
-advanced_tab:"Advanced",\r
-general_props:"General properties",\r
-popup_props:"Popup properties",\r
-event_props:"Events",\r
-advanced_props:"Advanced properties",\r
-popup_opts:"Options",\r
-anchor_names:"Anchors",\r
-target_same:"Open in this window / frame",\r
-target_parent:"Open in parent window / frame",\r
-target_top:"Open in top frame (replaces all frames)",\r
-target_blank:"Open in new window",\r
-popup:"Javascript popup",\r
-popup_url:"Popup URL",\r
-popup_name:"Window name",\r
-popup_return:"Insert 'return false'",\r
-popup_scrollbars:"Show scrollbars",\r
-popup_statusbar:"Show status bar",\r
-popup_toolbar:"Show toolbars",\r
-popup_menubar:"Show menu bar",\r
-popup_location:"Show location bar",\r
-popup_resizable:"Make window resizable",\r
-popup_dependent:"Dependent (Mozilla/Firefox only)",\r
-popup_size:"Size",\r
-popup_position:"Position (X/Y)",\r
-id:"Id",\r
-style:"Style",\r
-classes:"Classes",\r
-target_name:"Target name",\r
-langdir:"Language direction",\r
-target_langcode:"Target language",\r
-langcode:"Language code",\r
-encoding:"Target character encoding",\r
-mime:"Target MIME type",\r
-rel:"Relationship page to target",\r
-rev:"Relationship target to page",\r
-tabindex:"Tabindex",\r
-accesskey:"Accesskey",\r
-ltr:"Left to right",\r
-rtl:"Right to left",\r
-link_list:"Link list"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.advlink_dlg',{"target_name":"Target Name",classes:"Classes",style:"Style",id:"ID","popup_position":"Position (X/Y)",langdir:"Language Direction","popup_size":"Size","popup_dependent":"Dependent (Mozilla/Firefox Only)","popup_resizable":"Make Window Resizable","popup_location":"Show Location Bar","popup_menubar":"Show Menu Bar","popup_toolbar":"Show Toolbars","popup_statusbar":"Show Status Bar","popup_scrollbars":"Show Scrollbars","popup_return":"Insert \'return false\'","popup_name":"Window Name","popup_url":"Popup URL",popup:"JavaScript Popup","target_blank":"Open in New Window","target_top":"Open in Top Frame (Replaces All Frames)","target_parent":"Open in Parent Window/Frame","target_same":"Open in This Window/Frame","anchor_names":"Anchors","popup_opts":"Options","advanced_props":"Advanced Properties","event_props":"Events","popup_props":"Popup Properties","general_props":"General Properties","advanced_tab":"Advanced","events_tab":"Events","popup_tab":"Popup","general_tab":"General",list:"Link List","is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",titlefield:"Title",target:"Target",url:"Link URL",title:"Insert/Edit Link","link_list":"Link List",rtl:"Right to Left",ltr:"Left to Right",accesskey:"AccessKey",tabindex:"TabIndex",rev:"Relationship Target to Page",rel:"Relationship Page to Target",mime:"Target MIME Type",encoding:"Target Character Encoding",langcode:"Language Code","target_langcode":"Target Language",width:"Width",height:"Height"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 876669c..8ab7c2a
@@ -9,37 +9,38 @@
        <script type="text/javascript" src="js/advlink.js"></script>\r
        <link href="css/advlink.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="advlink" style="display: none">\r
-    <form onsubmit="insertAction();return false;" action="#">\r
-               <div class="tabs">\r
+<body id="advlink" style="display: none" role="application" onload="javascript:mcTabs.displayTab('general_tab','general_panel', true);" aria-labelledby="app_label">\r
+       <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advlink_dlg.title}</span>\r
+       <form onsubmit="insertAction();return false;" action="#">\r
+               <div class="tabs" role="presentation">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li>\r
-                               <li id="popup_tab"><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li>\r
-                               <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel" ><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li>\r
+                               <li id="popup_tab" aria-controls="popup_panel" ><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li>\r
+                               <li id="events_tab" aria-controls="events_panel"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
-               <div class="panel_wrapper">\r
+               <div class="panel_wrapper" role="presentation">\r
                        <div id="general_panel" class="panel current">\r
                                <fieldset>\r
                                        <legend>{#advlink_dlg.general_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table border="0" cellpadding="4" cellspacing="0" role="presentation">\r
                                                <tr>\r
-                                                 <td class="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td>\r
-                                                 <td><table border="0" cellspacing="0" cellpadding="0">\r
-                                                               <tr>\r
-                                                                 <td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" /></td>\r
-                                                                 <td id="hrefbrowsercontainer">&nbsp;</td>\r
-                                                               </tr>\r
-                                                         </table></td>\r
+                                                       <td class="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td>\r
+                                                               <td><table border="0" cellspacing="0" cellpadding="0">\r
+                                                       <tr>\r
+                                                               <td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" aria-required="true" /></td>\r
+                                                               <td id="hrefbrowsercontainer">&nbsp;</td>\r
+                                                       </tr>\r
+                                                       </table></td>\r
                                                </tr>\r
                                                <tr id="linklisthrefrow">\r
                                                        <td class="column1"><label for="linklisthref">{#advlink_dlg.list}</label></td>\r
                                                        <td colspan="2" id="linklisthrefcontainer"><select id="linklisthref"><option value=""></option></select></td>\r
                                                </tr>\r
-                                               <tr>\r
+                                               <tr id="anchorlistrow">\r
                                                        <td class="column1"><label for="anchorlist">{#advlink_dlg.anchor_names}</label></td>\r
                                                        <td colspan="2" id="anchorlistcontainer"><select id="anchorlist"><option value=""></option></select></td>\r
                                                </tr>\r
@@ -70,7 +71,7 @@
                                        <input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" />\r
                                        <label id="ispopuplabel" for="ispopup">{#advlink_dlg.popup}</label>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
                                                <tr>\r
                                                        <td class="nowrap"><label for="popupurl">{#advlink_dlg.popup_url}</label>&nbsp;</td>\r
                                                        <td>\r
                                                        <td class="nowrap"><label for="popupname">{#advlink_dlg.popup_name}</label>&nbsp;</td>\r
                                                        <td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td>\r
                                                </tr>\r
-                                               <tr>\r
-                                                       <td class="nowrap"><label>{#advlink_dlg.popup_size}</label>&nbsp;</td>\r
+                                               <tr role="group" aria-labelledby="popup_size_label">\r
+                                                       <td class="nowrap"><label id="popup_size_label">{#advlink_dlg.popup_size}</label>&nbsp;</td>\r
                                                        <td class="nowrap">\r
-                                                               <input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" /> x\r
-                                                               <input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" /> px\r
+                                                               <span style="display:none" id="width_voiceLabel">{#advlink_dlg.width}</span>\r
+                                                               <input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" aria-labelledby="width_voiceLabel" /> x\r
+                                                               <span style="display:none" id="height_voiceLabel">{#advlink_dlg.height}</span>\r
+                                                               <input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" aria-labelledby="height_voiceLabel" /> px\r
                                                        </td>\r
                                                </tr>\r
-                                               <tr>\r
-                                                       <td class="nowrap" id="labelleft"><label>{#advlink_dlg.popup_position}</label>&nbsp;</td>\r
+                                               <tr role="group" aria-labelledby="popup_position_label center_hint">\r
+                                                       <td class="nowrap" id="labelleft"><label id="popup_position_label">{#advlink_dlg.popup_position}</label>&nbsp;</td>\r
                                                        <td class="nowrap">\r
-                                                               <input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" /> /                                \r
-                                                               <input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" /> (c /c = center)\r
+                                                               <span style="display:none" id="x_voiceLabel">X</span>\r
+                                                               <input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" aria-labelledby="x_voiceLabel" /> /                                \r
+                                                               <span style="display:none" id="y_voiceLabel">Y</span>\r
+                                                               <input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" aria-labelledby="y_voiceLabel" /> <span id="center_hint">(c /c = center)</span>\r
                                                        </td>\r
                                                </tr>\r
                                        </table>\r
                                        <fieldset>\r
                                                <legend>{#advlink_dlg.popup_opts}</legend>\r
 \r
-                                               <table border="0" cellpadding="0" cellspacing="4">\r
+                                               <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
                                                        <tr>\r
                                                                <td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td>\r
                                                                <td class="nowrap"><label id="popuplocationlabel" for="popuplocation">{#advlink_dlg.popup_location}</label></td>\r
                        <fieldset>\r
                                        <legend>{#advlink_dlg.advanced_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
                                                <tr>\r
                                                        <td class="column1"><label id="idlabel" for="id">{#advlink_dlg.id}</label></td> \r
                                                        <td><input id="id" name="id" type="text" value="" /></td> \r
                        <fieldset>\r
                                        <legend>{#advlink_dlg.event_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table border="0" cellpadding="0" cellspacing="4" role="presentation" >\r
                                                <tr>\r
                                                        <td class="column1"><label for="onfocus">onfocus</label></td> \r
                                                        <td><input id="onfocus" name="onfocus" type="text" value="" /></td> \r
                        <input type="submit" id="insert" name="insert" value="{#insert}" />\r
                        <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
                </div>\r
-    </form>\r
+       </form>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index 02d1697..57ecce6
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square")},createControl:function(d,b){var f=this,e,h;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){h=f[d][0]}function c(i,k){var j=true;a(k.styles,function(m,l){if(f.editor.dom.getStyle(i,l)!=m){j=false;return false}});return j}function g(){var k,i=f.editor,l=i.dom,j=i.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,h)){i.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(h){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,h.styles);k.removeAttribute("_mce_style")}}}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){g()}});e.onRenderMenu.add(function(i,j){j.onShowMenu.add(function(){var m=f.editor.dom,l=m.getParent(f.editor.selection.getNode(),"ol,ul"),k;if(l||h){k=f[d];a(j.items,function(n){var o=true;n.setSelected(0);if(l&&!n.isDisabled()){a(k,function(p){if(p.id==n.id){if(!c(l,p)){o=false;return false}}});if(o){n.setSelected(1)}}});if(!l){j.items[h.id].setSelected(1)}}});j.add({id:f.editor.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle"}).setDisabled(1);a(f[d],function(k){k.id=f.editor.dom.uniqueId();j.add({id:k.id,title:k.title,onclick:function(){h=k;g()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
\ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index a61887a..a8f046b
                        // Setup number formats from config or default\r
                        t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");\r
                        t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");\r
+\r
+                       if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))\r
+                               t.isIE7 = true;\r
                },\r
 \r
                createControl: function(name, cm) {\r
-                       var t = this, btn, format;\r
+                       var t = this, btn, format, editor = t.editor;\r
 \r
                        if (name == 'numlist' || name == 'bullist') {\r
                                // Default to first item if it's a default item\r
@@ -50,7 +53,7 @@
 \r
                                        each(format.styles, function(value, name) {\r
                                                // Format doesn't match\r
-                                               if (t.editor.dom.getStyle(node, name) != value) {\r
+                                               if (editor.dom.getStyle(node, name) != value) {\r
                                                        state = false;\r
                                                        return false;\r
                                                }\r
                                };\r
 \r
                                function applyListFormat() {\r
-                                       var list, ed = t.editor, dom = ed.dom, sel = ed.selection;\r
+                                       var list, dom = editor.dom, sel = editor.selection;\r
 \r
                                        // Check for existing list element\r
                                        list = dom.getParent(sel.getNode(), 'ol,ul');\r
 \r
                                        // Switch/add list type if needed\r
                                        if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))\r
-                                               ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');\r
+                                               editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');\r
 \r
                                        // Append styles to new list element\r
                                        if (format) {\r
                                                list = dom.getParent(sel.getNode(), 'ol,ul');\r
-\r
                                                if (list) {\r
                                                        dom.setStyles(list, format.styles);\r
-                                                       list.removeAttribute('_mce_style');\r
+                                                       list.removeAttribute('data-mce-style');\r
                                                }\r
                                        }\r
+\r
+                                       editor.focus();\r
                                };\r
 \r
                                btn = cm.createSplitButton(name, {\r
                                });\r
 \r
                                btn.onRenderMenu.add(function(btn, menu) {\r
+                                       menu.onHideMenu.add(function() {\r
+                                               if (t.bookmark) {\r
+                                                       editor.selection.moveToBookmark(t.bookmark);\r
+                                                       t.bookmark = 0;\r
+                                               }\r
+                                       });\r
+\r
                                        menu.onShowMenu.add(function() {\r
-                                               var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList;\r
+                                               var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;\r
 \r
                                                if (list || format) {\r
                                                        fmtList = t[name];\r
                                                        if (!list)\r
                                                                menu.items[format.id].setSelected(1);\r
                                                }\r
+       \r
+                                               editor.focus();\r
+\r
+                                               // IE looses it's selection so store it away and restore it later\r
+                                               if (tinymce.isIE) {\r
+                                                       t.bookmark = editor.selection.getBookmark(1);\r
+                                               }\r
                                        });\r
 \r
-                                       menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+                                       menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);\r
 \r
                                        each(t[name], function(item) {\r
-                                               item.id = t.editor.dom.uniqueId();\r
+                                               // IE<8 doesn't support lower-greek, skip it\r
+                                               if (t.isIE7 && item.styles.listStyleType == 'lower-greek')\r
+                                                       return;\r
+\r
+                                               item.id = editor.dom.uniqueId();\r
 \r
                                                menu.add({id : item.id, title : item.title, onclick : function() {\r
                                                        format = item;\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js
new file mode 100644 (file)
index 0000000..d54e37a
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..4db4acf
--- /dev/null
@@ -0,0 +1,174 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2011, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.AutolinkPlugin', {\r
+       /**\r
+       * Initializes the plugin, this will be executed after the plugin has been created.\r
+       * This call is done before the editor instance has finished it's initialization so use the onInit event\r
+       * of the editor instance to intercept that event.\r
+       *\r
+       * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
+       * @param {string} url Absolute URL to where the plugin is located.\r
+       */\r
+\r
+       init : function(ed, url) {\r
+               var t = this;\r
+\r
+               // Internet Explorer has built-in automatic linking\r
+               if (tinyMCE.isIE)\r
+                       return;\r
+\r
+               // Add a key down handler\r
+               ed.onKeyDown.add(function(ed, e) {\r
+                       if (e.keyCode == 13)\r
+                               return t.handleEnter(ed);\r
+                       });\r
+\r
+               ed.onKeyPress.add(function(ed, e) {\r
+                       if (e.which == 41)\r
+                               return t.handleEclipse(ed);\r
+               });\r
+\r
+               // Add a key up handler\r
+               ed.onKeyUp.add(function(ed, e) {\r
+                       if (e.keyCode == 32)\r
+                               return t.handleSpacebar(ed);\r
+                       });\r
+              },\r
+\r
+               handleEclipse : function(ed) {\r
+                       this.parseCurrentLine(ed, -1, '(', true);\r
+               },\r
+\r
+               handleSpacebar : function(ed) {\r
+                        this.parseCurrentLine(ed, 0, '', true);\r
+                },\r
+\r
+               handleEnter : function(ed) {\r
+                       this.parseCurrentLine(ed, -1, '', false);\r
+               },\r
+\r
+               parseCurrentLine : function(ed, end_offset, delimiter, goback) {\r
+                       var r, end, start, endContainer, bookmark, text, matches, prev, len;\r
+\r
+                       // We need at least five characters to form a URL,\r
+                       // hence, at minimum, five characters from the beginning of the line.\r
+                       r = ed.selection.getRng().cloneRange();\r
+                       if (r.startOffset < 5) {\r
+                               // During testing, the caret is placed inbetween two text nodes. \r
+                               // The previous text node contains the URL.\r
+                               prev = r.endContainer.previousSibling;\r
+                               if (prev == null) {\r
+                                       if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)\r
+                                               return;\r
+\r
+                                       prev = r.endContainer.firstChild.nextSibling;\r
+                               }\r
+                               len = prev.length;\r
+                               r.setStart(prev, len);\r
+                               r.setEnd(prev, len);\r
+\r
+                               if (r.endOffset < 5)\r
+                                       return;\r
+\r
+                               end = r.endOffset;\r
+                               endContainer = prev;\r
+                       } else {\r
+                               endContainer = r.endContainer;\r
+\r
+                               // Get a text node\r
+                               if (endContainer.nodeType != 3 && endContainer.firstChild) {\r
+                                       while (endContainer.nodeType != 3 && endContainer.firstChild)\r
+                                               endContainer = endContainer.firstChild;\r
+\r
+                                       r.setStart(endContainer, 0);\r
+                                       r.setEnd(endContainer, endContainer.nodeValue.length);\r
+                               }\r
+\r
+                               if (r.endOffset == 1)\r
+                                       end = 2;\r
+                               else\r
+                                       end = r.endOffset - 1 - end_offset;\r
+                       }\r
+\r
+                       start = end;\r
+\r
+                       do\r
+                       {\r
+                               // Move the selection one character backwards.\r
+                               r.setStart(endContainer, end - 2);\r
+                               r.setEnd(endContainer, end - 1);\r
+                               end -= 1;\r
+\r
+                               // Loop until one of the following is found: a blank space, &nbsp;, delimeter, (end-2) >= 0\r
+                       } while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);\r
+\r
+                       if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {\r
+                               r.setStart(endContainer, end);\r
+                               r.setEnd(endContainer, start);\r
+                               end += 1;\r
+                       } else if (r.startOffset == 0) {\r
+                               r.setStart(endContainer, 0);\r
+                               r.setEnd(endContainer, start);\r
+                       }\r
+                       else {\r
+                               r.setStart(endContainer, end);\r
+                               r.setEnd(endContainer, start);\r
+                       }\r
+\r
+                       text = r.toString();\r
+                       matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|[A-Z0-9._%+-]+@)(.+)$/i);\r
+\r
+                       if (matches) {\r
+                               if (matches[1] == 'www.') {\r
+                                       matches[1] = 'http://www.';\r
+                               } else if (/@$/.test(matches[1])) {\r
+                                       matches[1] = 'mailto:' + matches[1];\r
+                               }\r
+\r
+                               bookmark = ed.selection.getBookmark();\r
+\r
+                               ed.selection.setRng(r);\r
+                               tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);\r
+                               ed.selection.moveToBookmark(bookmark);\r
+\r
+                               // TODO: Determine if this is still needed.\r
+                               if (tinyMCE.isWebKit) {\r
+                                       // move the caret to its original position\r
+                                       ed.selection.collapse(false);\r
+                                       var max = Math.min(endContainer.length, start + 1);\r
+                                       r.setStart(endContainer, max);\r
+                                       r.setEnd(endContainer, max);\r
+                                       ed.selection.setRng(r);\r
+                               }\r
+                       }\r
+               },\r
+\r
+               /**\r
+               * Returns information about the plugin as a name/value array.\r
+               * The current keys are longname, author, authorurl, infourl and version.\r
+               *\r
+               * @return {Object} Name/value array containing information about the plugin.\r
+               */\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Autolink',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);\r
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index 1676b15..46d9dc3
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this;if(a.getParam("fullscreen_is_enabled")){return}function b(){var h=a.getDoc(),e=h.body,j=h.documentElement,g=tinymce.DOM,i=d.autoresize_min_height,f;f=tinymce.isIE?e.scrollHeight:j.offsetHeight;if(f>d.autoresize_min_height){i=f}g.setStyle(g.get(a.id+"_ifr"),"height",i+"px");if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=a.getElement().offsetHeight;a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(f,e){f.setProgressState(true);d.throbbing=true;f.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(f,e){b();setTimeout(function(){b();f.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var j,i=a.getDoc(),f=i.body,l=i.documentElement,h=tinymce.DOM,k=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:(tinymce.isWebKit&&f.clientHeight==0?0:f.offsetHeight);if(g>d.autoresize_min_height){k=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){k=d.autoresize_max_height;f.style.overflowY="auto";l.style.overflowY="auto"}else{f.style.overflowY="hidden";l.style.overflowY="hidden";f.scrollTop=0}if(k!==e){j=k-e;h.setStyle(h.get(a.id+"_ifr"),"height",k+"px");e=k;if(tinymce.isWebKit&&j<0){b()}}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onLoad.add(b);a.onLoadContent.add(b)}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index c260b7a..7673bcf
@@ -11,7 +11,7 @@
 (function() {
        /**
         * Auto Resize
-        * 
+        *
         * This plugin automatically resizes the content area to fit its content height.
         * It will retain a minimum height, which is the height of the content area when
         * it's initialized.
@@ -26,7 +26,7 @@
                 * @param {string} url Absolute URL to where the plugin is located.
                 */
                init : function(ed, url) {
-                       var t = this;
+                       var t = this, oldSize = 0;
 
                        if (ed.getParam('fullscreen_is_enabled'))
                                return;
                         * This method gets executed each time the editor needs to resize.
                         */
                        function resize() {
-                               var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
+                               var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
 
                                // Get height differently depending on the browser used
-                               myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight;
+                               myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight);
 
                                // Don't make it smaller than the minimum height
                                if (myHeight > t.autoresize_min_height)
                                        resizeHeight = myHeight;
 
-                               // Resize content element
-                               DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+                               // If a maximum height has been defined don't exceed this height
+                               if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
+                                       resizeHeight = t.autoresize_max_height;
+                                       body.style.overflowY = "auto";
+                                       de.style.overflowY = "auto"; // Old IE
+                               } else {
+                                       body.style.overflowY = "hidden";
+                                       de.style.overflowY = "hidden"; // Old IE
+                                       body.scrollTop = 0;
+                               }
 
-                               // if we're throbbing, we'll re-throb to match the new size
-                               if (t.throbbing) {
-                                       ed.setProgressState(false);
-                                       ed.setProgressState(true);
+                               // Resize content element
+                               if (resizeHeight !== oldSize) {
+                                       deltaSize = resizeHeight - oldSize;
+                                       DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+                                       oldSize = resizeHeight;
+
+                                       // WebKit doesn't decrease the size of the body element until the iframe gets resized
+                                       // So we need to continue to resize the iframe down until the size gets fixed
+                                       if (tinymce.isWebKit && deltaSize < 0)
+                                               resize();
                                }
                        };
 
                        t.editor = ed;
 
                        // Define minimum height
-                       t.autoresize_min_height = ed.getElement().offsetHeight;
+                       t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight));
+
+                       // Define maximum height
+                       t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0));
+
+                       // Add padding at the bottom for better UX
+                       ed.onInit.add(function(ed){
+                               ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
+                       });
 
                        // Add appropriate listeners for resizing content area
                        ed.onChange.add(resize);
                        ed.onPostRender.add(resize);
 
                        if (ed.getParam('autoresize_on_init', true)) {
-                               // Things to do when the editor is ready
-                               ed.onInit.add(function(ed, l) {
-                                       // Show throbber until content area is resized properly
-                                       ed.setProgressState(true);
-                                       t.throbbing = true;
-
-                                       // Hide scrollbars
-                                       ed.getBody().style.overflowY = "hidden";
-                               });
-
-                               ed.onLoadContent.add(function(ed, l) {
-                                       resize();
-
-                                       // Because the content area resizes when its content CSS loads,
-                                       // and we can't easily add a listener to its onload event,
-                                       // we'll just trigger a resize after a short loading period
-                                       setTimeout(function() {
-                                               resize();
-
-                                               // Disable throbber
-                                               ed.setProgressState(false);
-                                               t.throbbing = false;
-                                       }, 1250);
-                               });
+                               ed.onLoad.add(resize);
+                               ed.onLoadContent.add(resize);
                        }
 
                        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
 
        // Register plugin
        tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
-})();
\ No newline at end of file
+})();
old mode 100755 (executable)
new mode 100644 (file)
index b33ebfb..f7d0576
@@ -1 +1 @@
-(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent().replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();m.save("TinyMCE")},getItem:function(l){var m=i.getElement();m.load("TinyMCE");return m.getAttribute(l)},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent();if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
\ No newline at end of file
+(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d8cc112..8311483
                        ed.addButton(RESTORE_DRAFT, {\r
                                title : PLUGIN_NAME + ".restore_content",\r
                                onclick : function() {\r
-                                       if (ed.getContent().replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {\r
+                                       if (ed.getContent({draft: true}).replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {\r
                                                // Show confirm dialog if the editor isn't empty\r
                                                ed.windowManager.confirm(\r
                                                        PLUGIN_NAME + ".warning_message",\r
 \r
                                                                userDataElement.setAttribute(key, value);\r
                                                                userDataElement.expires = self.getExpDate();\r
-                                                               userDataElement.save("TinyMCE");\r
+\r
+                                                               try {\r
+                                                                       userDataElement.save("TinyMCE");\r
+                                                               } catch (e) {\r
+                                                                       // Ignore, saving might fail if "Userdata Persistence" is disabled in IE\r
+                                                               }\r
                                                        },\r
 \r
                                                        getItem : function(key) {\r
                                                                var userDataElement = ed.getElement();\r
 \r
-                                                               userDataElement.load("TinyMCE");\r
-\r
-                                                               return userDataElement.getAttribute(key);\r
+                                                               try {\r
+                                                                       userDataElement.load("TinyMCE");\r
+                                                                       return userDataElement.getAttribute(key);\r
+                                                               } catch (e) {\r
+                                                                       // Ignore, loading might fail if "Userdata Persistence" is disabled in IE\r
+                                                                       return null;\r
+                                                               }\r
                                                        },\r
 \r
                                                        removeItem : function(key) {\r
                                        return;\r
 \r
                                // Store contents if the contents if longer than the minlength of characters\r
-                               content = editor.getContent();\r
+                               content = editor.getContent({draft: true});\r
                                if (content.length > editor.settings.autosave_minlength) {\r
                                        expires = self.getExpDate();\r
 \r
                 * @method restoreDraft\r
                 */\r
                restoreDraft : function() {\r
-                       var self = this, storage = self.storage;\r
+                       var self = this, storage = self.storage, content;\r
 \r
                        if (storage) {\r
                                content = storage.getItem(self.key);\r
old mode 100755 (executable)
new mode 100644 (file)
index db676cd..8f8821f
@@ -1,155 +1 @@
-/**\r
- * editor_plugin_src.js\r
- *\r
- * Copyright 2009, Moxiecode Systems AB\r
- * Released under LGPL License.\r
- *\r
- * License: http://tinymce.moxiecode.com/license\r
- * Contributing: http://tinymce.moxiecode.com/contributing\r
- */\r
-\r
-/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */\r
-\r
-(function() {\r
-       tinymce.create('tinymce.plugins.BBCodePlugin', {\r
-               init : function(ed, url) {\r
-                       var t = this, dialect = ed.getParam('bbcode_dialect', 'dfrn').toLowerCase();\r
-\r
-                       ed.onBeforeSetContent.add(function(ed, o) {\r
-                               o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
-                       });\r
-\r
-                       ed.onPostProcess.add(function(ed, o) {\r
-                               if (o.set)\r
-                                       o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
-\r
-                               if (o.get)\r
-                                       o.content = t['_' + dialect + '_html2bbcode'](o.content);\r
-                       });\r
-               },\r
-\r
-               getInfo : function() {\r
-                       return {\r
-                               longname : 'BBCode Plugin',\r
-                               author : 'Moxiecode Systems AB',\r
-                               authorurl : 'http://tinymce.moxiecode.com',\r
-                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',\r
-                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
-                       };\r
-               },\r
-\r
-               // Private methods\r
-\r
-               // HTML -> BBCode in DFRN dialect\r
-               _dfrn_html2bbcode : function(s) {\r
-                       s = tinymce.trim(s);\r
-\r
-                       function rep(re, str) {\r
-                               s = s.replace(re, str);\r
-                       };\r
-
-
-
-
-                       /* oembed */
-                       function _h2b_cb(match) {
-                               text = bin2hex(match);
-                               function s_h2b(data) {
-                                               match = data;
-                               }
-                               $.ajax({
-                                       url: 'oembed/h2b?text=' + text,
-                                       async: false,
-                                       success: s_h2b,
-                                       dataType: 'html'
-                               });
-                               return match;
-                       }
-                       s = s.replace(/<span class=\"oembed(.*?)<\/span>/gi, _h2b_cb);
-                       /* /oembed */
-
-\r
-                       // example: <strong> to [b]\r
-                       rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
-                       rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
-                       rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
-                       rep(/<font>(.*?)<\/font>/gi,"$1");\r
-                       rep(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");\r
-                       rep(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");\r
-                       rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");\r
-                       rep(/<\/(strong|b)>/gi,"[/b]");\r
-                       rep(/<(strong|b)>/gi,"[b]");\r
-                       rep(/<\/(em|i)>/gi,"[/i]");\r
-                       rep(/<(em|i)>/gi,"[i]");\r
-                       rep(/<\/u>/gi,"[/u]");\r
-                       rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");\r
-                       rep(/<u>/gi,"[u]");\r
-                       rep(/<blockquote[^>]*>/gi,"[quote]");\r
-                       rep(/<\/blockquote>/gi,"[/quote]");\r
-                       rep(/<br \/>/gi,"\n\n");\r
-                       rep(/<br\/>/gi,"\n\n");\r
-                       rep(/<br>/gi,"\n");\r
-                       rep(/<p>/gi,"");\r
-                       rep(/<\/p>/gi,"\n");\r
-                       rep(/&nbsp;/gi," ");\r
-                       rep(/&quot;/gi,"\"");\r
-                       rep(/&lt;/gi,"<");\r
-                       rep(/&gt;/gi,">");\r
-                       rep(/&amp;/gi,"&");\r
-\r
-                       return s; \r
-               },\r
-\r
-               // BBCode -> HTML from DFRN dialect\r
-               _dfrn_bbcode2html : function(s) {\r
-                       s = tinymce.trim(s);\r
-\r
-                       function rep(re, str) {\r
-                               s = s.replace(re, str);\r
-                       };\r
-\r
-                       // example: [b] to <strong>\r
-                       rep(/\n/gi,"<br />");\r
-                       rep(/\[b\]/gi,"<strong>");\r
-                       rep(/\[\/b\]/gi,"</strong>");\r
-                       rep(/\[i\]/gi,"<em>");\r
-                       rep(/\[\/i\]/gi,"</em>");\r
-                       rep(/\[u\]/gi,"<u>");\r
-                       rep(/\[\/u\]/gi,"</u>");\r
-                       rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
-                       rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
-                       rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");\r
-                       rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
-                       rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");\r
-                       rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");\r
-                       rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");\r
-                       rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");\r
-
-                       /* oembed */
-                       function _b2h_cb(match, url) {
-                               url = bin2hex(url);
-                               function s_b2h(data) {
-                                               match = data;
-                               }
-                               $.ajax({
-                                       url: 'oembed/b2h?url=' + url,
-                                       async: false,
-                                       success: s_b2h,
-                                       dataType: 'html'
-                               });
-                               return match;
-                       }
-                       s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);
-                       
-                       /* /oembed */
-\r
-                       return s; \r
-               }\r
-       });\r
-\r
-       // Register plugin\r
-       tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);\r
-})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/&nbsp;|\u00a0/gi," ");b(/&quot;/gi,'"');b(/&lt;/gi,"<");b(/&gt;/gi,">");b(/&amp;/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"<br />");b(/\[b\]/gi,"<strong>");b(/\[\/b\]/gi,"</strong>");b(/\[i\]/gi,"<em>");b(/\[\/i\]/gi,"</em>");b(/\[u\]/gi,"<u>");b(/\[\/u\]/gi,"</u>");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>');b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js
deleted file mode 100755 (executable)
index b0926c9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(function(){tinymce.create('tinymce.plugins.BBCodePlugin',{init:function(ed,url){var t=this,dialect=ed.getParam('bbcode_dialect','dfrn').toLowerCase();ed.onBeforeSetContent.add(function(ed,o){o.content=t['_'+dialect+'_bbcode2html'](o.content)});ed.onPostProcess.add(function(ed,o){if(o.set)o.content=t['_'+dialect+'_bbcode2html'](o.content);if(o.get)o.content=t['_'+dialect+'_html2bbcode'](o.content)})},getInfo:function(){return{longname:'BBCode Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',version:tinymce.majorVersion+"."+tinymce.minorVersion version:tinymce.majorVersion+"."+tinymce.minorVersion}},_dfrn_html2bbcode:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/<font>(.*?)<\/font>/gi,"$1");rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");rep(/<\/(strong|b)>/gi,"[/b]");rep(/<(strong|b)>/gi,"[b]");rep(/<\/(em|i)>/gi,"[/i]");rep(/<(em|i)>/gi,"[i]");rep(/<\/u>/gi,"[/u]");rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");rep(/<u>/gi,"[u]");rep(/<blockquote[^>]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/<br \/>/gi,"\n");rep(/<br\/>/gi,"\n");rep(/<br>/gi,"\n");rep(/<p>/gi,"");rep(/<\/p>/gi,"\n");rep(/&nbsp;/gi," ");rep(/&quot;/gi,"\"");rep(/&lt;/gi,"<");rep(/&gt;/gi,">");rep(/&amp;/gi,"&");return s},_dfrn_bbcode2html:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/\n/gi,"<br />");rep(/\[b\]/gi,"<strong>");rep(/\[\/b\]/gi,"</strong>");rep(/\[i\]/gi,"<em>");rep(/\[\/i\]/gi,"</em>");rep(/\[u\]/gi,"<u>");rep(/\[\/u\]/gi,"</u>");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");return s}});tinymce.PluginManager.add('bbcode',tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 9749e51..4f99010
@@ -1 +1 @@
-(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(d){var f=this,g;f.editor=d;f.onContextMenu=new tinymce.util.Dispatcher(this);d.onContextMenu.add(function(h,i){if(!i.ctrlKey){if(g){h.selection.setRng(g)}f._getMenu(h).showMenu(i.clientX,i.clientY);a.add(h.getDoc(),"click",function(j){e(h,j)});a.cancel(i)}});d.onRemove.add(function(){if(f._menu){f._menu.removeAll()}});function e(h,i){g=null;if(i&&i.button==2){g=h.selection.getRng();return}if(f._menu){f._menu.removeAll();f._menu.destroy();a.remove(h.getDoc(),"click",e)}}d.onMouseDown.add(e);d.onKeyDown.add(e)},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
\ No newline at end of file
+(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(e){var h=this,f,d,i;h.editor=e;d=e.settings.contextmenu_never_use_native;h.onContextMenu=new tinymce.util.Dispatcher(this);f=e.onContextMenu.add(function(j,k){if((i!==0?i:k.ctrlKey)&&!d){return}a.cancel(k);if(k.target.nodeName=="IMG"){j.selection.select(k.target)}h._getMenu(j).showMenu(k.clientX||k.pageX,k.clientY||k.pageY);a.add(j.getDoc(),"click",function(l){g(j,l)});j.nodeChanged()});e.onRemove.add(function(){if(h._menu){h._menu.removeAll()}});function g(j,k){i=0;if(k&&k.button==2){i=k.ctrlKey;return}if(h._menu){h._menu.removeAll();h._menu.destroy();a.remove(j.getDoc(),"click",g);h._menu=null}}e.onMouseDown.add(g);e.onKeyDown.add(g);e.onKeyDown.add(function(j,k){if(k.shiftKey&&!k.ctrlKey&&!k.altKey&&k.keyCode===121){a.cancel(k);f(j,k)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(e){var g=this,d=g._menu,j=e.selection,f=j.isCollapsed(),h=j.getNode()||e.getBody(),i,k;if(d){d.removeAll();d.destroy()}k=b.getPos(e.getContentAreaContainer());d=e.controlManager.createDropMenu("contextmenu",{offset_x:k.x+e.getParam("contextmenu_offset_x",0),offset_y:k.y+e.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});g._menu=d;d.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(f);d.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(f);d.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((h.nodeName=="A"&&!e.dom.getAttrib(h,"name"))||!f){d.addSeparator();d.add({title:"advanced.link_desc",icon:"link",cmd:e.plugins.advlink?"mceAdvLink":"mceLink",ui:true});d.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}d.addSeparator();d.add({title:"advanced.image_desc",icon:"image",cmd:e.plugins.advimage?"mceAdvImage":"mceImage",ui:true});d.addSeparator();i=d.addMenu({title:"contextmenu.align"});i.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});i.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});i.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});i.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});g.onContextMenu.dispatch(g,d,h,f);return d}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 13813a6..004d011
                 * @param {string} url Absolute URL to where the plugin is located.\r
                 */\r
                init : function(ed) {\r
-                       var t = this, lastRng;\r
+                       var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey;\r
 \r
                        t.editor = ed;\r
 \r
+                       contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;\r
+\r
                        /**\r
                         * This event gets fired when the context menu is shown.\r
                         *\r
                         */\r
                        t.onContextMenu = new tinymce.util.Dispatcher(this);\r
 \r
-                       ed.onContextMenu.add(function(ed, e) {\r
-                               if (!e.ctrlKey) {\r
-                                       // Restore the last selection since it was removed\r
-                                       if (lastRng)\r
-                                               ed.selection.setRng(lastRng);\r
+                       showMenu = ed.onContextMenu.add(function(ed, e) {\r
+                               // Block TinyMCE menu on ctrlKey and work around Safari issue\r
+                               if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative)\r
+                                       return;\r
 \r
-                                       t._getMenu(ed).showMenu(e.clientX, e.clientY);\r
-                                       Event.add(ed.getDoc(), 'click', function(e) {\r
-                                               hide(ed, e);\r
-                                       });\r
-                                       Event.cancel(e);\r
-                               }\r
+                               Event.cancel(e);\r
+\r
+                               // Select the image if it's clicked. WebKit would other wise expand the selection\r
+                               if (e.target.nodeName == 'IMG')\r
+                                       ed.selection.select(e.target);\r
+\r
+                               t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY);\r
+                               Event.add(ed.getDoc(), 'click', function(e) {\r
+                                       hide(ed, e);\r
+                               });\r
+\r
+                               ed.nodeChanged();\r
                        });\r
 \r
                        ed.onRemove.add(function() {\r
                        });\r
 \r
                        function hide(ed, e) {\r
-                               lastRng = null;\r
+                               realCtrlKey = 0;\r
 \r
                                // Since the contextmenu event moves\r
                                // the selection we need to store it away\r
                                if (e && e.button == 2) {\r
-                                       lastRng = ed.selection.getRng();\r
+                                       realCtrlKey = e.ctrlKey;\r
                                        return;\r
                                }\r
 \r
                                        t._menu.removeAll();\r
                                        t._menu.destroy();\r
                                        Event.remove(ed.getDoc(), 'click', hide);\r
+                                       t._menu = null;\r
                                }\r
                        };\r
 \r
                        ed.onMouseDown.add(hide);\r
                        ed.onKeyDown.add(hide);\r
+                       ed.onKeyDown.add(function(ed, e) {\r
+                               if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {\r
+                                       Event.cancel(e);\r
+                                       showMenu(ed, e);\r
+                               }\r
+                       });\r
                },\r
 \r
                /**\r
                },\r
 \r
                _getMenu : function(ed) {\r
-                       var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;\r
+                       var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p;\r
 \r
                        if (m) {\r
                                m.removeAll();\r
                                m.destroy();\r
                        }\r
 \r
-                       p1 = DOM.getPos(ed.getContentAreaContainer());\r
-                       p2 = DOM.getPos(ed.getContainer());\r
+                       p = DOM.getPos(ed.getContentAreaContainer());\r
 \r
                        m = ed.controlManager.createDropMenu('contextmenu', {\r
-                               offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0),\r
-                               offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0),\r
-                               constrain : 1\r
+                               offset_x : p.x + ed.getParam('contextmenu_offset_x', 0),\r
+                               offset_y : p.y + ed.getParam('contextmenu_offset_y', 0),\r
+                               constrain : 1,\r
+                               keyboard_focus: true\r
                        });\r
 \r
                        t._menu = m;\r
 \r
        // Register plugin\r
        tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);\r
-})();
\ No newline at end of file
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index 55a1d72..1013556
@@ -5,36 +5,38 @@
        <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
        <script type="text/javascript" src="js/emotions.js"></script>\r
 </head>\r
-<body style="display: none">\r
-       <div align="center">\r
-               <div class="title">{#emotions_dlg.title}:<br /><br /></div>\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#emotions_dlg.title}</span>\r
+<div align="center">\r
+       <div class="title">{#emotions_dlg.title}:<br /><br /></div>\r
 \r
-               <table border="0" cellspacing="0" cellpadding="4">\r
-                 <tr>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}" title="{#emotions_dlg.cool}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}" title="{#emotions_dlg.cry}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}" title="{#emotions_dlg.embarassed}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}" title="{#emotions_dlg.foot_in_mouth}" /></a></td>\r
-                 </tr>\r
-                 <tr>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}" title="{#emotions_dlg.frown}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}" title="{#emotions_dlg.innocent}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}" title="{#emotions_dlg.kiss}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}" title="{#emotions_dlg.laughing}" /></a></td>\r
-                 </tr>\r
-                 <tr>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}" title="{#emotions_dlg.money_mouth}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}" title="{#emotions_dlg.sealed}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}" title="{#emotions_dlg.smile}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}" title="{#emotions_dlg.surprised}" /></a></td>\r
-                 </tr>\r
-                 <tr>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}" title="{#emotions_dlg.tongue_out}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}" title="{#emotions_dlg.undecided}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}" title="{#emotions_dlg.wink}" /></a></td>\r
-                       <td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}" title="{#emotions_dlg.yell}" /></a></td>\r
-                 </tr>\r
-               </table>\r
-       </div>\r
+       <table id="emoticon_table" role="presentation" border="0" cellspacing="0" cellpadding="4">\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cool}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cry}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}"  /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.frown}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}. {#emotions_dlg.usage}"  /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}"/></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.smile}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+               <tr>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.tongue_out}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.wink}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}. {#emotions_dlg.usage}" /></a></td>\r
+                       <td><a class="emoticon_link" role="button" title="{#emotions_dlg.yell}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}. {#emotions_dlg.usage}" /></a></td>\r
+               </tr>\r
+       </table>\r
+       <div>{#emotions_dlg.usage}</div>\r
+</div>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index 16f68cc..c7cf101
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 1606c11..82c5b18
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index b33d3cc..fe66220
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index e6a9e60..fd27edf
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-smile.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-smile.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index cb99cdd..0cc9bb7
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 9faf1af..0631c76
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-wink.gif and b/library/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-wink.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index c549367..b360f20
@@ -1,8 +1,29 @@
 tinyMCEPopup.requireLangPack();\r
 \r
 var EmotionsDialog = {\r
+       addKeyboardNavigation: function(){\r
+               var tableElm, cells, settings;\r
+                       \r
+               cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");\r
+                       \r
+               settings ={\r
+                       root: "emoticon_table",\r
+                       items: cells\r
+               };\r
+               cells[0].tabindex=0;\r
+               tinyMCEPopup.dom.addClass(cells[0], "mceFocus");\r
+               if (tinymce.isGecko) {\r
+                       cells[0].focus();               \r
+               } else {\r
+                       setTimeout(function(){\r
+                               cells[0].focus();\r
+                       }, 100);\r
+               }\r
+               tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);\r
+       }, \r
        init : function(ed) {\r
                tinyMCEPopup.resizeToInnerSize();\r
+               this.addKeyboardNavigation();\r
        },\r
 \r
        insert : function(file, title) {\r
old mode 100755 (executable)
new mode 100644 (file)
index 3b57ad9..037c4b5
@@ -1,20 +1 @@
-tinyMCE.addI18n('en.emotions_dlg',{\r
-title:"Insert emotion",\r
-desc:"Emotions",\r
-cool:"Cool",\r
-cry:"Cry",\r
-embarassed:"Embarassed",\r
-foot_in_mouth:"Foot in mouth",\r
-frown:"Frown",\r
-innocent:"Innocent",\r
-kiss:"Kiss",\r
-laughing:"Laughing",\r
-money_mouth:"Money mouth",\r
-sealed:"Sealed",\r
-smile:"Smile",\r
-surprised:"Surprised",\r
-tongue_out:"Tongue out",\r
-undecided:"Undecided",\r
-wink:"Wink",\r
-yell:"Yell"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",usage:"Use left and right arrows to navigate.",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"});
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js
new file mode 100644 (file)
index 0000000..0a4551d
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.ExampleDependencyPlugin",{init:function(a,b){},getInfo:function(){return{longname:"Example Dependency plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency",version:"1.0"}}});tinymce.PluginManager.add("example_dependency",tinymce.plugins.ExampleDependencyPlugin,["example"])})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..e1c55e4
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+
+       tinymce.create('tinymce.plugins.ExampleDependencyPlugin', {
+               /**
+                * Initializes the plugin, this will be executed after the plugin has been created.
+                * This call is done before the editor instance has finished it's initialization so use the onInit event
+                * of the editor instance to intercept that event.
+                *
+                * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+                * @param {string} url Absolute URL to where the plugin is located.
+                */
+               init : function(ed, url) {
+               },
+
+
+               /**
+                * Returns information about the plugin as a name/value array.
+                * The current keys are longname, author, authorurl, infourl and version.
+                *
+                * @return {Object} Name/value array containing information about the plugin.
+                */
+               getInfo : function() {
+                       return {
+                               longname : 'Example Dependency plugin',
+                               author : 'Some author',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency',
+                               version : "1.0"
+                       };
+               }
+       });
+
+       /**
+        * Register the plugin, specifying the list of the plugins that this plugin depends on.  They are specified in a list, with the list loaded in order.
+        * plugins in this list will be initialised when this plugin is initialized. (before the init method is called).
+        * plugins in a depends list should typically be specified using the short name).  If neccesary this can be done
+        * with an object which has the url to the plugin and the shortname.
+        */
+       tinymce.PluginManager.add('example_dependency', tinymce.plugins.ExampleDependencyPlugin, ['example']);
+})();
old mode 100755 (executable)
new mode 100644 (file)
index 7a3334f..2675cec
        width: 240px;\r
 }\r
 \r
-/* Head list classes */\r
-\r
-.headlistwrapper {\r
-       width: 100%;\r
-}\r
-\r
-.addbutton, .removebutton, .moveupbutton, .movedownbutton {\r
-       border-top: 1px solid;\r
-       border-left: 1px solid;\r
-       border-bottom: 1px solid;\r
-       border-right: 1px solid;\r
-       border-color: #F0F0EE;\r
-       cursor: default;\r
-       display: block;\r
-       width: 20px;\r
-       height: 20px;\r
-}\r
-\r
 #doctypes {\r
        width: 200px;\r
 }\r
 \r
-.addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover {\r
-       border: 1px solid #0A246A;\r
-       background-color: #B6BDD2;\r
-}\r
-\r
-.addbutton {\r
-       background-image: url('../images/add.gif');\r
-       float: left;\r
-       margin-right: 3px;\r
-}\r
-\r
-.removebutton {\r
-       background-image: url('../images/remove.gif');\r
-       float: left;\r
-}\r
-\r
-.moveupbutton {\r
-       background-image: url('../images/move_up.gif');\r
-       float: left;\r
-       margin-right: 3px;\r
-}\r
+/* Head list classes */\r
 \r
-.movedownbutton {\r
-       background-image: url('../images/move_down.gif');\r
-       float: left;\r
+.headlistwrapper {\r
+       width: 100%;\r
 }\r
 \r
 .selected {\r
old mode 100755 (executable)
new mode 100644 (file)
index aeaa669..dcf7602
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceFullPageProperties",function(){a.windowManager.open({file:b+"/fullpage.htm",width:430+parseInt(a.getLang("fullpage.delta_width",0)),height:495+parseInt(a.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:b,head_html:c.head})});a.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});a.onBeforeSetContent.add(c._setContent,c);a.onSetContent.add(c._setBodyAttribs,c);a.onGetContent.add(c._getContent,c)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_setBodyAttribs:function(d,a){var l,c,e,g,b,h,j,f=this.head.match(/body(.*?)>/i);if(f&&f[1]){l=f[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(l){for(c=0,e=l.length;c<e;c++){g=l[c].split("=");b=g[0].replace(/\s/,"");h=g[1];if(h){h=h.replace(/^\s+/,"").replace(/\s+$/,"");j=h.match(/^["'](.*)["']$/);if(j){h=j[1]}}else{h=b}d.dom.setAttrib(d.getBody(),"style",h)}}}},_createSerializer:function(){return new tinymce.dom.Serializer({dom:this.editor.dom,apply_source_formatting:true})},_setContent:function(d,b){var h=this,a,j,f=b.content,g,i="";if(b.format=="raw"&&h.head){return}if(b.source_view&&d.getParam("fullpage_hide_in_source_view")){return}f=f.replace(/<(\/?)BODY/gi,"<$1body");a=f.indexOf("<body");if(a!=-1){a=f.indexOf(">",a);h.head=f.substring(0,a+1);j=f.indexOf("</body",a);if(j==-1){j=f.indexOf("</body",j)}b.content=f.substring(a+1,j);h.foot=f.substring(j);function e(c){return c.replace(/<\/?[A-Z]+/g,function(k){return k.toLowerCase()})}h.head=e(h.head);h.foot=e(h.foot)}else{h.head="";if(d.getParam("fullpage_default_xml_pi")){h.head+='<?xml version="1.0" encoding="'+d.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}h.head+=d.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');h.head+="\n<html>\n<head>\n<title>"+d.getParam("fullpage_default_title","Untitled document")+"</title>\n";if(g=d.getParam("fullpage_default_encoding")){h.head+='<meta http-equiv="Content-Type" content="'+g+'" />\n'}if(g=d.getParam("fullpage_default_font_family")){i+="font-family: "+g+";"}if(g=d.getParam("fullpage_default_font_size")){i+="font-size: "+g+";"}if(g=d.getParam("fullpage_default_text_color")){i+="color: "+g+";"}h.head+="</head>\n<body"+(i?' style="'+i+'"':"")+">\n";h.foot="\n</body>\n</html>"}},_getContent:function(a,c){var b=this;if(!c.source_view||!a.getParam("fullpage_hide_in_source_view")){c.content=tinymce.trim(b.head)+"\n"+tinymce.trim(c.content)+"\n"+tinymce.trim(b.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})();
\ No newline at end of file
+(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}e.remove("fullpage_styles");if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l);j=e.get("fullpage_styles");if(j.styleSheet){j.styleSheet.cssText=l}}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+e+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index a2c9df8..23de7c5
@@ -9,6 +9,8 @@
  */\r
 \r
 (function() {\r
+       var each = tinymce.each, Node = tinymce.html.Node;\r
+\r
        tinymce.create('tinymce.plugins.FullPagePlugin', {\r
                init : function(ed, url) {\r
                        var t = this;\r
@@ -24,7 +26,7 @@
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url,\r
-                                       head_html : t.head\r
+                                       data : t._htmlToData()\r
                                });\r
                        });\r
 \r
@@ -32,7 +34,6 @@
                        ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});\r
 \r
                        ed.onBeforeSetContent.add(t._setContent, t);\r
-                       ed.onSetContent.add(t._setBodyAttribs, t);\r
                        ed.onGetContent.add(t._getContent, t);\r
                },\r
 \r
 \r
                // Private plugin internal methods\r
 \r
-               _setBodyAttribs : function(ed, o) {\r
-                       var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i);\r
+               _htmlToData : function() {\r
+                       var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;\r
 \r
-                       if (attr && attr[1]) {\r
-                               bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);\r
+                       function getAttr(elm, name) {\r
+                               var value = elm.attr(name);\r
 \r
-                               if (bdattr) {\r
-                                       for(i = 0, len = bdattr.length; i < len; i++) {\r
-                                               kv = bdattr[i].split('=');\r
-                                               k = kv[0].replace(/\s/,'');\r
-                                               v = kv[1];\r
+                               return value || '';\r
+                       };\r
 \r
-                                               if (v) {\r
-                                                       v = v.replace(/^\s+/,'').replace(/\s+$/,'');\r
-                                                       t = v.match(/^["'](.*)["']$/);\r
+                       // Default some values\r
+                       data.fontface = editor.getParam("fullpage_default_fontface", "");\r
+                       data.fontsize = editor.getParam("fullpage_default_fontsize", "");\r
+\r
+                       // Parse XML PI\r
+                       elm = headerFragment.firstChild;\r
+                       if (elm.type == 7) {\r
+                               data.xml_pi = true;\r
+                               matches = /encoding="([^"]+)"/.exec(elm.value);\r
+                               if (matches)\r
+                                       data.docencoding = matches[1];\r
+                       }\r
 \r
-                                                       if (t)\r
-                                                               v = t[1];\r
-                                               } else\r
-                                                       v = k;\r
+                       // Parse doctype\r
+                       elm = headerFragment.getAll('#doctype')[0];\r
+                       if (elm)\r
+                               data.doctype = '<!DOCTYPE' + elm.value + ">"; \r
 \r
-                                               ed.dom.setAttrib(ed.getBody(), 'style', v);\r
-                                       }\r
+                       // Parse title element\r
+                       elm = headerFragment.getAll('title')[0];\r
+                       if (elm && elm.firstChild) {\r
+                               data.metatitle = elm.firstChild.value;\r
+                       }\r
+\r
+                       // Parse meta elements\r
+                       each(headerFragment.getAll('meta'), function(meta) {\r
+                               var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;\r
+\r
+                               if (name)\r
+                                       data['meta' + name.toLowerCase()] = meta.attr('content');\r
+                               else if (httpEquiv == "Content-Type") {\r
+                                       matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));\r
+\r
+                                       if (matches)\r
+                                               data.docencoding = matches[1];\r
                                }\r
+                       });\r
+\r
+                       // Parse html attribs\r
+                       elm = headerFragment.getAll('html')[0];\r
+                       if (elm)\r
+                               data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');\r
+       \r
+                       // Parse stylesheet\r
+                       elm = headerFragment.getAll('link')[0];\r
+                       if (elm && elm.attr('rel') == 'stylesheet')\r
+                               data.stylesheet = elm.attr('href');\r
+\r
+                       // Parse body parts\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               data.langdir = getAttr(elm, 'dir');\r
+                               data.style = getAttr(elm, 'style');\r
+                               data.visited_color = getAttr(elm, 'vlink');\r
+                               data.link_color = getAttr(elm, 'link');\r
+                               data.active_color = getAttr(elm, 'alink');\r
                        }\r
+\r
+                       return data;\r
                },\r
 \r
-               _createSerializer : function() {\r
-                       return new tinymce.dom.Serializer({\r
-                               dom : this.editor.dom,\r
-                               apply_source_formatting : true\r
+               _dataToHtml : function(data) {\r
+                       var headerFragment, headElement, html, elm, value, dom = this.editor.dom;\r
+\r
+                       function setAttr(elm, name, value) {\r
+                               elm.attr(name, value ? value : undefined);\r
+                       };\r
+\r
+                       function addHeadNode(node) {\r
+                               if (headElement.firstChild)\r
+                                       headElement.insert(node, headElement.firstChild);\r
+                               else\r
+                                       headElement.append(node);\r
+                       };\r
+\r
+                       headerFragment = this._parseHeader();\r
+                       headElement = headerFragment.getAll('head')[0];\r
+                       if (!headElement) {\r
+                               elm = headerFragment.getAll('html')[0];\r
+                               headElement = new Node('head', 1);\r
+\r
+                               if (elm.firstChild)\r
+                                       elm.insert(headElement, elm.firstChild, true);\r
+                               else\r
+                                       elm.append(headElement);\r
+                       }\r
+\r
+                       // Add/update/remove XML-PI\r
+                       elm = headerFragment.firstChild;\r
+                       if (data.xml_pi) {\r
+                               value = 'version="1.0"';\r
+\r
+                               if (data.docencoding)\r
+                                       value += ' encoding="' + data.docencoding + '"';\r
+\r
+                               if (elm.type != 7) {\r
+                                       elm = new Node('xml', 7);\r
+                                       headerFragment.insert(elm, headerFragment.firstChild, true);\r
+                               }\r
+\r
+                               elm.value = value;\r
+                       } else if (elm && elm.type == 7)\r
+                               elm.remove();\r
+\r
+                       // Add/update/remove doctype\r
+                       elm = headerFragment.getAll('#doctype')[0];\r
+                       if (data.doctype) {\r
+                               if (!elm) {\r
+                                       elm = new Node('#doctype', 10);\r
+\r
+                                       if (data.xml_pi)\r
+                                               headerFragment.insert(elm, headerFragment.firstChild);\r
+                                       else\r
+                                               addHeadNode(elm);\r
+                               }\r
+\r
+                               elm.value = data.doctype.substring(9, data.doctype.length - 1);\r
+                       } else if (elm)\r
+                               elm.remove();\r
+\r
+                       // Add/update/remove title\r
+                       elm = headerFragment.getAll('title')[0];\r
+                       if (data.metatitle) {\r
+                               if (!elm) {\r
+                                       elm = new Node('title', 1);\r
+                                       elm.append(new Node('#text', 3)).value = data.metatitle;\r
+                                       addHeadNode(elm);\r
+                               }\r
+                       }\r
+\r
+                       // Add meta encoding\r
+                       if (data.docencoding) {\r
+                               elm = null;\r
+                               each(headerFragment.getAll('meta'), function(meta) {\r
+                                       if (meta.attr('http-equiv') == 'Content-Type')\r
+                                               elm = meta;\r
+                               });\r
+\r
+                               if (!elm) {\r
+                                       elm = new Node('meta', 1);\r
+                                       elm.attr('http-equiv', 'Content-Type');\r
+                                       elm.shortEnded = true;\r
+                                       addHeadNode(elm);\r
+                               }\r
+\r
+                               elm.attr('content', 'text/html; charset=' + data.docencoding);\r
+                       }\r
+\r
+                       // Add/update/remove meta\r
+                       each('keywords,description,author,copyright,robots'.split(','), function(name) {\r
+                               var nodes = headerFragment.getAll('meta'), i, meta, value = data['meta' + name];\r
+\r
+                               for (i = 0; i < nodes.length; i++) {\r
+                                       meta = nodes[i];\r
+\r
+                                       if (meta.attr('name') == name) {\r
+                                               if (value)\r
+                                                       meta.attr('content', value);\r
+                                               else\r
+                                                       meta.remove();\r
+\r
+                                               return;\r
+                                       }\r
+                               }\r
+\r
+                               if (value) {\r
+                                       elm = new Node('meta', 1);\r
+                                       elm.attr('name', name);\r
+                                       elm.attr('content', value);\r
+                                       elm.shortEnded = true;\r
+\r
+                                       addHeadNode(elm);\r
+                               }\r
                        });\r
+\r
+                       // Add/update/delete link\r
+                       elm = headerFragment.getAll('link')[0];\r
+                       if (elm && elm.attr('rel') == 'stylesheet') {\r
+                               if (data.stylesheet)\r
+                                       elm.attr('href', data.stylesheet);\r
+                               else\r
+                                       elm.remove();\r
+                       } else if (data.stylesheet) {\r
+                               elm = new Node('link', 1);\r
+                               elm.attr({\r
+                                       rel : 'stylesheet',\r
+                                       text : 'text/css',\r
+                                       href : data.stylesheet\r
+                               });\r
+                               elm.shortEnded = true;\r
+\r
+                               addHeadNode(elm);\r
+                       }\r
+\r
+                       // Update body attributes\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               setAttr(elm, 'dir', data.langdir);\r
+                               setAttr(elm, 'style', data.style);\r
+                               setAttr(elm, 'vlink', data.visited_color);\r
+                               setAttr(elm, 'link', data.link_color);\r
+                               setAttr(elm, 'alink', data.active_color);\r
+\r
+                               // Update iframe body as well\r
+                               dom.setAttribs(this.editor.getBody(), {\r
+                                       style : data.style,\r
+                                       dir : data.dir,\r
+                                       vLink : data.visited_color,\r
+                                       link : data.link_color,\r
+                                       aLink : data.active_color\r
+                               });\r
+                       }\r
+\r
+                       // Set html attributes\r
+                       elm = headerFragment.getAll('html')[0];\r
+                       if (elm) {\r
+                               setAttr(elm, 'lang', data.langcode);\r
+                               setAttr(elm, 'xml:lang', data.langcode);\r
+                       }\r
+\r
+                       // Serialize header fragment and crop away body part\r
+                       html = new tinymce.html.Serializer({\r
+                               validate: false,\r
+                               indent: true,\r
+                               apply_source_formatting : true,\r
+                               indent_before: 'head,html,body,meta,title,script,link,style',\r
+                               indent_after: 'head,html,body,meta,title,script,link,style'\r
+                       }).serialize(headerFragment);\r
+\r
+                       this.head = html.substring(0, html.indexOf('</body>'));\r
+               },\r
+\r
+               _parseHeader : function() {\r
+                       // Parse the contents with a DOM parser\r
+                       return new tinymce.html.DomParser({\r
+                               validate: false,\r
+                               root_name: '#document'\r
+                       }).parse(this.head);\r
                },\r
 \r
                _setContent : function(ed, o) {\r
-                       var t = this, sp, ep, c = o.content, v, st = '';\r
+                       var self = this, startPos, endPos, content = o.content, headerFragment, styles = '', dom = self.editor.dom, elm;\r
+\r
+                       function low(s) {\r
+                               return s.replace(/<\/?[A-Z]+/g, function(a) {\r
+                                       return a.toLowerCase();\r
+                               })\r
+                       };\r
 \r
                        // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate\r
-                       if (o.format == 'raw' && t.head)\r
+                       if (o.format == 'raw' && self.head)\r
                                return;\r
 \r
                        if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))\r
                                return;\r
 \r
                        // Parse out head, body and footer\r
-                       c = c.replace(/<(\/?)BODY/gi, '<$1body');\r
-                       sp = c.indexOf('<body');\r
+                       content = content.replace(/<(\/?)BODY/gi, '<$1body');\r
+                       startPos = content.indexOf('<body');\r
 \r
-                       if (sp != -1) {\r
-                               sp = c.indexOf('>', sp);\r
-                               t.head = c.substring(0, sp + 1);\r
+                       if (startPos != -1) {\r
+                               startPos = content.indexOf('>', startPos);\r
+                               self.head = low(content.substring(0, startPos + 1));\r
 \r
-                               ep = c.indexOf('</body', sp);\r
-                               if (ep == -1)\r
-                                       ep = c.indexOf('</body', ep);\r
+                               endPos = content.indexOf('</body', startPos);\r
+                               if (endPos == -1)\r
+                                       endPos = content.length;\r
 \r
-                               o.content = c.substring(sp + 1, ep);\r
-                               t.foot = c.substring(ep);\r
+                               o.content = content.substring(startPos + 1, endPos);\r
+                               self.foot = low(content.substring(endPos));\r
+                       } else {\r
+                               self.head = this._getDefaultHeader();\r
+                               self.foot = '\n</body>\n</html>';\r
+                       }\r
 \r
-                               function low(s) {\r
-                                       return s.replace(/<\/?[A-Z]+/g, function(a) {\r
-                                               return a.toLowerCase();\r
-                                       })\r
-                               };\r
+                       // Parse header and update iframe\r
+                       headerFragment = self._parseHeader();\r
+                       each(headerFragment.getAll('style'), function(node) {\r
+                               if (node.firstChild)\r
+                                       styles += node.firstChild.value;\r
+                       });\r
 \r
-                               t.head = low(t.head);\r
-                               t.foot = low(t.foot);\r
-                       } else {\r
-                               t.head = '';\r
-                               if (ed.getParam('fullpage_default_xml_pi'))\r
-                                       t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';\r
+                       elm = headerFragment.getAll('body')[0];\r
+                       if (elm) {\r
+                               dom.setAttribs(self.editor.getBody(), {\r
+                                       style : elm.attr('style') || '',\r
+                                       dir : elm.attr('dir') || '',\r
+                                       vLink : elm.attr('vlink') || '',\r
+                                       link : elm.attr('link') || '',\r
+                                       aLink : elm.attr('alink') || ''\r
+                               });\r
+                       }\r
 \r
-                               t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');\r
-                               t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n';\r
+                       dom.remove('fullpage_styles');\r
 \r
-                               if (v = ed.getParam('fullpage_default_encoding'))\r
-                                       t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';\r
+                       if (styles) {\r
+                               dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);\r
 \r
-                               if (v = ed.getParam('fullpage_default_font_family'))\r
-                                       st += 'font-family: ' + v + ';';\r
+                               // Needed for IE 6/7\r
+                               elm = dom.get('fullpage_styles');\r
+                               if (elm.styleSheet)\r
+                                       elm.styleSheet.cssText = styles;\r
+                       }\r
+               },\r
 \r
-                               if (v = ed.getParam('fullpage_default_font_size'))\r
-                                       st += 'font-size: ' + v + ';';\r
+               _getDefaultHeader : function() {\r
+                       var header = '', editor = this.editor, value, styles = '';\r
 \r
-                               if (v = ed.getParam('fullpage_default_text_color'))\r
-                                       st += 'color: ' + v + ';';\r
+                       if (editor.getParam('fullpage_default_xml_pi'))\r
+                               header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';\r
 \r
-                               t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';\r
-                               t.foot = '\n</body>\n</html>';\r
-                       }\r
+                       header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');\r
+                       header += '\n<html>\n<head>\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_title'))\r
+                               header += '<title>' + value + '</title>\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_encoding'))\r
+                               header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';\r
+\r
+                       if (value = editor.getParam('fullpage_default_font_family'))\r
+                               styles += 'font-family: ' + value + ';';\r
+\r
+                       if (value = editor.getParam('fullpage_default_font_size'))\r
+                               styles += 'font-size: ' + value + ';';\r
+\r
+                       if (value = editor.getParam('fullpage_default_text_color'))\r
+                               styles += 'color: ' + value + ';';\r
+\r
+                       header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';\r
+\r
+                       return header;\r
                },\r
 \r
                _getContent : function(ed, o) {\r
-                       var t = this;\r
+                       var self = this;\r
 \r
                        if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))\r
-                               o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot);\r
+                               o.content = tinymce.trim(self.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(self.foot);\r
                }\r
        });\r
 \r
        // Register plugin\r
        tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);\r
-})();
\ No newline at end of file
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index c32afaf..14ab865
@@ -8,13 +8,12 @@
        <script type="text/javascript" src="js/fullpage.js"></script>\r
        <link href="css/fullpage.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="advlink" style="display: none">\r
-    <form onsubmit="updateAction();return false;" name="fullpage" action="#">\r
+<body id="fullpage" style="display: none">\r
+<form onsubmit="FullPageDialog.update();return false;" name="fullpage" action="#">\r
                <div class="tabs">\r
                        <ul>\r
                                <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>\r
                                <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_tab}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
@@ -72,9 +71,9 @@
                                                        </td> \r
                                                </tr>\r
                                                <tr>\r
-                                                       <td class="nowrap"><label for="doctypes">{#fullpage_dlg.doctypes}</label>&nbsp;</td>\r
+                                                       <td class="nowrap"><label for="doctype">{#fullpage_dlg.doctypes}</label>&nbsp;</td>\r
                                                        <td>\r
-                                                               <select id="doctypes" name="doctypes">\r
+                                                               <select id="doctype" name="doctype">\r
                                                                                <option value="">{#not_set}</option>\r
                                                                </select>\r
                                                        </td>\r
                                                <tr>\r
                                                        <td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td> \r
                                                        <td>\r
-                                                               <select id="fontface" name="fontface" onchange="changedStyleField(this);">\r
+                                                               <select id="fontface" name="fontface" onchange="FullPageDialog.changedStyleProp();">\r
                                                                                <option value="">{#not_set}</option>\r
                                                                </select>\r
                                                        </td> \r
                                                <tr>\r
                                                        <td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td> \r
                                                        <td>\r
-                                                               <select id="fontsize" name="fontsize" onchange="changedStyleField(this);">\r
+                                                               <select id="fontsize" name="fontsize" onchange="FullPageDialog.changedStyleProp();">\r
                                                                                <option value="">{#not_set}</option>\r
                                                                </select>\r
                                                        </td>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td>\r
+                                                                               <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="textcolor_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td>\r
+                                                                               <td><input id="bgimage" name="bgimage" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="bgimage_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="bgcolor_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
                                        <table border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td> \r
-                                                       <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td>\r
+                                                       <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
                                                        <td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td> \r
-                                                       <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td>\r
+                                                       <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
                                                </tr>\r
                                                <tr>\r
                                                        <td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td> \r
-                                                       <td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td>\r
+                                                       <td><input id="topmargin" name="topmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
                                                        <td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td> \r
-                                                       <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td>\r
+                                                       <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td>\r
+                                                                               <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="link_color_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td>\r
+                                                                               <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="visited_color_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        <td>\r
                                                                <table border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td>\r
+                                                                               <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');FullPageDialog.changedStyleProp();" /></td>\r
                                                                                <td id="active_color_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
 \r
                                                        <td>&nbsp;</td>\r
                                                        <td>&nbsp;</td>\r
-\r
-<!--                                                   <td class="column1"><label for="hover_color">{#fullpage_dlg.hover_color}</label></td> \r
-                                                       <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
-                                                                       <tr>\r
-                                                                               <td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td>\r
-                                                                               <td id="hover_color_pickcontainer">&nbsp;</td>\r
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td> -->\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
                                                </tr>\r
                                                <tr>\r
                                                        <td class="column1"><label for="style">{#fullpage_dlg.style}</label></td> \r
-                                                       <td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td>\r
-                                               </tr>\r
-                                       </table>\r
-                               </fieldset>\r
-                       </div>\r
-\r
-                       <div id="advanced_panel" class="panel">\r
-                               <div id="addmenu">\r
-                                       <table border="0" cellpadding="0" cellspacing="0">\r
-                                               <tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{#fullpage_dlg.add_title}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{#fullpage_dlg.add_meta}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{#fullpage_dlg.add_script}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{#fullpage_dlg.add_style}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{#fullpage_dlg.add_link}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{#fullpage_dlg.add_base}</span></a></td></tr>\r
-                                               <tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{#fullpage_dlg.add_comment}</span></a></td></tr>\r
-                                       </table>\r
-                               </div>\r
-\r
-                               <fieldset>\r
-                                       <legend>{#fullpage_dlg.head_elements}</legend>\r
-\r
-                                       <div class="headlistwrapper">\r
-                                               <div class="toolbar">\r
-                                                       <div style="float: left">\r
-                                                               <a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{#fullpage_dlg.add}"></a>\r
-                                                               <a href="#" onmousedown="return false;" class="removebutton" title="{#fullpage_dlg.remove}"></a>\r
-                                                       </div>\r
-                                                       <div style="float: right">\r
-                                                               <a href="#" onmousedown="return false;" class="moveupbutton" title="{#fullpage_dlg.moveup}"></a>\r
-                                                               <a href="#" onmousedown="return false;" class="movedownbutton" title="{#fullpage_dlg.movedown}"></a>\r
-                                                       </div>\r
-                                                       <br style="clear: both" />\r
-                                               </div>\r
-                                               <select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);">\r
-                                                       <option value="title_0">&lt;title&gt;Some title bla bla bla&lt;/title&gt;</option>\r
-                                                       <option value="meta_1">&lt;meta name="keywords"&gt;Some bla bla bla&lt;/meta&gt;</option>\r
-                                                       <option value="meta_2">&lt;meta name="description"&gt;Some bla bla bla bla bla bla bla bla bla&lt;/meta&gt;</option>\r
-                                                       <option value="script_3">&lt;script language=&quot;javascript&quot;&gt;...&lt;/script&gt;</option>\r
-                                                       <option value="style_4">&lt;style&gt;...&lt;/style&gt;</option>\r
-                                                       <option value="base_5">&lt;base href="." /&gt;</option>\r
-                                                       <option value="comment_6">&lt;!-- ... --&gt;</option>\r
-                                                       <option value="link_7">&lt;link href="." /&gt;</option>\r
-                                               </select>\r
-                                       </div>\r
-                               </fieldset>\r
-\r
-                               <fieldset id="meta_element">\r
-                                       <legend>{#fullpage_dlg.meta_element}</legend>\r
-\r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_meta_type">{#fullpage_dlg.type}</label></td> \r
-                                                       <td><select id="element_meta_type">\r
-                                                                               <option value="name">name</option>\r
-                                                                               <option value="http-equiv">http-equiv</option>\r
-                                                               </select></td>\r
-                                               </tr>\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_meta_name">{#fullpage_dlg.name}</label></td> \r
-                                                       <td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td>\r
-                                               </tr>\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_meta_content">{#fullpage_dlg.content}</label></td> \r
-                                                       <td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td>\r
-                                               </tr>\r
-                                       </table>\r
-\r
-                                       <input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="title_element">\r
-                                       <legend>{#fullpage_dlg.title_element}</legend>\r
-\r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_title">{#fullpage_dlg.meta_title}</label></td> \r
-                                                       <td><input id="element_title" name="element_title" type="text" value="" /></td>\r
-                                               </tr>\r
-                                       </table>\r
-\r
-                                       <input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="script_element">\r
-                                       <legend>{#fullpage_dlg.script_element}</legend>\r
-\r
-                                       <div class="tabs">\r
-                                               <ul>\r
-                                                       <li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>\r
-                                                       <li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>\r
-                                               </ul>\r
-                                       </div>\r
-\r
-                                       <br style="clear: both" />\r
-\r
-                                       <div class="panel_wrapper">\r
-                                               <div id="script_props_panel" class="panel current">\r
-                                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_script_type">{#fullpage_dlg.type}</label></td> \r
-                                                                       <td><select id="element_script_type">\r
-                                                                               <option value="text/javascript">text/javascript</option>\r
-                                                                               <option value="text/jscript">text/jscript</option>\r
-                                                                               <option value="text/vbscript">text/vbscript</option>\r
-                                                                               <option value="text/vbs">text/vbs</option>\r
-                                                                               <option value="text/ecmascript">text/ecmascript</option>\r
-                                                                               <option value="text/xml">text/xml</option>\r
-                                                                       </select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_script_src">{#fullpage_dlg.src}</label></td> \r
-                                                                       <td><table border="0" cellpadding="0" cellspacing="0">\r
-                                                                       <tr>\r
-                                                                               <td><input id="element_script_src" name="element_script_src" type="text" value="" /></td>\r
-                                                                               <td id="script_src_pickcontainer">&nbsp;</td>\r
-                                                                       </tr>\r
-                                                               </table></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_script_charset">{#fullpage_dlg.charset}</label></td> \r
-                                                                       <td><select id="element_script_charset"><option value="">{#not_set}</option></select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_script_defer">{#fullpage_dlg.defer}</label></td> \r
-                                                                       <td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td>\r
-                                                               </tr>\r
-                                                       </table>\r
-                                               </div>\r
-\r
-                                               <div id="script_value_panel" class="panel">\r
-                                                       <textarea id="element_script_value"></textarea>\r
-                                               </div>\r
-                                       </div>\r
-\r
-                                       <input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="style_element">\r
-                                       <legend>{#fullpage_dlg.style_element}</legend>\r
-\r
-                                       <div class="tabs">\r
-                                               <ul>\r
-                                                       <li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>\r
-                                                       <li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>\r
-                                               </ul>\r
-                                       </div>\r
-\r
-                                       <br style="clear: both" />\r
-\r
-                                       <div class="panel_wrapper">\r
-                                               <div id="style_props_panel" class="panel current">\r
-                                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_style_type">{#fullpage_dlg.type}</label></td> \r
-                                                                       <td><select id="element_style_type">\r
-                                                                               <option value="text/css">text/css</option>\r
-                                                                       </select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_style_media">{#fullpage_dlg.media}</label></td> \r
-                                                                       <td><select id="element_style_media"></select></td>\r
-                                                               </tr>\r
-                                                       </table>\r
-                                               </div>\r
-\r
-                                               <div id="style_value_panel" class="panel">\r
-                                                       <textarea id="element_style_value"></textarea>\r
-                                               </div>\r
-                                       </div>\r
-\r
-                                       <input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="base_element">\r
-                                       <legend>{#fullpage_dlg.base_element}</legend>\r
-\r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_base_href">{#fullpage_dlg.href}</label></td> \r
-                                                       <td><input id="element_base_href" name="element_base_href" type="text" value="" /></td>\r
-                                               </tr>\r
-                                               <tr>\r
-                                                       <td class="column1"><label for="element_base_target">{#fullpage_dlg.target}</label></td> \r
-                                                       <td><input id="element_base_target" name="element_base_target" type="text" value="" /></td>\r
+                                                       <td><input id="style" name="style" type="text" value="" onchange="FullPageDialog.changedStyle();" /></td>\r
                                                </tr>\r
                                        </table>\r
-\r
-                                       <input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="link_element">\r
-                                       <legend>{#fullpage_dlg.link_element}</legend>\r
-\r
-                                       <div class="tabs">\r
-                                               <ul>\r
-                                                       <li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{#fullpage_dlg.general_props}</a></span></li>\r
-                                                       <li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_props}</a></span></li>\r
-                                               </ul>\r
-                                       </div>\r
-\r
-                                       <br style="clear: both" />\r
-\r
-                                       <div class="panel_wrapper">\r
-                                               <div id="link_general_panel" class="panel current">\r
-                                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_href">{#fullpage_dlg.href}</label></td> \r
-                                                                       <td><table border="0" cellpadding="0" cellspacing="0">\r
-                                                                       <tr>\r
-                                                                               <td><input id="element_link_href" name="element_link_href" type="text" value="" /></td>\r
-                                                                               <td id="link_href_pickcontainer">&nbsp;</td>\r
-                                                                       </tr>\r
-                                                               </table></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_title">{#fullpage_dlg.meta_title}</label></td> \r
-                                                                       <td><input id="element_link_title" name="element_link_title" type="text" value="" /></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_type">{#fullpage_dlg.type}</label></td> \r
-                                                                       <td><select id="element_link_type" name="element_link_type">\r
-                                                                               <option value="text/css">text/css</option>\r
-                                                                               <option value="text/javascript">text/javascript</option>\r
-                                                                       </select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_media">{#fullpage_dlg.media}</label></td> \r
-                                                                       <td><select id="element_link_media" name="element_link_media"></select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td><label for="element_style_rel">{#fullpage_dlg.rel}</label></td>\r
-                                                                       <td><select id="element_style_rel" name="element_style_rel"> \r
-                                                                                       <option value="">{#not_set}</option> \r
-                                                                                       <option value="stylesheet">Stylesheet</option>\r
-                                                                                       <option value="alternate">Alternate</option>\r
-                                                                                       <option value="designates">Designates</option>\r
-                                                                                       <option value="start">Start</option>\r
-                                                                                       <option value="next">Next</option>\r
-                                                                                       <option value="prev">Prev</option>\r
-                                                                                       <option value="contents">Contents</option>\r
-                                                                                       <option value="index">Index</option>\r
-                                                                                       <option value="glossary">Glossary</option>\r
-                                                                                       <option value="copyright">Copyright</option>\r
-                                                                                       <option value="chapter">Chapter</option>\r
-                                                                                       <option value="subsection">Subsection</option>\r
-                                                                                       <option value="appendix">Appendix</option>\r
-                                                                                       <option value="help">Help</option>\r
-                                                                                       <option value="bookmark">Bookmark</option>\r
-                                                                               </select> \r
-                                                                       </td>\r
-                                                               </tr>\r
-                                                       </table>\r
-                                               </div>\r
-\r
-                                               <div id="link_advanced_panel" class="panel">\r
-                                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_charset">{#fullpage_dlg.charset}</label></td> \r
-                                                                       <td><select id="element_link_charset"><option value="">{#not_set}</option></select></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_hreflang">{#fullpage_dlg.hreflang}</label></td> \r
-                                                                       <td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td class="column1"><label for="element_link_target">{#fullpage_dlg.target}</label></td> \r
-                                                                       <td><input id="element_link_target" name="element_link_target" type="text" value="" /></td>\r
-                                                               </tr>\r
-                                                               <tr>\r
-                                                                       <td><label for="element_style_rev">{#fullpage_dlg.rev}</label></td>\r
-                                                                       <td><select id="element_style_rev" name="element_style_rev"> \r
-                                                                                       <option value="">{#not_set}</option> \r
-                                                                                       <option value="alternate">Alternate</option> \r
-                                                                                       <option value="designates">Designates</option> \r
-                                                                                       <option value="stylesheet">Stylesheet</option> \r
-                                                                                       <option value="start">Start</option> \r
-                                                                                       <option value="next">Next</option> \r
-                                                                                       <option value="prev">Prev</option> \r
-                                                                                       <option value="contents">Contents</option> \r
-                                                                                       <option value="index">Index</option> \r
-                                                                                       <option value="glossary">Glossary</option> \r
-                                                                                       <option value="copyright">Copyright</option> \r
-                                                                                       <option value="chapter">Chapter</option> \r
-                                                                                       <option value="subsection">Subsection</option> \r
-                                                                                       <option value="appendix">Appendix</option> \r
-                                                                                       <option value="help">Help</option> \r
-                                                                                       <option value="bookmark">Bookmark</option> \r
-                                                                               </select> \r
-                                                                       </td>\r
-                                                               </tr>\r
-                                                       </table>\r
-                                               </div>\r
-                                       </div>\r
-\r
-                                       <input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
-                               </fieldset>\r
-\r
-                               <fieldset id="comment_element">\r
-                                       <legend>{#fullpage_dlg.comment_element}</legend>\r
-\r
-                                       <textarea id="element_comment_value"></textarea>\r
-\r
-                                       <input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />\r
                                </fieldset>\r
                        </div>\r
                </div>\r
                        <input type="submit" id="insert" name="update" value="{#update}" />\r
                        <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />\r
                </div>\r
-    </form>\r
+</form>\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index a1bb719..3f672ad
  * Contributing: http://tinymce.moxiecode.com/contributing\r
  */\r
 \r
-tinyMCEPopup.requireLangPack();\r
-\r
-var doc;\r
-\r
-var defaultDocTypes = \r
-       'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +\r
-       'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +\r
-       'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +\r
-       'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +\r
-       'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +\r
-       'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +\r
-       'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';\r
-\r
-var defaultEncodings = \r
-       'Western european (iso-8859-1)=iso-8859-1,' +\r
-       'Central European (iso-8859-2)=iso-8859-2,' +\r
-       'Unicode (UTF-8)=utf-8,' +\r
-       'Chinese traditional (Big5)=big5,' +\r
-       'Cyrillic (iso-8859-5)=iso-8859-5,' +\r
-       'Japanese (iso-2022-jp)=iso-2022-jp,' +\r
-       'Greek (iso-8859-7)=iso-8859-7,' +\r
-       'Korean (iso-2022-kr)=iso-2022-kr,' +\r
-       'ASCII (us-ascii)=us-ascii';\r
-\r
-var defaultMediaTypes = \r
-       'all=all,' +\r
-       'screen=screen,' +\r
-       'print=print,' +\r
-       'tty=tty,' +\r
-       'tv=tv,' +\r
-       'projection=projection,' +\r
-       'handheld=handheld,' +\r
-       'braille=braille,' +\r
-       'aural=aural';\r
-\r
-var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';\r
-var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';\r
-\r
-function init() {\r
-       var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style;\r
-\r
-       // Setup doctype select box\r
-       doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(',');\r
-       for (i=0; i<doctypes.length; i++) {\r
-               p = doctypes[i].split('=');\r
-\r
-               if (p.length > 1)\r
-                       addSelectValue(f, 'doctypes', p[0], p[1]);\r
-       }\r
-\r
-       // Setup fonts select box\r
-       fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';');\r
-       for (i=0; i<fonts.length; i++) {\r
-               p = fonts[i].split('=');\r
-\r
-               if (p.length > 1)\r
-                       addSelectValue(f, 'fontface', p[0], p[1]);\r
-       }\r
-\r
-       // Setup fontsize select box\r
-       fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(',');\r
-       for (i=0; i<fonts.length; i++)\r
-               addSelectValue(f, 'fontsize', fonts[i], fonts[i]);\r
-\r
-       // Setup mediatype select boxs\r
-       mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(',');\r
-       for (i=0; i<mediaTypes.length; i++) {\r
-               p = mediaTypes[i].split('=');\r
-\r
-               if (p.length > 1) {\r
-                       addSelectValue(f, 'element_style_media', p[0], p[1]);\r
-                       addSelectValue(f, 'element_link_media', p[0], p[1]);\r
-               }\r
-       }\r
-\r
-       // Setup encodings select box\r
-       encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(',');\r
-       for (i=0; i<encodings.length; i++) {\r
-               p = encodings[i].split('=');\r
-\r
-               if (p.length > 1) {\r
-                       addSelectValue(f, 'docencoding', p[0], p[1]);\r
-                       addSelectValue(f, 'element_script_charset', p[0], p[1]);\r
-                       addSelectValue(f, 'element_link_charset', p[0], p[1]);\r
-               }\r
-       }\r
-\r
-       document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
-       document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');\r
-       //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');\r
-       document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');\r
-       document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');\r
-       document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');\r
-       document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');\r
-       document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');\r
-       document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');\r
-       document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');\r
-\r
-       // Resize some elements\r
-       if (isVisible('stylesheetbrowser'))\r
-               document.getElementById('stylesheet').style.width = '220px';\r
-\r
-       if (isVisible('link_href_browser'))\r
-               document.getElementById('element_link_href').style.width = '230px';\r
-\r
-       if (isVisible('bgimage_browser'))\r
-               document.getElementById('bgimage').style.width = '210px';\r
-\r
-       // Add iframe\r
-       dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}});\r
-       doc = dom.get('documentIframe').contentWindow.document;\r
-       h = tinyMCEPopup.getWindowArg('head_html');\r
-\r
-       // Preprocess the HTML disable scripts and urls\r
-       h = h.replace(/<script>/gi, '<script type="text/javascript">');\r
-       h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-');\r
-       h = h.replace(/(src=|href=)/g, '_mce_$1');\r
-\r
-       // Write in the content in the iframe\r
-       doc.write(h + '</body></html>');\r
-       doc.close();\r
-\r
-       // Parse xml and doctype\r
-       xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);\r
-       xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);\r
-       docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');\r
-       f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);\r
-\r
-       // Parse title\r
-       if (e = doc.getElementsByTagName('title')[0])\r
-               el.metatitle.value = e.textContent || e.text;\r
-\r
-       // Parse meta\r
-       tinymce.each(doc.getElementsByTagName('meta'), function(n) {\r
-               var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || '';\r
-\r
-               e = el['meta' + na];\r
-\r
-               if (na == 'robots') {\r
-                       selectByValue(f, 'metarobots', tinymce.trim(va), true, true);\r
-                       return;\r
-               }\r
-\r
-               switch (eq.toLowerCase()) {\r
-                       case "content-type":\r
-                               tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);\r
-\r
-                               // Override XML encoding\r
-                               if (tmp != "")\r
-                                       xmlEnc = tmp;\r
-\r
-                               return;\r
-               }\r
-\r
-               if (e)\r
-                       e.value = va;\r
-       });\r
-\r
-       selectByValue(f, 'doctypes', docType, true, true);\r
-       selectByValue(f, 'docencoding', xmlEnc, true, true);\r
-       selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true);\r
-\r
-       if (xmlVer != '')\r
-               el.xml_pi.checked = true;\r
-\r
-       // Parse appearance\r
-\r
-       // Parse primary stylesheet\r
-       tinymce.each(doc.getElementsByTagName("link"), function(l) {\r
-               var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || '';\r
-\r
-               if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") {\r
-                       f.stylesheet.value = l.getAttribute('_mce_href', 2) || '';\r
-                       return false;\r
-               }\r
-       });\r
-\r
-       // Get from style elements\r
-       tinymce.each(doc.getElementsByTagName("style"), function(st) {\r
-               var tmp = parseStyleElement(st);\r
-\r
-               for (x=0; x<tmp.length; x++) {\r
-                       if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])\r
-                               f.visited_color.value = tmp[x].data['color'];\r
-\r
-                       if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])\r
-                               f.link_color.value = tmp[x].data['color'];\r
-\r
-                       if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])\r
-                               f.active_color.value = tmp[x].data['color'];\r
-               }\r
-       });\r
-\r
-       f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text");\r
-       f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink");\r
-       f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link");\r
-       f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink");\r
-       f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor");\r
-       f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background");\r
-\r
-       // Get from style info\r
-       style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style'));\r
-\r
-       if (style['font-family'])\r
-               selectByValue(f, 'fontface', style['font-family'], true, true);\r
-       else\r
-               selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true);\r
-\r
-       if (style['font-size'])\r
-               selectByValue(f, 'fontsize', style['font-size'], true, true);\r
-       else\r
-               selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true);\r
-\r
-       if (style['color'])\r
-               f.textcolor.value = convertRGBToHex(style['color']);\r
-\r
-       if (style['background-image'])\r
-               f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");\r
-\r
-       if (style['background-color'])\r
-               f.bgcolor.value = style['background-color'];\r
-\r
-       if (style['margin']) {\r
-               tmp = style['margin'].replace(/[^0-9 ]/g, '');\r
-               tmp = tmp.split(/ +/);\r
-               f.topmargin.value = tmp.length > 0 ? tmp[0] : '';\r
-               f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];\r
-               f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];\r
-               f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];\r
-       }\r
-\r
-       if (style['margin-left'])\r
-               f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');\r
-\r
-       if (style['margin-right'])\r
-               f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');\r
-\r
-       if (style['margin-top'])\r
-               f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');\r
-\r
-       if (style['margin-bottom'])\r
-               f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');\r
-\r
-       f.style.value = tinyMCEPopup.dom.serializeStyle(style);\r
-\r
-       // Update colors\r
-       updateColor('textcolor_pick', 'textcolor');\r
-       updateColor('bgcolor_pick', 'bgcolor');\r
-       updateColor('visited_color_pick', 'visited_color');\r
-       updateColor('active_color_pick', 'active_color');\r
-       updateColor('link_color_pick', 'link_color');\r
-}\r
-\r
-function getReItem(r, s, i) {\r
-       var c = r.exec(s);\r
-\r
-       if (c && c.length > i)\r
-               return c[i];\r
-\r
-       return '';\r
-}\r
-\r
-function updateAction() {\r
-       var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;\r
-\r
-       head = doc.getElementsByTagName('head')[0];\r
-\r
-       // Fix scripts without a type\r
-       nl = doc.getElementsByTagName('script');\r
-       for (i=0; i<nl.length; i++) {\r
-               if (tinyMCEPopup.dom.getAttrib(nl[i], '_mce_type') == '')\r
-                       nl[i].setAttribute('_mce_type', 'text/javascript');\r
-       }\r
-\r
-       // Get primary stylesheet\r
-       nl = doc.getElementsByTagName("link");\r
-       for (i=0; i<nl.length; i++) {\r
-               l = nl[i];\r
-\r
-               tmp = tinyMCEPopup.dom.getAttrib(l, 'media');\r
-\r
-               if (tinyMCEPopup.dom.getAttrib(l, '_mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") {\r
-                       addlink = false;\r
-\r
-                       if (f.stylesheet.value == '')\r
-                               l.parentNode.removeChild(l);\r
+(function() {\r
+       tinyMCEPopup.requireLangPack();\r
+\r
+       var defaultDocTypes = \r
+               'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +\r
+               'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +\r
+               'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +\r
+               'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +\r
+               'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +\r
+               'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +\r
+               'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';\r
+\r
+       var defaultEncodings = \r
+               'Western european (iso-8859-1)=iso-8859-1,' +\r
+               'Central European (iso-8859-2)=iso-8859-2,' +\r
+               'Unicode (UTF-8)=utf-8,' +\r
+               'Chinese traditional (Big5)=big5,' +\r
+               'Cyrillic (iso-8859-5)=iso-8859-5,' +\r
+               'Japanese (iso-2022-jp)=iso-2022-jp,' +\r
+               'Greek (iso-8859-7)=iso-8859-7,' +\r
+               'Korean (iso-2022-kr)=iso-2022-kr,' +\r
+               'ASCII (us-ascii)=us-ascii';\r
+\r
+       var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';\r
+       var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';\r
+\r
+       function setVal(id, value) {\r
+               var elm = document.getElementById(id);\r
+\r
+               if (elm) {\r
+                       value = value || '';\r
+\r
+                       if (elm.nodeName == "SELECT")\r
+                               selectByValue(document.forms[0], id, value);\r
+                       else if (elm.type == "checkbox")\r
+                               elm.checked = !!value;\r
                        else\r
-                               l.setAttribute('_mce_href', f.stylesheet.value);\r
-\r
-                       break;\r
+                               elm.value = value;\r
                }\r
-       }\r
-\r
-       // Add new link\r
-       if (f.stylesheet.value != '') {\r
-               l = doc.createElement('link');\r
-\r
-               l.setAttribute('type', 'text/css');\r
-               l.setAttribute('_mce_href', f.stylesheet.value);\r
-               l.setAttribute('rel', 'stylesheet');\r
-\r
-               head.appendChild(l);\r
-       }\r
-\r
-       setMeta(head, 'keywords', f.metakeywords.value);\r
-       setMeta(head, 'description', f.metadescription.value);\r
-       setMeta(head, 'author', f.metaauthor.value);\r
-       setMeta(head, 'copyright', f.metacopyright.value);\r
-       setMeta(head, 'robots', getSelectValue(f, 'metarobots'));\r
-       setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));\r
-\r
-       doc.body.dir = getSelectValue(f, 'langdir');\r
-       doc.body.style.cssText = f.style.value;\r
-\r
-       doc.body.setAttribute('vLink', f.visited_color.value);\r
-       doc.body.setAttribute('link', f.link_color.value);\r
-       doc.body.setAttribute('text', f.textcolor.value);\r
-       doc.body.setAttribute('aLink', f.active_color.value);\r
+       };\r
 \r
-       doc.body.style.fontFamily = getSelectValue(f, 'fontface');\r
-       doc.body.style.fontSize = getSelectValue(f, 'fontsize');\r
-       doc.body.style.backgroundColor = f.bgcolor.value;\r
+       function getVal(id) {\r
+               var elm = document.getElementById(id);\r
 \r
-       if (f.leftmargin.value != '')\r
-               doc.body.style.marginLeft = f.leftmargin.value + 'px';\r
+               if (elm.nodeName == "SELECT")\r
+                       return elm.options[elm.selectedIndex].value;\r
 \r
-       if (f.rightmargin.value != '')\r
-               doc.body.style.marginRight = f.rightmargin.value + 'px';\r
+               if (elm.type == "checkbox")\r
+                       return elm.checked;\r
 \r
-       if (f.bottommargin.value != '')\r
-               doc.body.style.marginBottom = f.bottommargin.value + 'px';\r
+               return elm.value;\r
+       };\r
 \r
-       if (f.topmargin.value != '')\r
-               doc.body.style.marginTop = f.topmargin.value + 'px';\r
+       window.FullPageDialog = {\r
+               changedStyle : function() {\r
+                       var val, styles = tinyMCEPopup.editor.dom.parseStyle(getVal('style'));\r
 \r
-       html = doc.getElementsByTagName('html')[0];\r
-       html.setAttribute('lang', f.langcode.value);\r
-       html.setAttribute('xml:lang', f.langcode.value);\r
+                       setVal('fontface', styles['font-face']);\r
+                       setVal('fontsize', styles['font-size']);\r
+                       setVal('textcolor', styles['color']);\r
 \r
-       if (f.bgimage.value != '')\r
-               doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";\r
-       else\r
-               doc.body.style.backgroundImage = '';\r
-\r
-       ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();\r
-       ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head');\r
-\r
-       h = ser.serialize(doc.documentElement);\r
-       h = h.substring(0, h.lastIndexOf('</body>'));\r
-\r
-       if (h.indexOf('<title>') == -1)\r
-               h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');\r
-       else\r
-               h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');\r
-\r
-       if ((v = getSelectValue(f, 'doctypes')) != '')\r
-               h = v + '\n' + h;\r
-\r
-       if (f.xml_pi.checked) {\r
-               s = '<?xml version="1.0"';\r
-\r
-               if ((v = getSelectValue(f, 'docencoding')) != '')\r
-                       s += ' encoding="' + v + '"';\r
-\r
-               s += '?>\n';\r
-               h = s + h;\r
-       }\r
-\r
-       h = h.replace(/type=\"\-mce\-/gi, 'type="');\r
-\r
-       tinyMCEPopup.editor.plugins.fullpage.head = h;\r
-       tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});\r
-       tinyMCEPopup.close();\r
-}\r
+                       if (val = styles['background-image'])\r
+                               setVal('bgimage', val.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"));\r
+                       else\r
+                               setVal('bgimage', '');\r
+\r
+                       setVal('bgcolor', styles['background-color']);\r
+\r
+                       // Reset margin form elements\r
+                       setVal('topmargin', '');\r
+                       setVal('rightmargin', '');\r
+                       setVal('bottommargin', '');\r
+                       setVal('leftmargin', '');\r
+\r
+                       // Expand margin\r
+                       if (val = styles['margin']) {\r
+                               val = val.split(' ');\r
+                               styles['margin-top'] = val[0] || '';\r
+                               styles['margin-right'] = val[1] || val[0] || '';\r
+                               styles['margin-bottom'] = val[2] || val[0] || '';\r
+                               styles['margin-left'] = val[3] || val[0] || '';\r
+                       }\r
+\r
+                       if (val = styles['margin-top'])\r
+                               setVal('topmargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-right'])\r
+                               setVal('rightmargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-bottom'])\r
+                               setVal('bottommargin', val.replace(/px/, ''));\r
+\r
+                       if (val = styles['margin-left'])\r
+                               setVal('leftmargin', val.replace(/px/, ''));\r
+\r
+                       updateColor('bgcolor_pick', 'bgcolor');\r
+                       updateColor('textcolor_pick', 'textcolor');\r
+               },\r
+\r
+               changedStyleProp : function() {\r
+                       var val, dom = tinyMCEPopup.editor.dom, styles = dom.parseStyle(getVal('style'));\r
+       \r
+                       styles['font-face'] = getVal('fontface');\r
+                       styles['font-size'] = getVal('fontsize');\r
+                       styles['color'] = getVal('textcolor');\r
+                       styles['background-color'] = getVal('bgcolor');\r
+\r
+                       if (val = getVal('bgimage'))\r
+                               styles['background-image'] = "url('" + val + "')";\r
+                       else\r
+                               styles['background-image'] = '';\r
 \r
-function changedStyleField(field) {\r
-}\r
+                       delete styles['margin'];\r
 \r
-function setMeta(he, k, v) {\r
-       var nl, i, m;\r
+                       if (val = getVal('topmargin'))\r
+                               styles['margin-top'] = val + "px";\r
+                       else\r
+                               styles['margin-top'] = '';\r
 \r
-       nl = he.getElementsByTagName('meta');\r
-       for (i=0; i<nl.length; i++) {\r
-               if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) {\r
-                       if (v == '')\r
-                               nl[i].parentNode.removeChild(nl[i]);\r
+                       if (val = getVal('rightmargin'))\r
+                               styles['margin-right'] = val + "px";\r
                        else\r
-                               nl[i].setAttribute('content', "text/html; charset=" + v);\r
+                               styles['margin-right'] = '';\r
 \r
-                       return;\r
-               }\r
+                       if (val = getVal('bottommargin'))\r
+                               styles['margin-bottom'] = val + "px";\r
+                       else\r
+                               styles['margin-bottom'] = '';\r
 \r
-               if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {\r
-                       if (v == '')\r
-                               nl[i].parentNode.removeChild(nl[i]);\r
+                       if (val = getVal('leftmargin'))\r
+                               styles['margin-left'] = val + "px";\r
                        else\r
-                               nl[i].setAttribute('content', v);\r
-                       return;\r
+                               styles['margin-left'] = '';\r
+\r
+                       // Serialize, parse and reserialize this will compress redundant styles\r
+                       setVal('style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(styles))));\r
+                       this.changedStyle();\r
+               },\r
+               \r
+               update : function() {\r
+                       var data = {};\r
+\r
+                       tinymce.each(tinyMCEPopup.dom.select('select,input,textarea'), function(node) {\r
+                               data[node.id] = getVal(node.id);\r
+                       });\r
+\r
+                       tinyMCEPopup.editor.plugins.fullpage._dataToHtml(data);\r
+                       tinyMCEPopup.close();\r
+               }\r
+       };\r
+       \r
+       function init() {\r
+               var form = document.forms[0], i, item, list, editor = tinyMCEPopup.editor;\r
+\r
+               // Setup doctype select box\r
+               list = editor.getParam("fullpage_doctypes", defaultDocTypes).split(',');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
+\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'doctype', item[0], item[1]);\r
                }\r
-       }\r
-\r
-       if (v == '')\r
-               return;\r
-\r
-       m = doc.createElement('meta');\r
-\r
-       if (k == 'Content-Type')\r
-               m.httpEquiv = k;\r
-       else\r
-               m.setAttribute('name', k);\r
-\r
-       m.setAttribute('content', v);\r
-       he.appendChild(m);\r
-}\r
-\r
-function parseStyleElement(e) {\r
-       var v = e.innerHTML;\r
-       var p, i, r;\r
-\r
-       v = v.replace(/<!--/gi, '');\r
-       v = v.replace(/-->/gi, '');\r
-       v = v.replace(/[\n\r]/gi, '');\r
-       v = v.replace(/\s+/gi, ' ');\r
-\r
-       r = [];\r
-       p = v.split(/{|}/);\r
-\r
-       for (i=0; i<p.length; i+=2) {\r
-               if (p[i] != "")\r
-                       r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])};\r
-       }\r
-\r
-       return r;\r
-}\r
-\r
-function serializeStyleElement(d) {\r
-       var i, s, st;\r
-\r
-       s = '<!--\n';\r
-\r
-       for (i=0; i<d.length; i++) {\r
-               s += d[i].rule + ' {\n';\r
-\r
-               st = tinyMCE.serializeStyle(d[i].data);\r
 \r
-               if (st != '')\r
-                       st += ';';\r
+               // Setup fonts select box\r
+               list = editor.getParam("fullpage_fonts", defaultFontNames).split(';');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
 \r
-               s += st.replace(/;/g, ';\n');\r
-               s += '}\n';\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'fontface', item[0], item[1]);\r
+               }\r
 \r
-               if (i != d.length - 1)\r
-                       s += '\n';\r
-       }\r
+               // Setup fontsize select box\r
+               list = editor.getParam("fullpage_fontsizes", defaultFontSizes).split(',');\r
+               for (i = 0; i < list.length; i++)\r
+                       addSelectValue(form, 'fontsize', list[i], list[i]);\r
 \r
-       s += '\n-->';\r
+               // Setup encodings select box\r
+               list = editor.getParam("fullpage_encodings", defaultEncodings).split(',');\r
+               for (i = 0; i < list.length; i++) {\r
+                       item = list[i].split('=');\r
 \r
-       return s;\r
-}\r
+                       if (item.length > 1)\r
+                               addSelectValue(form, 'docencoding', item[0], item[1]);\r
+               }\r
 \r
-tinyMCEPopup.onInit.add(init);\r
+               // Setup color pickers\r
+               document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+               document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');\r
+               document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');\r
+               document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');\r
+               document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');\r
+               document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');\r
+               document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');\r
+\r
+               // Resize some elements\r
+               if (isVisible('stylesheetbrowser'))\r
+                       document.getElementById('stylesheet').style.width = '220px';\r
+\r
+               if (isVisible('link_href_browser'))\r
+                       document.getElementById('element_link_href').style.width = '230px';\r
+\r
+               if (isVisible('bgimage_browser'))\r
+                       document.getElementById('bgimage').style.width = '210px';\r
+\r
+               // Update form\r
+               tinymce.each(tinyMCEPopup.getWindowArg('data'), function(value, key) {\r
+                       setVal(key, value);\r
+               });\r
+\r
+               FullPageDialog.changedStyle();\r
+\r
+               // Update colors\r
+               updateColor('textcolor_pick', 'textcolor');\r
+               updateColor('bgcolor_pick', 'bgcolor');\r
+               updateColor('visited_color_pick', 'visited_color');\r
+               updateColor('active_color_pick', 'active_color');\r
+               updateColor('link_color_pick', 'link_color');\r
+       };\r
+\r
+       tinyMCEPopup.onInit.add(init);\r
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index f5801b8..516edc7
@@ -1,85 +1 @@
-tinyMCE.addI18n('en.fullpage_dlg',{\r
-title:"Document properties",\r
-meta_tab:"General",\r
-appearance_tab:"Appearance",\r
-advanced_tab:"Advanced",\r
-meta_props:"Meta information",\r
-langprops:"Language and encoding",\r
-meta_title:"Title",\r
-meta_keywords:"Keywords",\r
-meta_description:"Description",\r
-meta_robots:"Robots",\r
-doctypes:"Doctype",\r
-langcode:"Language code",\r
-langdir:"Language direction",\r
-ltr:"Left to right",\r
-rtl:"Right to left",\r
-xml_pi:"XML declaration",\r
-encoding:"Character encoding",\r
-appearance_bgprops:"Background properties",\r
-appearance_marginprops:"Body margins",\r
-appearance_linkprops:"Link colors",\r
-appearance_textprops:"Text properties",\r
-bgcolor:"Background color",\r
-bgimage:"Background image",\r
-left_margin:"Left margin",\r
-right_margin:"Right margin",\r
-top_margin:"Top margin",\r
-bottom_margin:"Bottom margin",\r
-text_color:"Text color",\r
-font_size:"Font size",\r
-font_face:"Font face",\r
-link_color:"Link color",\r
-hover_color:"Hover color",\r
-visited_color:"Visited color",\r
-active_color:"Active color",\r
-textcolor:"Color",\r
-fontsize:"Font size",\r
-fontface:"Font family",\r
-meta_index_follow:"Index and follow the links",\r
-meta_index_nofollow:"Index and don't follow the links",\r
-meta_noindex_follow:"Do not index but follow the links",\r
-meta_noindex_nofollow:"Do not index and don\'t follow the links",\r
-appearance_style:"Stylesheet and style properties",\r
-stylesheet:"Stylesheet",\r
-style:"Style",\r
-author:"Author",\r
-copyright:"Copyright",\r
-add:"Add new element",\r
-remove:"Remove selected element",\r
-moveup:"Move selected element up",\r
-movedown:"Move selected element down",\r
-head_elements:"Head elements",\r
-info:"Information",\r
-add_title:"Title element",\r
-add_meta:"Meta element",\r
-add_script:"Script element",\r
-add_style:"Style element",\r
-add_link:"Link element",\r
-add_base:"Base element",\r
-add_comment:"Comment node",\r
-title_element:"Title element",\r
-script_element:"Script element",\r
-style_element:"Style element",\r
-base_element:"Base element",\r
-link_element:"Link element",\r
-meta_element:"Meta element",\r
-comment_element:"Comment",\r
-src:"Src",\r
-language:"Language",\r
-href:"Href",\r
-target:"Target",\r
-type:"Type",\r
-charset:"Charset",\r
-defer:"Defer",\r
-media:"Media",\r
-properties:"Properties",\r
-name:"Name",\r
-value:"Value",\r
-content:"Content",\r
-rel:"Rel",\r
-rev:"Rev",\r
-hreflang:"Href lang",\r
-general_props:"General",\r
-advanced_props:"Advanced"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.fullpage_dlg',{title:"Document Properties","meta_tab":"General","appearance_tab":"Appearance","advanced_tab":"Advanced","meta_props":"Meta Information",langprops:"Language and Encoding","meta_title":"Title","meta_keywords":"Keywords","meta_description":"Description","meta_robots":"Robots",doctypes:"Doctype",langcode:"Language Code",langdir:"Language Direction",ltr:"Left to Right",rtl:"Right to Left","xml_pi":"XML Declaration",encoding:"Character Encoding","appearance_bgprops":"Background Properties","appearance_marginprops":"Body Margins","appearance_linkprops":"Link Colors","appearance_textprops":"Text Properties",bgcolor:"Background Color",bgimage:"Background Image","left_margin":"Left Margin","right_margin":"Right Margin","top_margin":"Top Margin","bottom_margin":"Bottom Margin","text_color":"Text Color","font_size":"Font Size","font_face":"Font Face","link_color":"Link Color","hover_color":"Hover Color","visited_color":"Visited Color","active_color":"Active Color",textcolor:"Color",fontsize:"Font Size",fontface:"Font Family","meta_index_follow":"Index and Follow the Links","meta_index_nofollow":"Index and Don\'t Follow the Links","meta_noindex_follow":"Do Not Index but Follow the Links","meta_noindex_nofollow":"Do Not Index and Don\'t Follow the Links","appearance_style":"Stylesheet and Style Properties",stylesheet:"Stylesheet",style:"Style",author:"Author",copyright:"Copyright",add:"Add New Element",remove:"Remove Selected Element",moveup:"Move Selected Element Up",movedown:"Move Selected Element Down","head_elements":"Head Elements",info:"Information","add_title":"Title Element","add_meta":"Meta Element","add_script":"Script Element","add_style":"Style Element","add_link":"Link Element","add_base":"Base Element","add_comment":"Comment Node","title_element":"Title Element","script_element":"Script Element","style_element":"Style Element","base_element":"Base Element","link_element":"Link Element","meta_element":"Meta Element","comment_element":"Comment",src:"Source",language:"Language",href:"HREF",target:"Target",type:"Type",charset:"Charset",defer:"Defer",media:"Media",properties:"Properties",name:"Name",value:"Value",content:"Content",rel:"Rel",rev:"Rev",hreflang:"HREF Lang","general_props":"General","advanced_props":"Advanced"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 4437bd2..a6456f8
@@ -1 +1 @@
-(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var m=tinymce.DOM.getViewPort(),k=e.fullscreenEditor,j,l;j=k.dom.getSize(k.getContainer().firstChild);l=k.dom.getSize(k.getContainer().getElementsByTagName("iframe")[0]);k.theme.resizeTo(m.w-j.w+l.w,m.h-j.h+l.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
\ No newline at end of file
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().firstChild);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 0efd9bb..afa4f9b
@@ -13,7 +13,7 @@
 \r
        tinymce.create('tinymce.plugins.FullScreenPlugin', {\r
                init : function(ed, url) {\r
-                       var t = this, s = {}, vp;\r
+                       var t = this, s = {}, vp, posCss;\r
 \r
                        t.editor = ed;\r
 \r
@@ -27,7 +27,7 @@
                                        else {\r
                                                DOM.win.setTimeout(function() {\r
                                                        tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);\r
-                                                       tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});\r
+                                                       tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());\r
                                                        tinyMCE.remove(ed);\r
                                                        DOM.remove('mce_fullscreen_container');\r
                                                        de.style.overflow = ed.getParam('fullscreen_html_overflow');\r
                                        if (tinymce.isIE)\r
                                                vp.h -= 1;\r
 \r
-                                       n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});\r
+                                       // Use fixed position if it exists\r
+                                       if (tinymce.isIE6)\r
+                                               posCss = 'absolute;top:' + vp.y;\r
+                                       else\r
+                                               posCss = 'fixed;top:0';\r
+\r
+                                       n = DOM.add(DOM.doc.body, 'div', {\r
+                                               id : 'mce_fullscreen_container', \r
+                                               style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});\r
                                        DOM.add(n, 'div', {id : 'mce_fullscreen'});\r
 \r
                                        tinymce.each(ed.settings, function(v, n) {\r
                                        s.fullscreen_editor_id = ed.id;\r
                                        s.theme_advanced_resizing = false;\r
                                        s.save_onsavecallback = function() {\r
-                                               ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});\r
+                                               ed.setContent(tinyMCE.get(s.id).getContent());\r
                                                ed.execCommand('mceSave');\r
                                        };\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 4c4f27e..ffe528e
@@ -1,7 +1,8 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<!DOCTYPE html>\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
        <title></title>\r
+       <meta http-equiv="X-UA-Compatible" content="IE=edge" />\r
        <script type="text/javascript" src="../../tiny_mce.js"></script>\r
        <script type="text/javascript">\r
                function patchCallback(settings, key) {\r
old mode 100755 (executable)
new mode 100644 (file)
index 07ea477..8bb96f9
@@ -1 +1 @@
-(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No newline at end of file
+(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","<br />"));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceClose"){z.close(null,i);return a.cancel(t)}else{if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(i,k){var g=this,f,j=d.doc,h,k;k=g._findId(k||i);if(!g.windows[k]){g.parent(i);return}g.count--;if(g.count==0){d.remove("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","false");g.editor.focus()}if(f=g.windows[k]){g.onClose.dispatch(g);a.remove(j,"mousedown",f.mousedownFunc);a.remove(j,"click",f.clickFunc);a.clear(k);a.clear(k+"_ifr");d.setAttrib(k+"_ifr","src",'javascript:""');f.element.remove();delete g.windows[k];h=g._frontWindow();if(h){g.focus(h.id)}}},_frontWindow:function(){var g,f=0;e(this.windows,function(h){if(h.zIndex>f){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index e991683..67123ca
@@ -42,7 +42,7 @@
                },\r
 \r
                open : function(f, p) {\r
-                       var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;\r
+                       var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;\r
 \r
                        f = f || {};\r
                        p = p || {};\r
                        if (!f.inline)\r
                                return t.parent(f, p);\r
 \r
+                       parentWindow = t._frontWindow();\r
+                       if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {\r
+                               parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;\r
+                       }\r
+                       \r
                        // Only store selection if the type is a normal window\r
                        if (!f.type)\r
                                t.bookmark = ed.selection.getBookmark(1);\r
 \r
                        // Create DOM objects\r
                        t._addAll(DOM.doc.body, \r
-                               ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'}, \r
+                               ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'}, \r
                                        ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},\r
                                                ['div', {id : id + '_top', 'class' : 'mceTop'}, \r
                                                        ['div', {'class' : 'mceLeft'}],\r
                                                ],\r
 \r
                                                ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, \r
-                                                       ['div', {id : id + '_left', 'class' : 'mceLeft'}],\r
+                                                       ['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],\r
                                                        ['span', {id : id + '_content'}],\r
-                                                       ['div', {id : id + '_right', 'class' : 'mceRight'}]\r
+                                                       ['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]\r
                                                ],\r
 \r
                                                ['div', {id : id + '_bottom', 'class' : 'mceBottom'},\r
 \r
                                DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});\r
                                DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));\r
+                               \r
+                               Event.add(id, 'keyup', function(evt) {\r
+                                       var VK_ESCAPE = 27;\r
+                                       if (evt.keyCode === VK_ESCAPE) {\r
+                                               f.button_func(false);\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               });\r
+\r
+                               Event.add(id, 'keydown', function(evt) {\r
+                                       var cancelButton, VK_TAB = 9;\r
+                                       if (evt.keyCode === VK_TAB) {\r
+                                               cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];\r
+                                               if (cancelButton && cancelButton !== evt.target) {\r
+                                                       cancelButton.focus();\r
+                                               } else {\r
+                                                       DOM.get(id + '_ok').focus();\r
+                                               }\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               });\r
                        }\r
 \r
                        // Register events\r
                                t.focus(id);\r
 \r
                                if (n.nodeName == 'A' || n.nodeName == 'a') {\r
-                                       if (n.className == 'mceMax') {\r
+                                       if (n.className == 'mceClose') {\r
+                                               t.close(null, id);\r
+                                               return Event.cancel(e);\r
+                                       } else if (n.className == 'mceMax') {\r
                                                w.oldPos = w.element.getXY();\r
                                                w.oldSize = w.element.getSize();\r
 \r
                                        }\r
                                }\r
                        });\r
-\r
+                       \r
+                       // Make sure the tab order loops within the dialog.\r
+                       Event.add([id + '_left', id + '_right'], 'focus', function(evt) {\r
+                               var iframe = DOM.get(id + '_ifr');\r
+                               if (iframe) {\r
+                                       var body = iframe.contentWindow.document.body;\r
+                                       var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);\r
+                                       if (evt.target.id === (id + '_left')) {\r
+                                               focusable[focusable.length - 1].focus();\r
+                                       } else {\r
+                                               focusable[0].focus();\r
+                                       }\r
+                               } else {\r
+                                       DOM.get(id + '_ok').focus();\r
+                               }\r
+                       });\r
+                       \r
                        // Add window\r
                        w = t.windows[id] = {\r
                                id : id,\r
                                });\r
 \r
                                DOM.show('mceModalBlocker'); // Reduces flicker in IE\r
+                               DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');\r
                        } else\r
                                DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);\r
 \r
                        if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))\r
                                DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});\r
 \r
+                       DOM.setAttrib(id, 'aria-hidden', 'false');\r
                        t.focus(id);\r
                        t._fixIELayout(id, 1);\r
 \r
                        // Focus ok button\r
                        if (DOM.get(id + '_ok'))\r
                                DOM.get(id + '_ok').focus();\r
-\r
                        t.count++;\r
 \r
                        return w;\r
                                DOM.removeClass(t.lastId, 'mceFocus');\r
                                DOM.addClass(id, 'mceFocus');\r
                                t.lastId = id;\r
+                               \r
+                               if (w.focussedElement) {\r
+                                       w.focussedElement.focus();\r
+                               } else if (DOM.get(id + '_ok')) {\r
+                                       DOM.get(w.id + '_ok').focus();\r
+                               } else if (DOM.get(w.id + '_ifr')) {\r
+                                       DOM.get(w.id + '_ifr').focus();\r
+                               }\r
                        }\r
                },\r
 \r
                },\r
 \r
                close : function(win, id) {\r
-                       var t = this, w, d = DOM.doc, ix = 0, fw, id;\r
+                       var t = this, w, d = DOM.doc, fw, id;\r
 \r
                        id = t._findId(id || win);\r
 \r
 \r
                        t.count--;\r
 \r
-                       if (t.count == 0)\r
+                       if (t.count == 0) {\r
                                DOM.remove('mceModalBlocker');\r
+                               DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');\r
+                               t.editor.focus();\r
+                       }\r
 \r
                        if (w = t.windows[id]) {\r
                                t.onClose.dispatch(t);\r
                                w.element.remove();\r
                                delete t.windows[id];\r
 \r
-                               // Find front most window and focus that\r
-                               each (t.windows, function(w) {\r
-                                       if (w.zIndex > ix) {\r
-                                               fw = w;\r
-                                               ix = w.zIndex;\r
-                                       }\r
-                               });\r
+                               fw = t._frontWindow();\r
 \r
                                if (fw)\r
                                        t.focus(fw.id);\r
                        }\r
                },\r
+               \r
+               // Find front most window\r
+               _frontWindow : function() {\r
+                       var fw, ix = 0;\r
+                       // Find front most window and focus that\r
+                       each (this.windows, function(w) {\r
+                               if (w.zIndex > ix) {\r
+                                       fw = w;\r
+                                       ix = w.zIndex;\r
+                               }\r
+                       });\r
+                       return fw;\r
+               },\r
 \r
                setTitle : function(w, ti) {\r
                        var e;\r
old mode 100755 (executable)
new mode 100644 (file)
index 94abd08..2191398
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif and b/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index e671094..f957e49
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif and b/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 497307a..20acbbf
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif and b/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index c894b2e..d5de1cc
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif and b/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 43a735f..0b4cc36
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif and b/library/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 5e6fd7d..a50d4fc
@@ -87,4 +87,4 @@
 .clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
 .clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
 .clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
-.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)} 
\ No newline at end of file
+.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}
old mode 100755 (executable)
new mode 100644 (file)
index f88a6dd..ca3857a
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.Layer",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertLayer",c._insertLayer,c);a.addCommand("mceMoveForward",function(){c._move(1)});a.addCommand("mceMoveBackward",function(){c._move(-1)});a.addCommand("mceMakeAbsolute",function(){c._toggleAbsolute()});a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});a.onInit.add(function(){if(tinymce.isIE){a.getDoc().execCommand("2D-Position",false,true)}});a.onNodeChange.add(c._nodeChange,c);a.onVisualAid.add(c._visualAid,c)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var c,d;c=this._getParentLayer(e);d=b.dom.getParent(e,"DIV,P,IMG");if(!d){a.setDisabled("absolute",1);a.setDisabled("moveforward",1);a.setDisabled("movebackward",1)}else{a.setDisabled("absolute",0);a.setDisabled("moveforward",!c);a.setDisabled("movebackward",!c);a.setActive("absolute",c&&c.style.position.toLowerCase()=="absolute")}},_visualAid:function(a,c,b){var d=a.dom;tinymce.each(d.select("div,p",c),function(f){if(/^(absolute|relative|static)$/i.test(f.style.position)){if(b){d.addClass(f,"mceItemVisualAid")}else{d.removeClass(f,"mceItemVisualAid")}}})},_move:function(h){var b=this.editor,f,g=[],e=this._getParentLayer(b.selection.getNode()),c=-1,j=-1,a;a=[];tinymce.walk(b.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){a.push(d)}},"childNodes");for(f=0;f<a.length;f++){g[f]=a[f].style.zIndex?parseInt(a[f].style.zIndex):0;if(c<0&&a[f]==e){c=f}}if(h<0){for(f=0;f<g.length;f++){if(g[f]<g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{if(g[c]>0){a[c].style.zIndex=g[c]-1}}}else{for(f=0;f<g.length;f++){if(g[f]>g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{a[c].style.zIndex=g[c]+1}}b.execCommand("mceRepaint")},_getParentLayer:function(a){return this.editor.dom.getParent(a,function(b){return b.nodeType==1&&/^(absolute|relative|static)$/i.test(b.style.position)})},_insertLayer:function(){var a=this.editor,b=a.dom.getPos(a.dom.getParent(a.selection.getNode(),"*"));a.dom.add(a.getBody(),"div",{style:{position:"absolute",left:b.x,top:(b.y>20?b.y:20),width:100,height:100},"class":"mceItemVisualAid"},a.selection.getContent()||a.getLang("layer.content"))},_toggleAbsolute:function(){var a=this.editor,b=this._getParentLayer(a.selection.getNode());if(!b){b=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")}if(b){if(b.style.position.toLowerCase()=="absolute"){a.dom.setStyles(b,{position:"",left:"",top:"",width:"",height:""});a.dom.removeClass(b,"mceItemVisualAid")}else{if(b.style.left==""){b.style.left=20+"px"}if(b.style.top==""){b.style.top=20+"px"}if(b.style.width==""){b.style.width=b.width?(b.width+"px"):"100px"}if(b.style.height==""){b.style.height=b.height?(b.height+"px"):"100px"}b.style.position="absolute";a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
\ No newline at end of file
+(function(){function a(b){do{if(b.className&&b.className.indexOf("mceItemLayer")!=-1){return b}}while(b=b.parentNode)}tinymce.create("tinymce.plugins.Layer",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceInsertLayer",d._insertLayer,d);b.addCommand("mceMoveForward",function(){d._move(1)});b.addCommand("mceMoveBackward",function(){d._move(-1)});b.addCommand("mceMakeAbsolute",function(){d._toggleAbsolute()});b.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});b.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});b.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});b.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});b.onInit.add(function(){var e=b.dom;if(tinymce.isIE){b.getDoc().execCommand("2D-Position",false,true)}});b.onMouseUp.add(function(f,h){var g=a(h.target);if(g){f.dom.setAttrib(g,"data-mce-style","")}});b.onMouseDown.add(function(f,j){var h=j.target,i=f.getDoc(),g;if(tinymce.isGecko){if(a(h)){if(i.designMode!=="on"){i.designMode="on";h=i.body;g=h.parentNode;g.removeChild(h);g.appendChild(h)}}else{if(i.designMode=="on"){i.designMode="off"}}}});b.onNodeChange.add(d._nodeChange,d);b.onVisualAid.add(d._visualAid,d)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(c,b,f){var d,e;d=this._getParentLayer(f);e=c.dom.getParent(f,"DIV,P,IMG");if(!e){b.setDisabled("absolute",1);b.setDisabled("moveforward",1);b.setDisabled("movebackward",1)}else{b.setDisabled("absolute",0);b.setDisabled("moveforward",!d);b.setDisabled("movebackward",!d);b.setActive("absolute",d&&d.style.position.toLowerCase()=="absolute")}},_visualAid:function(b,d,c){var f=b.dom;tinymce.each(f.select("div,p",d),function(g){if(/^(absolute|relative|fixed)$/i.test(g.style.position)){if(c){f.addClass(g,"mceItemVisualAid")}else{f.removeClass(g,"mceItemVisualAid")}f.addClass(g,"mceItemLayer")}})},_move:function(j){var c=this.editor,g,h=[],f=this._getParentLayer(c.selection.getNode()),e=-1,k=-1,b;b=[];tinymce.walk(c.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){b.push(d)}},"childNodes");for(g=0;g<b.length;g++){h[g]=b[g].style.zIndex?parseInt(b[g].style.zIndex):0;if(e<0&&b[g]==f){e=g}}if(j<0){for(g=0;g<h.length;g++){if(h[g]<h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{if(h[e]>0){b[e].style.zIndex=h[e]-1}}}else{for(g=0;g<h.length;g++){if(h[g]>h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{b[e].style.zIndex=h[e]+1}}c.execCommand("mceRepaint")},_getParentLayer:function(b){return this.editor.dom.getParent(b,function(c){return c.nodeType==1&&/^(absolute|relative|static)$/i.test(c.style.position)})},_insertLayer:function(){var c=this.editor,e=c.dom,d=e.getPos(e.getParent(c.selection.getNode(),"*")),b=c.getBody();c.dom.add(b,"div",{style:{position:"absolute",left:d.x,top:(d.y>20?d.y:20),width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},c.selection.getContent()||c.getLang("layer.content"));if(tinymce.isIE){e.setHTML(b,b.innerHTML)}},_toggleAbsolute:function(){var b=this.editor,c=this._getParentLayer(b.selection.getNode());if(!c){c=b.dom.getParent(b.selection.getNode(),"DIV,P,IMG")}if(c){if(c.style.position.toLowerCase()=="absolute"){b.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""});b.dom.removeClass(c,"mceItemVisualAid");b.dom.removeClass(c,"mceItemLayer")}else{if(c.style.left==""){c.style.left=20+"px"}if(c.style.top==""){c.style.top=20+"px"}if(c.style.width==""){c.style.width=c.width?(c.width+"px"):"100px"}if(c.style.height==""){c.style.height=c.height?(c.height+"px"):"100px"}c.style.position="absolute";b.dom.setAttrib(c,"data-mce-style","");b.addVisual(b.getBody())}b.execCommand("mceRepaint");b.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d5aa865..daed280
@@ -9,6 +9,14 @@
  */\r
 \r
 (function() {\r
+       function findParentLayer(node) {\r
+               do {\r
+                       if (node.className && node.className.indexOf('mceItemLayer') != -1) {\r
+                               return node;\r
+                       }\r
+               } while (node = node.parentNode);\r
+       };\r
+\r
        tinymce.create('tinymce.plugins.Layer', {\r
                init : function(ed, url) {\r
                        var t = this;\r
                        ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'});\r
 \r
                        ed.onInit.add(function() {\r
+                               var dom = ed.dom;\r
+\r
                                if (tinymce.isIE)\r
                                        ed.getDoc().execCommand('2D-Position', false, true);\r
                        });\r
 \r
+                       // Remove serialized styles when selecting a layer since it might be changed by a drag operation\r
+                       ed.onMouseUp.add(function(ed, e) {\r
+                               var layer = findParentLayer(e.target);\r
+       \r
+                               if (layer) {\r
+                                       ed.dom.setAttrib(layer, 'data-mce-style', '');\r
+                               }\r
+                       });\r
+\r
+                       // Fixes edit focus issues with layers on Gecko\r
+                       // This will enable designMode while inside a layer and disable it when outside\r
+                       ed.onMouseDown.add(function(ed, e) {\r
+                               var node = e.target, doc = ed.getDoc(), parent;\r
+\r
+                               if (tinymce.isGecko) {\r
+                                       if (findParentLayer(node)) {\r
+                                               if (doc.designMode !== 'on') {\r
+                                                       doc.designMode = 'on';\r
+\r
+                                                       // Repaint caret\r
+                                                       node = doc.body;\r
+                                                       parent = node.parentNode;\r
+                                                       parent.removeChild(node);\r
+                                                       parent.appendChild(node);\r
+                                               }\r
+                                       } else if (doc.designMode == 'on') {\r
+                                               doc.designMode = 'off';\r
+                                       }\r
+                               }\r
+                       });\r
+\r
                        ed.onNodeChange.add(t._nodeChange, t);\r
                        ed.onVisualAid.add(t._visualAid, t);\r
                },\r
                        var dom = ed.dom;\r
 \r
                        tinymce.each(dom.select('div,p', e), function(e) {\r
-                               if (/^(absolute|relative|static)$/i.test(e.style.position)) {\r
+                               if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {\r
                                        if (s)\r
                                                dom.addClass(e, 'mceItemVisualAid');\r
                                        else\r
-                                               dom.removeClass(e, 'mceItemVisualAid'); \r
+                                               dom.removeClass(e, 'mceItemVisualAid');\r
+\r
+                                       dom.addClass(e, 'mceItemLayer');\r
                                }\r
                        });\r
                },\r
                },\r
 \r
                _insertLayer : function() {\r
-                       var ed = this.editor, p = ed.dom.getPos(ed.dom.getParent(ed.selection.getNode(), '*'));\r
+                       var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody();\r
 \r
-                       ed.dom.add(ed.getBody(), 'div', {\r
+                       ed.dom.add(body, 'div', {\r
                                style : {\r
                                        position : 'absolute',\r
                                        left : p.x,\r
                                        width : 100,\r
                                        height : 100\r
                                },\r
-                               'class' : 'mceItemVisualAid'\r
+                               'class' : 'mceItemVisualAid mceItemLayer'\r
                        }, ed.selection.getContent() || ed.getLang('layer.content'));\r
+\r
+                       // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7\r
+                       if (tinymce.isIE)\r
+                               dom.setHTML(body, body.innerHTML);\r
                },\r
 \r
                _toggleAbsolute : function() {\r
                                        });\r
 \r
                                        ed.dom.removeClass(le, 'mceItemVisualAid');\r
+                                       ed.dom.removeClass(le, 'mceItemLayer');\r
                                } else {\r
                                        if (le.style.left == "")\r
                                                le.style.left = 20 + 'px';\r
                                                le.style.height = le.height ? (le.height + 'px') : '100px';\r
 \r
                                        le.style.position = "absolute";\r
+\r
+                                       ed.dom.setAttrib(le, 'data-mce-style', '');\r
                                        ed.addVisual(ed.getBody());\r
                                }\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 29d43c5..b3a4ce3
@@ -1 +1 @@
-(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.serializer;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"full"}},bold:{inline:"b"},italic:{inline:"i"},underline:{inline:"u"},strikethrough:{inline:"strike"},fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});d._setup();a.each("b,i,u,strike".split(","),function(f){var g=d.rules[f];if(!g){d.addRules(f)}});if(!d.rules.font){d.addRules("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.rules[f],g;if(h){a.each(h.attribs,function(j,i){if(i.name=="align"){g=true;return false}});if(!g){h.attribs.push({name:"align"})}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
\ No newline at end of file
+(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index e852da1..e627ec7
@@ -26,7 +26,7 @@
                        editor.onInit.add(function() {\r
                                var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',\r
                                        fontSizes = tinymce.explode(editor.settings.font_size_style_values),\r
-                                       serializer = editor.serializer;\r
+                                       schema = editor.schema;\r
 \r
                                // Override some internal formats to produce legacy elements and attributes\r
                                editor.formatter.register({\r
                                        alignleft : {selector : alignElements, attributes : {align : 'left'}},\r
                                        aligncenter : {selector : alignElements, attributes : {align : 'center'}},\r
                                        alignright : {selector : alignElements, attributes : {align : 'right'}},\r
-                                       alignfull : {selector : alignElements, attributes : {align : 'full'}},\r
-\r
-                                       // Change the basic formatting elements to use deprecated element types\r
-                                       bold : {inline : 'b'},\r
-                                       italic : {inline : 'i'},\r
-                                       underline : {inline : 'u'},\r
-                                       strikethrough : {inline : 'strike'},\r
+                                       alignfull : {selector : alignElements, attributes : {align : 'justify'}},\r
+\r
+                                       // Change the basic formatting elements to use deprecated element types
+                                       bold : [\r
+                                               {inline : 'b', remove : 'all'},\r
+                                               {inline : 'strong', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontWeight : 'bold'}}\r
+                                       ],\r
+                                       italic : [\r
+                                               {inline : 'i', remove : 'all'},\r
+                                               {inline : 'em', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontStyle : 'italic'}}\r
+                                       ],\r
+                                       underline : [\r
+                                               {inline : 'u', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration : 'underline'}, exact : true}\r
+                                       ],\r
+                                       strikethrough : [\r
+                                               {inline : 'strike', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration: 'line-through'}, exact : true}\r
+                                       ],
 \r
                                        // Change font size and font family to use the deprecated font element\r
                                        fontname : {inline : 'font', attributes : {face : '%value'}},\r
                                        hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}\r
                                });\r
 \r
-                               // Force parsing of the serializer rules\r
-                               serializer._setup();\r
-\r
                                // Check that deprecated elements are allowed if not add them\r
                                tinymce.each('b,i,u,strike'.split(','), function(name) {\r
-                                       var rule = serializer.rules[name];\r
-\r
-                                       if (!rule)\r
-                                               serializer.addRules(name);\r
+                                       schema.addValidElements(name + '[*]');\r
                                });\r
 \r
                                // Add font element if it's missing\r
-                               if (!serializer.rules["font"])\r
-                                       serializer.addRules("font[face|size|color|style]");\r
+                               if (!schema.getElementRule("font"))\r
+                                       schema.addValidElements("font[face|size|color|style]");\r
 \r
                                // Add the missing and depreacted align attribute for the serialization engine\r
                                tinymce.each(alignElements.split(','), function(name) {\r
-                                       var rule = serializer.rules[name], found;\r
+                                       var rule = schema.getElementRule(name), found;\r
 \r
                                        if (rule) {\r
-                                               tinymce.each(rule.attribs, function(name, attr) {\r
-                                                       if (attr.name == 'align') {\r
-                                                               found = true;\r
-                                                               return false;\r
-                                                       }\r
-                                               });\r
-\r
-                                               if (!found)\r
-                                                       rule.attribs.push({name : 'align'});\r
+                                               if (!rule.attributes.align) {\r
+                                                       rule.attributes.align = {};\r
+                                                       rule.attributesOrder.push('align');\r
+                                               }\r
                                        }\r
                                });\r
 \r
 \r
        // Register plugin\r
        tinymce.PluginManager.add('legacyoutput', tinymce.plugins.LegacyOutput);\r
-})(tinymce);
\ No newline at end of file
+})(tinymce);\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js
new file mode 100644 (file)
index 0000000..f07e372
--- /dev/null
@@ -0,0 +1 @@
+(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{return v&&u.tagName==="P"&&t.tagName==="P"}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(y){var v="TABBING";var s="EMPTY";var J="ESCAPE";var z="PARAGRAPH";var N="UNKNOWN";var x=N;function E(U){return U.keyCode===tinymce.VK.TAB&&!(U.altKey||U.ctrlKey)&&(y.queryCommandState("InsertUnorderedList")||y.queryCommandState("InsertOrderedList"))}function w(){var U=B();var W=U.parentNode.parentNode;var V=U.parentNode.lastChild===U;return V&&!t(W)&&P(U)}function t(U){if(n(U)){return U.parentNode&&U.parentNode.tagName==="LI"}else{return U.tagName==="LI"}}function F(){return y.selection.isCollapsed()&&P(B())}function B(){var U=y.selection.getStart();return((U.tagName=="BR"||U.tagName=="")&&U.parentNode.tagName=="LI")?U.parentNode:U}function P(U){var V=U.childNodes.length;if(U.tagName==="LI"){return V==0?true:V==1&&(U.firstChild.tagName==""||U.firstChild.tagName=="BR"||H(U))}return false}function H(U){var V=tinymce.grep(U.parentNode.childNodes,function(Y){return Y.tagName=="LI"});var W=U==V[V.length-1];var X=U.firstChild;return tinymce.isIE9&&W&&(X.nodeValue==String.fromCharCode(160)||X.nodeValue==String.fromCharCode(32))}function T(U){return U.keyCode===tinymce.VK.ENTER}function A(U){return T(U)&&!U.shiftKey}function M(U){if(E(U)){return v}else{if(A(U)&&w()){return N}else{if(A(U)&&F()){return s}else{return N}}}}function D(U,V){if(x==v||x==s||tinymce.isGecko&&x==J){r.cancel(V)}}function C(){var U=y.selection.getRng(true);var V=U.startContainer;if(V.nodeType==3){var W=V.nodeValue;if(tinymce.isIE9&&W.length>1&&W.charCodeAt(W.length-1)==32){return(U.endOffset==W.length-1)}else{return(U.endOffset==W.length)}}else{if(V.nodeType==1){return U.endOffset==V.childNodes.length}}return false}function I(){var W=y.selection.getNode();var V="h1,h2,h3,h4,h5,h6,p,div";var U=y.dom.is(W,V)&&W.parentNode.tagName==="LI"&&W.parentNode.lastChild===W;return y.selection.isCollapsed()&&U&&C()}function K(W,Y){if(A(Y)&&I()){var X=W.selection.getNode();var V=W.dom.create("li");var U=W.dom.getParent(X,"li");W.dom.insertAfter(V,U);if(tinymce.isIE6||tinymce.isIE7||tinyMCE.isIE8){W.selection.setCursorLocation(V,1)}else{W.selection.setCursorLocation(V,0)}Y.preventDefault()}}function u(X,Z){var ac;if(!tinymce.isGecko){return}var V=X.selection.getStart();if(Z.keyCode!=tinymce.VK.BACKSPACE||V.tagName!=="IMG"){return}function W(ag){var ah=ag.firstChild;var af=null;do{if(!ah){break}if(ah.tagName==="LI"){af=ah}}while(ah=ah.nextSibling);return af}function ae(ag,af){while(ag.childNodes.length>0){af.appendChild(ag.childNodes[0])}}ac=V.parentNode.previousSibling;if(!ac){return}var aa;if(ac.tagName==="UL"||ac.tagName==="OL"){aa=ac}else{if(ac.previousSibling&&(ac.previousSibling.tagName==="UL"||ac.previousSibling.tagName==="OL")){aa=ac.previousSibling}else{return}}var ad=W(aa);var U=X.dom.createRng();U.setStart(ad,1);U.setEnd(ad,1);X.selection.setRng(U);X.selection.collapse(true);var Y=X.selection.getBookmark();var ab=V.parentNode.cloneNode(true);if(ab.tagName==="P"||ab.tagName==="DIV"){ae(ab,ad)}else{ad.appendChild(ab)}V.parentNode.parentNode.removeChild(V.parentNode);X.selection.moveToBookmark(Y)}function G(U){var V=y.dom.getParent(U,"ol,ul");if(V!=null){var W=V.lastChild;y.selection.setCursorLocation(W,0)}}this.ed=y;y.addCommand("Indent",this.indent,this);y.addCommand("Outdent",this.outdent,this);y.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);y.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);y.onInit.add(function(){y.editorCommands.addCommands({outdent:function(){var V=y.selection,W=y.dom;function U(X){X=W.getParent(X,W.isBlock);return X&&(parseInt(y.dom.getStyle(X,"margin-left")||0,10)+parseInt(y.dom.getStyle(X,"padding-left")||0,10))>0}return U(V.getStart())||U(V.getEnd())||y.queryCommandState("InsertOrderedList")||y.queryCommandState("InsertUnorderedList")}},"state")});y.onKeyUp.add(function(V,W){if(x==v){V.execCommand(W.shiftKey?"Outdent":"Indent",true,null);x=N;return r.cancel(W)}else{if(x==s){var U=B();var Y=V.settings.list_outdent_on_enter===true||W.shiftKey;V.execCommand(Y?"Outdent":"Indent",true,null);if(tinymce.isIE){G(U)}return r.cancel(W)}else{if(x==J){if(tinymce.isIE6||tinymce.isIE7||tinymce.isIE8){var X=V.getDoc().createTextNode("\uFEFF");V.selection.getNode().appendChild(X)}else{if(tinymce.isIE9||tinymce.isGecko){V.execCommand("Outdent");return r.cancel(W)}}}}}});function L(V,U){var W=y.getDoc().createTextNode("\uFEFF");V.insertBefore(W,U);y.selection.setCursorLocation(W,0);y.execCommand("mceRepaint")}function R(V,X){if(T(X)){var U=B();if(U){var W=U.parentNode;var Y=W&&W.parentNode;if(Y&&Y.nodeName=="LI"&&Y.firstChild==W&&U==W.firstChild){L(Y,W)}}}}function S(V,X){if(T(X)){var U=B();if(V.dom.select("ul li",U).length===1){var W=U.firstChild;L(U,W)}}}function Q(V,Z){function W(ad,aa){var ac=[];var ae=new tinymce.dom.TreeWalker(aa,ad);for(var ab=ae.current();ab;ab=ae.next()){if(V.dom.is(ab,"ol,ul,li")){ac.push(ab)}}return ac}if(Z.keyCode==tinymce.VK.BACKSPACE){var U=B();if(U){var Y=V.dom.getParent(U,"ol,ul");if(Y&&Y.firstChild===U){var X=W(Y,U);V.execCommand("Outdent",false,X);V.undoManager.add();return r.cancel(Z)}}}}function O(V,X){var U=B();if(X.keyCode===tinymce.VK.BACKSPACE&&V.dom.is(U,"li")&&U.parentNode.firstChild!==U){if(V.dom.select("ul,ol",U).length===1){var Z=U.previousSibling;V.dom.remove(V.dom.select("br",U));V.dom.remove(U,true);var W=tinymce.grep(Z.childNodes,function(aa){return aa.nodeType===3});if(W.length===1){var Y=W[0];V.selection.setCursorLocation(Y,Y.length)}V.undoManager.add();return r.cancel(X)}}}y.onKeyDown.add(function(U,V){x=M(V)});y.onKeyDown.add(D);y.onKeyDown.add(u);y.onKeyDown.add(K);if(tinymce.isGecko){y.onKeyUp.add(R)}if(tinymce.isIE8){y.onKeyUp.add(S)}if(tinymce.isGecko||tinymce.isWebKit){y.onKeyDown.add(Q)}if(tinymce.isWebKit){y.onKeyDown.add(O)}},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(t){if(t.tagName==="LI"&&(M.tagName==="P"||G.length>1)){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true)}return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(P,L,N){var t,O=P,M;while(!I.isBlock(P.parentNode)&&P.parentNode!==I.getRoot()){P=I.split(P.parentNode,P.previousSibling);P=P.nextSibling;O=P}if(N){t=N.cloneNode(true);P.parentNode.insertBefore(t,P);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");P.parentNode.insertBefore(t,P)}while(O&&O!=L){M=O.nextSibling;t.appendChild(O);O=M}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(U){if(U.hasAttribute&&U.hasAttribute("_mce_bogus")){return true}if(P(N,U)){I.addClass(U,"_mce_tagged_br");N=S(U)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w&&!H||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D,elements:this.selectedBlocks()}}else{B={defaultAction:x,elements:this.selectedBlocks()}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true),elements:this.selectedBlocks()})},outdent:function(y,x){var w=this,u=w.ed,z=u.dom,s=[];function A(t){var C,B,D;if(!d(u,t,s)){if(z.getStyle(t,"margin-left")!==""||z.getStyle(t,"padding-left")!==""){return w.adjustPaddingFunction(false)(t)}D=z.getStyle(t,"text-align",true);if(D==="center"||D==="right"){z.setStyle(t,"text-align","left");return}t=c(t,z);C=t.parentNode;B=t.parentNode.parentNode;if(B.tagName==="P"){z.split(B,t.parentNode)}else{z.split(C,t);if(B.tagName==="LI"){z.split(B,t)}else{if(!z.is(B,"ol,ul")){z.rename(t,"p")}}}s.push(t)}}var v=x&&tinymce.is(x,"array")?x:this.selectedBlocks();this.process({LI:A,defaultAction:this.adjustPaddingFunction(false),elements:v});e(s,m)},process:function(y){var F=this,w=F.ed.selection,z=F.ed.dom,E,u;function B(t){var s=tinymce.grep(t.childNodes,function(H){return !(H.nodeName==="BR"||H.nodeName==="SPAN"&&z.getAttrib(H,"data-mce-type")=="bookmark"||H.nodeType==3&&(H.nodeValue==String.fromCharCode(160)||H.nodeValue==""))});return s.length===0}function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1||E.length>1&&B(s)){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){F.splitSafeEach(s.childNodes,x)}function C(s,t){return t>=0&&s.hasChildNodes()&&t<s.childNodes.length&&s.childNodes[t].tagName==="BR"}function D(){var t=w.getNode();var s=z.getParent(t,"td");return s!==null}E=y.elements;u=w.getRng(true);if(!u.collapsed){if(C(u.endContainer,u.endOffset-1)){u.setEnd(u.endContainer,u.endOffset-1);w.setRng(u)}if(C(u.startContainer,u.startOffset)){u.setStart(u.startContainer,u.startOffset+1);w.setRng(u)}}if(tinymce.isIE8){var G=F.ed.selection.getNode();if(G.tagName==="LI"&&!(G.parentNode.lastChild===G)){var A=F.ed.getDoc().createTextNode("\uFEFF");G.appendChild(A)}}g=w.getBookmark();y.OL=y.UL=v;F.splitSafeEach(E,x);w.moveToBookmark(g);g=null;if(!D()){F.ed.execCommand("mceRepaint")}},splitSafeEach:function(t,s){if(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent))){this.classBasedEach(t,s)}else{e(t,s)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},selectedBlocks:function(){var s=this.ed;var t=s.selection.getSelectedBlocks();return t.length==0?[s.dom.getRoot()]:t},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}());
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..fa10b74
--- /dev/null
@@ -0,0 +1,951 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2011, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       var each = tinymce.each, Event = tinymce.dom.Event, bookmark;\r
+\r
+       // Skips text nodes that only contain whitespace since they aren't semantically important.\r
+       function skipWhitespaceNodes(e, next) {\r
+               while (e && (e.nodeType === 8 || (e.nodeType === 3 && /^[ \t\n\r]*$/.test(e.nodeValue)))) {\r
+                       e = next(e);\r
+               }\r
+               return e;\r
+       }\r
+\r
+       function skipWhitespaceNodesBackwards(e) {\r
+               return skipWhitespaceNodes(e, function(e) {\r
+                       return e.previousSibling;\r
+               });\r
+       }\r
+\r
+       function skipWhitespaceNodesForwards(e) {\r
+               return skipWhitespaceNodes(e, function(e) {\r
+                       return e.nextSibling;\r
+               });\r
+       }\r
+\r
+       function hasParentInList(ed, e, list) {\r
+               return ed.dom.getParent(e, function(p) {\r
+                       return tinymce.inArray(list, p) !== -1;\r
+               });\r
+       }\r
+\r
+       function isList(e) {\r
+               return e && (e.tagName === 'OL' || e.tagName === 'UL');\r
+       }\r
+\r
+       function splitNestedLists(element, dom) {\r
+               var tmp, nested, wrapItem;\r
+               tmp = skipWhitespaceNodesBackwards(element.lastChild);\r
+               while (isList(tmp)) {\r
+                       nested = tmp;\r
+                       tmp = skipWhitespaceNodesBackwards(nested.previousSibling);\r
+               }\r
+               if (nested) {\r
+                       wrapItem = dom.create('li', { style: 'list-style-type: none;'});\r
+                       dom.split(element, nested);\r
+                       dom.insertAfter(wrapItem, nested);\r
+                       wrapItem.appendChild(nested);\r
+                       wrapItem.appendChild(nested);\r
+                       element = wrapItem.previousSibling;\r
+               }\r
+               return element;\r
+       }\r
+\r
+       function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {\r
+               e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);\r
+               return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);\r
+       }\r
+\r
+       function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {\r
+               var prev = skipWhitespaceNodesBackwards(e.previousSibling);\r
+               if (prev) {\r
+                       return attemptMerge(prev, e, allowDifferentListStyles ? prev : false, mergeParagraphs);\r
+               } else {\r
+                       return e;\r
+               }\r
+       }\r
+\r
+       function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {\r
+               var next = skipWhitespaceNodesForwards(e.nextSibling);\r
+               if (next) {\r
+                       return attemptMerge(e, next, allowDifferentListStyles ? next : false, mergeParagraphs);\r
+               } else {\r
+                       return e;\r
+               }\r
+       }\r
+\r
+       function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {\r
+               if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {\r
+                       return merge(e1, e2, differentStylesMasterElement);\r
+               } else if (e1 && e1.tagName === 'LI' && isList(e2)) {\r
+                       // Fix invalidly nested lists.\r
+                       e1.appendChild(e2);\r
+               }\r
+               return e2;\r
+       }\r
+\r
+       function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {\r
+               if (!e1 || !e2) {\r
+                       return false;\r
+               } else if (e1.tagName === 'LI' && e2.tagName === 'LI') {\r
+                       return e2.style.listStyleType === 'none' || containsOnlyAList(e2);\r
+               } else if (isList(e1)) {\r
+                       return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);\r
+               } else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P';\r
+       }\r
+\r
+       function isListForIndent(e) {\r
+               var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);\r
+               return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));\r
+       }\r
+\r
+       function containsOnlyAList(e) {\r
+               var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);\r
+               return firstChild && lastChild && firstChild === lastChild && isList(firstChild);\r
+       }\r
+\r
+       function merge(e1, e2, masterElement) {\r
+               var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);\r
+               if (e1.tagName === 'P') {\r
+                       e1.appendChild(e1.ownerDocument.createElement('br'));\r
+               }\r
+               while (e2.firstChild) {\r
+                       e1.appendChild(e2.firstChild);\r
+               }\r
+               if (masterElement) {\r
+                       e1.style.listStyleType = masterElement.style.listStyleType;\r
+               }\r
+               e2.parentNode.removeChild(e2);\r
+               attemptMerge(lastOriginal, firstNew, false);\r
+               return e1;\r
+       }\r
+\r
+       function findItemToOperateOn(e, dom) {\r
+               var item;\r
+               if (!dom.is(e, 'li,ol,ul')) {\r
+                       item = dom.getParent(e, 'li');\r
+                       if (item) {\r
+                               e = item;\r
+                       }\r
+               }\r
+               return e;\r
+       }\r
+\r
+       tinymce.create('tinymce.plugins.Lists', {\r
+               init: function(ed) {\r
+                       var LIST_TABBING = 'TABBING';\r
+                       var LIST_EMPTY_ITEM = 'EMPTY';\r
+                       var LIST_ESCAPE = 'ESCAPE';\r
+                       var LIST_PARAGRAPH = 'PARAGRAPH';\r
+                       var LIST_UNKNOWN = 'UNKNOWN';\r
+                       var state = LIST_UNKNOWN;\r
+\r
+                       function isTabInList(e) {\r
+                               // Don't indent on Ctrl+Tab or Alt+Tab\r
+                               return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&\r
+                                       (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));\r
+                       }\r
+\r
+                       function isOnLastListItem() {\r
+                               var li = getLi();\r
+                               var grandParent = li.parentNode.parentNode;\r
+                               var isLastItem = li.parentNode.lastChild === li;\r
+                               return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li);\r
+                       }\r
+\r
+                       function isNestedList(grandParent) {\r
+                               if (isList(grandParent)) {\r
+                                       return grandParent.parentNode && grandParent.parentNode.tagName === 'LI';\r
+                               } else {\r
+                                       return  grandParent.tagName === 'LI';\r
+                               }\r
+                       }\r
+\r
+                       function isInEmptyListItem() {\r
+                               return ed.selection.isCollapsed() && isEmptyListItem(getLi());\r
+                       }\r
+\r
+                       function getLi() {\r
+                               var n = ed.selection.getStart();\r
+                               // Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position\r
+                               return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n;\r
+                       }\r
+\r
+                       function isEmptyListItem(li) {\r
+                               var numChildren = li.childNodes.length;\r
+                               if (li.tagName === 'LI') {\r
+                                       return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li));\r
+                               }\r
+                               return false;\r
+                       }\r
+\r
+                       function isEmptyIE9Li(li) {\r
+                               // only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these\r
+                               var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'});\r
+                               var isLastLi = li == lis[lis.length - 1];\r
+                               var child = li.firstChild;\r
+                               return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));\r
+                       }\r
+\r
+                       function isEnter(e) {\r
+                               return e.keyCode === tinymce.VK.ENTER;\r
+                       }\r
+\r
+                       function isEnterWithoutShift(e) {\r
+                               return isEnter(e) && !e.shiftKey;\r
+                       }\r
+\r
+                       function getListKeyState(e) {\r
+                               if (isTabInList(e)) {\r
+                                       return LIST_TABBING;\r
+                               } else if (isEnterWithoutShift(e) && isOnLastListItem()) {\r
+                                       // Returns LIST_UNKNOWN since breaking out of lists is handled by the EnterKey.js logic now\r
+                                       //return LIST_ESCAPE;\r
+                                       return LIST_UNKNOWN;\r
+                               } else if (isEnterWithoutShift(e) && isInEmptyListItem()) {\r
+                                       return LIST_EMPTY_ITEM;\r
+                               } else {\r
+                                       return LIST_UNKNOWN;\r
+                               }\r
+                       }\r
+\r
+                       function cancelDefaultEvents(ed, e) {\r
+                               // list escape is done manually using outdent as it does not create paragraphs correctly in td's\r
+                               if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) {\r
+                                       Event.cancel(e);\r
+                               }\r
+                       }\r
+\r
+                       function isCursorAtEndOfContainer() {\r
+                               var range = ed.selection.getRng(true);\r
+                               var startContainer = range.startContainer;\r
+                               if (startContainer.nodeType == 3) {\r
+                                       var value = startContainer.nodeValue;\r
+                                       if (tinymce.isIE9 && value.length > 1 && value.charCodeAt(value.length-1) == 32) {\r
+                                               // IE9 places a space on the end of the text in some cases so ignore last char\r
+                                               return (range.endOffset == value.length-1);\r
+                                       } else {\r
+                                               return (range.endOffset == value.length);\r
+                                       }\r
+                               } else if (startContainer.nodeType == 1) {\r
+                                       return range.endOffset == startContainer.childNodes.length;\r
+                               }\r
+                               return false;\r
+                       }\r
+\r
+                       /*\r
+                               If we are at the end of a list item surrounded with an element, pressing enter should create a\r
+                               new list item instead without splitting the element e.g. don't want to create new P or H1 tag\r
+                         */\r
+                       function isEndOfListItem() {\r
+                               var node = ed.selection.getNode();\r
+                               var validElements = 'h1,h2,h3,h4,h5,h6,p,div';\r
+                               var isLastParagraphOfLi = ed.dom.is(node, validElements) && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;\r
+                               return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();\r
+                       }\r
+\r
+                       // Creates a new list item after the current selection's list item parent\r
+                       function createNewLi(ed, e) {\r
+                               if (isEnterWithoutShift(e) && isEndOfListItem()) {\r
+                                       var node = ed.selection.getNode();\r
+                                       var li = ed.dom.create("li");\r
+                                       var parentLi = ed.dom.getParent(node, 'li');\r
+                                       ed.dom.insertAfter(li, parentLi);\r
+\r
+                                       // Move caret to new list element.\r
+                                       if (tinymce.isIE6 || tinymce.isIE7 || tinyMCE.isIE8) {\r
+                                               // Removed this line since it would create an odd <&nbsp;> tag and placing the caret inside an empty LI is handled and should be handled by the selection logic\r
+                                               //li.appendChild(ed.dom.create("&nbsp;")); // IE needs an element within the bullet point\r
+                                               ed.selection.setCursorLocation(li, 1);\r
+                                       } else {\r
+                                               ed.selection.setCursorLocation(li, 0);\r
+                                       }\r
+                                       e.preventDefault();\r
+                               }\r
+                       }\r
+\r
+                       function imageJoiningListItem(ed, e) {\r
+                               var prevSibling;\r
+\r
+                               if (!tinymce.isGecko)\r
+                                       return;\r
+\r
+                               var n = ed.selection.getStart();\r
+                               if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG')\r
+                                       return;\r
+\r
+                               function lastLI(node) {\r
+                                       var child = node.firstChild;\r
+                                       var li = null;\r
+                                       do {\r
+                                               if (!child)\r
+                                                       break;\r
+\r
+                                               if (child.tagName === 'LI')\r
+                                                       li = child;\r
+                                       } while (child = child.nextSibling);\r
+\r
+                                       return li;\r
+                               }\r
+\r
+                               function addChildren(parentNode, destination) {\r
+                                       while (parentNode.childNodes.length > 0)\r
+                                               destination.appendChild(parentNode.childNodes[0]);\r
+                               }\r
+\r
+                               // Check if there is a previous sibling\r
+                               prevSibling = n.parentNode.previousSibling;\r
+                               if (!prevSibling)\r
+                                       return;\r
+\r
+                               var ul;\r
+                               if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL')\r
+                                       ul = prevSibling;\r
+                               else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL'))\r
+                                       ul = prevSibling.previousSibling;\r
+                               else\r
+                                       return;\r
+\r
+                               var li = lastLI(ul);\r
+\r
+                               // move the caret to the end of the list item\r
+                               var rng = ed.dom.createRng();\r
+                               rng.setStart(li, 1);\r
+                               rng.setEnd(li, 1);\r
+                               ed.selection.setRng(rng);\r
+                               ed.selection.collapse(true);\r
+\r
+                               // save a bookmark at the end of the list item\r
+                               var bookmark = ed.selection.getBookmark();\r
+\r
+                               // copy the image an its text to the list item\r
+                               var clone = n.parentNode.cloneNode(true);\r
+                               if (clone.tagName === 'P' || clone.tagName === 'DIV')\r
+                                       addChildren(clone, li);\r
+                               else\r
+                                       li.appendChild(clone);\r
+\r
+                               // remove the old copy of the image\r
+                               n.parentNode.parentNode.removeChild(n.parentNode);\r
+\r
+                               // move the caret where we saved the bookmark\r
+                               ed.selection.moveToBookmark(bookmark);\r
+                       }\r
+\r
+                       // fix the cursor position to ensure it is correct in IE\r
+                       function setCursorPositionToOriginalLi(li) {\r
+                               var list = ed.dom.getParent(li, 'ol,ul');\r
+                               if (list != null) {\r
+                                       var lastLi = list.lastChild;\r
+                                       // Removed this line since IE9 would report an DOM character error and placing the caret inside an empty LI is handled and should be handled by the selection logic\r
+                                       //lastLi.appendChild(ed.getDoc().createElement(''));\r
+                                       ed.selection.setCursorLocation(lastLi, 0);\r
+                               }\r
+                       }\r
+\r
+                       this.ed = ed;\r
+                       ed.addCommand('Indent', this.indent, this);\r
+                       ed.addCommand('Outdent', this.outdent, this);\r
+                       ed.addCommand('InsertUnorderedList', function() {\r
+                               this.applyList('UL', 'OL');\r
+                       }, this);\r
+                       ed.addCommand('InsertOrderedList', function() {\r
+                               this.applyList('OL', 'UL');\r
+                       }, this);\r
+\r
+                       ed.onInit.add(function() {\r
+                               ed.editorCommands.addCommands({\r
+                                       'outdent': function() {\r
+                                               var sel = ed.selection, dom = ed.dom;\r
+\r
+                                               function hasStyleIndent(n) {\r
+                                                       n = dom.getParent(n, dom.isBlock);\r
+                                                       return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;\r
+                                               }\r
+\r
+                                               return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');\r
+                                       }\r
+                               }, 'state');\r
+                       });\r
+\r
+                       ed.onKeyUp.add(function(ed, e) {\r
+                               if (state == LIST_TABBING) {\r
+                                       ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);\r
+                                       state = LIST_UNKNOWN;\r
+                                       return Event.cancel(e);\r
+                               } else if (state == LIST_EMPTY_ITEM) {\r
+                                       var li = getLi();\r
+                                       var shouldOutdent =  ed.settings.list_outdent_on_enter === true || e.shiftKey;\r
+                                       ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null);\r
+                                       if (tinymce.isIE) {\r
+                                               setCursorPositionToOriginalLi(li);\r
+                                       }\r
+\r
+                                       return Event.cancel(e);\r
+                               } else if (state == LIST_ESCAPE) {\r
+                                       if (tinymce.isIE6 || tinymce.isIE7 || tinymce.isIE8) {\r
+                                               // append a zero sized nbsp so that caret is positioned correctly in IE after escaping and applying formatting.\r
+                                               // if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after\r
+                                               // escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.\r
+                                               var n = ed.getDoc().createTextNode('\uFEFF');\r
+                                               ed.selection.getNode().appendChild(n);\r
+                                       } else if (tinymce.isIE9 || tinymce.isGecko) {\r
+                                               // IE9 does not escape the list so we use outdent to do this and cancel the default behaviour\r
+                                               // Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves\r
+                                               ed.execCommand('Outdent');\r
+                                               return Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       function fixListItem(parent, reference) {\r
+                               // a zero-sized non-breaking space is placed in the empty list item so that the nested list is\r
+                               // displayed on the below line instead of next to it\r
+                               var n = ed.getDoc().createTextNode('\uFEFF');\r
+                               parent.insertBefore(n, reference);\r
+                               ed.selection.setCursorLocation(n, 0);\r
+                               // repaint to remove rendering artifact. only visible when creating new list\r
+                               ed.execCommand('mceRepaint');\r
+                       }\r
+\r
+                       function fixIndentedListItemForGecko(ed, e) {\r
+                               if (isEnter(e)) {\r
+                                       var li = getLi();\r
+                                       if (li) {\r
+                                               var parent = li.parentNode;\r
+                                               var grandParent = parent && parent.parentNode;\r
+                                               if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) {\r
+                                                       fixListItem(grandParent, parent);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       function fixIndentedListItemForIE8(ed, e) {\r
+                               if (isEnter(e)) {\r
+                                       var li = getLi();\r
+                                       if (ed.dom.select('ul li', li).length === 1) {\r
+                                               var list = li.firstChild;\r
+                                               fixListItem(li, list);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       function fixDeletingFirstCharOfList(ed, e) {\r
+                               function listElements(list, li) {\r
+                                       var elements = [];\r
+                                       var walker = new tinymce.dom.TreeWalker(li, list);\r
+                                       for (var node = walker.current(); node; node = walker.next()) {\r
+                                               if (ed.dom.is(node, 'ol,ul,li')) {\r
+                                                       elements.push(node);\r
+                                               }\r
+                                       }\r
+                                       return elements;\r
+                               }\r
+\r
+                               if (e.keyCode == tinymce.VK.BACKSPACE) {\r
+                                       var li = getLi();\r
+                                       if (li) {\r
+                                               var list = ed.dom.getParent(li, 'ol,ul');\r
+                                               if (list && list.firstChild === li) {\r
+                                                       var elements = listElements(list, li);\r
+                                                       ed.execCommand("Outdent", false, elements);\r
+                                                       ed.undoManager.add();\r
+                                                       return Event.cancel(e);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       function fixDeletingEmptyLiInWebkit(ed, e) {\r
+                               var li = getLi();\r
+                               if (e.keyCode === tinymce.VK.BACKSPACE && ed.dom.is(li, 'li') && li.parentNode.firstChild!==li) {\r
+                                       if (ed.dom.select('ul,ol', li).length === 1) {\r
+                                               var prevLi = li.previousSibling;\r
+                                               ed.dom.remove(ed.dom.select('br', li));\r
+                                               ed.dom.remove(li, true);\r
+                                               var textNodes = tinymce.grep(prevLi.childNodes, function(n){ return n.nodeType === 3 });\r
+                                               if (textNodes.length === 1) {\r
+                                                       var textNode = textNodes[0]\r
+                                                       ed.selection.setCursorLocation(textNode, textNode.length);\r
+                                               }\r
+                                               ed.undoManager.add();\r
+                                               return Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });\r
+                       ed.onKeyDown.add(cancelDefaultEvents);\r
+                       ed.onKeyDown.add(imageJoiningListItem);\r
+                       ed.onKeyDown.add(createNewLi);\r
+\r
+                       if (tinymce.isGecko) {\r
+                               ed.onKeyUp.add(fixIndentedListItemForGecko);\r
+                       }\r
+                       if (tinymce.isIE8) {\r
+                               ed.onKeyUp.add(fixIndentedListItemForIE8);\r
+                       }\r
+                       if (tinymce.isGecko || tinymce.isWebKit) {\r
+                               ed.onKeyDown.add(fixDeletingFirstCharOfList);\r
+                       }\r
+                       if (tinymce.isWebKit) {\r
+                               ed.onKeyDown.add(fixDeletingEmptyLiInWebkit);\r
+                       }\r
+               },\r
+\r
+               applyList: function(targetListType, oppositeListType) {\r
+                       var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,\r
+                                       selectedBlocks = ed.selection.getSelectedBlocks();\r
+\r
+                       function cleanupBr(e) {\r
+                               if (e && e.tagName === 'BR') {\r
+                                       dom.remove(e);\r
+                               }\r
+                       }\r
+\r
+                       function makeList(element) {\r
+                               var list = dom.create(targetListType), li;\r
+\r
+                               function adjustIndentForNewList(element) {\r
+                                       // If there's a margin-left, outdent one level to account for the extra list margin.\r
+                                       if (element.style.marginLeft || element.style.paddingLeft) {\r
+                                               t.adjustPaddingFunction(false)(element);\r
+                                       }\r
+                               }\r
+\r
+                               if (element.tagName === 'LI') {\r
+                                       // No change required.\r
+                               } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {\r
+                                       processBrs(element, function(startSection, br) {\r
+                                               doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);\r
+                                               li = startSection.parentNode;\r
+                                               adjustIndentForNewList(li);\r
+                                               cleanupBr(br);\r
+                                       });\r
+                                       if (li) {\r
+                                               if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) {\r
+                                                       dom.split(li.parentNode.parentNode, li.parentNode);\r
+                                               }\r
+                                               attemptMergeWithAdjacent(li.parentNode, true);\r
+                                       }\r
+                                       return;\r
+                               } else {\r
+                                       // Put the list around the element.\r
+                                       li = dom.create('li');\r
+                                       dom.insertAfter(li, element);\r
+                                       li.appendChild(element);\r
+                                       adjustIndentForNewList(element);\r
+                                       element = li;\r
+                               }\r
+                               dom.insertAfter(list, element);\r
+                               list.appendChild(element);\r
+                               attemptMergeWithAdjacent(list, true);\r
+                               applied.push(element);\r
+                       }\r
+\r
+                       function doWrapList(start, end, template) {\r
+                               var li, n = start, tmp;\r
+                               while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {\r
+                                       start = dom.split(start.parentNode, start.previousSibling);\r
+                                       start = start.nextSibling;\r
+                                       n = start;\r
+                               }\r
+                               if (template) {\r
+                                       li = template.cloneNode(true);\r
+                                       start.parentNode.insertBefore(li, start);\r
+                                       while (li.firstChild) dom.remove(li.firstChild);\r
+                                       li = dom.rename(li, 'li');\r
+                               } else {\r
+                                       li = dom.create('li');\r
+                                       start.parentNode.insertBefore(li, start);\r
+                               }\r
+                               while (n && n != end) {\r
+                                       tmp = n.nextSibling;\r
+                                       li.appendChild(n);\r
+                                       n = tmp;\r
+                               }\r
+                               if (li.childNodes.length === 0) {\r
+                                       li.innerHTML = '<br _mce_bogus="1" />';\r
+                               }\r
+                               makeList(li);\r
+                       }\r
+\r
+                       function processBrs(element, callback) {\r
+                               var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,\r
+                                               breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';\r
+\r
+                               function isAnyPartSelected(start, end) {\r
+                                       var r = dom.createRng(), sel;\r
+                                       bookmark.keep = true;\r
+                                       ed.selection.moveToBookmark(bookmark);\r
+                                       bookmark.keep = false;\r
+                                       sel = ed.selection.getRng(true);\r
+                                       if (!end) {\r
+                                               end = start.parentNode.lastChild;\r
+                                       }\r
+                                       r.setStartBefore(start);\r
+                                       r.setEndAfter(end);\r
+                                       return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);\r
+                               }\r
+\r
+                               function nextLeaf(br) {\r
+                                       if (br.nextSibling)\r
+                                               return br.nextSibling;\r
+                                       if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())\r
+                                               return nextLeaf(br.parentNode);\r
+                               }\r
+\r
+                               // Split on BRs within the range and process those.\r
+                               startSection = element.firstChild;\r
+                               // First mark the BRs that have any part of the previous section selected.\r
+                               var trailingContentSelected = false;\r
+                               each(dom.select(breakElements, element), function(br) {\r
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {\r
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.\r
+                                       }\r
+                                       if (isAnyPartSelected(startSection, br)) {\r
+                                               dom.addClass(br, '_mce_tagged_br');\r
+                                               startSection = nextLeaf(br);\r
+                                       }\r
+                               });\r
+                               trailingContentSelected = (startSection && isAnyPartSelected(startSection, undefined));\r
+                               startSection = element.firstChild;\r
+                               each(dom.select(breakElements, element), function(br) {\r
+                                       // Got a section from start to br.\r
+                                       var tmp = nextLeaf(br);\r
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {\r
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.\r
+                                       }\r
+                                       if (dom.hasClass(br, '_mce_tagged_br')) {\r
+                                               callback(startSection, br, previousBR);\r
+                                               previousBR = null;\r
+                                       } else {\r
+                                               previousBR = br;\r
+                                       }\r
+                                       startSection = tmp;\r
+                               });\r
+                               if (trailingContentSelected) {\r
+                                       callback(startSection, undefined, previousBR);\r
+                               }\r
+                       }\r
+\r
+                       function wrapList(element) {\r
+                               processBrs(element, function(startSection, br, previousBR) {\r
+                                       // Need to indent this part\r
+                                       doWrapList(startSection, br);\r
+                                       cleanupBr(br);\r
+                                       cleanupBr(previousBR);\r
+                               });\r
+                       }\r
+\r
+                       function changeList(element) {\r
+                               if (tinymce.inArray(applied, element) !== -1) {\r
+                                       return;\r
+                               }\r
+                               if (element.parentNode.tagName === oppositeListType) {\r
+                                       dom.split(element.parentNode, element);\r
+                                       makeList(element);\r
+                                       attemptMergeWithNext(element.parentNode, false);\r
+                               }\r
+                               applied.push(element);\r
+                       }\r
+\r
+                       function convertListItemToParagraph(element) {\r
+                               var child, nextChild, mergedElement, splitLast;\r
+                               if (tinymce.inArray(applied, element) !== -1) {\r
+                                       return;\r
+                               }\r
+                               element = splitNestedLists(element, dom);\r
+                               while (dom.is(element.parentNode, 'ol,ul,li')) {\r
+                                       dom.split(element.parentNode, element);\r
+                               }\r
+                               // Push the original element we have from the selection, not the renamed one.\r
+                               applied.push(element);\r
+                               element = dom.rename(element, 'p');\r
+                               mergedElement = attemptMergeWithAdjacent(element, false, ed.settings.force_br_newlines);\r
+                               if (mergedElement === element) {\r
+                                       // Now split out any block elements that can't be contained within a P.\r
+                                       // Manually iterate to ensure we handle modifications correctly (doesn't work with tinymce.each)\r
+                                       child = element.firstChild;\r
+                                       while (child) {\r
+                                               if (dom.isBlock(child)) {\r
+                                                       child = dom.split(child.parentNode, child);\r
+                                                       splitLast = true;\r
+                                                       nextChild = child.nextSibling && child.nextSibling.firstChild;\r
+                                               } else {\r
+                                                       nextChild = child.nextSibling;\r
+                                                       if (splitLast && child.tagName === 'BR') {\r
+                                                               dom.remove(child);\r
+                                                       }\r
+                                                       splitLast = false;\r
+                                               }\r
+                                               child = nextChild;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       each(selectedBlocks, function(e) {\r
+                               e = findItemToOperateOn(e, dom);\r
+                               if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {\r
+                                       hasOppositeType = true;\r
+                               } else if (e.tagName === targetListType || (e.tagName === 'LI' && e.parentNode.tagName === targetListType)) {\r
+                                       hasSameType = true;\r
+                               } else {\r
+                                       hasNonList = true;\r
+                               }\r
+                       });\r
+\r
+                       if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) {\r
+                               actions = {\r
+                                       'LI': changeList,\r
+                                       'H1': makeList,\r
+                                       'H2': makeList,\r
+                                       'H3': makeList,\r
+                                       'H4': makeList,\r
+                                       'H5': makeList,\r
+                                       'H6': makeList,\r
+                                       'P': makeList,\r
+                                       'BODY': makeList,\r
+                                       'DIV': selectedBlocks.length > 1 ? makeList : wrapList,\r
+                                       defaultAction: wrapList,\r
+                                       elements: this.selectedBlocks()\r
+                               };\r
+                       } else {\r
+                               actions = {\r
+                                       defaultAction: convertListItemToParagraph,\r
+                                       elements: this.selectedBlocks()\r
+                               };\r
+                       }\r
+                       this.process(actions);\r
+               },\r
+\r
+               indent: function() {\r
+                       var ed = this.ed, dom = ed.dom, indented = [];\r
+\r
+                       function createWrapItem(element) {\r
+                               var wrapItem = dom.create('li', { style: 'list-style-type: none;'});\r
+                               dom.insertAfter(wrapItem, element);\r
+                               return wrapItem;\r
+                       }\r
+\r
+                       function createWrapList(element) {\r
+                               var wrapItem = createWrapItem(element),\r
+                                               list = dom.getParent(element, 'ol,ul'),\r
+                                               listType = list.tagName,\r
+                                               listStyle = dom.getStyle(list, 'list-style-type'),\r
+                                               attrs = {},\r
+                                               wrapList;\r
+                               if (listStyle !== '') {\r
+                                       attrs.style = 'list-style-type: ' + listStyle + ';';\r
+                               }\r
+                               wrapList = dom.create(listType, attrs);\r
+                               wrapItem.appendChild(wrapList);\r
+                               return wrapList;\r
+                       }\r
+\r
+                       function indentLI(element) {\r
+                               if (!hasParentInList(ed, element, indented)) {\r
+                                       element = splitNestedLists(element, dom);\r
+                                       var wrapList = createWrapList(element);\r
+                                       wrapList.appendChild(element);\r
+                                       attemptMergeWithAdjacent(wrapList.parentNode, false);\r
+                                       attemptMergeWithAdjacent(wrapList, false);\r
+                                       indented.push(element);\r
+                               }\r
+                       }\r
+\r
+                       this.process({\r
+                               'LI': indentLI,\r
+                               defaultAction: this.adjustPaddingFunction(true),\r
+                               elements: this.selectedBlocks()\r
+                       });\r
+\r
+               },\r
+\r
+               outdent: function(ui, elements) {\r
+                       var t = this, ed = t.ed, dom = ed.dom, outdented = [];\r
+\r
+                       function outdentLI(element) {\r
+                               var listElement, targetParent, align;\r
+                               if (!hasParentInList(ed, element, outdented)) {\r
+                                       if (dom.getStyle(element, 'margin-left') !== '' || dom.getStyle(element, 'padding-left') !== '') {\r
+                                               return t.adjustPaddingFunction(false)(element);\r
+                                       }\r
+                                       align = dom.getStyle(element, 'text-align', true);\r
+                                       if (align === 'center' || align === 'right') {\r
+                                               dom.setStyle(element, 'text-align', 'left');\r
+                                               return;\r
+                                       }\r
+                                       element = splitNestedLists(element, dom);\r
+                                       listElement = element.parentNode;\r
+                                       targetParent = element.parentNode.parentNode;\r
+                                       if (targetParent.tagName === 'P') {\r
+                                               dom.split(targetParent, element.parentNode);\r
+                                       } else {\r
+                                               dom.split(listElement, element);\r
+                                               if (targetParent.tagName === 'LI') {\r
+                                                       // Nested list, need to split the LI and go back out to the OL/UL element.\r
+                                                       dom.split(targetParent, element);\r
+                                               } else if (!dom.is(targetParent, 'ol,ul')) {\r
+                                                       dom.rename(element, 'p');\r
+                                               }\r
+                                       }\r
+                                       outdented.push(element);\r
+                               }\r
+                       }\r
+\r
+                       var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks();\r
+                       this.process({\r
+                               'LI': outdentLI,\r
+                               defaultAction: this.adjustPaddingFunction(false),\r
+                               elements: listElements\r
+                       });\r
+\r
+                       each(outdented, attemptMergeWithAdjacent);\r
+               },\r
+\r
+               process: function(actions) {\r
+                       var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;\r
+\r
+                       function isEmptyElement(element) {\r
+                               var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) {\r
+                                       return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark'\r
+                                                       || n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == ''));\r
+                               });\r
+                               return excludeBrsAndBookmarks.length === 0;\r
+                       }\r
+\r
+                       function processElement(element) {\r
+                               dom.removeClass(element, '_mce_act_on');\r
+                               if (!element || element.nodeType !== 1 || selectedBlocks.length > 1 && isEmptyElement(element)) {\r
+                                       return;\r
+                               }\r
+                               element = findItemToOperateOn(element, dom);\r
+                               var action = actions[element.tagName];\r
+                               if (!action) {\r
+                                       action = actions.defaultAction;\r
+                               }\r
+                               action(element);\r
+                       }\r
+\r
+                       function recurse(element) {\r
+                               t.splitSafeEach(element.childNodes, processElement);\r
+                       }\r
+\r
+                       function brAtEdgeOfSelection(container, offset) {\r
+                               return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&\r
+                                               container.childNodes[offset].tagName === 'BR';\r
+                       }\r
+\r
+                       function isInTable() {\r
+                               var n = sel.getNode();\r
+                               var p = dom.getParent(n, 'td');\r
+                               return p !== null;\r
+                       }\r
+\r
+                       selectedBlocks = actions.elements;\r
+\r
+                       r = sel.getRng(true);\r
+                       if (!r.collapsed) {\r
+                               if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {\r
+                                       r.setEnd(r.endContainer, r.endOffset - 1);\r
+                                       sel.setRng(r);\r
+                               }\r
+                               if (brAtEdgeOfSelection(r.startContainer, r.startOffset)) {\r
+                                       r.setStart(r.startContainer, r.startOffset + 1);\r
+                                       sel.setRng(r);\r
+                               }\r
+                       }\r
+\r
+\r
+                       if (tinymce.isIE8) {\r
+                               // append a zero sized nbsp so that caret is restored correctly using bookmark\r
+                               var s = t.ed.selection.getNode();\r
+                               if (s.tagName === 'LI' && !(s.parentNode.lastChild === s)) {\r
+                                       var i = t.ed.getDoc().createTextNode('\uFEFF');\r
+                                       s.appendChild(i);\r
+                               }\r
+                       }\r
+\r
+                       bookmark = sel.getBookmark();\r
+                       actions.OL = actions.UL = recurse;\r
+                       t.splitSafeEach(selectedBlocks, processElement);\r
+                       sel.moveToBookmark(bookmark);\r
+                       bookmark = null;\r
+\r
+                       // we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6\r
+                       if (!isInTable()) {\r
+                               // Avoids table or image handles being left behind in Firefox.\r
+                               t.ed.execCommand('mceRepaint');\r
+                       }\r
+               },\r
+\r
+               splitSafeEach: function(elements, f) {\r
+                       if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||\r
+                                       /Firefox\/3\.[0-4]/.test(navigator.userAgent))) {\r
+                               this.classBasedEach(elements, f);\r
+                       } else {\r
+                               each(elements, f);\r
+                       }\r
+               },\r
+\r
+               classBasedEach: function(elements, f) {\r
+                       var dom = this.ed.dom, nodes, element;\r
+                       // Mark nodes\r
+                       each(elements, function(element) {\r
+                               dom.addClass(element, '_mce_act_on');\r
+                       });\r
+                       nodes = dom.select('._mce_act_on');\r
+                       while (nodes.length > 0) {\r
+                               element = nodes.shift();\r
+                               dom.removeClass(element, '_mce_act_on');\r
+                               f(element);\r
+                               nodes = dom.select('._mce_act_on');\r
+                       }\r
+               },\r
+\r
+               adjustPaddingFunction: function(isIndent) {\r
+                       var indentAmount, indentUnits, ed = this.ed;\r
+                       indentAmount = ed.settings.indentation;\r
+                       indentUnits = /[a-z%]+/i.exec(indentAmount);\r
+                       indentAmount = parseInt(indentAmount, 10);\r
+                       return function(element) {\r
+                               var currentIndent, newIndentAmount;\r
+                               currentIndent = parseInt(ed.dom.getStyle(element, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(element, 'padding-left') || 0, 10);\r
+                               if (isIndent) {\r
+                                       newIndentAmount = currentIndent + indentAmount;\r
+                               } else {\r
+                                       newIndentAmount = currentIndent - indentAmount;\r
+                               }\r
+                               ed.dom.setStyle(element, 'padding-left', '');\r
+                               ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');\r
+                       };\r
+               },\r
+\r
+               selectedBlocks: function() {\r
+                       var ed = this.ed\r
+                       var selectedBlocks = ed.selection.getSelectedBlocks();\r
+                       return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks;\r
+               },\r
+\r
+               getInfo: function() {\r
+                       return {\r
+                               longname : 'Lists',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+       tinymce.PluginManager.add("lists", tinymce.plugins.Lists);\r
+}());\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/css/content.css b/library/tinymce/jscripts/tiny_mce/plugins/media/css/content.css
deleted file mode 100755 (executable)
index 1bf6a75..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;}\r
-.mceItemShockWave {background-image: url(../img/shockwave.gif);}\r
-.mceItemFlash {background-image:url(../img/flash.gif);}\r
-.mceItemQuickTime {background-image:url(../img/quicktime.gif);}\r
-.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);}\r
-.mceItemRealMedia {background-image:url(../img/realmedia.gif);}\r
old mode 100755 (executable)
new mode 100644 (file)
index 2d08794..0c45c7f
@@ -1,12 +1,12 @@
-#id, #name, #hspace, #vspace, #class_name, #align {    width: 100px }\r
+#id, #name, #hspace, #vspace, #class_name, #align { width: 100px }\r
 #hspace, #vspace { width: 50px }\r
 #flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }\r
-#flash_base, #flash_flashvars { width: 240px }\r
+#flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }\r
 #width, #height { width: 40px }\r
 #src, #media_type { width: 250px }\r
 #class { width: 120px }\r
-#prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto }\r
-.panel_wrapper div.current { height: 390px; overflow: auto }\r
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }\r
+.panel_wrapper div.current { height: 420px; overflow: auto }\r
 #flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }\r
 .mceAddSelectValue { background-color: #DDDDDD }\r
 #qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }\r
@@ -14,3 +14,4 @@
 #rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }\r
 #shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }\r
 #qt_qtsrc { width: 200px }\r
+iframe {border: 1px solid gray}\r
old mode 100755 (executable)
new mode 100644 (file)
index 4bbe367..37b4320
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme&&b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,_mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,_mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{_mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({_mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality","data"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}if(!f.src){f.src=f.data;delete f.data}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
+(function(){var d=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),h=tinymce.makeMap(d.join(",")),b=tinymce.html.Node,f,a,g=tinymce.util.JSON,e;f=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"],["EmbeddedAudio"],["Audio"]];function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(i){return i&&i.nodeName==="IMG"&&n.dom.hasClass(i,"mceItemMedia")}r.editor=n;r.url=j;a="";for(m=0;m<f.length;m++){k=f[m][0];q={name:k,clsids:tinymce.explode(f[m][1]||""),mimes:tinymce.explode(f[m][2]||""),codebase:f[m][3]};for(p=0;p<q.clsids.length;p++){l["clsid:"+q.clsids[p]]=q}for(p=0;p<q.mimes.length;p++){l[q.mimes[p]]=q}l["mceItem"+k]=q;l[k.toLowerCase()]=q;a+=(a?"|":"")+k}tinymce.each(n.getParam("media_types","video=mp4,m4v,ogv,webm;silverlight=xap;flash=swf,flv;shockwave=dcr;quicktime=mov,qt,mpg,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar;audio=mp3,ogg").split(";"),function(v){var s,u,t;v=v.split(/=/);u=tinymce.explode(v[1].toLowerCase());for(s=0;s<u.length;s++){t=l[v[0].toLowerCase()];if(t){l[u[s]]=t}}});a=new RegExp("write("+a+")\\(([^)]+)\\)");r.lookup=l;n.onPreInit.add(function(){n.schema.addValidElements("object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]");n.parser.addNodeFilter("object,embed,video,audio,script,iframe",function(s){var t=s.length;while(t--){r.objectToImg(s[t])}});n.serializer.addNodeFilter("img",function(s,u,t){var v=s.length,w;while(v--){w=s[v];if((w.attr("class")||"").indexOf("mceItemMedia")!==-1){r.imgToObject(w,t)}}})});n.onInit.add(function(){if(n.theme&&n.theme.onResolveName){n.theme.onResolveName.add(function(i,s){if(s.name==="img"&&n.dom.hasClass(s.node,"mceItemMedia")){s.name="media"}})}if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(s,t,i){if(i.nodeName==="IMG"&&i.className.indexOf("mceItemMedia")!==-1){t.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});n.addCommand("mceMedia",function(){var s,i;i=n.selection.getNode();if(o(i)){s=n.dom.getAttrib(i,"data-mce-json");if(s){s=g.parse(s);tinymce.each(d,function(t){var u=n.dom.getAttrib(i,t);if(u){s[t]=u}});s.type=r.getType(i.className).name.toLowerCase()}}if(!s){s={type:"flash",video:{sources:[]},params:{}}}n.windowManager.open({file:j+"/media.htm",width:430+parseInt(n.getLang("media.delta_width",0)),height:500+parseInt(n.getLang("media.delta_height",0)),inline:1},{plugin_url:j,data:s})});n.addButton("media",{title:"media.desc",cmd:"mceMedia"});n.onNodeChange.add(function(s,i,t){i.setActive("media",o(t))})},convertUrl:function(k,n){var j=this,m=j.editor,l=m.settings,o=l.url_converter,i=l.url_converter_scope||j;if(!k){return k}if(n){return m.documentBaseURI.toAbsolute(k)}return o.call(i,k,"src","object")},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},dataToImg:function(m,k){var r=this,o=r.editor,p=o.documentBaseURI,j,q,n,l;m.params.src=r.convertUrl(m.params.src,k);q=m.video.attrs;if(q){q.src=r.convertUrl(q.src,k)}if(q){q.poster=r.convertUrl(q.poster,k)}j=c(m.video.sources);if(j){for(l=0;l<j.length;l++){j[l].src=r.convertUrl(j[l].src,k)}}n=r.editor.dom.create("img",{id:m.id,style:m.style,align:m.align,hspace:m.hspace,vspace:m.vspace,src:r.editor.theme.url+"/img/trans.gif","class":"mceItemMedia mceItem"+r.getType(m.type).name,"data-mce-json":g.serialize(m,"'")});n.width=m.width||(m.type=="audio"?"300":"320");n.height=m.height||(m.type=="audio"?"32":"240");return n},dataToHtml:function(i,j){return this.editor.serializer.serialize(this.dataToImg(i,j),{forced_root_block:"",force_absolute:j})},htmlToData:function(k){var j,i,l;l={type:"flash",video:{sources:[]},params:{}};j=this.editor.parser.parse(k);i=j.getAll("img")[0];if(i){l=g.parse(i.attr("data-mce-json"));l.type=this.getType(i.attr("class")).name.toLowerCase();tinymce.each(d,function(m){var n=i.attr(m);if(n){l[m]=n}})}return l},getType:function(m){var k,j,l;j=tinymce.explode(m," ");for(k=0;k<j.length;k++){l=this.lookup[j[k]];if(l){return l}}},imgToObject:function(z,o){var u=this,p=u.editor,C,H,j,t,I,y,G,w,k,E,s,q,A,D,m,x,l,B,F;function r(i,n){var M,L,N,K,J;J=p.getParam("flash_video_player_url",u.convertUrl(u.url+"/moxieplayer.swf"));if(J){M=p.documentBaseURI;G.params.src=J;if(p.getParam("flash_video_player_absvideourl",true)){i=M.toAbsolute(i||"",true);n=M.toAbsolute(n||"",true)}N="";L=p.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(L,function(P,O){P=P.replace(/\$url/,i||"");P=P.replace(/\$poster/,n||"");if(P.length>0){N+=(N?"&":"")+O+"="+escape(P)}});if(N.length){G.params.flashvars=N}K=p.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(K,function(P,O){G.params[O]=""+P})}}G=z.attr("data-mce-json");if(!G){return}G=g.parse(G);q=this.getType(z.attr("class"));B=z.attr("data-mce-style");if(!B){B=z.attr("style");if(B){B=p.dom.serializeStyle(p.dom.parseStyle(B,"img"))}}if(q.name==="Iframe"){x=new b("iframe",1);tinymce.each(d,function(i){var n=z.attr(i);if(i=="class"&&n){n=n.replace(/mceItem.+ ?/g,"")}if(n&&n.length>0){x.attr(i,n)}});for(I in G.params){x.attr(I,G.params[I])}x.attr({style:B,src:G.params.src});z.replace(x);return}if(this.editor.settings.media_use_script){x=new b("script",1).attr("type","text/javascript");y=new b("#text",3);y.value="write"+q.name+"("+g.serialize(tinymce.extend(G.params,{width:z.attr("width"),height:z.attr("height")}))+");";x.append(y);z.replace(x);return}if(q.name==="Video"&&G.video.sources[0]){C=new b("video",1).attr(tinymce.extend({id:z.attr("id"),width:z.attr("width"),height:z.attr("height"),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);for(A=0;A<k.length;A++){if(/\.mp4$/.test(k[A].src)){m=k[A].src}}if(!k[0].type){C.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new b("source",1).attr(k[A]);w.shortEnded=true;C.append(w)}if(m){r(m,l);q=u.getType("flash")}else{G.params.src=""}}if(q.name==="Audio"&&G.video.sources[0]){F=new b("audio",1).attr(tinymce.extend({id:z.attr("id"),width:z.attr("width"),height:z.attr("height"),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);if(!k[0].type){F.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new b("source",1).attr(k[A]);w.shortEnded=true;F.append(w)}G.params.src=""}if(q.name==="EmbeddedAudio"){j=new b("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:z.attr("width"),height:z.attr("height"),style:B,type:z.attr("type")});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(d,function(i){if(G[i]&&i!="type"){j.attr(i,G[i])}});G.params.src=""}if(G.params.src){if(/\.flv$/i.test(G.params.src)){r(G.params.src,"")}if(o&&o.force_absolute){G.params.src=p.documentBaseURI.toAbsolute(G.params.src)}H=new b("object",1).attr({id:z.attr("id"),width:z.attr("width"),height:z.attr("height"),style:B});tinymce.each(d,function(i){var n=G[i];if(i=="class"&&n){n=n.replace(/mceItem.+ ?/g,"")}if(n&&i!="type"){H.attr(i,n)}});for(I in G.params){s=new b("param",1);s.shortEnded=true;y=G.params[I];if(I==="src"&&q.name==="WindowsMedia"){I="url"}s.attr({name:I,value:y});H.append(s)}if(this.editor.getParam("media_strict",true)){H.attr({data:G.params.src,type:q.mimes[0]})}else{H.attr({classid:"clsid:"+q.clsids[0],codebase:q.codebase});j=new b("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:z.attr("width"),height:z.attr("height"),style:B,type:q.mimes[0]});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(d,function(i){if(G[i]&&i!="type"){j.attr(i,G[i])}});H.append(j)}if(G.object_html){y=new b("#text",3);y.raw=true;y.value=G.object_html;H.append(y)}if(C){C.append(H)}}if(C){if(G.video_html){y=new b("#text",3);y.raw=true;y.value=G.video_html;C.append(y)}}if(F){if(G.video_html){y=new b("#text",3);y.raw=true;y.value=G.video_html;F.append(y)}}var v=C||F||H||j;if(v){z.replace(v)}else{z.remove()}},objectToImg:function(C){var L,k,F,s,M,N,y,A,x,G,E,t,q,I,B,l,K,o,H=this.lookup,m,z,v=this.editor.settings.url_converter,n=this.editor.settings.url_converter_scope,w,r,D,j;function u(i){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(i)}function J(O,i){return H[(O.attr(i)||"").toLowerCase()]}function p(O){var i=O.replace(/^.*\.([^.]+)$/,"$1");return H[i.toLowerCase()||""]}if(!C.parent){return}if(C.name==="script"){if(C.firstChild){m=a.exec(C.firstChild.value)}if(!m){return}o=m[1];K={video:{},params:g.parse(m[2])};A=K.params.width;x=K.params.height}K=K||{video:{},params:{}};M=new b("img",1);M.attr({src:this.editor.theme.url+"/img/trans.gif"});N=C.name;if(N==="video"||N=="audio"){F=C;L=C.getAll("object")[0];k=C.getAll("embed")[0];A=F.attr("width");x=F.attr("height");y=F.attr("id");K.video={attrs:{},sources:[]};z=K.video.attrs;for(N in F.attributes.map){z[N]=F.attributes.map[N]}B=C.attr("src");if(B){K.video.sources.push({src:v.call(n,B,"src",C.name)})}l=F.getAll("source");for(E=0;E<l.length;E++){B=l[E].remove();K.video.sources.push({src:v.call(n,B.attr("src"),"src","source"),type:B.attr("type"),media:B.attr("media")})}if(z.poster){z.poster=v.call(n,z.poster,"poster",C.name)}}if(C.name==="object"){L=C;k=C.getAll("embed")[0]}if(C.name==="embed"){k=C}if(C.name==="iframe"){s=C;o="Iframe"}if(L){A=A||L.attr("width");x=x||L.attr("height");G=G||L.attr("style");y=y||L.attr("id");w=w||L.attr("hspace");r=r||L.attr("vspace");D=D||L.attr("align");j=j||L.attr("bgcolor");K.name=L.attr("name");I=L.getAll("param");for(E=0;E<I.length;E++){q=I[E];N=q.remove().attr("name");if(!h[N]){K.params[N]=q.attr("value")}}K.params.src=K.params.src||L.attr("data")}if(k){A=A||k.attr("width");x=x||k.attr("height");G=G||k.attr("style");y=y||k.attr("id");w=w||k.attr("hspace");r=r||k.attr("vspace");D=D||k.attr("align");j=j||k.attr("bgcolor");for(N in k.attributes.map){if(!h[N]&&!K.params[N]){K.params[N]=k.attributes.map[N]}}}if(s){A=s.attr("width");x=s.attr("height");G=G||s.attr("style");y=s.attr("id");w=s.attr("hspace");r=s.attr("vspace");D=s.attr("align");j=s.attr("bgcolor");tinymce.each(d,function(i){M.attr(i,s.attr(i))});for(N in s.attributes.map){if(!h[N]&&!K.params[N]){K.params[N]=s.attributes.map[N]}}}if(K.params.movie){K.params.src=K.params.src||K.params.movie;delete K.params.movie}if(K.params.src){K.params.src=v.call(n,K.params.src,"src","object")}if(F){if(C.name==="video"){o=H.video.name}else{if(C.name==="audio"){o=H.audio.name}}}if(L&&!o){o=(J(L,"clsid")||J(L,"classid")||J(L,"type")||{}).name}if(k&&!o){o=(J(k,"type")||p(K.params.src)||{}).name}if(k&&o=="EmbeddedAudio"){K.params.type=k.attr("type")}C.replace(M);if(k){k.remove()}if(L){t=u(L.remove());if(t){K.object_html=t}}if(F){t=u(F.remove());if(t){K.video_html=t}}K.hspace=w;K.vspace=r;K.align=D;K.bgcolor=j;M.attr({id:y,"class":"mceItemMedia mceItem"+(o||"Flash"),style:G,width:A||(C.name=="audio"?"300":"320"),height:x||(C.name=="audio"?"32":"240"),hspace:w,vspace:r,align:D,bgcolor:j,"data-mce-json":g.serialize(K,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index fc84e5b..ea79db1
  */\r
 \r
 (function() {\r
-       var each = tinymce.each;\r
+       var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,\r
+               mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;\r
+\r
+       // Media types supported by this plugin\r
+       mediaTypes = [\r
+               // Type, clsid:s, mime types, codebase\r
+               ["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],\r
+               ["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],\r
+               ["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],\r
+               ["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],\r
+               ["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],\r
+               ["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],\r
+               ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],\r
+               ["Iframe"],\r
+               ["Video"],\r
+               ["EmbeddedAudio"],\r
+               ["Audio"]\r
+       ];\r
+\r
+       function toArray(obj) {\r
+               var undef, out, i;\r
+\r
+               if (obj && !obj.splice) {\r
+                       out = [];\r
+\r
+                       for (i = 0; true; i++) {\r
+                               if (obj[i])\r
+                                       out[i] = obj[i];\r
+                               else\r
+                                       break;\r
+                       }\r
+\r
+                       return out;\r
+               }\r
+\r
+               return obj;\r
+       };\r
 \r
        tinymce.create('tinymce.plugins.MediaPlugin', {\r
                init : function(ed, url) {\r
-                       var t = this;\r
-                       \r
-                       t.editor = ed;\r
-                       t.url = url;\r
+                       var self = this, lookup = {}, i, y, item, name;\r
 \r
-                       function isMediaElm(n) {\r
-                               return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);\r
+                       function isMediaImg(node) {\r
+                               return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');\r
                        };\r
 \r
-                       ed.onPreInit.add(function() {\r
-                               // Force in _value parameter this extra parameter is required for older Opera versions\r
-                               ed.serializer.addRules('param[name|value|_mce_value]');\r
-                       });\r
+                       self.editor = ed;\r
+                       self.url = url;\r
 \r
-                       // Register commands\r
-                       ed.addCommand('mceMedia', function() {\r
-                               ed.windowManager.open({\r
-                                       file : url + '/media.htm',\r
-                                       width : 430 + parseInt(ed.getLang('media.delta_width', 0)),\r
-                                       height : 470 + parseInt(ed.getLang('media.delta_height', 0)),\r
-                                       inline : 1\r
-                               }, {\r
-                                       plugin_url : url\r
-                               });\r
-                       });\r
+                       // Parse media types into a lookup table\r
+                       scriptRegExp = '';\r
+                       for (i = 0; i < mediaTypes.length; i++) {\r
+                               name = mediaTypes[i][0];\r
 \r
-                       // Register buttons\r
-                       ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});\r
+                               item = {\r
+                                       name : name,\r
+                                       clsids : tinymce.explode(mediaTypes[i][1] || ''),\r
+                                       mimes : tinymce.explode(mediaTypes[i][2] || ''),\r
+                                       codebase : mediaTypes[i][3]\r
+                               };\r
 \r
-                       ed.onNodeChange.add(function(ed, cm, n) {\r
-                               cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));\r
+                               for (y = 0; y < item.clsids.length; y++)\r
+                                       lookup['clsid:' + item.clsids[y]] = item;\r
+\r
+                               for (y = 0; y < item.mimes.length; y++)\r
+                                       lookup[item.mimes[y]] = item;\r
+\r
+                               lookup['mceItem' + name] = item;\r
+                               lookup[name.toLowerCase()] = item;\r
+\r
+                               scriptRegExp += (scriptRegExp ? '|' : '') + name;\r
+                       }\r
+\r
+                       // Handle the media_types setting\r
+                       tinymce.each(ed.getParam("media_types",\r
+                               "video=mp4,m4v,ogv,webm;" +\r
+                               "silverlight=xap;" +\r
+                               "flash=swf,flv;" +\r
+                               "shockwave=dcr;" +\r
+                               "quicktime=mov,qt,mpg,mpeg;" +\r
+                               "shockwave=dcr;" +\r
+                               "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +\r
+                               "realmedia=rm,ra,ram;" +\r
+                               "java=jar;" +\r
+                               "audio=mp3,ogg"\r
+                       ).split(';'), function(item) {\r
+                               var i, extensions, type;\r
+\r
+                               item = item.split(/=/);\r
+                               extensions = tinymce.explode(item[1].toLowerCase());\r
+                               for (i = 0; i < extensions.length; i++) {\r
+                                       type = lookup[item[0].toLowerCase()];\r
+\r
+                                       if (type)\r
+                                               lookup[extensions[i]] = type;\r
+                               }\r
                        });\r
 \r
-                       ed.onInit.add(function() {\r
-                               var lo = {\r
-                                       mceItemFlash : 'flash',\r
-                                       mceItemShockWave : 'shockwave',\r
-                                       mceItemWindowsMedia : 'windowsmedia',\r
-                                       mceItemQuickTime : 'quicktime',\r
-                                       mceItemRealMedia : 'realmedia'\r
-                               };\r
+                       scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');\r
+                       self.lookup = lookup;\r
+\r
+                       ed.onPreInit.add(function() {\r
+                               // Allow video elements\r
+                               ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');\r
+\r
+                               // Convert video elements to image placeholder\r
+                               ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {\r
+                                       var i = nodes.length;\r
 \r
-                               ed.selection.onSetContent.add(function() {\r
-                                       t._spansToImgs(ed.getBody());\r
+                                       while (i--)\r
+                                               self.objectToImg(nodes[i]);\r
                                });\r
 \r
-                               ed.selection.onBeforeSetContent.add(t._objectsToSpans, t);\r
+                               // Convert image placeholders to video elements\r
+                               ed.serializer.addNodeFilter('img', function(nodes, name, args) {\r
+                                       var i = nodes.length, node;\r
 \r
-                               if (ed.settings.content_css !== false)\r
-                                       ed.dom.loadCSS(url + "/css/content.css");\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)\r
+                                                       self.imgToObject(node, args);\r
+                                       }\r
+                               });\r
+                       });\r
 \r
+                       ed.onInit.add(function() {\r
+                               // Display "media" instead of "img" in element path\r
                                if (ed.theme && ed.theme.onResolveName) {\r
-                                       ed.theme.onResolveName.add(function(th, o) {\r
-                                               if (o.name == 'img') {\r
-                                                       each(lo, function(v, k) {\r
-                                                               if (ed.dom.hasClass(o.node, k)) {\r
-                                                                       o.name = v;\r
-                                                                       o.title = ed.dom.getAttrib(o.node, 'title');\r
-                                                                       return false;\r
-                                                               }\r
-                                                       });\r
-                                               }\r
+                                       ed.theme.onResolveName.add(function(theme, path_object) {\r
+                                               if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))\r
+                                                       path_object.name = 'media';\r
                                        });\r
                                }\r
 \r
+                               // Add contect menu if it's loaded\r
                                if (ed && ed.plugins.contextmenu) {\r
-                                       ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {\r
-                                               if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) {\r
-                                                       m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});\r
-                                               }\r
+                                       ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {\r
+                                               if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)\r
+                                                       menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});\r
                                        });\r
                                }\r
                        });\r
 \r
-                       ed.onBeforeSetContent.add(t._objectsToSpans, t);\r
-\r
-                       ed.onSetContent.add(function() {\r
-                               t._spansToImgs(ed.getBody());\r
-                       });\r
+                       // Register commands\r
+                       ed.addCommand('mceMedia', function() {\r
+                               var data, img;\r
 \r
-                       ed.onPreProcess.add(function(ed, o) {\r
-                               var dom = ed.dom;\r
+                               img = ed.selection.getNode();\r
+                               if (isMediaImg(img)) {\r
+                                       data = ed.dom.getAttrib(img, 'data-mce-json');\r
+                                       if (data) {\r
+                                               data = JSON.parse(data);\r
 \r
-                               if (o.set) {\r
-                                       t._spansToImgs(o.node);\r
+                                               // Add some extra properties to the data object\r
+                                               tinymce.each(rootAttributes, function(name) {\r
+                                                       var value = ed.dom.getAttrib(img, name);\r
 \r
-                                       each(dom.select('IMG', o.node), function(n) {\r
-                                               var p;\r
+                                                       if (value)\r
+                                                               data[name] = value;\r
+                                               });\r
 \r
-                                               if (isMediaElm(n)) {\r
-                                                       p = t._parse(n.title);\r
-                                                       dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100));\r
-                                                       dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100));\r
-                                               }\r
-                                       });\r
+                                               data.type = self.getType(img.className).name.toLowerCase();\r
+                                       }\r
                                }\r
 \r
-                               if (o.get) {\r
-                                       each(dom.select('IMG', o.node), function(n) {\r
-                                               var ci, cb, mt;\r
-\r
-                                               if (ed.getParam('media_use_script')) {\r
-                                                       if (isMediaElm(n))\r
-                                                               n.className = n.className.replace(/mceItem/g, 'mceTemp');\r
-\r
-                                                       return;\r
-                                               }\r
-\r
-                                               switch (n.className) {\r
-                                                       case 'mceItemFlash':\r
-                                                               ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';\r
-                                                               cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';\r
-                                                               mt = 'application/x-shockwave-flash';\r
-                                                               break;\r
-\r
-                                                       case 'mceItemShockWave':\r
-                                                               ci = '166b1bca-3f9c-11cf-8075-444553540000';\r
-                                                               cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';\r
-                                                               mt = 'application/x-director';\r
-                                                               break;\r
-\r
-                                                       case 'mceItemWindowsMedia':\r
-                                                               ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6';\r
-                                                               cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';\r
-                                                               mt = 'application/x-mplayer2';\r
-                                                               break;\r
-\r
-                                                       case 'mceItemQuickTime':\r
-                                                               ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b';\r
-                                                               cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';\r
-                                                               mt = 'video/quicktime';\r
-                                                               break;\r
-\r
-                                                       case 'mceItemRealMedia':\r
-                                                               ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa';\r
-                                                               cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';\r
-                                                               mt = 'audio/x-pn-realaudio-plugin';\r
-                                                               break;\r
-                                               }\r
-\r
-                                               if (ci) {\r
-                                                       dom.replace(t._buildObj({\r
-                                                               classid : ci,\r
-                                                               codebase : cb,\r
-                                                               type : mt\r
-                                                       }, n), n);\r
-                                               }\r
-                                       });\r
+                               if (!data) {\r
+                                       data = {\r
+                                               type : 'flash',\r
+                                               video: {sources:[]},\r
+                                               params: {}\r
+                                       };\r
                                }\r
-                       });\r
 \r
-                       ed.onPostProcess.add(function(ed, o) {\r
-                               o.content = o.content.replace(/_mce_value=/g, 'value=');\r
+                               ed.windowManager.open({\r
+                                       file : url + '/media.htm',\r
+                                       width : 430 + parseInt(ed.getLang('media.delta_width', 0)),\r
+                                       height : 500 + parseInt(ed.getLang('media.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url,\r
+                                       data : data\r
+                               });\r
                        });\r
 \r
-                       function getAttr(s, n) {\r
-                               n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);\r
+                       // Register buttons\r
+                       ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});\r
 \r
-                               return n ? ed.dom.decode(n[1]) : '';\r
-                       };\r
+                       // Update media selection status\r
+                       ed.onNodeChange.add(function(ed, cm, node) {\r
+                               cm.setActive('media', isMediaImg(node));\r
+                       });\r
+               },\r
 \r
-                       ed.onPostProcess.add(function(ed, o) {\r
-                               if (ed.getParam('media_use_script')) {\r
-                                       o.content = o.content.replace(/<img[^>]+>/g, function(im) {\r
-                                               var cl = getAttr(im, 'class');\r
+               convertUrl : function(url, force_absolute) {\r
+                       var self = this, editor = self.editor, settings = editor.settings,\r
+                               urlConverter = settings.url_converter,\r
+                               urlConverterScope = settings.url_converter_scope || self;\r
 \r
-                                               if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) {\r
-                                                       at = t._parse(getAttr(im, 'title'));\r
-                                                       at.width = getAttr(im, 'width');\r
-                                                       at.height = getAttr(im, 'height');\r
-                                                       im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>';\r
-                                               }\r
+                       if (!url)\r
+                               return url;\r
 \r
-                                               return im;\r
-                                       });\r
-                               }\r
-                       });\r
+                       if (force_absolute)\r
+                               return editor.documentBaseURI.toAbsolute(url);\r
+\r
+                       return urlConverter.call(urlConverterScope, url, 'src', 'object');\r
                },\r
 \r
                getInfo : function() {\r
                        };\r
                },\r
 \r
-               // Private methods\r
-               _objectsToSpans : function(ed, o) {\r
-                       var t = this, h = o.content;\r
+               /**\r
+                * Converts the JSON data object to an img node.\r
+                */\r
+               dataToImg : function(data, force_absolute) {\r
+                       var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;\r
 \r
-                       h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {\r
-                               var o = t._parse(c);\r
+                       data.params.src = self.convertUrl(data.params.src, force_absolute);\r
 \r
-                               return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + t.url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'\r
+                       attrs = data.video.attrs;\r
+                       if (attrs)\r
+                               attrs.src = self.convertUrl(attrs.src, force_absolute);\r
+\r
+                       if (attrs)\r
+                               attrs.poster = self.convertUrl(attrs.poster, force_absolute);\r
+\r
+                       sources = toArray(data.video.sources);\r
+                       if (sources) {\r
+                               for (i = 0; i < sources.length; i++)\r
+                                       sources[i].src = self.convertUrl(sources[i].src, force_absolute);\r
+                       }\r
+\r
+                       img = self.editor.dom.create('img', {\r
+                               id : data.id,\r
+                               style : data.style,\r
+                               align : data.align,\r
+                               hspace : data.hspace,\r
+                               vspace : data.vspace,\r
+                               src : self.editor.theme.url + '/img/trans.gif',\r
+                               'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,\r
+                               'data-mce-json' : JSON.serialize(data, "'")\r
                        });\r
 \r
-                       h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>');\r
-                       h = h.replace(/<embed([^>]*)\/?>/gi, '<span class="mceItemEmbed" $1></span>');\r
-                       h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>');\r
-                       h = h.replace(/<\/(object)([^>]*)>/gi, '</span>');\r
-                       h = h.replace(/<\/embed>/gi, '');\r
-                       h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_mce_value=') + ' class="mceItemParam"></span>'});\r
-                       h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>');\r
+                       img.width = data.width || (data.type == 'audio' ? "300" : "320");\r
+                       img.height = data.height || (data.type == 'audio' ? "32" : "240");\r
+\r
+                       return img;\r
+               },\r
+\r
+               /**\r
+                * Converts the JSON data object to a HTML string.\r
+                */\r
+               dataToHtml : function(data, force_absolute) {\r
+                       return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});\r
+               },\r
+\r
+               /**\r
+                * Converts the JSON data object to a HTML string.\r
+                */\r
+               htmlToData : function(html) {\r
+                       var fragment, img, data;\r
+\r
+                       data = {\r
+                               type : 'flash',\r
+                               video: {sources:[]},\r
+                               params: {}\r
+                       };\r
+\r
+                       fragment = this.editor.parser.parse(html);\r
+                       img = fragment.getAll('img')[0];\r
+\r
+                       if (img) {\r
+                               data = JSON.parse(img.attr('data-mce-json'));\r
+                               data.type = this.getType(img.attr('class')).name.toLowerCase();\r
+\r
+                               // Add some extra properties to the data object\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = img.attr(name);\r
 \r
-                       o.content = h;\r
+                                       if (value)\r
+                                               data[name] = value;\r
+                               });\r
+                       }\r
+\r
+                       return data;\r
+               },\r
+\r
+               /**\r
+                * Get type item by extension, class, clsid or mime type.\r
+                *\r
+                * @method getType\r
+                * @param {String} value Value to get type item by.\r
+                * @return {Object} Type item object or undefined.\r
+                */\r
+               getType : function(value) {\r
+                       var i, values, typeItem;\r
+\r
+                       // Find type by checking the classes\r
+                       values = tinymce.explode(value, ' ');\r
+                       for (i = 0; i < values.length; i++) {\r
+                               typeItem = this.lookup[values[i]];\r
+\r
+                               if (typeItem)\r
+                                       return typeItem;\r
+                       }\r
                },\r
 \r
-               _buildObj : function(o, n) {\r
-                       var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc;\r
-                       \r
-                       stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash';\r
-\r
-                       p.width = o.width = dom.getAttrib(n, 'width') || 100;\r
-                       p.height = o.height = dom.getAttrib(n, 'height') || 100;\r
-\r
-                       if (p.src)\r
-                               p.src = ed.convertURL(p.src, 'src', n);\r
-\r
-                       if (stc) {\r
-                               ob = dom.create('span', {\r
-                                       id : p.id,\r
-                                       _mce_name : 'object',\r
-                                       type : 'application/x-shockwave-flash',\r
-                                       data : p.src,\r
-                                       style : dom.getAttrib(n, 'style'),\r
-                                       width : o.width,\r
-                                       height : o.height\r
+               /**\r
+                * Converts a tinymce.html.Node image element to video/object/embed.\r
+                */\r
+               imgToObject : function(node, args) {\r
+                       var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,\r
+                               source, sources, params, param, typeItem, i, item, mp4Source, replacement,\r
+                               posterSrc, style, audio;\r
+\r
+                       // Adds the flash player\r
+                       function addPlayer(video_src, poster_src) {\r
+                               var baseUri, flashVars, flashVarsOutput, params, flashPlayer;\r
+\r
+                               flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));\r
+                               if (flashPlayer) {\r
+                                       baseUri = editor.documentBaseURI;\r
+                                       data.params.src = flashPlayer;\r
+\r
+                                       // Convert the movie url to absolute urls\r
+                                       if (editor.getParam('flash_video_player_absvideourl', true)) {\r
+                                               video_src = baseUri.toAbsolute(video_src || '', true);\r
+                                               poster_src = baseUri.toAbsolute(poster_src || '', true);\r
+                                       }\r
+\r
+                                       // Generate flash vars\r
+                                       flashVarsOutput = '';\r
+                                       flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});\r
+                                       tinymce.each(flashVars, function(value, name) {\r
+                                               // Replace $url and $poster variables in flashvars value\r
+                                               value = value.replace(/\$url/, video_src || '');\r
+                                               value = value.replace(/\$poster/, poster_src || '');\r
+\r
+                                               if (value.length > 0)\r
+                                                       flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);\r
+                                       });\r
+\r
+                                       if (flashVarsOutput.length)\r
+                                               data.params.flashvars = flashVarsOutput;\r
+\r
+                                       params = editor.getParam('flash_video_player_params', {\r
+                                               allowfullscreen: true,\r
+                                               allowscriptaccess: true\r
+                                       });\r
+\r
+                                       tinymce.each(params, function(value, name) {\r
+                                               data.params[name] = "" + value;\r
+                                       });\r
+                               }\r
+                       };\r
+\r
+                       data = node.attr('data-mce-json');\r
+                       if (!data)\r
+                               return;\r
+\r
+                       data = JSON.parse(data);\r
+                       typeItem = this.getType(node.attr('class'));\r
+\r
+                       style = node.attr('data-mce-style')\r
+                       if (!style) {\r
+                               style = node.attr('style');\r
+\r
+                               if (style)\r
+                                       style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));\r
+                       }\r
+\r
+                       // Handle iframe\r
+                       if (typeItem.name === 'Iframe') {\r
+                               replacement = new Node('iframe', 1);\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = node.attr(name);\r
+\r
+                                       if (name == 'class' && value)\r
+                                               value = value.replace(/mceItem.+ ?/g, '');\r
+\r
+                                       if (value && value.length > 0)\r
+                                               replacement.attr(name, value);\r
                                });\r
-                       } else {\r
-                               ob = dom.create('span', {\r
-                                       id : p.id,\r
-                                       _mce_name : 'object',\r
-                                       classid : "clsid:" + o.classid,\r
-                                       style : dom.getAttrib(n, 'style'),\r
-                                       codebase : o.codebase,\r
-                                       width : o.width,\r
-                                       height : o.height\r
+\r
+                               for (name in data.params)\r
+                                       replacement.attr(name, data.params[name]);\r
+\r
+                               replacement.attr({\r
+                                       style: style,\r
+                                       src: data.params.src\r
                                });\r
+\r
+                               node.replace(replacement);\r
+\r
+                               return;\r
                        }\r
 \r
-                       each (p, function(v, k) {\r
-                               if (!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(k)) {\r
-                                       // Use url instead of src in IE for Windows media\r
-                                       if (o.type == 'application/x-mplayer2' && k == 'src' && !p.url)\r
-                                               k = 'url';\r
+                       // Handle scripts\r
+                       if (this.editor.settings.media_use_script) {\r
+                               replacement = new Node('script', 1).attr('type', 'text/javascript');\r
+\r
+                               value = new Node('#text', 3);\r
+                               value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height')\r
+                               })) + ');';\r
+\r
+                               replacement.append(value);\r
+                               node.replace(replacement);\r
 \r
-                                       if (v)\r
-                                               dom.add(ob, 'span', {_mce_name : 'param', name : k, '_mce_value' : v});\r
+                               return;\r
+                       }\r
+\r
+                       // Add HTML5 video element\r
+                       if (typeItem.name === 'Video' && data.video.sources[0]) {\r
+                               // Create new object element\r
+                               video = new Node('video', 1).attr(tinymce.extend({\r
+                                       id : node.attr('id'),\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height'),\r
+                                       style : style\r
+                               }, data.video.attrs));\r
+\r
+                               // Get poster source and use that for flash fallback\r
+                               if (data.video.attrs)\r
+                                       posterSrc = data.video.attrs.poster;\r
+\r
+                               sources = data.video.sources = toArray(data.video.sources);\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       if (/\.mp4$/.test(sources[i].src))\r
+                                               mp4Source = sources[i].src;\r
                                }\r
-                       });\r
 \r
-                       if (!stc)\r
-                               dom.add(ob, 'span', tinymce.extend({_mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));\r
+                               if (!sources[0].type) {\r
+                                       video.attr('src', sources[0].src);\r
+                                       sources.splice(0, 1);\r
+                               }\r
 \r
-                       return ob;\r
-               },\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = new Node('source', 1).attr(sources[i]);\r
+                                       source.shortEnded = true;\r
+                                       video.append(source);\r
+                               }\r
 \r
-               _spansToImgs : function(p) {\r
-                       var t = this, dom = t.editor.dom, im, ci;\r
+                               // Create flash fallback for video if we have a mp4 source\r
+                               if (mp4Source) {\r
+                                       addPlayer(mp4Source, posterSrc);\r
+                                       typeItem = self.getType('flash');\r
+                               } else\r
+                                       data.params.src = '';\r
+                       }\r
 \r
-                       each(dom.select('span', p), function(n) {\r
-                               // Convert object into image\r
-                               if (dom.getAttrib(n, 'class') == 'mceItemObject') {\r
-                                       ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, '');\r
+                       // Add HTML5 audio element\r
+                       if (typeItem.name === 'Audio' && data.video.sources[0]) {\r
+                               // Create new object element\r
+                               audio = new Node('audio', 1).attr(tinymce.extend({\r
+                                       id : node.attr('id'),\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height'),\r
+                                       style : style\r
+                               }, data.video.attrs));\r
+\r
+                               // Get poster source and use that for flash fallback\r
+                               if (data.video.attrs)\r
+                                       posterSrc = data.video.attrs.poster;\r
+\r
+                               sources = data.video.sources = toArray(data.video.sources);\r
+                               if (!sources[0].type) {\r
+                                       audio.attr('src', sources[0].src);\r
+                                       sources.splice(0, 1);\r
+                               }\r
 \r
-                                       switch (ci) {\r
-                                               case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                                       break;\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = new Node('source', 1).attr(sources[i]);\r
+                                       source.shortEnded = true;\r
+                                       audio.append(source);\r
+                               }\r
 \r
-                                               case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':\r
-                                                       dom.replace(t._createImg('mceItemShockWave', n), n);\r
-                                                       break;\r
+                               data.params.src = '';\r
+                       }\r
 \r
-                                               case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':\r
-                                               case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':\r
-                                               case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':\r
-                                                       dom.replace(t._createImg('mceItemWindowsMedia', n), n);\r
-                                                       break;\r
+                       if (typeItem.name === 'EmbeddedAudio') {\r
+                               embed = new Node('embed', 1);\r
+                               embed.shortEnded = true;\r
+                               embed.attr({\r
+                                       id: node.attr('id'),\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height'),\r
+                                       style : style,\r
+                                       type: node.attr('type')\r
+                               });\r
 \r
-                                               case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':\r
-                                                       dom.replace(t._createImg('mceItemQuickTime', n), n);\r
-                                                       break;\r
+                               for (name in data.params)\r
+                                       embed.attr(name, data.params[name]);\r
 \r
-                                               case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':\r
-                                                       dom.replace(t._createImg('mceItemRealMedia', n), n);\r
-                                                       break;\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       if (data[name] && name != 'type')\r
+                                               embed.attr(name, data[name]);\r
+                               });\r
 \r
-                                               default:\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                       }\r
-                                       \r
-                                       return;\r
+                               data.params.src = '';\r
+                       }\r
+\r
+                       // Do we have a params src then we can generate object\r
+                       if (data.params.src) {\r
+                               // Is flv movie add player for it\r
+                               if (/\.flv$/i.test(data.params.src))\r
+                                       addPlayer(data.params.src, '');\r
+\r
+                               if (args && args.force_absolute)\r
+                                       data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);\r
+\r
+                               // Create new object element\r
+                               object = new Node('object', 1).attr({\r
+                                       id : node.attr('id'),\r
+                                       width: node.attr('width'),\r
+                                       height: node.attr('height'),\r
+                                       style : style\r
+                               });\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = data[name];\r
+\r
+                                       if (name == 'class' && value)\r
+                                               value = value.replace(/mceItem.+ ?/g, '');\r
+\r
+                                       if (value && name != 'type')\r
+                                               object.attr(name, value);\r
+                               });\r
+\r
+                               // Add params\r
+                               for (name in data.params) {\r
+                                       param = new Node('param', 1);\r
+                                       param.shortEnded = true;\r
+                                       value = data.params[name];\r
+\r
+                                       // Windows media needs to use url instead of src for the media URL\r
+                                       if (name === 'src' && typeItem.name === 'WindowsMedia')\r
+                                               name = 'url';\r
+\r
+                                       param.attr({name: name, value: value});\r
+                                       object.append(param);\r
                                }\r
 \r
-                               // Convert embed into image\r
-                               if (dom.getAttrib(n, 'class') == 'mceItemEmbed') {\r
-                                       switch (dom.getAttrib(n, 'type')) {\r
-                                               case 'application/x-shockwave-flash':\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                                       break;\r
+                               // Setup add type and classid if strict is disabled\r
+                               if (this.editor.getParam('media_strict', true)) {\r
+                                       object.attr({\r
+                                               data: data.params.src,\r
+                                               type: typeItem.mimes[0]\r
+                                       });\r
+                               } else {\r
+                                       object.attr({\r
+                                               classid: "clsid:" + typeItem.clsids[0],\r
+                                               codebase: typeItem.codebase\r
+                                       });\r
 \r
-                                               case 'application/x-director':\r
-                                                       dom.replace(t._createImg('mceItemShockWave', n), n);\r
-                                                       break;\r
+                                       embed = new Node('embed', 1);\r
+                                       embed.shortEnded = true;\r
+                                       embed.attr({\r
+                                               id: node.attr('id'),\r
+                                               width: node.attr('width'),\r
+                                               height: node.attr('height'),\r
+                                               style : style,\r
+                                               type: typeItem.mimes[0]\r
+                                       });\r
 \r
-                                               case 'application/x-mplayer2':\r
-                                                       dom.replace(t._createImg('mceItemWindowsMedia', n), n);\r
-                                                       break;\r
+                                       for (name in data.params)\r
+                                               embed.attr(name, data.params[name]);\r
 \r
-                                               case 'video/quicktime':\r
-                                                       dom.replace(t._createImg('mceItemQuickTime', n), n);\r
-                                                       break;\r
+                                       tinymce.each(rootAttributes, function(name) {\r
+                                               if (data[name] && name != 'type')\r
+                                                       embed.attr(name, data[name]);\r
+                                       });\r
 \r
-                                               case 'audio/x-pn-realaudio-plugin':\r
-                                                       dom.replace(t._createImg('mceItemRealMedia', n), n);\r
-                                                       break;\r
+                                       object.append(embed);\r
+                               }\r
 \r
-                                               default:\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                       }\r
-                               }                       \r
-                       });\r
+                               // Insert raw HTML\r
+                               if (data.object_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.object_html;\r
+                                       object.append(value);\r
+                               }\r
+\r
+                               // Append object to video element if it exists\r
+                               if (video)\r
+                                       video.append(object);\r
+                       }\r
+\r
+                       if (video) {\r
+                               // Insert raw HTML\r
+                               if (data.video_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.video_html;\r
+                                       video.append(value);\r
+                               }\r
+                       }\r
+\r
+                       if (audio) {\r
+                               // Insert raw HTML\r
+                               if (data.video_html) {\r
+                                       value = new Node('#text', 3);\r
+                                       value.raw = true;\r
+                                       value.value = data.video_html;\r
+                                       audio.append(value);\r
+                               }\r
+                       }\r
+\r
+                       var n = video || audio || object || embed;\r
+                       if (n)\r
+                               node.replace(n);\r
+                       else\r
+                               node.remove();\r
                },\r
 \r
-               _createImg : function(cl, n) {\r
-                       var im, dom = this.editor.dom, pa = {}, ti = '', args;\r
+               /**\r
+                * Converts a tinymce.html.Node video/object/embed to an img element.\r
+                *\r
+                * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:\r
+                * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />\r
+                *\r
+                * The JSON structure will be like this:\r
+                * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}\r
+                */\r
+               objectToImg : function(node) {\r
+                       var object, embed, video, iframe, img, name, id, width, height, style, i, html,\r
+                               param, params, source, sources, data, type, lookup = this.lookup,\r
+                               matches, attrs, urlConverter = this.editor.settings.url_converter,\r
+                               urlConverterScope = this.editor.settings.url_converter_scope,\r
+                               hspace, vspace, align, bgcolor;\r
+\r
+                       function getInnerHTML(node) {\r
+                               return new tinymce.html.Serializer({\r
+                                       inner: true,\r
+                                       validate: false\r
+                               }).serialize(node);\r
+                       };\r
 \r
-                       args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality', 'data'];        \r
+                       function lookupAttribute(o, attr) {\r
+                               return lookup[(o.attr(attr) || '').toLowerCase()];\r
+                       }\r
 \r
-                       // Create image\r
-                       im = dom.create('img', {\r
-                               src : this.url + '/img/trans.gif',\r
-                               width : dom.getAttrib(n, 'width') || 100,\r
-                               height : dom.getAttrib(n, 'height') || 100,\r
-                               style : dom.getAttrib(n, 'style'),\r
-                               'class' : cl\r
-                       });\r
+                       function lookupExtension(src) {\r
+                               var ext = src.replace(/^.*\.([^.]+)$/, '$1');\r
+                               return lookup[ext.toLowerCase() || ''];\r
+                       }\r
 \r
-                       // Setup base parameters\r
-                       each(args, function(na) {\r
-                               var v = dom.getAttrib(n, na);\r
+                       // If node isn't in document\r
+                       if (!node.parent)\r
+                               return;\r
 \r
-                               if (v)\r
-                                       pa[na] = v;\r
-                       });\r
+                       // Handle media scripts\r
+                       if (node.name === 'script') {\r
+                               if (node.firstChild)\r
+                                       matches = scriptRegExp.exec(node.firstChild.value);\r
+\r
+                               if (!matches)\r
+                                       return;\r
+\r
+                               type = matches[1];\r
+                               data = {video : {}, params : JSON.parse(matches[2])};\r
+                               width = data.params.width;\r
+                               height = data.params.height;\r
+                       }\r
 \r
-                       // Add optional parameters\r
-                       each(dom.select('span', n), function(n) {\r
-                               if (dom.hasClass(n, 'mceItemParam'))\r
-                                       pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_mce_value');\r
+                       // Setup data objects\r
+                       data = data || {\r
+                               video : {},\r
+                               params : {}\r
+                       };\r
+\r
+                       // Setup new image object\r
+                       img = new Node('img', 1);\r
+                       img.attr({\r
+                               src : this.editor.theme.url + '/img/trans.gif'\r
                        });\r
 \r
-                       // Use src not movie\r
-                       if (pa.movie) {\r
-                               pa.src = pa.movie;\r
-                               delete pa.movie;\r
+                       // Video element\r
+                       name = node.name;\r
+                       if (name === 'video' || name == 'audio') {\r
+                               video = node;\r
+                               object = node.getAll('object')[0];\r
+                               embed = node.getAll('embed')[0];\r
+                               width = video.attr('width');\r
+                               height = video.attr('height');\r
+                               id = video.attr('id');\r
+                               data.video = {attrs : {}, sources : []};\r
+\r
+                               // Get all video attributes\r
+                               attrs = data.video.attrs;\r
+                               for (name in video.attributes.map)\r
+                                       attrs[name] = video.attributes.map[name];\r
+\r
+                               source = node.attr('src');\r
+                               if (source)\r
+                                       data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});\r
+\r
+                               // Get all sources\r
+                               sources = video.getAll("source");\r
+                               for (i = 0; i < sources.length; i++) {\r
+                                       source = sources[i].remove();\r
+\r
+                                       data.video.sources.push({\r
+                                               src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),\r
+                                               type: source.attr('type'),\r
+                                               media: source.attr('media')\r
+                                       });\r
+                               }\r
+\r
+                               // Convert the poster URL\r
+                               if (attrs.poster)\r
+                                       attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);\r
+                       }\r
+\r
+                       // Object element\r
+                       if (node.name === 'object') {\r
+                               object = node;\r
+                               embed = node.getAll('embed')[0];\r
+                       }\r
+\r
+                       // Embed element\r
+                       if (node.name === 'embed')\r
+                               embed = node;\r
+\r
+                       // Iframe element\r
+                       if (node.name === 'iframe') {\r
+                               iframe = node;\r
+                               type = 'Iframe';\r
                        }\r
 \r
-                       // No src try data\r
-                       if (!pa.src) {\r
-                               pa.src = pa.data;\r
-                               delete pa.data;\r
+                       if (object) {\r
+                               // Get width/height\r
+                               width = width || object.attr('width');\r
+                               height = height || object.attr('height');\r
+                               style = style || object.attr('style');\r
+                               id = id || object.attr('id');\r
+                               hspace = hspace || object.attr('hspace');\r
+                               vspace = vspace || object.attr('vspace');\r
+                               align = align || object.attr('align');\r
+                               bgcolor = bgcolor || object.attr('bgcolor');\r
+                               data.name = object.attr('name');\r
+\r
+                               // Get all object params\r
+                               params = object.getAll("param");\r
+                               for (i = 0; i < params.length; i++) {\r
+                                       param = params[i];\r
+                                       name = param.remove().attr('name');\r
+\r
+                                       if (!excludedAttrs[name])\r
+                                               data.params[name] = param.attr('value');\r
+                               }\r
+\r
+                               data.params.src = data.params.src || object.attr('data');\r
                        }\r
 \r
-                       // Merge with embed args\r
-                       n = dom.select('.mceItemEmbed', n)[0];\r
-                       if (n) {\r
-                               each(args, function(na) {\r
-                                       var v = dom.getAttrib(n, na);\r
+                       if (embed) {\r
+                               // Get width/height\r
+                               width = width || embed.attr('width');\r
+                               height = height || embed.attr('height');\r
+                               style = style || embed.attr('style');\r
+                               id = id || embed.attr('id');\r
+                               hspace = hspace || embed.attr('hspace');\r
+                               vspace = vspace || embed.attr('vspace');\r
+                               align = align || embed.attr('align');\r
+                               bgcolor = bgcolor || embed.attr('bgcolor');\r
+\r
+                               // Get all embed attributes\r
+                               for (name in embed.attributes.map) {\r
+                                       if (!excludedAttrs[name] && !data.params[name])\r
+                                               data.params[name] = embed.attributes.map[name];\r
+                               }\r
+                       }\r
 \r
-                                       if (v && !pa[na])\r
-                                               pa[na] = v;\r
+                       if (iframe) {\r
+                               // Get width/height\r
+                               width = iframe.attr('width');\r
+                               height = iframe.attr('height');\r
+                               style = style || iframe.attr('style');\r
+                               id = iframe.attr('id');\r
+                               hspace = iframe.attr('hspace');\r
+                               vspace = iframe.attr('vspace');\r
+                               align = iframe.attr('align');\r
+                               bgcolor = iframe.attr('bgcolor');\r
+\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       img.attr(name, iframe.attr(name));\r
                                });\r
+\r
+                               // Get all iframe attributes\r
+                               for (name in iframe.attributes.map) {\r
+                                       if (!excludedAttrs[name] && !data.params[name])\r
+                                               data.params[name] = iframe.attributes.map[name];\r
+                               }\r
                        }\r
 \r
-                       delete pa.width;\r
-                       delete pa.height;\r
+                       // Use src not movie\r
+                       if (data.params.movie) {\r
+                               data.params.src = data.params.src || data.params.movie;\r
+                               delete data.params.movie;\r
+                       }\r
 \r
-                       im.title = this._serialize(pa);\r
+                       // Convert the URL to relative/absolute depending on configuration\r
+                       if (data.params.src)\r
+                               data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');\r
 \r
-                       return im;\r
-               },\r
+                       if (video) {\r
+                               if (node.name === 'video')\r
+                                       type = lookup.video.name;\r
+                               else if (node.name === 'audio')\r
+                                       type = lookup.audio.name;\r
+                       }\r
 \r
-               _parse : function(s) {\r
-                       return tinymce.util.JSON.parse('{' + s + '}');\r
-               },\r
+                       if (object && !type)\r
+                               type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;\r
+\r
+                       if (embed && !type)\r
+                               type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;\r
 \r
-               _serialize : function(o) {\r
-                       return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');\r
+                       // for embedded audio we preserve the original specified type\r
+                       if (embed && type == 'EmbeddedAudio') {\r
+                               data.params.type = embed.attr('type');\r
+                       }\r
+\r
+                       // Replace the video/object/embed element with a placeholder image containing the data\r
+                       node.replace(img);\r
+\r
+                       // Remove embed\r
+                       if (embed)\r
+                               embed.remove();\r
+\r
+                       // Serialize the inner HTML of the object element\r
+                       if (object) {\r
+                               html = getInnerHTML(object.remove());\r
+\r
+                               if (html)\r
+                                       data.object_html = html;\r
+                       }\r
+\r
+                       // Serialize the inner HTML of the video element\r
+                       if (video) {\r
+                               html = getInnerHTML(video.remove());\r
+\r
+                               if (html)\r
+                                       data.video_html = html;\r
+                       }\r
+\r
+                       data.hspace = hspace;\r
+                       data.vspace = vspace;\r
+                       data.align = align;\r
+                       data.bgcolor = bgcolor;\r
+\r
+                       // Set width/height of placeholder\r
+                       img.attr({\r
+                               id : id,\r
+                               'class' : 'mceItemMedia mceItem' + (type || 'Flash'),\r
+                               style : style,\r
+                               width : width || (node.name == 'audio' ? "300" : "320"),\r
+                               height : height || (node.name == 'audio' ? "32" : "240"),\r
+                               hspace : hspace,\r
+                               vspace : vspace,\r
+                               align : align,\r
+                               bgcolor : bgcolor,\r
+                               "data-mce-json" : JSON.serialize(data, "'")\r
+                       });\r
                }\r
        });\r
 \r
        // Register plugin\r
        tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);\r
-})();
\ No newline at end of file
+})();\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/flash.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/flash.gif
deleted file mode 100755 (executable)
index cb192e6..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/flash.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/flv_player.swf b/library/tinymce/jscripts/tiny_mce/plugins/media/img/flv_player.swf
deleted file mode 100755 (executable)
index 042c2ab..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/flv_player.swf and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/quicktime.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/quicktime.gif
deleted file mode 100755 (executable)
index 3b04991..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/quicktime.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/realmedia.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/realmedia.gif
deleted file mode 100755 (executable)
index fdfe0b9..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/realmedia.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/shockwave.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/shockwave.gif
deleted file mode 100755 (executable)
index 5f235df..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/shockwave.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/trans.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/trans.gif
deleted file mode 100755 (executable)
index 3884865..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/trans.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/img/windowsmedia.gif b/library/tinymce/jscripts/tiny_mce/plugins/media/img/windowsmedia.gif
deleted file mode 100755 (executable)
index ab50f2d..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/media/img/windowsmedia.gif and /dev/null differ
old mode 100755 (executable)
new mode 100644 (file)
index 86cfa98..733c5f6
-tinyMCEPopup.requireLangPack();\r
+(function() {\r
+       var url;\r
 \r
-var oldWidth, oldHeight, ed, url;\r
+       if (url = tinyMCEPopup.getParam("media_external_list_url"))\r
+               document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
 \r
-if (url = tinyMCEPopup.getParam("media_external_list_url"))\r
-       document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');\r
-\r
-function init() {\r
-       var pl = "", f, val;\r
-       var type = "flash", fe, i;\r
-\r
-       ed = tinyMCEPopup.editor;\r
-\r
-       tinyMCEPopup.resizeToInnerSize();\r
-       f = document.forms[0]\r
-\r
-       fe = ed.selection.getNode();\r
-       if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {\r
-               pl = fe.title;\r
-\r
-               switch (ed.dom.getAttrib(fe, 'class')) {\r
-                       case 'mceItemFlash':\r
-                               type = 'flash';\r
-                               break;\r
-\r
-                       case 'mceItemFlashVideo':\r
-                               type = 'flv';\r
-                               break;\r
-\r
-                       case 'mceItemShockWave':\r
-                               type = 'shockwave';\r
-                               break;\r
-\r
-                       case 'mceItemWindowsMedia':\r
-                               type = 'wmp';\r
-                               break;\r
-\r
-                       case 'mceItemQuickTime':\r
-                               type = 'qt';\r
-                               break;\r
-\r
-                       case 'mceItemRealMedia':\r
-                               type = 'rmp';\r
-                               break;\r
-               }\r
-\r
-               document.forms[0].insert.value = ed.getLang('update', 'Insert', true); \r
-       }\r
-\r
-       document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');\r
-       document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');\r
-       document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
-\r
-       var html = getMediaListHTML('medialist','src','media','media');\r
-       if (html == "")\r
-               document.getElementById("linklistrow").style.display = 'none';\r
-       else\r
-               document.getElementById("linklistcontainer").innerHTML = html;\r
-\r
-       // Resize some elements\r
-       if (isVisible('filebrowser'))\r
-               document.getElementById('src').style.width = '230px';\r
-\r
-       // Setup form\r
-       if (pl != "") {\r
-               pl = tinyMCEPopup.editor.plugins.media._parse(pl);\r
-\r
-               switch (type) {\r
-                       case "flash":\r
-                               setBool(pl, 'flash', 'play');\r
-                               setBool(pl, 'flash', 'loop');\r
-                               setBool(pl, 'flash', 'menu');\r
-                               setBool(pl, 'flash', 'swliveconnect');\r
-                               setStr(pl, 'flash', 'quality');\r
-                               setStr(pl, 'flash', 'scale');\r
-                               setStr(pl, 'flash', 'salign');\r
-                               setStr(pl, 'flash', 'wmode');\r
-                               setStr(pl, 'flash', 'base');\r
-                               setStr(pl, 'flash', 'flashvars');\r
-                       break;\r
-\r
-                       case "qt":\r
-                               setBool(pl, 'qt', 'loop');\r
-                               setBool(pl, 'qt', 'autoplay');\r
-                               setBool(pl, 'qt', 'cache');\r
-                               setBool(pl, 'qt', 'controller');\r
-                               setBool(pl, 'qt', 'correction');\r
-                               setBool(pl, 'qt', 'enablejavascript');\r
-                               setBool(pl, 'qt', 'kioskmode');\r
-                               setBool(pl, 'qt', 'autohref');\r
-                               setBool(pl, 'qt', 'playeveryframe');\r
-                               setBool(pl, 'qt', 'tarsetcache');\r
-                               setStr(pl, 'qt', 'scale');\r
-                               setStr(pl, 'qt', 'starttime');\r
-                               setStr(pl, 'qt', 'endtime');\r
-                               setStr(pl, 'qt', 'tarset');\r
-                               setStr(pl, 'qt', 'qtsrcchokespeed');\r
-                               setStr(pl, 'qt', 'volume');\r
-                               setStr(pl, 'qt', 'qtsrc');\r
-                       break;\r
-\r
-                       case "shockwave":\r
-                               setBool(pl, 'shockwave', 'sound');\r
-                               setBool(pl, 'shockwave', 'progress');\r
-                               setBool(pl, 'shockwave', 'autostart');\r
-                               setBool(pl, 'shockwave', 'swliveconnect');\r
-                               setStr(pl, 'shockwave', 'swvolume');\r
-                               setStr(pl, 'shockwave', 'swstretchstyle');\r
-                               setStr(pl, 'shockwave', 'swstretchhalign');\r
-                               setStr(pl, 'shockwave', 'swstretchvalign');\r
-                       break;\r
-\r
-                       case "wmp":\r
-                               setBool(pl, 'wmp', 'autostart');\r
-                               setBool(pl, 'wmp', 'enabled');\r
-                               setBool(pl, 'wmp', 'enablecontextmenu');\r
-                               setBool(pl, 'wmp', 'fullscreen');\r
-                               setBool(pl, 'wmp', 'invokeurls');\r
-                               setBool(pl, 'wmp', 'mute');\r
-                               setBool(pl, 'wmp', 'stretchtofit');\r
-                               setBool(pl, 'wmp', 'windowlessvideo');\r
-                               setStr(pl, 'wmp', 'balance');\r
-                               setStr(pl, 'wmp', 'baseurl');\r
-                               setStr(pl, 'wmp', 'captioningid');\r
-                               setStr(pl, 'wmp', 'currentmarker');\r
-                               setStr(pl, 'wmp', 'currentposition');\r
-                               setStr(pl, 'wmp', 'defaultframe');\r
-                               setStr(pl, 'wmp', 'playcount');\r
-                               setStr(pl, 'wmp', 'rate');\r
-                               setStr(pl, 'wmp', 'uimode');\r
-                               setStr(pl, 'wmp', 'volume');\r
-                       break;\r
-\r
-                       case "rmp":\r
-                               setBool(pl, 'rmp', 'autostart');\r
-                               setBool(pl, 'rmp', 'loop');\r
-                               setBool(pl, 'rmp', 'autogotourl');\r
-                               setBool(pl, 'rmp', 'center');\r
-                               setBool(pl, 'rmp', 'imagestatus');\r
-                               setBool(pl, 'rmp', 'maintainaspect');\r
-                               setBool(pl, 'rmp', 'nojava');\r
-                               setBool(pl, 'rmp', 'prefetch');\r
-                               setBool(pl, 'rmp', 'shuffle');\r
-                               setStr(pl, 'rmp', 'console');\r
-                               setStr(pl, 'rmp', 'controls');\r
-                               setStr(pl, 'rmp', 'numloop');\r
-                               setStr(pl, 'rmp', 'scriptcallbacks');\r
-                       break;\r
-               }\r
-\r
-               setStr(pl, null, 'src');\r
-               setStr(pl, null, 'id');\r
-               setStr(pl, null, 'name');\r
-               setStr(pl, null, 'vspace');\r
-               setStr(pl, null, 'hspace');\r
-               setStr(pl, null, 'bgcolor');\r
-               setStr(pl, null, 'align');\r
-               setStr(pl, null, 'width');\r
-               setStr(pl, null, 'height');\r
-\r
-               if ((val = ed.dom.getAttrib(fe, "width")) != "")\r
-                       pl.width = f.width.value = val;\r
-\r
-               if ((val = ed.dom.getAttrib(fe, "height")) != "")\r
-                       pl.height = f.height.value = val;\r
-\r
-               oldWidth = pl.width ? parseInt(pl.width) : 0;\r
-               oldHeight = pl.height ? parseInt(pl.height) : 0;\r
-       } else\r
-               oldWidth = oldHeight = 0;\r
-\r
-       selectByValue(f, 'media_type', type);\r
-       changedType(type);\r
-       updateColor('bgcolor_pick', 'bgcolor');\r
-\r
-       TinyMCE_EditableSelects.init();\r
-       generatePreview();\r
-}\r
-\r
-function insertMedia() {\r
-       var fe, f = document.forms[0], h;\r
-\r
-       tinyMCEPopup.restoreSelection();\r
-\r
-       if (!AutoValidator.validate(f)) {\r
-               tinyMCEPopup.alert(ed.getLang('invalid_data'));\r
-               return false;\r
+       function get(id) {\r
+               return document.getElementById(id);\r
        }\r
 \r
-       f.width.value = f.width.value == "" ? 100 : f.width.value;\r
-       f.height.value = f.height.value == "" ? 100 : f.height.value;\r
+       function clone(obj) {\r
+               var i, len, copy, attr;\r
 \r
-       fe = ed.selection.getNode();\r
-       if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {\r
-               switch (f.media_type.options[f.media_type.selectedIndex].value) {\r
-                       case "flash":\r
-                               fe.className = "mceItemFlash";\r
-                               break;\r
+               if (null == obj || "object" != typeof obj)\r
+                       return obj;\r
 \r
-                       case "flv":\r
-                               fe.className = "mceItemFlashVideo";\r
-                               break;\r
+               // Handle Array\r
+               if ('length' in obj) {\r
+                       copy = [];\r
 \r
-                       case "shockwave":\r
-                               fe.className = "mceItemShockWave";\r
-                               break;\r
-\r
-                       case "qt":\r
-                               fe.className = "mceItemQuickTime";\r
-                               break;\r
-\r
-                       case "wmp":\r
-                               fe.className = "mceItemWindowsMedia";\r
-                               break;\r
+                       for (i = 0, len = obj.length; i < len; ++i) {\r
+                               copy[i] = clone(obj[i]);\r
+                       }\r
 \r
-                       case "rmp":\r
-                               fe.className = "mceItemRealMedia";\r
-                               break;\r
+                       return copy;\r
                }\r
 \r
-               if (fe.width != f.width.value || fe.height != f.height.value)\r
-                       ed.execCommand('mceRepaint');\r
-\r
-               fe.title = serializeParameters();\r
-               fe.width = f.width.value;\r
-               fe.height = f.height.value;\r
-               fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');\r
-               fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');\r
-               fe.align = f.align.options[f.align.selectedIndex].value;\r
-       } else {\r
-               h = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ;\r
-\r
-               switch (f.media_type.options[f.media_type.selectedIndex].value) {\r
-                       case "flash":\r
-                               h += ' class="mceItemFlash"';\r
-                               break;\r
-\r
-                       case "flv":\r
-                               h += ' class="mceItemFlashVideo"';\r
-                               break;\r
-\r
-                       case "shockwave":\r
-                               h += ' class="mceItemShockWave"';\r
-                               break;\r
-\r
-                       case "qt":\r
-                               h += ' class="mceItemQuickTime"';\r
-                               break;\r
-\r
-                       case "wmp":\r
-                               h += ' class="mceItemWindowsMedia"';\r
-                               break;\r
-\r
-                       case "rmp":\r
-                               h += ' class="mceItemRealMedia"';\r
-                               break;\r
+               // Handle Object\r
+               copy = {};\r
+               for (attr in obj) {\r
+                       if (obj.hasOwnProperty(attr))\r
+                               copy[attr] = clone(obj[attr]);\r
                }\r
 \r
-               h += ' title="' + serializeParameters() + '"';\r
-               h += ' width="' + f.width.value + '"';\r
-               h += ' height="' + f.height.value + '"';\r
-               h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';\r
-\r
-               h += ' />';\r
-\r
-               ed.execCommand('mceInsertContent', false, h);\r
+               return copy;\r
        }\r
 \r
-       tinyMCEPopup.close();\r
-}\r
+       function getVal(id) {\r
+               var elm = get(id);\r
 \r
-function updatePreview() {\r
-       var f = document.forms[0], type;\r
+               if (elm.nodeName == "SELECT")\r
+                       return elm.options[elm.selectedIndex].value;\r
 \r
-       f.width.value = f.width.value || '320';\r
-       f.height.value = f.height.value || '240';\r
+               if (elm.type == "checkbox")\r
+                       return elm.checked;\r
 \r
-       type = getType(f.src.value);\r
-       selectByValue(f, 'media_type', type);\r
-       changedType(type);\r
-       generatePreview();\r
-}\r
-\r
-function getMediaListHTML() {\r
-       if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {\r
-               var html = "";\r
-\r
-               html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';\r
-               html += '<option value="">---</option>';\r
-\r
-               for (var i=0; i<tinyMCEMediaList.length; i++)\r
-                       html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';\r
-\r
-               html += '</select>';\r
-\r
-               return html;\r
+               return elm.value;\r
        }\r
 \r
-       return "";\r
-}\r
-\r
-function getType(v) {\r
-       var fo, i, c, el, x, f = document.forms[0];\r
-\r
-       fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');\r
-\r
-       // YouTube\r
-       if (v.match(/watch\?v=(.+)(.*)/)) {\r
-               f.width.value = '425';\r
-               f.height.value = '350';\r
-               f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];\r
-               return 'flash';\r
-       }\r
-\r
-       // Google video\r
-       if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {\r
-               f.width.value = '425';\r
-               f.height.value = '326';\r
-               f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';\r
-               return 'flash';\r
-       }\r
-\r
-       for (i=0; i<fo.length; i++) {\r
-               c = fo[i].split('=');\r
-\r
-               el = c[1].split(',');\r
-               for (x=0; x<el.length; x++)\r
-               if (v.indexOf('.' + el[x]) != -1)\r
-                       return c[0];\r
-       }\r
-\r
-       return null;\r
-}\r
-\r
-function switchType(v) {\r
-       var t = getType(v), d = document, f = d.forms[0];\r
-\r
-       if (!t)\r
-               return;\r
-\r
-       selectByValue(d.forms[0], 'media_type', t);\r
-       changedType(t);\r
-\r
-       // Update qtsrc also\r
-       if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {\r
-               alert(ed.getLang("media_qt_stream_warn"));\r
-\r
-               if (f.qt_qtsrc.value == '')\r
-                       f.qt_qtsrc.value = f.src.value;\r
-       }\r
-}\r
-\r
-function changedType(t) {\r
-       var d = document;\r
-\r
-       d.getElementById('flash_options').style.display = 'none';\r
-       d.getElementById('flv_options').style.display = 'none';\r
-       d.getElementById('qt_options').style.display = 'none';\r
-       d.getElementById('shockwave_options').style.display = 'none';\r
-       d.getElementById('wmp_options').style.display = 'none';\r
-       d.getElementById('rmp_options').style.display = 'none';\r
-\r
-       if (t)\r
-               d.getElementById(t + '_options').style.display = 'block';\r
-}\r
-\r
-function serializeParameters() {\r
-       var d = document, f = d.forms[0], s = '';\r
-\r
-       switch (f.media_type.options[f.media_type.selectedIndex].value) {\r
-               case "flash":\r
-                       s += getBool('flash', 'play', true);\r
-                       s += getBool('flash', 'loop', true);\r
-                       s += getBool('flash', 'menu', true);\r
-                       s += getBool('flash', 'swliveconnect', false);\r
-                       s += getStr('flash', 'quality');\r
-                       s += getStr('flash', 'scale');\r
-                       s += getStr('flash', 'salign');\r
-                       s += getStr('flash', 'wmode');\r
-                       s += getStr('flash', 'base');\r
-                       s += getStr('flash', 'flashvars');\r
-               break;\r
-\r
-               case "qt":\r
-                       s += getBool('qt', 'loop', false);\r
-                       s += getBool('qt', 'autoplay', true);\r
-                       s += getBool('qt', 'cache', false);\r
-                       s += getBool('qt', 'controller', true);\r
-                       s += getBool('qt', 'correction', false, 'none', 'full');\r
-                       s += getBool('qt', 'enablejavascript', false);\r
-                       s += getBool('qt', 'kioskmode', false);\r
-                       s += getBool('qt', 'autohref', false);\r
-                       s += getBool('qt', 'playeveryframe', false);\r
-                       s += getBool('qt', 'targetcache', false);\r
-                       s += getStr('qt', 'scale');\r
-                       s += getStr('qt', 'starttime');\r
-                       s += getStr('qt', 'endtime');\r
-                       s += getStr('qt', 'target');\r
-                       s += getStr('qt', 'qtsrcchokespeed');\r
-                       s += getStr('qt', 'volume');\r
-                       s += getStr('qt', 'qtsrc');\r
-               break;\r
-\r
-               case "shockwave":\r
-                       s += getBool('shockwave', 'sound');\r
-                       s += getBool('shockwave', 'progress');\r
-                       s += getBool('shockwave', 'autostart');\r
-                       s += getBool('shockwave', 'swliveconnect');\r
-                       s += getStr('shockwave', 'swvolume');\r
-                       s += getStr('shockwave', 'swstretchstyle');\r
-                       s += getStr('shockwave', 'swstretchhalign');\r
-                       s += getStr('shockwave', 'swstretchvalign');\r
-               break;\r
-\r
-               case "wmp":\r
-                       s += getBool('wmp', 'autostart', true);\r
-                       s += getBool('wmp', 'enabled', false);\r
-                       s += getBool('wmp', 'enablecontextmenu', true);\r
-                       s += getBool('wmp', 'fullscreen', false);\r
-                       s += getBool('wmp', 'invokeurls', true);\r
-                       s += getBool('wmp', 'mute', false);\r
-                       s += getBool('wmp', 'stretchtofit', false);\r
-                       s += getBool('wmp', 'windowlessvideo', false);\r
-                       s += getStr('wmp', 'balance');\r
-                       s += getStr('wmp', 'baseurl');\r
-                       s += getStr('wmp', 'captioningid');\r
-                       s += getStr('wmp', 'currentmarker');\r
-                       s += getStr('wmp', 'currentposition');\r
-                       s += getStr('wmp', 'defaultframe');\r
-                       s += getStr('wmp', 'playcount');\r
-                       s += getStr('wmp', 'rate');\r
-                       s += getStr('wmp', 'uimode');\r
-                       s += getStr('wmp', 'volume');\r
-               break;\r
-\r
-               case "rmp":\r
-                       s += getBool('rmp', 'autostart', false);\r
-                       s += getBool('rmp', 'loop', false);\r
-                       s += getBool('rmp', 'autogotourl', true);\r
-                       s += getBool('rmp', 'center', false);\r
-                       s += getBool('rmp', 'imagestatus', true);\r
-                       s += getBool('rmp', 'maintainaspect', false);\r
-                       s += getBool('rmp', 'nojava', false);\r
-                       s += getBool('rmp', 'prefetch', false);\r
-                       s += getBool('rmp', 'shuffle', false);\r
-                       s += getStr('rmp', 'console');\r
-                       s += getStr('rmp', 'controls');\r
-                       s += getStr('rmp', 'numloop');\r
-                       s += getStr('rmp', 'scriptcallbacks');\r
-               break;\r
+       function setVal(id, value, name) {\r
+               if (typeof(value) != 'undefined' && value != null) {\r
+                       var elm = get(id);\r
+\r
+                       if (elm.nodeName == "SELECT")\r
+                               selectByValue(document.forms[0], id, value);\r
+                       else if (elm.type == "checkbox") {\r
+                               if (typeof(value) == 'string') {\r
+                                       value = value.toLowerCase();\r
+                                       value = (!name && value === 'true') || (name && value === name.toLowerCase());\r
+                               }\r
+                               elm.checked = !!value;\r
+                       } else\r
+                               elm.value = value;\r
+               }\r
        }\r
 \r
-       s += getStr(null, 'id');\r
-       s += getStr(null, 'name');\r
-       s += getStr(null, 'src');\r
-       s += getStr(null, 'align');\r
-       s += getStr(null, 'bgcolor');\r
-       s += getInt(null, 'vspace');\r
-       s += getInt(null, 'hspace');\r
-       s += getStr(null, 'width');\r
-       s += getStr(null, 'height');\r
-\r
-       s = s.length > 0 ? s.substring(0, s.length - 1) : s;\r
-\r
-       return s;\r
-}\r
-\r
-function setBool(pl, p, n) {\r
-       if (typeof(pl[n]) == "undefined")\r
-               return;\r
-\r
-       document.forms[0].elements[p + "_" + n].checked = pl[n] != 'false';\r
-}\r
-\r
-function setStr(pl, p, n) {\r
-       var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];\r
-\r
-       if (typeof(pl[n]) == "undefined")\r
-               return;\r
+       window.Media = {\r
+               init : function() {\r
+                       var html, editor, self = this;\r
 \r
-       if (e.type == "text")\r
-               e.value = pl[n];\r
-       else\r
-               selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);\r
-}\r
+                       self.editor = editor = tinyMCEPopup.editor;\r
 \r
-function getBool(p, n, d, tv, fv) {\r
-       var v = document.forms[0].elements[p + "_" + n].checked;\r
+                       // Setup file browsers and color pickers\r
+                       get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');\r
+                       get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');\r
+                       get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');\r
+                       get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');\r
+                       get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');\r
+                       get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');\r
+                       get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');\r
+                       get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');\r
 \r
-       tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";\r
-       fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";\r
+                       html = self.getMediaListHTML('medialist', 'src', 'media', 'media');\r
+                       if (html == "")\r
+                               get("linklistrow").style.display = 'none';\r
+                       else\r
+                               get("linklistcontainer").innerHTML = html;\r
 \r
-       return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',");\r
-}\r
+                       if (isVisible('filebrowser'))\r
+                               get('src').style.width = '230px';\r
+\r
+                       if (isVisible('video_filebrowser_altsource1'))\r
+                               get('video_altsource1').style.width = '220px';\r
+\r
+                       if (isVisible('video_filebrowser_altsource2'))\r
+                               get('video_altsource2').style.width = '220px';\r
+\r
+                       if (isVisible('audio_filebrowser_altsource1'))\r
+                               get('audio_altsource1').style.width = '220px';\r
+\r
+                       if (isVisible('audio_filebrowser_altsource2'))\r
+                               get('audio_altsource2').style.width = '220px';\r
+\r
+                       if (isVisible('filebrowser_poster'))\r
+                               get('video_poster').style.width = '220px';\r
+\r
+                       editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor));\r
+\r
+                       self.setDefaultDialogSettings(editor);\r
+                       self.data = clone(tinyMCEPopup.getWindowArg('data'));\r
+                       self.dataToForm();\r
+                       self.preview();\r
+\r
+                       updateColor('bgcolor_pick', 'bgcolor');\r
+               },\r
+\r
+               insert : function() {\r
+                       var editor = tinyMCEPopup.editor;\r
+\r
+                       this.formToData();\r
+                       editor.execCommand('mceRepaint');\r
+                       tinyMCEPopup.restoreSelection();\r
+                       editor.selection.setNode(editor.plugins.media.dataToImg(this.data));\r
+                       tinyMCEPopup.close();\r
+               },\r
+\r
+               preview : function() {\r
+                       get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true);\r
+               },\r
+\r
+               moveStates : function(to_form, field) {\r
+                       var data = this.data, editor = this.editor,\r
+                               mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;\r
+\r
+                       defaultStates = {\r
+                               // QuickTime\r
+                               quicktime_autoplay : true,\r
+                               quicktime_controller : true,\r
+\r
+                               // Flash\r
+                               flash_play : true,\r
+                               flash_loop : true,\r
+                               flash_menu : true,\r
+\r
+                               // WindowsMedia\r
+                               windowsmedia_autostart : true,\r
+                               windowsmedia_enablecontextmenu : true,\r
+                               windowsmedia_invokeurls : true,\r
+\r
+                               // RealMedia\r
+                               realmedia_autogotourl : true,\r
+                               realmedia_imagestatus : true\r
+                       };\r
+\r
+                       function parseQueryParams(str) {\r
+                               var out = {};\r
+\r
+                               if (str) {\r
+                                       tinymce.each(str.split('&'), function(item) {\r
+                                               var parts = item.split('=');\r
+\r
+                                               out[unescape(parts[0])] = unescape(parts[1]);\r
+                                       });\r
+                               }\r
+\r
+                               return out;\r
+                       };\r
+\r
+                       function setOptions(type, names) {\r
+                               var i, name, formItemName, value, list;\r
+\r
+                               if (type == data.type || type == 'global') {\r
+                                       names = tinymce.explode(names);\r
+                                       for (i = 0; i < names.length; i++) {\r
+                                               name = names[i];\r
+                                               formItemName = type == 'global' ? name : type + '_' + name;\r
+\r
+                                               if (type == 'global')\r
+                                               list = data;\r
+                                       else if (type == 'video' || type == 'audio') {\r
+                                                       list = data.video.attrs;\r
+\r
+                                                       if (!list && !to_form)\r
+                                                       data.video.attrs = list = {};\r
+                                               } else\r
+                                               list = data.params;\r
+\r
+                                               if (list) {\r
+                                                       if (to_form) {\r
+                                                               setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');\r
+                                                       } else {\r
+                                                               delete list[name];\r
+\r
+                                                               value = getVal(formItemName);\r
+                                                               if ((type == 'video' || type == 'audio') && value === true)\r
+                                                                       value = name;\r
+\r
+                                                               if (defaultStates[formItemName]) {\r
+                                                                       if (value !== defaultStates[formItemName]) {\r
+                                                                               value = "" + value;\r
+                                                                               list[name] = value;\r
+                                                                       }\r
+                                                               } else if (value) {\r
+                                                                       value = "" + value;\r
+                                                                       list[name] = value;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
 \r
-function getStr(p, n, d) {\r
-       var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];\r
-       var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;\r
+                       if (!to_form) {\r
+                               data.type = get('media_type').options[get('media_type').selectedIndex].value;\r
+                               data.width = getVal('width');\r
+                               data.height = getVal('height');\r
 \r
-       if (n == 'src')\r
-               v = tinyMCEPopup.editor.convertURL(v, 'src', null);\r
+                               // Switch type based on extension\r
+                               src = getVal('src');\r
+                               if (field == 'src') {\r
+                                       ext = src.replace(/^.*\.([^.]+)$/, '$1');\r
+                                       if (typeInfo = mediaPlugin.getType(ext))\r
+                                               data.type = typeInfo.name.toLowerCase();\r
 \r
-       return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");\r
-}\r
+                                       setVal('media_type', data.type);\r
+                               }\r
 \r
-function getInt(p, n, d) {\r
-       var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];\r
-       var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;\r
+                               if (data.type == "video" || data.type == "audio") {\r
+                                       if (!data.video.sources)\r
+                                               data.video.sources = [];\r
 \r
-       return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");\r
-}\r
+                                       data.video.sources[0] = {src: getVal('src')};\r
+                               }\r
+                       }\r
 \r
-function jsEncode(s) {\r
-       s = s.replace(new RegExp('\\\\', 'g'), '\\\\');\r
-       s = s.replace(new RegExp('"', 'g'), '\\"');\r
-       s = s.replace(new RegExp("'", 'g'), "\\'");\r
+                       // Hide all fieldsets and show the one active\r
+                       get('video_options').style.display = 'none';\r
+                       get('audio_options').style.display = 'none';\r
+                       get('flash_options').style.display = 'none';\r
+                       get('quicktime_options').style.display = 'none';\r
+                       get('shockwave_options').style.display = 'none';\r
+                       get('windowsmedia_options').style.display = 'none';\r
+                       get('realmedia_options').style.display = 'none';\r
+                       get('embeddedaudio_options').style.display = 'none';\r
+\r
+                       if (get(data.type + '_options'))\r
+                               get(data.type + '_options').style.display = 'block';\r
+\r
+                       setVal('media_type', data.type);\r
+\r
+                       setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars');\r
+                       setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc');\r
+                       setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');\r
+                       setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');\r
+                       setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');\r
+                       setOptions('video', 'poster,autoplay,loop,muted,preload,controls');\r
+                       setOptions('audio', 'autoplay,loop,preload,controls');\r
+                       setOptions('embeddedaudio', 'autoplay,loop,controls');\r
+                       setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');\r
+\r
+                       if (to_form) {\r
+                               if (data.type == 'video') {\r
+                                       if (data.video.sources[0])\r
+                                               setVal('src', data.video.sources[0].src);\r
+\r
+                                       src = data.video.sources[1];\r
+                                       if (src)\r
+                                               setVal('video_altsource1', src.src);\r
+\r
+                                       src = data.video.sources[2];\r
+                                       if (src)\r
+                                               setVal('video_altsource2', src.src);\r
+                } else if (data.type == 'audio') {\r
+                    if (data.video.sources[0])\r
+                        setVal('src', data.video.sources[0].src);\r
+                    \r
+                    src = data.video.sources[1];\r
+                    if (src)\r
+                        setVal('audio_altsource1', src.src);\r
+                    \r
+                    src = data.video.sources[2];\r
+                    if (src)\r
+                        setVal('audio_altsource2', src.src);\r
+                               } else {\r
+                                       // Check flash vars\r
+                                       if (data.type == 'flash') {\r
+                                               tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {\r
+                                                       if (value == '$url')\r
+                                                               data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';\r
+                                               });\r
+                                       }\r
+\r
+                                       setVal('src', data.params.src);\r
+                               }\r
+                       } else {\r
+                               src = getVal("src");\r
+\r
+                               // YouTube *NEW*\r
+                               if (src.match(/youtu.be\/[a-z1-9.-_]+/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               // YouTube\r
+                               if (src.match(/youtube.com(.+)v=([^&]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 350;\r
+                                       data.params.frameborder = '0';\r
+                                       data.type = 'iframe';\r
+                                       src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1];\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               // Google video\r
+                               if (src.match(/video.google.com(.+)docid=([^&]+)/)) {\r
+                                       data.width = 425;\r
+                                       data.height = 326;\r
+                                       data.type = 'flash';\r
+                                       src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en';\r
+                                       setVal('src', src);\r
+                                       setVal('media_type', data.type);\r
+                               }\r
+\r
+                               if (data.type == 'video') {\r
+                                       if (!data.video.sources)\r
+                                               data.video.sources = [];\r
+\r
+                                       data.video.sources[0] = {src : src};\r
+\r
+                                       src = getVal("video_altsource1");\r
+                                       if (src)\r
+                                               data.video.sources[1] = {src : src};\r
+\r
+                                       src = getVal("video_altsource2");\r
+                                       if (src)\r
+                                               data.video.sources[2] = {src : src};\r
+                } else if (data.type == 'audio') {\r
+                    if (!data.video.sources)\r
+                        data.video.sources = [];\r
+                    \r
+                    data.video.sources[0] = {src : src};\r
+                    \r
+                    src = getVal("audio_altsource1");\r
+                    if (src)\r
+                        data.video.sources[1] = {src : src};\r
+                    \r
+                    src = getVal("audio_altsource2");\r
+                    if (src)\r
+                        data.video.sources[2] = {src : src};\r
+                               } else\r
+                                       data.params.src = src;\r
+\r
+                               // Set default size\r
+                setVal('width', data.width || (data.type == 'audio' ? 300 : 320));\r
+                setVal('height', data.height || (data.type == 'audio' ? 32 : 240));\r
+                       }\r
+               },\r
+\r
+               dataToForm : function() {\r
+                       this.moveStates(true);\r
+               },\r
+\r
+               formToData : function(field) {\r
+                       if (field == "width" || field == "height")\r
+                               this.changeSize(field);\r
+\r
+                       if (field == 'source') {\r
+                               this.moveStates(false, field);\r
+                               setVal('source', this.editor.plugins.media.dataToHtml(this.data));\r
+                               this.panel = 'source';\r
+                       } else {\r
+                               if (this.panel == 'source') {\r
+                                       this.data = clone(this.editor.plugins.media.htmlToData(getVal('source')));\r
+                                       this.dataToForm();\r
+                                       this.panel = '';\r
+                               }\r
+\r
+                               this.moveStates(false, field);\r
+                               this.preview();\r
+                       }\r
+               },\r
+\r
+               beforeResize : function() {\r
+            this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);\r
+            this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);\r
+               },\r
+\r
+               changeSize : function(type) {\r
+                       var width, height, scale, size;\r
+\r
+                       if (get('constrain').checked) {\r
+                width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);\r
+                height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);\r
+\r
+                               if (type == 'width') {\r
+                                       this.height = Math.round((width / this.width) * height);\r
+                                       setVal('height', this.height);\r
+                               } else {\r
+                                       this.width = Math.round((height / this.height) * width);\r
+                                       setVal('width', this.width);\r
+                               }\r
+                       }\r
+               },\r
 \r
-       return s;\r
-}\r
+               getMediaListHTML : function() {\r
+                       if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {\r
+                               var html = "";\r
 \r
-function generatePreview(c) {\r
-       var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;\r
+                               html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';\r
+                               html += '<option value="">---</option>';\r
 \r
-       p.innerHTML = '<!-- x --->';\r
+                               for (var i=0; i<tinyMCEMediaList.length; i++)\r
+                                       html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';\r
 \r
-       nw = parseInt(f.width.value);\r
-       nh = parseInt(f.height.value);\r
+                               html += '</select>';\r
 \r
-       if (f.width.value != "" && f.height.value != "") {\r
-               if (f.constrain.checked) {\r
-                       if (c == 'width' && oldWidth != 0) {\r
-                               wp = nw / oldWidth;\r
-                               nh = Math.round(wp * nh);\r
-                               f.height.value = nh;\r
-                       } else if (c == 'height' && oldHeight != 0) {\r
-                               hp = nh / oldHeight;\r
-                               nw = Math.round(hp * nw);\r
-                               f.width.value = nw;\r
+                               return html;\r
                        }\r
-               }\r
-       }\r
 \r
-       if (f.width.value != "")\r
-               oldWidth = nw;\r
-\r
-       if (f.height.value != "")\r
-               oldHeight = nh;\r
-\r
-       // After constrain\r
-       pl = serializeParameters();\r
-\r
-       switch (f.media_type.options[f.media_type.selectedIndex].value) {\r
-               case "flash":\r
-                       cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';\r
-                       codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';\r
-                       type = 'application/x-shockwave-flash';\r
-                       break;\r
-\r
-               case "shockwave":\r
-                       cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';\r
-                       codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';\r
-                       type = 'application/x-director';\r
-                       break;\r
-\r
-               case "qt":\r
-                       cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';\r
-                       codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';\r
-                       type = 'video/quicktime';\r
-                       break;\r
-\r
-               case "wmp":\r
-                       cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';\r
-                       codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';\r
-                       type = 'application/x-mplayer2';\r
-                       break;\r
-\r
-               case "rmp":\r
-                       cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';\r
-                       codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';\r
-                       type = 'audio/x-pn-realaudio-plugin';\r
-                       break;\r
-       }\r
+                       return "";\r
+               },\r
 \r
-       if (pl == '') {\r
-               p.innerHTML = '';\r
-               return;\r
-       }\r
+               getMediaTypeHTML : function(editor) {\r
+                       function option(media_type, element) {\r
+                               if (!editor.schema.getElementRule(element || media_type)) {\r
+                                       return '';\r
+                               }\r
 \r
-       pl = tinyMCEPopup.editor.plugins.media._parse(pl);\r
+                               return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'\r
+                       }\r
 \r
-       if (!pl.src) {\r
-               p.innerHTML = '';\r
-               return;\r
-       }\r
+                       var html = "";\r
 \r
-       pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);\r
-       pl.width = !pl.width ? 100 : pl.width;\r
-       pl.height = !pl.height ? 100 : pl.height;\r
-       pl.id = !pl.id ? 'obj' : pl.id;\r
-       pl.name = !pl.name ? 'eobj' : pl.name;\r
-       pl.align = !pl.align ? '' : pl.align;\r
+                       html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';\r
+                       html += option("video");\r
+                       html += option("audio");\r
+                       html += option("flash", "object");\r
+                       html += option("quicktime", "object");\r
+                       html += option("shockwave", "object");\r
+                       html += option("windowsmedia", "object");\r
+                       html += option("realmedia", "object");\r
+                       html += option("iframe");\r
 \r
-       // Avoid annoying warning about insecure items\r
-       if (!tinymce.isIE || document.location.protocol != 'https:') {\r
-               h += '<object classid="' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';\r
+                       if (editor.getParam('media_embedded_audio', false)) {\r
+                               html += option('embeddedaudio', "object");\r
+                       }\r
 \r
-               for (n in pl) {\r
-                       h += '<param name="' + n + '" value="' + pl[n] + '">';\r
+                       html += '</select>';\r
+                       return html;\r
+               },\r
 \r
-                       // Add extra url parameter if it's an absolute URL\r
-                       if (n == 'src' && pl[n].indexOf('://') != -1)\r
-                               h += '<param name="url" value="' + pl[n] + '" />';\r
+               setDefaultDialogSettings : function(editor) {\r
+                       var defaultDialogSettings = editor.getParam("media_dialog_defaults", {});\r
+                       tinymce.each(defaultDialogSettings, function(v, k) {\r
+                               setVal(k, v);\r
+                       });\r
                }\r
-       }\r
-\r
-       h += '<embed type="' + type + '" ';\r
-\r
-       for (n in pl)\r
-               h += n + '="' + pl[n] + '" ';\r
-\r
-       h += '></embed>';\r
-\r
-       // Avoid annoying warning about insecure items\r
-       if (!tinymce.isIE || document.location.protocol != 'https:')\r
-               h += '</object>';\r
-\r
-       p.innerHTML = "<!-- x --->" + h;\r
-}\r
+       };\r
 \r
-tinyMCEPopup.onInit.add(init);\r
+       tinyMCEPopup.requireLangPack();\r
+       tinyMCEPopup.onInit.add(function() {\r
+               Media.init();\r
+       });\r
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index 6d0a996..ecef3a8
@@ -1,103 +1 @@
-tinyMCE.addI18n('en.media_dlg',{\r
-title:"Insert / edit embedded media",\r
-general:"General",\r
-advanced:"Advanced",\r
-file:"File/URL",\r
-list:"List",\r
-size:"Dimensions",\r
-preview:"Preview",\r
-constrain_proportions:"Constrain proportions",\r
-type:"Type",\r
-id:"Id",\r
-name:"Name",\r
-class_name:"Class",\r
-vspace:"V-Space",\r
-hspace:"H-Space",\r
-play:"Auto play",\r
-loop:"Loop",\r
-menu:"Show menu",\r
-quality:"Quality",\r
-scale:"Scale",\r
-align:"Align",\r
-salign:"SAlign",\r
-wmode:"WMode",\r
-bgcolor:"Background",\r
-base:"Base",\r
-flashvars:"Flashvars",\r
-liveconnect:"SWLiveConnect",\r
-autohref:"AutoHREF",\r
-cache:"Cache",\r
-hidden:"Hidden",\r
-controller:"Controller",\r
-kioskmode:"Kiosk mode",\r
-playeveryframe:"Play every frame",\r
-targetcache:"Target cache",\r
-correction:"No correction",\r
-enablejavascript:"Enable JavaScript",\r
-starttime:"Start time",\r
-endtime:"End time",\r
-href:"Href",\r
-qtsrcchokespeed:"Choke speed",\r
-target:"Target",\r
-volume:"Volume",\r
-autostart:"Auto start",\r
-enabled:"Enabled",\r
-fullscreen:"Fullscreen",\r
-invokeurls:"Invoke URLs",\r
-mute:"Mute",\r
-stretchtofit:"Stretch to fit",\r
-windowlessvideo:"Windowless video",\r
-balance:"Balance",\r
-baseurl:"Base URL",\r
-captioningid:"Captioning id",\r
-currentmarker:"Current marker",\r
-currentposition:"Current position",\r
-defaultframe:"Default frame",\r
-playcount:"Play count",\r
-rate:"Rate",\r
-uimode:"UI Mode",\r
-flash_options:"Flash options",\r
-qt_options:"Quicktime options",\r
-wmp_options:"Windows media player options",\r
-rmp_options:"Real media player options",\r
-shockwave_options:"Shockwave options",\r
-autogotourl:"Auto goto URL",\r
-center:"Center",\r
-imagestatus:"Image status",\r
-maintainaspect:"Maintain aspect",\r
-nojava:"No java",\r
-prefetch:"Prefetch",\r
-shuffle:"Shuffle",\r
-console:"Console",\r
-numloop:"Num loops",\r
-controls:"Controls",\r
-scriptcallbacks:"Script callbacks",\r
-swstretchstyle:"Stretch style",\r
-swstretchhalign:"Stretch H-Align",\r
-swstretchvalign:"Stretch V-Align",\r
-sound:"Sound",\r
-progress:"Progress",\r
-qtsrc:"QT Src",\r
-qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..",\r
-align_top:"Top",\r
-align_right:"Right",\r
-align_bottom:"Bottom",\r
-align_left:"Left",\r
-align_center:"Center",\r
-align_top_left:"Top left",\r
-align_top_right:"Top right",\r
-align_bottom_left:"Bottom left",\r
-align_bottom_right:"Bottom right",\r
-flv_options:"Flash video options",\r
-flv_scalemode:"Scale mode",\r
-flv_buffer:"Buffer",\r
-flv_startimage:"Start image",\r
-flv_starttime:"Start time",\r
-flv_defaultvolume:"Default volumne",\r
-flv_hiddengui:"Hidden GUI",\r
-flv_autostart:"Auto start",\r
-flv_loop:"Loop",\r
-flv_showscalemodes:"Show scale modes",\r
-flv_smoothvideo:"Smooth video",\r
-flv_jscallback:"JS Callback"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.media_dlg',{list:"List",file:"File/URL",advanced:"Advanced",general:"General",title:"Insert/Edit Embedded Media","align_top_left":"Top Left","align_center":"Center","align_left":"Left","align_bottom":"Bottom","align_right":"Right","align_top":"Top","qt_stream_warn":"Streamed RTSP resources should be added to the QT Source field under the Advanced tab.\nYou should also add a non-streamed version to the Source field.",qtsrc:"QT Source",progress:"Progress",sound:"Sound",swstretchvalign:"Stretch V-Align",swstretchhalign:"Stretch H-Align",swstretchstyle:"Stretch Style",scriptcallbacks:"Script Callbacks","align_top_right":"Top Right",uimode:"UI Mode",rate:"Rate",playcount:"Play Count",defaultframe:"Default Frame",currentposition:"Current Position",currentmarker:"Current Marker",captioningid:"Captioning ID",baseurl:"Base URL",balance:"Balance",windowlessvideo:"Windowless Video",stretchtofit:"Stretch to Fit",mute:"Mute",invokeurls:"Invoke URLs",fullscreen:"Full Screen",enabled:"Enabled",autostart:"Auto Start",volume:"Volume",target:"Target",qtsrcchokespeed:"Choke Speed",href:"HREF",endtime:"End Time",starttime:"Start Time",enablejavascript:"Enable JavaScript",correction:"No Correction",targetcache:"Target Cache",playeveryframe:"Play Every Frame",kioskmode:"Kiosk Mode",controller:"Controller",menu:"Show Menu",loop:"Loop",play:"Auto Play",hspace:"H-Space",vspace:"V-Space","class_name":"Class",name:"Name",id:"ID",type:"Type",size:"Dimensions",preview:"Preview","constrain_proportions":"Constrain Proportions",controls:"Controls",numloop:"Num Loops",console:"Console",cache:"Cache",autohref:"Auto HREF",liveconnect:"SWLiveConnect",flashvars:"Flash Vars",base:"Base",bgcolor:"Background",wmode:"WMode",salign:"SAlign",align:"Align",scale:"Scale",quality:"Quality",shuffle:"Shuffle",prefetch:"Prefetch",nojava:"No Java",maintainaspect:"Maintain Aspect",imagestatus:"Image Status",center:"Center",autogotourl:"Auto Goto URL","shockwave_options":"Shockwave Options","rmp_options":"Real Media Player Options","wmp_options":"Windows Media Player Options","qt_options":"QuickTime Options","flash_options":"Flash Options",hidden:"Hidden","align_bottom_left":"Bottom Left","align_bottom_right":"Bottom Right","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source","html5_audio_options":"Audio Options","preload_none":"Don\'t Preload","preload_metadata":"Preload video metadata","preload_auto":"Let user\'s browser decide", "embedded_audio_options":"Embedded Audio Options", video:"HTML5 Video", audio:"HTML5 Audio", flash:"Flash", quicktime:"QuickTime", shockwave:"Shockwave", windowsmedia:"Windows Media", realmedia:"Real Media", iframe:"Iframe", embeddedaudio:"Embedded Audio" }); 
old mode 100755 (executable)
new mode 100644 (file)
index 73a903f..957d83a
        <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
        <link href="css/media.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body style="display: none">\r
-    <form onsubmit="insertMedia();return false;" action="#">\r
-               <div class="tabs">\r
+<body style="display: none" role="application">\r
+<form onsubmit="Media.insert();return false;" action="#">\r
+               <div class="tabs" role="presentation">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.general}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>\r
+                               <li id="source_tab" aria-controls="source_panel"><span><a href="javascript:mcTabs.displayTab('source_tab','source_panel');Media.formToData('source');" onmousedown="return false;">{#media_dlg.source}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
                                <fieldset>\r
                                        <legend>{#media_dlg.general}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                        <tr>\r
                                                                <td><label for="media_type">{#media_dlg.type}</label></td>\r
                                                                <td>\r
-                                                                       <select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">\r
-                                                                               <option value="flash">Flash</option>\r
-                                                                               <!-- <option value="flv">Flash video (FLV)</option> -->\r
-                                                                               <option value="qt">Quicktime</option>\r
-                                                                               <option value="shockwave">Shockwave</option>\r
-                                                                               <option value="wmp">Windows Media</option>\r
-                                                                               <option value="rmp">Real Media</option>\r
-                                                                       </select>\r
+                                                                       <select id="media_type"></select>\r
                                                                </td>\r
                                                        </tr>\r
                                                        <tr>\r
                                                        <td><label for="src">{#media_dlg.file}</label></td>\r
-                                                         <td>\r
-                                                                       <table border="0" cellspacing="0" cellpadding="0">\r
-                                                                         <tr>\r
-                                                                               <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>\r
+                                                               <td>\r
+                                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="Media.formToData();" /></td>\r
                                                                                <td id="filebrowsercontainer">&nbsp;</td>\r
-                                                                         </tr>\r
+                                                                       </tr>\r
                                                                        </table>\r
                                                                </td>\r
                                                        </tr>\r
                                                        <tr>\r
                                                                <td><label for="width">{#media_dlg.size}</label></td>\r
                                                                <td>\r
-                                                                       <table border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                                <tr>\r
-                                                                                       <td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size"  onchange="generatePreview('height');" /></td>\r
-                                                                                       <td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>\r
+                                                                                       <td><input type="text" id="width" name="width" value="" class="size" onchange="Media.formToData('width');" onfocus="Media.beforeResize();" /> x <input type="text" id="height" name="height" value="" class="size" onfocus="Media.beforeResize();" onchange="Media.formToData('height');" /></td>\r
+                                                                                       <td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" checked="checked" /></td>\r
                                                                                        <td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>\r
                                                                                </tr>\r
                                                                        </table>\r
                                <fieldset>\r
                                        <legend>{#media_dlg.advanced}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
                                                <tr>\r
                                                        <td><label for="id">{#media_dlg.id}</label></td>\r
-                                                       <td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>\r
+                                                       <td><input type="text" id="id" name="id" onchange="Media.formToData();" /></td>\r
                                                        <td><label for="name">{#media_dlg.name}</label></td>\r
-                                                       <td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>\r
+                                                       <td><input type="text" id="name" name="name" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
                                                        <td><label for="align">{#media_dlg.align}</label></td>\r
                                                        <td>\r
-                                                               <select id="align" name="align" onchange="generatePreview();">\r
+                                                               <select id="align" name="align" onchange="Media.formToData();">\r
                                                                        <option value="">{#not_set}</option> \r
                                                                        <option value="top">{#media_dlg.align_top}</option>\r
                                                                        <option value="right">{#media_dlg.align_right}</option>\r
 \r
                                                        <td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>\r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td>\r
+                                                                               <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');Media.formToData();" /></td>\r
                                                                                <td id="bgcolor_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
 \r
                                                <tr>\r
                                                        <td><label for="vspace">{#media_dlg.vspace}</label></td>\r
-                                                       <td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>\r
+                                                       <td><input type="text" id="vspace" name="vspace" class="number" onchange="Media.formToData();" /></td>\r
                                                        <td><label for="hspace">{#media_dlg.hspace}</label></td>\r
-                                                       <td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>\r
+                                                       <td><input type="text" id="hspace" name="hspace" class="number" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
 \r
-                               <fieldset id="flash_options">\r
-                                       <legend>{#media_dlg.flash_options}</legend>\r
+                               <fieldset id="video_options">\r
+                                       <legend>{#media_dlg.html5_video_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation">\r
                                                <tr>\r
-                                                       <td><label for="flash_quality">{#media_dlg.quality}</label></td>\r
+                                                       <td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_quality" name="flash_quality" onchange="generatePreview();">\r
-                                                                       <option value="">{#not_set}</option> \r
-                                                                       <option value="high">high</option>\r
-                                                                       <option value="low">low</option>\r
-                                                                       <option value="autolow">autolow</option>\r
-                                                                       <option value="autohigh">autohigh</option>\r
-                                                                       <option value="best">best</option>\r
-                                                               </select>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_altsource1" name="video_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_altsource1_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
                                                        </td>\r
+                                               </tr>\r
 \r
-                                                       <td><label for="flash_scale">{#media_dlg.scale}</label></td>\r
+                                               <tr>\r
+                                                       <td><label for="video_altsource2">{#media_dlg.altsource2}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_scale" name="flash_scale" onchange="generatePreview();">\r
-                                                                       <option value="">{#not_set}</option> \r
-                                                                       <option value="showall">showall</option>\r
-                                                                       <option value="noborder">noborder</option>\r
-                                                                       <option value="exactfit">exactfit</option>\r
-                                                                       <option value="noscale">noscale</option>\r
-                                                               </select>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_altsource2" name="video_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_altsource2_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
                                                        </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>\r
+                                                       <td><label for="video_poster">{#media_dlg.poster}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">\r
-                                                                       <option value="">{#not_set}</option> \r
-                                                                       <option value="window">window</option>\r
-                                                                       <option value="opaque">opaque</option>\r
-                                                                       <option value="transparent">transparent</option>\r
-                                                               </select>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="video_poster" name="video_poster" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="video_poster_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
                                                        </td>\r
+                                               </tr>\r
 \r
-                                                       <td><label for="flash_salign">{#media_dlg.salign}</label></td>\r
+                                               <tr>\r
+                                                       <td><label for="video_preload">{#media_dlg.preload}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_salign" name="flash_salign" onchange="generatePreview();">\r
-                                                                       <option value="">{#not_set}</option> \r
-                                                                       <option value="l">{#media_dlg.align_left}</option>\r
-                                                                       <option value="t">{#media_dlg.align_top}</option>\r
-                                                                       <option value="r">{#media_dlg.align_right}</option>\r
-                                                                       <option value="b">{#media_dlg.align_bottom}</option>\r
-                                                                       <option value="tl">{#media_dlg.align_top_left}</option>\r
-                                                                       <option value="tr">{#media_dlg.align_top_right}</option>\r
-                                                                       <option value="bl">{#media_dlg.align_bottom_left}</option>\r
-                                                                       <option value="br">{#media_dlg.align_bottom_right}</option>\r
+                                                               <select id="video_preload" name="video_preload" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#media_dlg.preload_none}</option> \r
+                                                                       <option value="metadata">{#media_dlg.preload_metadata}</option>\r
+                                                                       <option value="auto">{#media_dlg.preload_auto}</option>\r
                                                                </select>\r
                                                        </td>\r
                                                </tr>\r
+                                       </table>\r
 \r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flash_play">{#media_dlg.play}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_autoplay" name="video_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_autoplay">{#media_dlg.play}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flash_loop">{#media_dlg.loop}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_muted">{#media_dlg.mute}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                                       <tr>\r
+                                                                                                       <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>\r
+                                                                                                       <td><label for="video_loop">{#media_dlg.loop}</label></td>\r
+                                                                                       </tr>\r
+                                                                       </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_controls">{#media_dlg.controls}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="embeddedaudio_options">\r
+                                       <legend>{#media_dlg.embedded_audio_options}</legend>\r
 \r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flash_menu">{#media_dlg.menu}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_autoplay">{#media_dlg.play}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_loop">{#media_dlg.loop}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
-                                               </tr>\r
-                                       </table>\r
-\r
-                                       <table>\r
-                                               <tr>\r
-                                                       <td><label for="flash_base">{#media_dlg.base}</label></td>\r
-                                                       <td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>\r
-                                               </tr>\r
 \r
-                                               <tr>\r
-                                                       <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>\r
-                                                       <td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_controls">{#media_dlg.controls}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
 \r
-                               <fieldset id="flv_options">\r
-                                       <legend>{#media_dlg.flv_options}</legend>\r
+                               <fieldset id="audio_options">\r
+                                       <legend>{#media_dlg.html5_audio_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation">\r
                                                <tr>\r
-                                                       <td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td>\r
+                                                       <td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>\r
                                                        <td>\r
-                                                               <select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();">\r
-                                                                       <option value="">{#not_set}</option> \r
-                                                                       <option value="none">none</option>\r
-                                                                       <option value="double">double</option>\r
-                                                                       <option value="full">full</option>\r
-                                                               </select>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="audio_altsource1_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
                                                        </td>\r
-\r
-                                                       <td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td>\r
-                                                       <td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td>\r
-                                                       <td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td>\r
-\r
-                                                       <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>\r
-                                                       <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>\r
+                                                                               <td id="audio_altsource2_filebrowser">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>\r
-                                                       <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>\r
-\r
-\r
+                                                       <td><label for="audio_preload">{#media_dlg.preload}</label></td>\r
+                                                       <td>\r
+                                                               <select id="audio_preload" name="audio_preload" onchange="Media.formToData();">\r
+                                                                       <option value="none">{#media_dlg.preload_none}</option>\r
+                                                                       <option value="metadata">{#media_dlg.preload_metadata}</option>\r
+                                                                       <option value="auto">{#media_dlg.preload_auto}</option>\r
+                                                               </select>\r
+                                                       </td>\r
                                                </tr>\r
+                                       </table>\r
 \r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_autoplay">{#media_dlg.play}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
-                                                       <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_loop">{#media_dlg.loop}</label></td>\r
+                                                                       </tr>\r
+                                                               </table>\r
+                                                       </td>\r
+\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="audio_controls">{#media_dlg.controls}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
+                                       </table>\r
+                               </fieldset>\r
+\r
+                               <fieldset id="flash_options">\r
+                                       <legend>{#media_dlg.flash_options}</legend>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td><label for="flash_quality">{#media_dlg.quality}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_quality" name="flash_quality" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="high">high</option>\r
+                                                                       <option value="low">low</option>\r
+                                                                       <option value="autolow">autolow</option>\r
+                                                                       <option value="autohigh">autohigh</option>\r
+                                                                       <option value="best">best</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="flash_scale">{#media_dlg.scale}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_scale" name="flash_scale" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="showall">showall</option>\r
+                                                                       <option value="noborder">noborder</option>\r
+                                                                       <option value="exactfit">exactfit</option>\r
+                                                                       <option value="noscale">noscale</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_wmode" name="flash_wmode" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="window">window</option>\r
+                                                                       <option value="opaque">opaque</option>\r
+                                                                       <option value="transparent">transparent</option>\r
+                                                               </select>\r
+                                                       </td>\r
+\r
+                                                       <td><label for="flash_salign">{#media_dlg.salign}</label></td>\r
+                                                       <td>\r
+                                                               <select id="flash_salign" name="flash_salign" onchange="Media.formToData();">\r
+                                                                       <option value="">{#not_set}</option> \r
+                                                                       <option value="l">{#media_dlg.align_left}</option>\r
+                                                                       <option value="t">{#media_dlg.align_top}</option>\r
+                                                                       <option value="r">{#media_dlg.align_right}</option>\r
+                                                                       <option value="b">{#media_dlg.align_bottom}</option>\r
+                                                                       <option value="tl">{#media_dlg.align_top_left}</option>\r
+                                                                       <option value="tr">{#media_dlg.align_top_right}</option>\r
+                                                                       <option value="bl">{#media_dlg.align_bottom_left}</option>\r
+                                                                       <option value="br">{#media_dlg.align_bottom_right}</option>\r
+                                                               </select>\r
+                                                       </td>\r
+                                               </tr>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_loop">{#media_dlg.flv_loop}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_play">{#media_dlg.play}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_loop">{#media_dlg.loop}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_menu">{#media_dlg.menu}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
                                        </table>\r
+\r
+                                       <table role="presentation">\r
+                                               <tr>\r
+                                                       <td><label for="flash_base">{#media_dlg.base}</label></td>\r
+                                                       <td><input type="text" id="flash_base" name="flash_base" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+\r
+                                               <tr>\r
+                                                       <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>\r
+                                                       <td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="Media.formToData();" /></td>\r
+                                               </tr>\r
+                                       </table>\r
                                </fieldset>\r
 \r
-                               <fieldset id="qt_options">\r
+                               <fieldset id="quicktime_options">\r
                                        <legend>{#media_dlg.qt_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_loop">{#media_dlg.loop}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_loop" name="quicktime_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_loop">{#media_dlg.loop}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_autoplay">{#media_dlg.play}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_autoplay" name="quicktime_autoplay" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_autoplay">{#media_dlg.play}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_cache">{#media_dlg.cache}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_cache" name="quicktime_cache" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_cache">{#media_dlg.cache}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_controller">{#media_dlg.controller}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_controller" name="quicktime_controller" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_controller">{#media_dlg.controller}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_correction">{#media_dlg.correction}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_correction" name="quicktime_correction" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_correction">{#media_dlg.correction}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_enablejavascript" name="quicktime_enablejavascript" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_enablejavascript">{#media_dlg.enablejavascript}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_kioskmode" name="quicktime_kioskmode" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_kioskmode">{#media_dlg.kioskmode}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_autohref">{#media_dlg.autohref}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_autohref" name="quicktime_autohref" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_autohref">{#media_dlg.autohref}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_playeveryframe" name="quicktime_playeveryframe" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_playeveryframe">{#media_dlg.playeveryframe}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="quicktime_targetcache" name="quicktime_targetcache" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="quicktime_targetcache">{#media_dlg.targetcache}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="qt_scale">{#media_dlg.scale}</label></td>\r
-                                                       <td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">\r
+                                                       <td><label for="quicktime_scale">{#media_dlg.scale}</label></td>\r
+                                                       <td><select id="quicktime_scale" name="quicktime_scale" class="mceEditableSelect" onchange="Media.formToData();">\r
                                                                        <option value="">{#not_set}</option> \r
                                                                        <option value="tofit">tofit</option>\r
                                                                        <option value="aspect">aspect</option>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="qt_starttime">{#media_dlg.starttime}</label></td>\r
-                                                       <td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_starttime">{#media_dlg.starttime}</label></td>\r
+                                                       <td><input type="text" id="quicktime_starttime" name="quicktime_starttime" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="qt_endtime">{#media_dlg.endtime}</label></td>\r
-                                                       <td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_endtime">{#media_dlg.endtime}</label></td>\r
+                                                       <td><input type="text" id="quicktime_endtime" name="quicktime_endtime" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="qt_target">{#media_dlg.target}</label></td>\r
-                                                       <td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_target">{#media_dlg.target}</label></td>\r
+                                                       <td><input type="text" id="quicktime_target" name="quicktime_target" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="qt_href">{#media_dlg.href}</label></td>\r
-                                                       <td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_href">{#media_dlg.href}</label></td>\r
+                                                       <td><input type="text" id="quicktime_href" name="quicktime_href" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>\r
-                                                       <td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>\r
+                                                       <td><input type="text" id="quicktime_qtsrcchokespeed" name="quicktime_qtsrcchokespeed" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="qt_volume">{#media_dlg.volume}</label></td>\r
-                                                       <td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="quicktime_volume">{#media_dlg.volume}</label></td>\r
+                                                       <td><input type="text" id="quicktime_volume" name="quicktime_volume" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td>\r
+                                                       <td><label for="quicktime_qtsrc">{#media_dlg.qtsrc}</label></td>\r
                                                        <td colspan="4">\r
-                                                       <table border="0" cellspacing="0" cellpadding="0">\r
-                                                                 <tr>\r
-                                                                       <td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td>\r
-                                                                       <td id="qtsrcfilebrowsercontainer">&nbsp;</td>\r
-                                                                 </tr>\r
-                                                       </table>\r
+                                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
+                                                                       <tr>\r
+                                                                               <td><input type="text" id="quicktime_qtsrc" name="quicktime_qtsrc" onchange="Media.formToData();" /></td>\r
+                                                                               <td id="qtsrcfilebrowsercontainer">&nbsp;</td>\r
+                                                                       </tr>\r
+                                                               </table>\r
                                                        </td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
 \r
-                               <fieldset id="wmp_options">\r
+                               <fieldset id="windowsmedia_options">\r
                                        <legend>{#media_dlg.wmp_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_autostart">{#media_dlg.autostart}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_autostart" name="windowsmedia_autostart" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_autostart">{#media_dlg.autostart}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_enabled">{#media_dlg.enabled}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_enabled" name="windowsmedia_enabled" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_enabled">{#media_dlg.enabled}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_enablecontextmenu" name="windowsmedia_enablecontextmenu" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_enablecontextmenu">{#media_dlg.menu}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_fullscreen" name="windowsmedia_fullscreen" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_fullscreen">{#media_dlg.fullscreen}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_invokeurls" name="windowsmedia_invokeurls" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_invokeurls">{#media_dlg.invokeurls}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_mute">{#media_dlg.mute}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_mute" name="windowsmedia_mute" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_mute">{#media_dlg.mute}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_stretchtofit" name="windowsmedia_stretchtofit" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_stretchtofit">{#media_dlg.stretchtofit}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="windowsmedia_windowlessvideo" name="windowsmedia_windowlessvideo" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="windowsmedia_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="wmp_balance">{#media_dlg.balance}</label></td>\r
-                                                       <td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_balance">{#media_dlg.balance}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_balance" name="windowsmedia_balance" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td>\r
-                                                       <td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_baseurl">{#media_dlg.baseurl}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_baseurl" name="windowsmedia_baseurl" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td>\r
-                                                       <td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_captioningid">{#media_dlg.captioningid}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_captioningid" name="windowsmedia_captioningid" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td>\r
-                                                       <td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_currentmarker">{#media_dlg.currentmarker}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_currentmarker" name="windowsmedia_currentmarker" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td>\r
-                                                       <td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_currentposition">{#media_dlg.currentposition}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_currentposition" name="windowsmedia_currentposition" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td>\r
-                                                       <td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_defaultframe">{#media_dlg.defaultframe}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_defaultframe" name="windowsmedia_defaultframe" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="wmp_playcount">{#media_dlg.playcount}</label></td>\r
-                                                       <td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_playcount">{#media_dlg.playcount}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_playcount" name="windowsmedia_playcount" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="wmp_rate">{#media_dlg.rate}</label></td>\r
-                                                       <td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_rate">{#media_dlg.rate}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_rate" name="windowsmedia_rate" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="wmp_uimode">{#media_dlg.uimode}</label></td>\r
-                                                       <td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_uimode">{#media_dlg.uimode}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_uimode" name="windowsmedia_uimode" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="wmp_volume">{#media_dlg.volume}</label></td>\r
-                                                       <td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="windowsmedia_volume">{#media_dlg.volume}</label></td>\r
+                                                       <td><input type="text" id="windowsmedia_volume" name="windowsmedia_volume" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                        </table>\r
                                </fieldset>\r
 \r
-                               <fieldset id="rmp_options">\r
+                               <fieldset id="realmedia_options">\r
                                        <legend>{#media_dlg.rmp_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_autostart">{#media_dlg.autostart}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_autostart" name="realmedia_autostart" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_autostart">{#media_dlg.autostart}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_loop">{#media_dlg.loop}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_loop" name="realmedia_loop" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_loop">{#media_dlg.loop}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_autogotourl" name="realmedia_autogotourl" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_autogotourl">{#media_dlg.autogotourl}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_center">{#media_dlg.center}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_center" name="realmedia_center" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_center">{#media_dlg.center}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_imagestatus" name="realmedia_imagestatus" checked="checked" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_imagestatus">{#media_dlg.imagestatus}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_maintainaspect" name="realmedia_maintainaspect" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_maintainaspect">{#media_dlg.maintainaspect}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_nojava" name="realmedia_nojava" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_nojava">{#media_dlg.nojava}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_prefetch" name="realmedia_prefetch" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_prefetch">{#media_dlg.prefetch}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>\r
-                                                                               <td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="realmedia_shuffle" name="realmedia_shuffle" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="realmedia_shuffle">{#media_dlg.shuffle}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="rmp_console">{#media_dlg.console}</label></td>\r
-                                                       <td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="realmedia_console">{#media_dlg.console}</label></td>\r
+                                                       <td><input type="text" id="realmedia_console" name="realmedia_console" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="rmp_controls">{#media_dlg.controls}</label></td>\r
-                                                       <td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="realmedia_controls">{#media_dlg.controls}</label></td>\r
+                                                       <td><input type="text" id="realmedia_controls" name="realmedia_controls" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td><label for="rmp_numloop">{#media_dlg.numloop}</label></td>\r
-                                                       <td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="realmedia_numloop">{#media_dlg.numloop}</label></td>\r
+                                                       <td><input type="text" id="realmedia_numloop" name="realmedia_numloop" onchange="Media.formToData();" /></td>\r
 \r
-                                                       <td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>\r
-                                                       <td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>\r
+                                                       <td><label for="realmedia_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>\r
+                                                       <td><input type="text" id="realmedia_scriptcallbacks" name="realmedia_scriptcallbacks" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
                                <fieldset id="shockwave_options">\r
                                        <legend>{#media_dlg.shockwave_options}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>\r
                                                        <td>\r
-                                                               <select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">\r
+                                                               <select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="Media.formToData();">\r
                                                                        <option value="none">{#not_set}</option>\r
                                                                        <option value="meet">Meet</option>\r
                                                                        <option value="fill">Fill</option>\r
                                                        </td>\r
 \r
                                                        <td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>\r
-                                                       <td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>\r
+                                                       <td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="Media.formToData();" /></td>\r
                                                </tr>\r
 \r
                                                <tr>\r
                                                        <td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>\r
                                                        <td>\r
-                                                               <select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">\r
+                                                               <select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="Media.formToData();">\r
                                                                        <option value="none">{#not_set}</option>\r
                                                                        <option value="left">{#media_dlg.align_left}</option>\r
                                                                        <option value="center">{#media_dlg.align_center}</option>\r
 \r
                                                        <td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>\r
                                                        <td>\r
-                                                               <select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">\r
+                                                               <select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="Media.formToData();">\r
                                                                        <option value="none">{#not_set}</option>\r
                                                                        <option value="meet">Meet</option>\r
                                                                        <option value="fill">Fill</option>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="Media.formToData();" checked="checked" /></td>\r
                                                                                <td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="Media.formToData();" checked="checked" /></td>\r
                                                                                <td><label for="shockwave_sound">{#media_dlg.sound}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
 \r
                                                <tr>\r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="Media.formToData();" /></td>\r
                                                                                <td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                                        </td>\r
 \r
                                                        <td colspan="2">\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
-                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>\r
+                                                                               <td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="Media.formToData();" checked="checked" /></td>\r
                                                                                <td><label for="shockwave_progress">{#media_dlg.progress}</label></td>\r
                                                                        </tr>\r
                                                                </table>\r
                                        </table>\r
                                </fieldset>\r
                        </div>\r
+\r
+                       <div id="source_panel" class="panel">\r
+                               <fieldset>\r
+                                       <legend>{#media_dlg.source}</legend>\r
+                                       <textarea id="source" style="width: 99%; height: 390px"></textarea>\r
+                               </fieldset>\r
+                       </div>\r
                </div>\r
 \r
                <div class="mceActionPanel">\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf b/library/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf
new file mode 100644 (file)
index 0000000..585d772
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf differ
old mode 100755 (executable)
new mode 100644 (file)
index f2dbbff..687f548
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span class="mceItemHidden mceVisualNbsp">&middot;</span>':"&nbsp;")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(tinymce.isIE&&f.keyCode==9){d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");tinymce.dom.Event.cancel(f)}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>':"&nbsp;")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(f.keyCode==9){f.preventDefault();d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking")}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index e3b078b..d492fbe
@@ -17,7 +17,7 @@
 \r
                        // Register commands\r
                        ed.addCommand('mceNonBreaking', function() {\r
-                               ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span class="mceItemHidden mceVisualNbsp">&middot;</span>' : '&nbsp;');\r
+                               ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');\r
                        });\r
 \r
                        // Register buttons\r
 \r
                        if (ed.getParam('nonbreaking_force_tab')) {\r
                                ed.onKeyDown.add(function(ed, e) {\r
-                                       if (tinymce.isIE && e.keyCode == 9) {\r
+                                       if (e.keyCode == 9) {\r
+                                               e.preventDefault();\r
+       \r
                                                ed.execCommand('mceNonBreaking');\r
                                                ed.execCommand('mceNonBreaking');\r
                                                ed.execCommand('mceNonBreaking');\r
-                                               tinymce.dom.Event.cancel(e);\r
                                        }\r
                                });\r
                        }\r
old mode 100755 (executable)
new mode 100644 (file)
index 9945cd8..e7f301d
@@ -1 +1 @@
-(function(){var a=tinymce.dom.Event;tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(d,e){var f=this,c,b;f.editor=d;c=d.getParam("noneditable_editable_class","mceEditable");b=d.getParam("noneditable_noneditable_class","mceNonEditable");d.onNodeChange.addToTop(function(h,g,k){var j,i;j=h.dom.getParent(h.selection.getStart(),function(l){return h.dom.hasClass(l,b)});i=h.dom.getParent(h.selection.getEnd(),function(l){return h.dom.hasClass(l,b)});if(j||i){f._setDisabled(1);return false}else{f._setDisabled(0)}})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_block:function(c,d){var b=d.keyCode;if((b>32&&b<41)||(b>111&&b<124)){return}return a.cancel(d)},_setDisabled:function(d){var c=this,b=c.editor;tinymce.each(b.controlManager.controls,function(e){e.setDisabled(d)});if(d!==c.disabled){if(d){b.onKeyDown.addToTop(c._block);b.onKeyPress.addToTop(c._block);b.onKeyUp.addToTop(c._block);b.onPaste.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
\ No newline at end of file
+(function(){var c=tinymce.dom.TreeWalker;var a="contenteditable",d="data-mce-"+a;var e=tinymce.VK;function b(n){var j=n.dom,p=n.selection,r,o="mce_noneditablecaret";r=tinymce.isGecko?"\u200B":"\uFEFF";function m(t){var s;if(t.nodeType===1){s=t.getAttribute(d);if(s&&s!=="inherit"){return s}s=t.contentEditable;if(s!=="inherit"){return s}}return null}function g(s){var t;while(s){t=m(s);if(t){return t==="false"?s:null}s=s.parentNode}}function l(s){while(s){if(s.id===o){return s}s=s.parentNode}}function k(s){var t;if(s){t=new c(s,s);for(s=t.current();s;s=t.next()){if(s.nodeType===3){return s}}}}function f(v,u){var s,t;if(m(v)==="false"){if(j.isBlock(v)){p.select(v);return}}t=j.createRng();if(m(v)==="true"){if(!v.firstChild){v.appendChild(n.getDoc().createTextNode("\u00a0"))}v=v.firstChild;u=true}s=j.create("span",{id:o,"data-mce-bogus":true},r);if(u){v.parentNode.insertBefore(s,v)}else{j.insertAfter(s,v)}t.setStart(s.firstChild,1);t.collapse(true);p.setRng(t);return s}function i(s){var v,t,u;if(s){rng=p.getRng(true);rng.setStartBefore(s);rng.setEndBefore(s);v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true);p.setRng(rng)}else{t=l(p.getStart());while((s=j.get(o))&&s!==u){if(t!==s){v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true)}u=s}}}function q(){var s,w,u,t,v;function x(B,D){var A,F,E,C,z;A=t.startContainer;F=t.startOffset;if(A.nodeType==3){z=A.nodeValue.length;if((F>0&&F<z)||(D?F==z:F==0)){return}}else{if(F<A.childNodes.length){var G=!D&&F>0?F-1:F;A=A.childNodes[G];if(A.hasChildNodes()){A=A.firstChild}}else{return !D?B:null}}E=new c(A,B);while(C=E[D?"prev":"next"]()){if(C.nodeType===3&&C.nodeValue.length>0){return}else{if(m(C)==="true"){return C}}}return B}i();u=p.isCollapsed();s=g(p.getStart());w=g(p.getEnd());if(s||w){t=p.getRng(true);if(u){s=s||w;var y=p.getStart();if(v=x(s,true)){f(v,true)}else{if(v=x(s,false)){f(v,false)}else{p.select(s)}}}else{t=p.getRng(true);if(s){t.setStartBefore(s)}if(w){t.setEndAfter(w)}p.setRng(t)}}}function h(y,A){var E=A.keyCode,w,B,C,u;function t(G,F){while(G=G[F?"previousSibling":"nextSibling"]){if(G.nodeType!==3||G.nodeValue.length>0){return G}}}function x(F,G){p.select(F);p.collapse(G)}C=p.getStart();u=p.getEnd();w=g(C)||g(u);if(w&&(E<112||E>124)&&E!=e.DELETE&&E!=e.BACKSPACE){A.preventDefault();if(E==e.LEFT||E==e.RIGHT){var v=E==e.LEFT;if(y.dom.isBlock(w)){var z=v?w.previousSibling:w.nextSibling;var s=new c(z,z);var D=v?s.prev():s.next();x(D,!v)}else{x(w,v)}}}else{if(E==e.LEFT||E==e.RIGHT||E==e.BACKSPACE||E==e.DELETE){B=l(C);if(B){if(E==e.LEFT||E==e.BACKSPACE){w=t(B,true);if(w&&m(w)==="false"){A.preventDefault();if(E==e.LEFT){x(w,true)}else{j.remove(w)}}else{i(B)}}if(E==e.RIGHT||E==e.DELETE){w=t(B);if(w&&m(w)==="false"){A.preventDefault();if(E==e.RIGHT){x(w,false)}else{j.remove(w)}}else{i(B)}}}}}}n.onMouseDown.addToTop(function(s,u){var t=s.selection.getNode();if(m(t)==="false"&&t==u.target){u.preventDefault()}});n.onMouseUp.addToTop(q);n.onKeyDown.addToTop(h);n.onKeyUp.addToTop(q)}tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(h,j){var g,f,i;g=" "+tinymce.trim(h.getParam("noneditable_editable_class","mceEditable"))+" ";f=" "+tinymce.trim(h.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";i=h.getParam("noneditable_regexp");if(i&&!i.length){i=[i]}h.onPreInit.add(function(){b(h);if(i){h.onBeforeSetContent.add(function(l,m){var n=i.length,o=m.content,k=tinymce.trim(f);if(m.format=="raw"){return}while(n--){o=o.replace(i[n],function(){var p=arguments;return'<span class="'+k+'" data-mce-content="'+l.dom.encode(p[0])+'">'+l.dom.encode(typeof(p[1])==="string"?p[1]:p[0])+"</span>"})}m.content=o})}h.parser.addAttributeFilter("class",function(k){var l=k.length,m,n;while(l--){n=k[l];m=" "+n.attr("class")+" ";if(m.indexOf(g)!==-1){n.attr(d,"true")}else{if(m.indexOf(f)!==-1){n.attr(d,"false")}}}});h.serializer.addAttributeFilter(d,function(k,l){var m=k.length,n;while(m--){n=k[m];if(i&&n.attr("data-mce-content")){n.name="#text";n.type=3;n.raw=true;n.value=n.attr("data-mce-content")}else{n.attr(a,null);n.attr(d,null)}}});h.parser.addAttributeFilter(a,function(k,l){var m=k.length,n;while(m--){n=k[m];n.attr(d,n.attr(a));n.attr(a,null)}})})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 656c971..c87d241
  */\r
 \r
 (function() {\r
-       var Event = tinymce.dom.Event;\r
+       var TreeWalker = tinymce.dom.TreeWalker;\r
+       var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;\r
+       var VK = tinymce.VK;\r
+\r
+       function handleContentEditableSelection(ed) {\r
+               var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret';\r
+\r
+               // Setup invisible character use zero width space on Gecko since it doesn't change the height of the container\r
+               invisibleChar = tinymce.isGecko ? '\u200B' : '\uFEFF';\r
+\r
+               // Returns the content editable state of a node "true/false" or null\r
+               function getContentEditable(node) {\r
+                       var contentEditable;\r
+\r
+                       // Ignore non elements\r
+                       if (node.nodeType === 1) {\r
+                               // Check for fake content editable\r
+                               contentEditable = node.getAttribute(internalName);\r
+                               if (contentEditable && contentEditable !== "inherit") {\r
+                                       return contentEditable;\r
+                               }\r
+\r
+                               // Check for real content editable\r
+                               contentEditable = node.contentEditable;\r
+                               if (contentEditable !== "inherit") {\r
+                                       return contentEditable;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+               };\r
+\r
+               // Returns the noneditable parent or null if there is a editable before it or if it wasn't found\r
+               function getNonEditableParent(node) {\r
+                       var state;\r
+\r
+                       while (node) {\r
+                               state = getContentEditable(node);\r
+                               if (state) {\r
+                                       return state  === "false" ? node : null;\r
+                               }\r
+\r
+                               node = node.parentNode;\r
+                       }\r
+               };\r
+\r
+               // Get caret container parent for the specified node\r
+               function getParentCaretContainer(node) {\r
+                       while (node) {\r
+                               if (node.id === caretContainerId) {\r
+                                       return node;\r
+                               }\r
+\r
+                               node = node.parentNode;\r
+                       }\r
+               };\r
+\r
+               // Finds the first text node in the specified node\r
+               function findFirstTextNode(node) {\r
+                       var walker;\r
+\r
+                       if (node) {\r
+                               walker = new TreeWalker(node, node);\r
+\r
+                               for (node = walker.current(); node; node = walker.next()) {\r
+                                       if (node.nodeType === 3) {\r
+                                               return node;\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               // Insert caret container before/after target or expand selection to include block\r
+               function insertCaretContainerOrExpandToBlock(target, before) {\r
+                       var caretContainer, rng;\r
+\r
+                       // Select block\r
+                       if (getContentEditable(target) === "false") {\r
+                               if (dom.isBlock(target)) {\r
+                                       selection.select(target);\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       rng = dom.createRng();\r
+\r
+                       if (getContentEditable(target) === "true") {\r
+                               if (!target.firstChild) {\r
+                                       target.appendChild(ed.getDoc().createTextNode('\u00a0'));\r
+                               }\r
+\r
+                               target = target.firstChild;\r
+                               before = true;\r
+                       }\r
+\r
+                       //caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar);\r
+                       caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);\r
+\r
+                       if (before) {\r
+                               target.parentNode.insertBefore(caretContainer, target);\r
+                       } else {\r
+                               dom.insertAfter(caretContainer, target);\r
+                       }\r
+\r
+                       rng.setStart(caretContainer.firstChild, 1);\r
+                       rng.collapse(true);\r
+                       selection.setRng(rng);\r
+\r
+                       return caretContainer;\r
+               };\r
+\r
+               // Removes any caret container except the one we might be in\r
+               function removeCaretContainer(caretContainer) {\r
+                       var child, currentCaretContainer, lastContainer;\r
+\r
+                       if (caretContainer) {\r
+                                       rng = selection.getRng(true);\r
+                                       rng.setStartBefore(caretContainer);\r
+                                       rng.setEndBefore(caretContainer);\r
+\r
+                                       child = findFirstTextNode(caretContainer);\r
+                                       if (child && child.nodeValue.charAt(0) == invisibleChar) {\r
+                                               child = child.deleteData(0, 1);\r
+                                       }\r
+\r
+                                       dom.remove(caretContainer, true);\r
+\r
+                                       selection.setRng(rng);\r
+                       } else {\r
+                               currentCaretContainer = getParentCaretContainer(selection.getStart());\r
+                               while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {\r
+                                       if (currentCaretContainer !== caretContainer) {\r
+                                               child = findFirstTextNode(caretContainer);\r
+                                               if (child && child.nodeValue.charAt(0) == invisibleChar) {\r
+                                                       child = child.deleteData(0, 1);\r
+                                               }\r
+\r
+                                               dom.remove(caretContainer, true);\r
+                                       }\r
+\r
+                                       lastContainer = caretContainer;\r
+                               }\r
+                       }\r
+               };\r
+\r
+               // Modifies the selection to include contentEditable false elements or insert caret containers\r
+               function moveSelection() {\r
+                       var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;\r
+\r
+                       // Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside\r
+                       function hasSideContent(element, left) {\r
+                               var container, offset, walker, node, len;\r
+\r
+                               container = rng.startContainer;\r
+                               offset = rng.startOffset;\r
+\r
+                               // If endpoint is in middle of text node then expand to beginning/end of element\r
+                               if (container.nodeType == 3) {\r
+                                       len = container.nodeValue.length;\r
+                                       if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) {\r
+                                               return;\r
+                                       }\r
+                               } else {\r
+                                       // Can we resolve the node by index\r
+                                       if (offset < container.childNodes.length) {\r
+                                               // Browser represents caret position as the offset at the start of an element. When moving right\r
+                                               // this is the element we are moving into so we consider our container to be child node at offset-1\r
+                                               var pos = !left && offset > 0 ? offset-1 : offset;\r
+                                               container = container.childNodes[pos];\r
+                                               if (container.hasChildNodes()) {\r
+                                                       container = container.firstChild;\r
+                                               }\r
+                                       } else {\r
+                                               // If not then the caret is at the last position in it's container and the caret container should be inserted after the noneditable element\r
+                                               return !left ? element : null;\r
+                                       }\r
+                               }\r
+\r
+                               // Walk left/right to look for contents\r
+                               walker = new TreeWalker(container, element);\r
+                               while (node = walker[left ? 'prev' : 'next']()) {\r
+                                       if (node.nodeType === 3 && node.nodeValue.length > 0) {\r
+                                               return;\r
+                                       } else if (getContentEditable(node) === "true") {\r
+                                               // Found contentEditable=true element return this one to we can move the caret inside it\r
+                                               return node;\r
+                                       }\r
+                               }\r
+\r
+                               return element;\r
+                       };\r
+\r
+                       // Remove any existing caret containers\r
+                       removeCaretContainer();\r
+\r
+                       // Get noneditable start/end elements\r
+                       isCollapsed = selection.isCollapsed();\r
+                       nonEditableStart = getNonEditableParent(selection.getStart());\r
+                       nonEditableEnd = getNonEditableParent(selection.getEnd());\r
+\r
+                       // Is any fo the range endpoints noneditable\r
+                       if (nonEditableStart || nonEditableEnd) {\r
+                               rng = selection.getRng(true);\r
+\r
+                               // If it's a caret selection then look left/right to see if we need to move the caret out side or expand\r
+                               if (isCollapsed) {\r
+                                       nonEditableStart = nonEditableStart || nonEditableEnd;\r
+                                       var start = selection.getStart();\r
+                                       if (element = hasSideContent(nonEditableStart, true)) {\r
+                                               // We have no contents to the left of the caret then insert a caret container before the noneditable element\r
+                                               insertCaretContainerOrExpandToBlock(element, true);\r
+                                       } else if (element = hasSideContent(nonEditableStart, false)) {\r
+                                               // We have no contents to the right of the caret then insert a caret container after the noneditable element\r
+                                               insertCaretContainerOrExpandToBlock(element, false);\r
+                                       } else {\r
+                                               // We are in the middle of a noneditable so expand to select it\r
+                                               selection.select(nonEditableStart);\r
+                                       }\r
+                               } else {\r
+                                       rng = selection.getRng(true);\r
+\r
+                                       // Expand selection to include start non editable element\r
+                                       if (nonEditableStart) {\r
+                                               rng.setStartBefore(nonEditableStart);\r
+                                       }\r
+\r
+                                       // Expand selection to include end non editable element\r
+                                       if (nonEditableEnd) {\r
+                                               rng.setEndAfter(nonEditableEnd);\r
+                                       }\r
+\r
+                                       selection.setRng(rng);\r
+                               }\r
+                       }\r
+               };\r
+\r
+               function handleKey(ed, e) {\r
+                       var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;\r
+\r
+                       function getNonEmptyTextNodeSibling(node, prev) {\r
+                               while (node = node[prev ? 'previousSibling' : 'nextSibling']) {\r
+                                       if (node.nodeType !== 3 || node.nodeValue.length > 0) {\r
+                                               return node;\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       function positionCaretOnElement(element, start) {\r
+                               selection.select(element);\r
+                               selection.collapse(start);\r
+                       }\r
+\r
+                       startElement = selection.getStart()\r
+                       endElement = selection.getEnd();\r
+\r
+                       // Disable all key presses in contentEditable=false except delete or backspace\r
+                       nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);\r
+                       if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {\r
+                               e.preventDefault();\r
+\r
+                               // Arrow left/right select the element and collapse left/right\r
+                               if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {\r
+                                       var left = keyCode == VK.LEFT;\r
+                                       // If a block element find previous or next element to position the caret\r
+                                       if (ed.dom.isBlock(nonEditableParent)) {\r
+                                               var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;\r
+                                               var walker = new TreeWalker(targetElement, targetElement);\r
+                                               var caretElement = left ? walker.prev() : walker.next();\r
+                                               positionCaretOnElement(caretElement, !left);\r
+                                       } else {\r
+                                               positionCaretOnElement(nonEditableParent, left);\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               // Is arrow left/right, backspace or delete\r
+                               if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {\r
+                                       caretContainer = getParentCaretContainer(startElement);\r
+                                       if (caretContainer) {\r
+                                               // Arrow left or backspace\r
+                                               if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {\r
+                                                       nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);\r
+\r
+                                                       if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {\r
+                                                               e.preventDefault();\r
+\r
+                                                               if (keyCode == VK.LEFT) {\r
+                                                                       positionCaretOnElement(nonEditableParent, true);\r
+                                                               } else {\r
+                                                                       dom.remove(nonEditableParent);\r
+                                                               }\r
+                                                       } else {\r
+                                                               removeCaretContainer(caretContainer);\r
+                                                       }\r
+                                               }\r
+\r
+                                               // Arrow right or delete\r
+                                               if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {\r
+                                                       nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);\r
+\r
+                                                       if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {\r
+                                                               e.preventDefault();\r
+\r
+                                                               if (keyCode == VK.RIGHT) {\r
+                                                                       positionCaretOnElement(nonEditableParent, false);\r
+                                                               } else {\r
+                                                                       dom.remove(nonEditableParent);\r
+                                                               }\r
+                                                       } else {\r
+                                                               removeCaretContainer(caretContainer);\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+\r
+               ed.onMouseDown.addToTop(function(ed, e){\r
+                       // prevent collapsing selection to caret when clicking in a non-editable section\r
+                       var node = ed.selection.getNode();\r
+                       if (getContentEditable(node) === "false" && node == e.target) {\r
+                               e.preventDefault();\r
+                       }\r
+               });\r
+               ed.onMouseUp.addToTop(moveSelection);\r
+               ed.onKeyDown.addToTop(handleKey);\r
+               ed.onKeyUp.addToTop(moveSelection);\r
+       };\r
 \r
        tinymce.create('tinymce.plugins.NonEditablePlugin', {\r
                init : function(ed, url) {\r
-                       var t = this, editClass, nonEditClass;\r
+                       var editClass, nonEditClass, nonEditableRegExps;\r
+\r
+                       editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";\r
+                       nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";\r
+\r
+                       // Setup noneditable regexps array\r
+                       nonEditableRegExps = ed.getParam("noneditable_regexp");\r
+                       if (nonEditableRegExps && !nonEditableRegExps.length) {\r
+                               nonEditableRegExps = [nonEditableRegExps];\r
+                       }\r
+\r
+                       ed.onPreInit.add(function() {\r
+                               handleContentEditableSelection(ed);\r
+\r
+                               if (nonEditableRegExps) {\r
+                                       ed.onBeforeSetContent.add(function(ed, args) {\r
+                                               var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass);\r
+\r
+                                               // Don't replace the variables when raw is used for example on undo/redo\r
+                                               if (args.format == "raw") {\r
+                                                       return;\r
+                                               }\r
 \r
-                       t.editor = ed;\r
-                       editClass = ed.getParam("noneditable_editable_class", "mceEditable");\r
-                       nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");\r
+                                               while (i--) {\r
+                                                       content = content.replace(nonEditableRegExps[i], function() {\r
+                                                               var args = arguments;\r
 \r
-                       ed.onNodeChange.addToTop(function(ed, cm, n) {\r
-                               var sc, ec;\r
+                                                               return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>';\r
+                                                       });\r
+                                               }\r
 \r
-                               // Block if start or end is inside a non editable element\r
-                               sc = ed.dom.getParent(ed.selection.getStart(), function(n) {\r
-                                       return ed.dom.hasClass(n, nonEditClass);\r
+                                               args.content = content;\r
+                                       });\r
+                               }\r
+                               \r
+                               // Apply contentEditable true/false on elements with the noneditable/editable classes\r
+                               ed.parser.addAttributeFilter('class', function(nodes) {\r
+                                       var i = nodes.length, className, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               className = " " + node.attr("class") + " ";\r
+\r
+                                               if (className.indexOf(editClass) !== -1) {\r
+                                                       node.attr(internalName, "true");\r
+                                               } else if (className.indexOf(nonEditClass) !== -1) {\r
+                                                       node.attr(internalName, "false");\r
+                                               }\r
+                                       }\r
                                });\r
 \r
-                               ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {\r
-                                       return ed.dom.hasClass(n, nonEditClass);\r
+                               // Remove internal name\r
+                               ed.serializer.addAttributeFilter(internalName, function(nodes, name) {\r
+                                       var i = nodes.length, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+\r
+                                               if (nonEditableRegExps && node.attr('data-mce-content')) {\r
+                                                       node.name = "#text";\r
+                                                       node.type = 3;\r
+                                                       node.raw = true;\r
+                                                       node.value = node.attr('data-mce-content');\r
+                                               } else {\r
+                                                       node.attr(externalName, null);\r
+                                                       node.attr(internalName, null);\r
+                                               }\r
+                                       }\r
                                });\r
 \r
-                               // Block or unblock\r
-                               if (sc || ec) {\r
-                                       t._setDisabled(1);\r
-                                       return false;\r
-                               } else\r
-                                       t._setDisabled(0);\r
+                               // Convert external name into internal name\r
+                               ed.parser.addAttributeFilter(externalName, function(nodes, name) {\r
+                                       var i = nodes.length, node;\r
+\r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               node.attr(internalName, node.attr(externalName));\r
+                                               node.attr(externalName, null);\r
+                                       }\r
+                               });\r
                        });\r
                },\r
 \r
                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',\r
                                version : tinymce.majorVersion + "." + tinymce.minorVersion\r
                        };\r
-               },\r
-\r
-               _block : function(ed, e) {\r
-                       var k = e.keyCode;\r
-\r
-                       // Don't block arrow keys, pg up/down, and F1-F12\r
-                       if ((k > 32 && k < 41) || (k > 111 && k < 124))\r
-                               return;\r
-\r
-                       return Event.cancel(e);\r
-               },\r
-\r
-               _setDisabled : function(s) {\r
-                       var t = this, ed = t.editor;\r
-\r
-                       tinymce.each(ed.controlManager.controls, function(c) {\r
-                               c.setDisabled(s);\r
-                       });\r
-\r
-                       if (s !== t.disabled) {\r
-                               if (s) {\r
-                                       ed.onKeyDown.addToTop(t._block);\r
-                                       ed.onKeyPress.addToTop(t._block);\r
-                                       ed.onKeyUp.addToTop(t._block);\r
-                                       ed.onPaste.addToTop(t._block);\r
-                               } else {\r
-                                       ed.onKeyDown.remove(t._block);\r
-                                       ed.onKeyPress.remove(t._block);\r
-                                       ed.onKeyUp.remove(t._block);\r
-                                       ed.onPaste.remove(t._block);\r
-                               }\r
-\r
-                               t.disabled = s;\r
-                       }\r
                }\r
        });\r
 \r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/css/content.css b/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/css/content.css
deleted file mode 100755 (executable)
index c949d58..0000000
+++ /dev/null
@@ -1 +0,0 @@
-.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../img/pagebreak.gif) no-repeat center top;}
old mode 100755 (executable)
new mode 100644 (file)
index a212f69..35085e8
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+d+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+b.theme.url+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 4e1eb0a..a094c19
@@ -11,7 +11,7 @@
 (function() {\r
        tinymce.create('tinymce.plugins.PageBreakPlugin', {\r
                init : function(ed, url) {\r
-                       var pb = '<img src="' + url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;\r
+                       var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;\r
 \r
                        pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');\r
 \r
@@ -24,9 +24,6 @@
                        ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});\r
 \r
                        ed.onInit.add(function() {\r
-                               if (ed.settings.content_css !== false)\r
-                                       ed.dom.loadCSS(url + "/css/content.css");\r
-\r
                                if (ed.theme.onResolveName) {\r
                                        ed.theme.onResolveName.add(function(th, o) {\r
                                                if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif b/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif
deleted file mode 100755 (executable)
index acdf408..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif and /dev/null differ
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/trans.gif b/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/trans.gif
deleted file mode 100755 (executable)
index 3884865..0000000
Binary files a/library/tinymce/jscripts/tiny_mce/plugins/pagebreak/img/trans.gif and /dev/null differ
old mode 100755 (executable)
new mode 100644 (file)
index 3e7b250..e47a5c6
@@ -1 +1 @@
-(function(){var c=tinymce.each,d=null,a={paste_auto_cleanup_on_paste:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(e,f){return e.getParam(f,a[f])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(e,f){var g=this;g.editor=e;g.url=f;g.onPreProcess=new tinymce.util.Dispatcher(g);g.onPostProcess=new tinymce.util.Dispatcher(g);g.onPreProcess.add(g._preProcess);g.onPostProcess.add(g._postProcess);g.onPreProcess.add(function(j,k){e.execCallback("paste_preprocess",j,k)});g.onPostProcess.add(function(j,k){e.execCallback("paste_postprocess",j,k)});e.pasteAsPlainText=false;function i(l,j){var k=e.dom;g.onPreProcess.dispatch(g,l);l.node=k.create("div",0,l.content);g.onPostProcess.dispatch(g,l);l.content=e.serializer.serialize(l.node,{getInner:1});if((!j)&&(e.pasteAsPlainText)){g._insertPlainText(e,k,l.content);if(!b(e,"paste_text_sticky")){e.pasteAsPlainText=false;e.controlManager.setActive("pastetext",false)}}else{if(/<(p|h[1-6]|ul|ol)/.test(l.content)){g._insertBlockContent(e,k,l.content)}else{g._insert(l.content)}}}e.addCommand("mceInsertClipboardContent",function(j,k){i(k,true)});if(!b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(k,j){var l=tinymce.util.Cookie;e.pasteAsPlainText=!e.pasteAsPlainText;e.controlManager.setActive("pastetext",e.pasteAsPlainText);if((e.pasteAsPlainText)&&(!l.get("tinymcePasteText"))){if(b(e,"paste_text_sticky")){e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}else{e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}if(!b(e,"paste_text_notifyalways")){l.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}e.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});e.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function h(s){var m,q,k,l=e.selection,p=e.dom,r=e.getBody(),j;if(e.pasteAsPlainText&&(s.clipboardData||p.doc.dataTransfer)){s.preventDefault();i({content:(s.clipboardData||p.doc.dataTransfer).getData("Text")},true);return}if(p.get("_mcePaste")){return}m=p.add(r,"div",{id:"_mcePaste","class":"mcePaste"},"\uFEFF");if(r!=e.getDoc().body){j=p.getPos(e.selection.getStart(),r).y}else{j=r.scrollTop}p.setStyles(m,{position:"absolute",left:-10000,top:j,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){k=p.doc.body.createTextRange();k.moveToElementText(m);k.execCommand("Paste");p.remove(m);if(m.innerHTML==="\uFEFF"){e.execCommand("mcePasteWord");s.preventDefault();return}i({content:m.innerHTML});return tinymce.dom.Event.cancel(s)}else{function o(n){n.preventDefault()}p.bind(e.getDoc(),"mousedown",o);p.bind(e.getDoc(),"keydown",o);q=e.selection.getRng();m=m.firstChild;k=e.getDoc().createRange();k.setStart(m,0);k.setEnd(m,1);l.setRng(k);window.setTimeout(function(){var t="",n=p.select("div.mcePaste");c(n,function(u){c(p.select("div.mcePaste",u),function(v){p.remove(v,1)});c(p.select("span.Apple-style-span",u),function(v){p.remove(v,1)});t+=u.innerHTML});c(n,function(u){p.remove(u)});if(q){l.setRng(q)}i({content:t});p.unbind(e.getDoc(),"mousedown",o);p.unbind(e.getDoc(),"keydown",o)},0)}}if(b(e,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){e.onKeyDown.add(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){h(k)}})}else{e.onPaste.addToTop(function(j,k){return h(k)})}}if(b(e,"paste_block_drop")){e.onInit.add(function(){e.dom.bind(e.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(j){j.preventDefault();j.stopPropagation();return false})})}g._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(i,f){var l=this.editor,k=f.content,q=tinymce.grep,p=tinymce.explode,g=tinymce.trim,m,j;function e(h){c(h,function(o){if(o.constructor==RegExp){k=k.replace(o,"")}else{k=k.replace(o[0],o[1])}})}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(k)||f.wordContent){f.wordContent=true;e([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(l,"paste_convert_headers_to_strong")){k=k.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(l,"paste_convert_middot_lists")){e([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"]])}e([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{m=k.length;k=k.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(m!=k.length);if(b(l,"paste_retain_style_properties").replace(/^none$/i,"").length==0){k=k.replace(/<\/?span[^>]*>/gi,"")}else{e([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(u,h,t){var v=[],o=0,r=p(g(t).replace(/&quot;/gi,"'"),";");c(r,function(s){var w,y,z=p(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":v[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":v[o++]="text-align:"+y;return;case"vert-align":v[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":v[o++]="color:"+y;return;case"mso-background":case"mso-highlight":v[o++]="background:"+y;return;case"mso-default-height":v[o++]="min-height:"+x(y);return;case"mso-default-width":v[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":v[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){v[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){v[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}v[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+v.join(";")+'"'}else{return h}}]])}}if(b(l,"paste_convert_headers_to_strong")){e([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}j=b(l,"paste_strip_class_attributes");if(j!=="none"){function n(r,o){if(j==="all"){return""}var h=q(p(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(s){return(/^(?!mso)/i.test(s))});return h.length?' class="'+h.join(" ")+'"':""}k=k.replace(/ class="([^"]+)"/gi,n);k=k.replace(/ class=(\w+)/gi,n)}if(b(l,"paste_remove_spans")){k=k.replace(/<\/?span[^>]*>/gi,"")}f.content=k},_postProcess:function(h,j){var g=this,f=g.editor,i=f.dom,e;if(j.wordContent){c(i.select("a",j.node),function(k){if(!k.href||k.href.indexOf("#_Toc")!=-1){i.remove(k,1)}});if(b(f,"paste_convert_middot_lists")){g._convertLists(h,j)}e=b(f,"paste_retain_style_properties");if((tinymce.is(e,"string"))&&(e!=="all")&&(e!=="*")){e=tinymce.explode(e.replace(/^none$/i,""));c(i.select("*",j.node),function(n){var o={},l=0,m,p,k;if(e){for(m=0;m<e.length;m++){p=e[m];k=i.getStyle(n,p);if(k){o[p]=k;l++}}}i.setAttrib(n,"style","");if(e&&l>0){i.setStyles(n,o)}else{if(n.nodeName=="SPAN"&&!n.className){i.remove(n,true)}}})}}if(b(f,"paste_remove_styles")||(b(f,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(i.select("*[style]",j.node),function(k){k.removeAttribute("style");k.removeAttribute("_mce_style")})}else{if(tinymce.isWebKit){c(i.select("*",j.node),function(k){k.removeAttribute("_mce_style")})}}},_convertLists:function(h,f){var j=h.editor.dom,i,m,e=-1,g,n=[],l,k;c(j.select("p",f.node),function(u){var r,v="",t,s,o,q;for(r=u.firstChild;r&&r.nodeType==3;r=r.nextSibling){v+=r.nodeValue}v=u.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(v)){t="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(v)){t="ol"}if(t){g=parseFloat(u.style.marginLeft||0);if(g>e){n.push(g)}if(!i||t!=l){i=j.create(t);j.insertAfter(i,u)}else{if(g>e){i=m.appendChild(j.create(t))}else{if(g<e){o=tinymce.inArray(n,g);q=j.getParents(i.parentNode,t);i=q[q.length-1-o]||i}}}c(j.select("span",u),function(w){var p=w.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(t=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){j.remove(w)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){j.remove(w)}}});s=u.innerHTML;if(t=="ul"){s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}m=i.appendChild(j.create("li",0,s));j.remove(u);e=g;l=t}else{i=e=0}});k=f.node.innerHTML;if(k.indexOf("__MCE_ITEM__")!=-1){f.node.innerHTML=k.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(l,h,m){var f,j,g=l.selection,q,n,e,o,i,k="mce_marker";function p(t){var s;if(tinymce.isIE){s=l.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(false);s.select()}else{g.select(t,1);g.collapse(false)}}this._insert('<span id="'+k+'">&nbsp;</span>',1);j=h.get(k);f=h.getParent(j,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(f&&!/TD|TH/.test(f.nodeName)){j=h.split(f,j);c(h.create("div",0,m).childNodes,function(r){q=j.parentNode.insertBefore(r.cloneNode(true),j)});p(q)}else{h.setOuterHTML(j,m);g.select(l.getBody(),1);g.collapse(0)}while(n=h.get(k)){h.remove(n)}n=g.getStart();e=h.getViewPort(l.getWin());o=l.dom.getPos(n).y;i=n.clientHeight;if(o<e.y||o+i>e.y+e.h){l.getDoc().body.scrollTop=o<e.y?o:o-e.h+25}},_insert:function(g,e){var f=this.editor,i=f.selection.getRng();if(!f.selection.isCollapsed()&&i.startContainer!=i.endContainer){f.getDoc().execCommand("Delete",false,null)}f.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,g,{skip_undo:e})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(h){c(h,function(i){if(i.constructor==RegExp){v=v.replace(i,"")}else{v=v.replace(i[0],i[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(!d){d=("34,quot,38,amp,39,apos,60,lt,62,gt,"+j.serializer.settings.entities).split(",")}if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/&(#\d+|[a-z0-9]{1,10});/gi,function(i,h){if(h.charAt(0)==="#"){return String.fromCharCode(h.slice(1))}else{return((i=y(d,h))>0)?String.fromCharCode(d[i-1]):" "}}],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.encode(v);if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker">&nbsp;</span>');window.setTimeout(function(){var h=x.get("_plain_text_marker"),B,i,A,w;s.select(h,false);z.execCommand("Delete",false,null);h=null;B=s.getStart();i=x.getViewPort(n);A=x.getPos(B).y;w=B.clientHeight;if((A<i.y)||(A+w>i.y+i.h)){z.body.scrollTop=A<i.y?A:A-i.h+25}},0)}},_legacySupport:function(){var f=this,e=f.editor;e.addCommand("mcePasteWord",function(){e.windowManager.open({file:f.url+"/pasteword.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})});if(b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(){e.windowManager.open({file:f.url+"/pastetext.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})})}e.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file
+(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"combined",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(l,j){var k=d.dom,i;f.onPreProcess.dispatch(f,l);l.node=k.create("div",0,l.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){if(l.node.childNodes.length===1&&/^(p|h[1-6]|pre)$/i.test(l.node.firstChild.nodeName)&&l.content.indexOf("__MCE_ITEM__")===-1){k.remove(l.node.firstChild,true)}}}f.onPostProcess.dispatch(f,l);l.content=d.serializer.serialize(l.node,{getInner:1,forced_root_block:""});if((!j)&&(d.pasteAsPlainText)){f._insertPlainText(l.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(l.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:o.encode(r).replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort(d.getWin()).y}o.setStyles(l,{position:"absolute",left:tinymce.isGecko?-40:0,top:i-25,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<p>"+o.encode(r).replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br />")+"</p>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){d([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g,"$1"]]);d([[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/&quot;/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(g){var d=this.editor,e=b(d,"paste_text_linebreaktype"),i=b(d,"paste_text_replacements"),f=tinymce.is;function h(j){c(j,function(k){if(k.constructor==RegExp){g=g.replace(k,"")}else{g=g.replace(k[0],k[1])}})}if((typeof(g)==="string")&&(g.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(g)){h([/[\n\r]+/g])}else{h([/\r+/g])}h([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"]]);g=d.dom.decode(tinymce.html.Entities.encodeRaw(g));if(f(i,"array")){h(i)}else{if(f(i,"string")){h(new RegExp(i,"gi"))}}if(e=="none"){h([[/\n+/g," "]])}else{if(e=="br"){h([[/\n/g,"<br />"]])}else{if(e=="p"){h([[/\n+/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"]])}else{h([[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]])}}}d.execCommand("mceInsertContent",false,g)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 4c3bf65..73fe7fe
@@ -10,9 +10,9 @@
 \r
 (function() {\r
        var each = tinymce.each,\r
-               entities = null,\r
                defs = {\r
                        paste_auto_cleanup_on_paste : true,\r
+                       paste_enable_default_filters : true,\r
                        paste_block_drop : false,\r
                        paste_retain_style_properties : "none",\r
                        paste_strip_class_attributes : "mso",\r
@@ -25,8 +25,9 @@
                        paste_dialog_height : "400",\r
                        paste_text_use_dialog : false,\r
                        paste_text_sticky : false,\r
+                       paste_text_sticky_default : false,\r
                        paste_text_notifyalways : false,\r
-                       paste_text_linebreaktype : "p",\r
+                       paste_text_linebreaktype : "combined",\r
                        paste_text_replacements : [\r
                                [/\u2026/g, "..."],\r
                                [/[\x93\x94\u201c\u201d]/g, '"'],\r
                                ed.execCallback('paste_postprocess', pl, o);\r
                        });\r
 \r
+                       ed.onKeyDown.addToTop(function(ed, e) {\r
+                               // Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that\r
+                               if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))\r
+                                       return false; // Stop other listeners\r
+                       });\r
+\r
                        // Initialize plain text flag\r
-                       ed.pasteAsPlainText = false;\r
+                       ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');\r
 \r
                        // This function executes the process handlers and inserts the contents\r
                        // force_rich overrides plain text mode set by user, important for pasting with execCommand\r
                        function process(o, force_rich) {\r
-                               var dom = ed.dom;\r
+                               var dom = ed.dom, rng;\r
 \r
                                // Execute pre process handlers\r
                                t.onPreProcess.dispatch(t, o);\r
                                // Create DOM structure\r
                                o.node = dom.create('div', 0, o.content);\r
 \r
+                               // If pasting inside the same element and the contents is only one block\r
+                               // remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element\r
+                               if (tinymce.isGecko) {\r
+                                       rng = ed.selection.getRng(true);\r
+                                       if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {\r
+                                               // Is only one block node and it doesn't contain word stuff\r
+                                               if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)\r
+                                                       dom.remove(o.node.firstChild, true);\r
+                                       }\r
+                               }\r
+\r
                                // Execute post process handlers\r
                                t.onPostProcess.dispatch(t, o);\r
 \r
                                // Serialize content\r
-                               o.content = ed.serializer.serialize(o.node, {getInner : 1});\r
+                               o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});\r
 \r
                                // Plain text option active?\r
                                if ((!force_rich) && (ed.pasteAsPlainText)) {\r
-                                       t._insertPlainText(ed, dom, o.content);\r
+                                       t._insertPlainText(o.content);\r
 \r
                                        if (!getParam(ed, "paste_text_sticky")) {\r
                                                ed.pasteAsPlainText = false;\r
                                                ed.controlManager.setActive("pastetext", false);\r
                                        }\r
-                               } else if (/<(p|h[1-6]|ul|ol)/.test(o.content)) {\r
-                                       // Handle insertion of contents containing block elements separately\r
-                                       t._insertBlockContent(ed, dom, o.content);\r
                                } else {\r
                                        t._insert(o.content);\r
                                }\r
                                                if (getParam(ed, "paste_text_sticky")) {\r
                                                        ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));\r
                                                } else {\r
-                                                       ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));\r
+                                                       ed.windowManager.alert(ed.translate('paste.plaintext_mode'));\r
                                                }\r
 \r
                                                if (!getParam(ed, "paste_text_notifyalways")) {\r
                        // hidden div and placing the caret inside it and after the browser paste\r
                        // is done it grabs that contents and processes that\r
                        function grabContent(e) {\r
-                               var n, or, rng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY;\r
+                               var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;\r
 \r
                                // Check if browser supports direct plaintext access\r
-                               if (ed.pasteAsPlainText && (e.clipboardData || dom.doc.dataTransfer)) {\r
-                                       e.preventDefault();\r
-                                       process({content : (e.clipboardData || dom.doc.dataTransfer).getData('Text')}, true);\r
-                                       return;\r
+                               if (e.clipboardData || dom.doc.dataTransfer) {\r
+                                       textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');\r
+\r
+                                       if (ed.pasteAsPlainText) {\r
+                                               e.preventDefault();\r
+                                               process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});\r
+                                               return;\r
+                                       }\r
                                }\r
 \r
                                if (dom.get('_mcePaste'))\r
                                        return;\r
 \r
                                // Create container to paste into\r
-                               n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF');\r
+                               n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');\r
 \r
                                // If contentEditable mode we need to find out the position of the closest element\r
                                if (body != ed.getDoc().body)\r
                                        posY = dom.getPos(ed.selection.getStart(), body).y;\r
                                else\r
-                                       posY = body.scrollTop;\r
+                                       posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;\r
 \r
                                // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles\r
+                               // If also needs to be in view on IE or the paste would fail\r
                                dom.setStyles(n, {\r
                                        position : 'absolute',\r
-                                       left : -10000,\r
-                                       top : posY,\r
+                                       left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div\r
+                                       top : posY - 25,\r
                                        width : 1,\r
                                        height : 1,\r
                                        overflow : 'hidden'\r
                                });\r
 \r
                                if (tinymce.isIE) {\r
+                                       // Store away the old range\r
+                                       oldRng = sel.getRng();\r
+\r
                                        // Select the container\r
                                        rng = dom.doc.body.createTextRange();\r
                                        rng.moveToElementText(n);\r
 \r
                                        // Check if the contents was changed, if it wasn't then clipboard extraction failed probably due\r
                                        // to IE security settings so we pass the junk though better than nothing right\r
-                                       if (n.innerHTML === '\uFEFF') {\r
+                                       if (n.innerHTML === '\uFEFF\uFEFF') {\r
                                                ed.execCommand('mcePasteWord');\r
                                                e.preventDefault();\r
                                                return;\r
                                        }\r
 \r
-                                       // Process contents\r
-                                       process({content : n.innerHTML});\r
+                                       // Restore the old range and clear the contents before pasting\r
+                                       sel.setRng(oldRng);\r
+                                       sel.setContent('');\r
+\r
+                                       // For some odd reason we need to detach the the mceInsertContent call from the paste event\r
+                                       // It's like IE has a reference to the parent element that you paste in and the selection gets messed up\r
+                                       // when it tries to restore the selection\r
+                                       setTimeout(function() {\r
+                                               // Process contents\r
+                                               process({content : n.innerHTML});\r
+                                       }, 0);\r
 \r
                                        // Block the real paste event\r
                                        return tinymce.dom.Event.cancel(e);\r
 \r
                                        or = ed.selection.getRng();\r
 \r
-                                       // Move caret into hidden div\r
+                                       // Move select contents inside DIV\r
                                        n = n.firstChild;\r
                                        rng = ed.getDoc().createRange();\r
                                        rng.setStart(n, 0);\r
-                                       rng.setEnd(n, 1);\r
+                                       rng.setEnd(n, 2);\r
                                        sel.setRng(rng);\r
 \r
                                        // Wait a while and grab the pasted contents\r
                                        window.setTimeout(function() {\r
-                                               var h = '', nl = dom.select('div.mcePaste');\r
+                                               var h = '', nl;\r
 \r
-                                               // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string\r
-                                               each(nl, function(n) {\r
-                                                       // WebKit duplicates the divs so we need to remove them\r
-                                                       each(dom.select('div.mcePaste', n), function(n) {\r
-                                                               dom.remove(n, 1);\r
-                                                       });\r
+                                               // Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit\r
+                                               if (!dom.select('div.mcePaste > div.mcePaste').length) {\r
+                                                       nl = dom.select('div.mcePaste');\r
 \r
-                                                       // Remove apply style spans\r
-                                                       each(dom.select('span.Apple-style-span', n), function(n) {\r
-                                                               dom.remove(n, 1);\r
-                                                       });\r
+                                                       // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string\r
+                                                       each(nl, function(n) {\r
+                                                               var child = n.firstChild;\r
 \r
-                                                       h += n.innerHTML;\r
-                                               });\r
+                                                               // WebKit inserts a DIV container with lots of odd styles\r
+                                                               if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {\r
+                                                                       dom.remove(child, 1);\r
+                                                               }\r
+\r
+                                                               // Remove apply style spans\r
+                                                               each(dom.select('span.Apple-style-span', n), function(n) {\r
+                                                                       dom.remove(n, 1);\r
+                                                               });\r
+\r
+                                                               // Remove bogus br elements\r
+                                                               each(dom.select('br[data-mce-bogus]', n), function(n) {\r
+                                                                       dom.remove(n);\r
+                                                               });\r
+\r
+                                                               // WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV\r
+                                                               if (n.parentNode.className != 'mcePaste')\r
+                                                                       h += n.innerHTML;\r
+                                                       });\r
+                                               } else {\r
+                                                       // Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc\r
+                                                       // So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same\r
+                                                       h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';\r
+                                               }\r
 \r
                                                // Remove the nodes\r
-                                               each(nl, function(n) {\r
+                                               each(dom.select('div.mcePaste'), function(n) {\r
                                                        dom.remove(n);\r
                                                });\r
 \r
                        if (getParam(ed, "paste_auto_cleanup_on_paste")) {\r
                                // Is it's Opera or older FF use key handler\r
                                if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {\r
-                                       ed.onKeyDown.add(function(ed, e) {\r
+                                       ed.onKeyDown.addToTop(function(ed, e) {\r
                                                if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))\r
                                                        grabContent(e);\r
                                        });\r
                                }\r
                        }\r
 \r
-                       // Block all drag/drop events\r
-                       if (getParam(ed, "paste_block_drop")) {\r
-                               ed.onInit.add(function() {\r
+                       ed.onInit.add(function() {\r
+                               ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);\r
+\r
+                               // Block all drag/drop events\r
+                               if (getParam(ed, "paste_block_drop")) {\r
                                        ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {\r
                                                e.preventDefault();\r
                                                e.stopPropagation();\r
 \r
                                                return false;\r
                                        });\r
-                               });\r
-                       }\r
+                               }\r
+                       });\r
 \r
                        // Add legacy support\r
                        t._legacySupport();\r
                },\r
 \r
                _preProcess : function(pl, o) {\r
-                       //console.log('Before preprocess:' + o.content);\r
-\r
                        var ed = this.editor,\r
                                h = o.content,\r
                                grep = tinymce.grep,\r
                                trim = tinymce.trim,\r
                                len, stripClass;\r
 \r
+                       //console.log('Before preprocess:' + o.content);\r
+\r
                        function process(items) {\r
                                each(items, function(v) {\r
                                        // Remove or replace\r
                                                h = h.replace(v[0], v[1]);\r
                                });\r
                        }\r
+                       \r
+                       if (ed.settings.paste_enable_default_filters == false) {\r
+                               return;\r
+                       }\r
+\r
+                       // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser\r
+                       if (tinymce.isIE && document.documentMode >= 9) {\r
+                               // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser\r
+                               process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);\r
+\r
+                               // IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break\r
+                               process([\r
+                                       [/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact\r
+                                       [/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s\r
+                                       [/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR\r
+                               ]);\r
+                       }\r
 \r
                        // Detect Word content and process it more aggressive\r
                        if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {\r
                                if (getParam(ed, "paste_convert_middot_lists")) {\r
                                        process([\r
                                                [/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'],                                    // Convert supportLists to a list item marker\r
-                                               [/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__']              // Convert mso-list and symbol spans to item markers\r
+                                               [/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'],             // Convert mso-list and symbol spans to item markers\r
+                                               [/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__']                             // Convert mso-list and symbol paragraphs to item markers (FF)\r
                                        ]);\r
                                }\r
 \r
                                ]);\r
                        }\r
 \r
+                       process([\r
+                               // Copy paste from Java like Open Office will produce this junk on FF\r
+                               [/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']\r
+                       ]);\r
+\r
                        // Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").\r
                        // Note:-  paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.\r
                        stripClass = getParam(ed, "paste_strip_class_attributes");\r
                                };\r
 \r
                                h = h.replace(/ class="([^"]+)"/gi, removeClasses);\r
-                               h = h.replace(/ class=(\w+)/gi, removeClasses);\r
+                               h = h.replace(/ class=([\-\w]+)/gi, removeClasses);\r
                        }\r
 \r
                        // Remove spans option\r
                _postProcess : function(pl, o) {\r
                        var t = this, ed = t.editor, dom = ed.dom, styleProps;\r
 \r
+                       if (ed.settings.paste_enable_default_filters == false) {\r
+                               return;\r
+                       }\r
+                       \r
                        if (o.wordContent) {\r
                                // Remove named anchors or TOC links\r
                                each(dom.select('a', o.node), function(a) {\r
                        if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {\r
                                each(dom.select('*[style]', o.node), function(el) {\r
                                        el.removeAttribute('style');\r
-                                       el.removeAttribute('_mce_style');\r
+                                       el.removeAttribute('data-mce-style');\r
                                });\r
                        } else {\r
                                if (tinymce.isWebKit) {\r
                                        // We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />\r
                                        // Removing the mce_style that contains the real value will force the Serializer engine to compress the styles\r
                                        each(dom.select('*', o.node), function(el) {\r
-                                               el.removeAttribute('_mce_style');\r
+                                               el.removeAttribute('data-mce-style');\r
                                        });\r
                                }\r
                        }\r
                                val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');\r
 \r
                                // Detect unordered lists look for bullets\r
-                               if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(val))\r
+                               if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))\r
                                        type = 'ul';\r
 \r
                                // Detect ordered lists 1., a. or ixv.\r
-                               if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(val))\r
+                               if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))\r
                                        type = 'ol';\r
 \r
                                // Check if node value matches the list pattern: o&nbsp;&nbsp;\r
                                                var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');\r
 \r
                                                // Remove span with the middot or the number\r
-                                               if (type == 'ul' && /^[\u2022\u00b7\u00a7\u00d8o]/.test(html))\r
+                                               if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))\r
                                                        dom.remove(span);\r
-                                               else if (/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))\r
+                                               else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))\r
                                                        dom.remove(span);\r
                                        });\r
 \r
 \r
                                        // Remove middot/list items\r
                                        if (type == 'ul')\r
-                                               html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/, '');\r
+                                               html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');\r
                                        else\r
                                                html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');\r
 \r
                                o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');\r
                },\r
 \r
-               /**\r
-                * This method will split the current block parent and insert the contents inside the split position.\r
-                * This logic can be improved so text nodes at the start/end remain in the start/end block elements\r
-                */\r
-               _insertBlockContent : function(ed, dom, content) {\r
-                       var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';\r
-\r
-                       function select(n) {\r
-                               var r;\r
-\r
-                               if (tinymce.isIE) {\r
-                                       r = ed.getDoc().body.createTextRange();\r
-                                       r.moveToElementText(n);\r
-                                       r.collapse(false);\r
-                                       r.select();\r
-                               } else {\r
-                                       sel.select(n, 1);\r
-                                       sel.collapse(false);\r
-                               }\r
-                       }\r
-\r
-                       // Insert a marker for the caret position\r
-                       this._insert('<span id="' + markerId + '">&nbsp;</span>', 1);\r
-                       marker = dom.get(markerId);\r
-                       parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');\r
-\r
-                       // If it's a parent block but not a table cell\r
-                       if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {\r
-                               // Split parent block\r
-                               marker = dom.split(parentBlock, marker);\r
-\r
-                               // Insert nodes before the marker\r
-                               each(dom.create('div', 0, content).childNodes, function(n) {\r
-                                       last = marker.parentNode.insertBefore(n.cloneNode(true), marker);\r
-                               });\r
-\r
-                               // Move caret after marker\r
-                               select(last);\r
-                       } else {\r
-                               dom.setOuterHTML(marker, content);\r
-                               sel.select(ed.getBody(), 1);\r
-                               sel.collapse(0);\r
-                       }\r
-\r
-                       // Remove marker if it's left\r
-                       while (elm = dom.get(markerId))\r
-                               dom.remove(elm);\r
-\r
-                       // Get element, position and height\r
-                       elm = sel.getStart();\r
-                       vp = dom.getViewPort(ed.getWin());\r
-                       y = ed.dom.getPos(elm).y;\r
-                       elmHeight = elm.clientHeight;\r
-\r
-                       // Is element within viewport if not then scroll it into view\r
-                       if (y < vp.y || y + elmHeight > vp.y + vp.h)\r
-                               ed.getDoc().body.scrollTop = y < vp.y ? y : y - vp.h + 25;\r
-               },\r
-\r
                /**\r
                 * Inserts the specified contents at the caret position.\r
                 */\r
                        if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)\r
                                ed.getDoc().execCommand('Delete', false, null);\r
 \r
-                       // It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents\r
-                       ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo});\r
+                       ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});\r
                },\r
 \r
                /**\r
                 * plugin, and requires minimal changes to add the new functionality.\r
                 * Speednet - June 2009\r
                 */\r
-               _insertPlainText : function(ed, dom, h) {\r
-                       var i, len, pos, rpos, node, breakElms, before, after,\r
-                               w = ed.getWin(),\r
-                               d = ed.getDoc(),\r
-                               sel = ed.selection,\r
-                               is = tinymce.is,\r
-                               inArray = tinymce.inArray,\r
+               _insertPlainText : function(content) {\r
+                       var ed = this.editor,\r
                                linebr = getParam(ed, "paste_text_linebreaktype"),\r
-                               rl = getParam(ed, "paste_text_replacements");\r
+                               rl = getParam(ed, "paste_text_replacements"),\r
+                               is = tinymce.is;\r
 \r
                        function process(items) {\r
                                each(items, function(v) {\r
                                        if (v.constructor == RegExp)\r
-                                               h = h.replace(v, "");\r
+                                               content = content.replace(v, "");\r
                                        else\r
-                                               h = h.replace(v[0], v[1]);\r
+                                               content = content.replace(v[0], v[1]);\r
                                });\r
                        };\r
 \r
-                       if ((typeof(h) === "string") && (h.length > 0)) {\r
-                               if (!entities)\r
-                                       entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");\r
-\r
+                       if ((typeof(content) === "string") && (content.length > 0)) {\r
                                // If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line\r
-                               if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {\r
+                               if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {\r
                                        process([\r
                                                /[\n\r]+/g\r
                                        ]);\r
                                        [/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],           // Table cells get tabs betweem them\r
                                        /<[a-z!\/?][^>]*>/gi,                                           // Delete all remaining tags\r
                                        [/&nbsp;/gi, " "],                                                      // Convert non-break spaces to regular spaces (remember, *plain text*)\r
-                                       [\r
-                                               // HTML entity\r
-                                               /&(#\d+|[a-z0-9]{1,10});/gi,\r
-\r
-                                               // Replace with actual character\r
-                                               function(e, s) {\r
-                                                       if (s.charAt(0) === "#") {\r
-                                                               return String.fromCharCode(s.slice(1));\r
-                                                       }\r
-                                                       else {\r
-                                                               return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";\r
-                                                       }\r
-                                               }\r
-                                       ],\r
-                                       [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],    // Cool little RegExp deletes whitespace around linebreak chars.\r
-                                       [/\n{3,}/g, "\n\n"],                                                    // Max. 2 consecutive linebreaks\r
-                                       /^\s+|\s+$/g                                                                    // Trim the front & back\r
+                                       [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],// Cool little RegExp deletes whitespace around linebreak chars.\r
+                                       [/\n{3,}/g, "\n\n"]                                                     // Max. 2 consecutive linebreaks\r
                                ]);\r
 \r
-                               h = dom.encode(h);\r
-\r
-                               // Delete any highlighted text before pasting\r
-                               if (!sel.isCollapsed()) {\r
-                                       d.execCommand("Delete", false, null);\r
-                               }\r
+                               content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));\r
 \r
                                // Perform default or custom replacements\r
-                               if (is(rl, "array") || (is(rl, "array"))) {\r
+                               if (is(rl, "array")) {\r
                                        process(rl);\r
-                               }\r
-                               else if (is(rl, "string")) {\r
+                               } else if (is(rl, "string")) {\r
                                        process(new RegExp(rl, "gi"));\r
                                }\r
 \r
                                // Treat paragraphs as specified in the config\r
                                if (linebr == "none") {\r
+                                       // Convert all line breaks to space\r
                                        process([\r
                                                [/\n+/g, " "]\r
                                        ]);\r
-                               }\r
-                               else if (linebr == "br") {\r
+                               } else if (linebr == "br") {\r
+                                       // Convert all line breaks to <br />\r
                                        process([\r
                                                [/\n/g, "<br />"]\r
                                        ]);\r
-                               }\r
-                               else {\r
+                               } else if (linebr == "p") {\r
+                                       // Convert all line breaks to <p>...</p>\r
+                                       process([\r
+                                               [/\n+/g, "</p><p>"],\r
+                                               [/^(.*<\/p>)(<p>)$/, '<p>$1']\r
+                                       ]);\r
+                               } else {\r
+                                       // defaults to "combined"\r
+                                       // Convert single line breaks to <br /> and double line breaks to <p>...</p>\r
                                        process([\r
-                                               /^\s+|\s+$/g,\r
                                                [/\n\n/g, "</p><p>"],\r
+                                               [/^(.*<\/p>)(<p>)$/, '<p>$1'],\r
                                                [/\n/g, "<br />"]\r
                                        ]);\r
                                }\r
 \r
-                               // This next piece of code handles the situation where we're pasting more than one paragraph of plain\r
-                               // text, and we are pasting the content into the middle of a block node in the editor.  The block\r
-                               // node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).\r
-                               // The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the\r
-                               // pasted text is prepended to "Para B".  Any other paragraphs of pasted text are placed between\r
-                               // "Para A" and "Para B".  This code solves a host of problems with the original plain text plugin and\r
-                               // now handles styles correctly.  (Pasting plain text into a styled paragraph is supposed to make the\r
-                               // plain text take the same style as the existing paragraph.)\r
-                               if ((pos = h.indexOf("</p><p>")) != -1) {\r
-                                       rpos = h.lastIndexOf("</p><p>");\r
-                                       node = sel.getNode(); \r
-                                       breakElms = [];         // Get list of elements to break \r
-\r
-                                       do {\r
-                                               if (node.nodeType == 1) {\r
-                                                       // Don't break tables and break at body\r
-                                                       if (node.nodeName == "TD" || node.nodeName == "BODY") {\r
-                                                               break;\r
-                                                       }\r
-\r
-                                                       breakElms[breakElms.length] = node;\r
-                                               }\r
-                                       } while (node = node.parentNode);\r
-\r
-                                       // Are we in the middle of a block node?\r
-                                       if (breakElms.length > 0) {\r
-                                               before = h.substring(0, pos);\r
-                                               after = "";\r
-\r
-                                               for (i=0, len=breakElms.length; i<len; i++) {\r
-                                                       before += "</" + breakElms[i].nodeName.toLowerCase() + ">";\r
-                                                       after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";\r
-                                               }\r
-\r
-                                               if (pos == rpos) {\r
-                                                       h = before + after + h.substring(pos+7);\r
-                                               }\r
-                                               else {\r
-                                                       h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // Insert content at the caret, plus add a marker for repositioning the caret\r
-                               ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker">&nbsp;</span>');\r
-\r
-                               // Reposition the caret to the marker, which was placed immediately after the inserted content.\r
-                               // Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.\r
-                               // The second part of the code scrolls the content up if the caret is positioned off-screen.\r
-                               // This is only necessary for WebKit browsers, but it doesn't hurt to use for all.\r
-                               window.setTimeout(function() {\r
-                                       var marker = dom.get('_plain_text_marker'),\r
-                                               elm, vp, y, elmHeight;\r
-\r
-                                       sel.select(marker, false);\r
-                                       d.execCommand("Delete", false, null);\r
-                                       marker = null;\r
-\r
-                                       // Get element, position and height\r
-                                       elm = sel.getStart();\r
-                                       vp = dom.getViewPort(w);\r
-                                       y = dom.getPos(elm).y;\r
-                                       elmHeight = elm.clientHeight;\r
-\r
-                                       // Is element within viewport if not then scroll it into view\r
-                                       if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {\r
-                                               d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;\r
-                                       }\r
-                               }, 0);\r
+                               ed.execCommand('mceInsertContent', false, content);\r
                        }\r
                },\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index eeac778..bc74daf
@@ -1,5 +1 @@
-tinyMCE.addI18n('en.paste_dlg',{\r
-text_title:"Use CTRL+V on your keyboard to paste the text into the window.",\r
-text_linebreaks:"Keep linebreaks",\r
-word_title:"Use CTRL+V on your keyboard to paste the text into the window."\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.paste_dlg',{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index cd9c985..165bc12
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:170+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){window.focus();a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:170+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 1433a06..4c87e8f
        tinymce.create('tinymce.plugins.SearchReplacePlugin', {\r
                init : function(ed, url) {\r
                        function open(m) {\r
+                               // Keep IE from writing out the f/r character to the editor\r
+                               // instance while initializing a new dialog. See: #3131190\r
+                               window.focus();\r
+\r
                                ed.windowManager.open({\r
                                        file : url + '/searchreplace.htm',\r
                                        width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),\r
old mode 100755 (executable)
new mode 100644 (file)
index c0a6243..80284b9
@@ -2,14 +2,18 @@ tinyMCEPopup.requireLangPack();
 \r
 var SearchReplaceDialog = {\r
        init : function(ed) {\r
-               var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");\r
+               var t = this, f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");\r
 \r
-               this.switchMode(m);\r
+               t.switchMode(m);\r
 \r
                f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");\r
 \r
                // Focus input field\r
                f[m + '_panel_searchstring'].focus();\r
+               \r
+               mcTabs.onChange.add(function(tab_id, panel_id) {\r
+                       t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));\r
+               });\r
        },\r
 \r
        switchMode : function(m) {\r
@@ -42,21 +46,23 @@ var SearchReplaceDialog = {
                ca = f[m + '_panel_casesensitivebox'].checked;\r
                rs = f['replace_panel_replacestring'].value;\r
 \r
+               if (tinymce.isIE) {\r
+                       r = ed.getDoc().selection.createRange();\r
+               }\r
+\r
                if (s == '')\r
                        return;\r
 \r
                function fix() {\r
                        // Correct Firefox graphics glitches\r
+                       // TODO: Verify if this is actually needed any more, maybe it was for very old FF versions? \r
                        r = se.getRng().cloneRange();\r
                        ed.getDoc().execCommand('SelectAll', false, null);\r
                        se.setRng(r);\r
                };\r
 \r
                function replace() {\r
-                       if (tinymce.isIE)\r
-                               ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE\r
-                       else\r
-                               ed.getDoc().execCommand('InsertHTML', false, rs);\r
+                       ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE\r
                };\r
 \r
                // IE flags\r
@@ -70,6 +76,9 @@ var SearchReplaceDialog = {
                                ed.selection.collapse(true);\r
 \r
                                if (tinymce.isIE) {\r
+                                       ed.focus();\r
+                                       r = ed.getDoc().selection.createRange();\r
+\r
                                        while (r.findText(s, b ? -1 : 1, fl)) {\r
                                                r.scrollIntoView();\r
                                                r.select();\r
@@ -111,6 +120,9 @@ var SearchReplaceDialog = {
                        return;\r
 \r
                if (tinymce.isIE) {\r
+                       ed.focus();\r
+                       r = ed.getDoc().selection.createRange();\r
+\r
                        if (r.findText(s, b ? -1 : 1, fl)) {\r
                                r.scrollIntoView();\r
                                r.select();\r
old mode 100755 (executable)
new mode 100644 (file)
index 370959a..8a65900
@@ -1,16 +1 @@
-tinyMCE.addI18n('en.searchreplace_dlg',{\r
-searchnext_desc:"Find again",\r
-notfound:"The search has been completed. The search string could not be found.",\r
-search_title:"Find",\r
-replace_title:"Find/Replace",\r
-allreplaced:"All occurrences of the search string were replaced.",\r
-findwhat:"Find what",\r
-replacewith:"Replace with",\r
-direction:"Direction",\r
-up:"Up",\r
-down:"Down",\r
-mcase:"Match case",\r
-findnext:"Find next",\r
-replace:"Replace",\r
-replaceall:"Replace all"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.searchreplace_dlg',{findwhat:"Find What",replacewith:"Replace with",direction:"Direction",up:"Up",down:"Down",mcase:"Match Case",findnext:"Find Next",allreplaced:"All occurrences of the search string were replaced.","searchnext_desc":"Find Again",notfound:"The search has been completed. The search string could not be found.","search_title":"Find","replace_title":"Find/Replace",replaceall:"Replace All",replace:"Replace"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d0424cf..5a22d8a
@@ -8,27 +8,28 @@
        <script type="text/javascript" src="js/searchreplace.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/searchreplace.css" />\r
 </head>\r
-<body style="display:none;">\r
+<body style="display:none;" role="application" aria-labelledby="app_title">\r
+<span id="app_title" style="display:none">{#searchreplace_dlg.replace_title}</span>\r
 <form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="search_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>\r
-                       <li id="replace_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li>\r
+                       <li id="search_tab" aria-controls="search_panel"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>\r
+                       <li id="replace_tab" aria-controls="replace_panel"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li>\r
                </ul>\r
        </div>\r
 \r
        <div class="panel_wrapper">\r
                <div id="search_panel" class="panel">\r
-                       <table border="0" cellspacing="0" cellpadding="2">\r
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="2">\r
                                <tr>\r
                                        <td><label for="search_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>\r
-                                       <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" /></td>\r
+                                       <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" aria-required="true" /></td>\r
                                </tr>\r
                                <tr>\r
                                        <td colspan="2">\r
-                                               <table border="0" cellspacing="0" cellpadding="0" class="direction">\r
-                                                       <tr>\r
-                                                               <td><label>{#searchreplace_dlg.direction}</label></td>\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0" class="direction">\r
+                                                       <tr role="group" aria-labelledby="search_panel_backwards_label">\r
+                                                               <td><label id="search_panel_backwards_label">{#searchreplace_dlg.direction}</label></td>\r
                                                                <td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td>\r
                                                                <td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td>\r
                                                                <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td>\r
@@ -39,7 +40,7 @@
                                </tr>\r
                                <tr>\r
                                        <td colspan="2">\r
-                                               <table border="0" cellspacing="0" cellpadding="0">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                        <tr>\r
                                                                <td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>\r
                                                                <td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>\r
                </div>\r
 \r
                <div id="replace_panel" class="panel">\r
-                       <table border="0" cellspacing="0" cellpadding="2">\r
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="2">\r
                                <tr>\r
                                        <td><label for="replace_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>\r
-                                       <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" /></td>\r
+                                       <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" aria-required="true" /></td>\r
                                </tr>\r
                                <tr>\r
                                        <td><label for="replace_panel_replacestring">{#searchreplace_dlg.replacewith}</label></td>\r
-                                       <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" /></td>\r
+                                       <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" aria-required="true" /></td>\r
                                </tr>\r
                                <tr>\r
                                        <td colspan="2">\r
-                                               <table border="0" cellspacing="0" cellpadding="0" class="direction">\r
-                                                       <tr>\r
-                                                               <td><label>{#searchreplace_dlg.direction}</label></td>\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0" class="direction">\r
+                                                       <tr role="group" aria-labelledby="replace_panel_dir_label">\r
+                                                               <td><label id="replace_panel_dir_label">{#searchreplace_dlg.direction}</label></td>\r
                                                                <td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td>\r
                                                                <td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td>\r
                                                                <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td>\r
@@ -75,7 +76,7 @@
                                </tr>\r
                                <tr>\r
                                        <td colspan="2">\r
-                                               <table border="0" cellspacing="0" cellpadding="0">\r
+                                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                        <tr>\r
                                                                <td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>\r
                                                                <td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>\r
old mode 100755 (executable)
new mode 100644 (file)
index a9ec3b9..48549c9
@@ -1 +1 @@
-(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url","{backend}");if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={},h=[];this._walk(e.getBody(),function(i){if(i.nodeType==3){d+=i.nodeValue+" "}});if(e.getParam("spellchecker_word_pattern")){h=d.match("("+e.getParam("spellchecker_word_pattern")+")","gi")}else{d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));h=d.split(" ")}c(h,function(i){if(!f[i]){g.push(i);f[i]=1}});return g},_removeWords:function(e){var f=this.editor,h=f.dom,g=f.selection,d=g.getBookmark();c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!e||h.decode(i.innerHTML)==e){h.remove(i,1)}}});g.moveToBookmark(d)},_markWords:function(o){var i,h,g,f,e,n="",k=this.editor,p=this._getSeparators(),j=k.dom,d=[];var l=k.selection,m=l.getBookmark();c(o,function(q){n+=(n?"|":"")+q});i=new RegExp("(["+p+"])("+n+")(["+p+"])","g");h=new RegExp("^("+n+")","g");g=new RegExp("("+n+")(["+p+"]?)$","g");f=new RegExp("^("+n+")(["+p+"]?)$","g");e=new RegExp("("+n+")(["+p+"])","g");this._walk(this.editor.getBody(),function(q){if(q.nodeType==3){d.push(q)}});c(d,function(r){var q;if(r.nodeType==3){q=r.nodeValue;if(i.test(q)||h.test(q)||g.test(q)||f.test(q)){q=j.encode(q);q=q.replace(e,'<span class="mceItemHiddenSpellWord">$1</span>$2');q=q.replace(g,'<span class="mceItemHiddenSpellWord">$1</span>$2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){l=b.getPos(h.getContentAreaContainer());d=h.controlManager.createDropMenu("spellcheckermenu",{offset_x:l.x,offset_y:l.y,"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})();
\ No newline at end of file
+(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url","{backend}");if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});if(e.settings.content_css!==false){e.contentCSS.push(f+"/css/content.css")}e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){if(n==f.selectedLang){return}l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={},h=[];this._walk(e.getBody(),function(i){if(i.nodeType==3){d+=i.nodeValue+" "}});if(e.getParam("spellchecker_word_pattern")){h=d.match("("+e.getParam("spellchecker_word_pattern")+")","gi")}else{d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));h=d.split(" ")}c(h,function(i){if(!f[i]){g.push(i);f[i]=1}});return g},_removeWords:function(d){var e=this.editor,h=e.dom,g=e.selection,f=g.getRng(true);c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!d||h.decode(i.innerHTML)==d){h.remove(i,1)}}});g.setRng(f)},_markWords:function(l){var h=this.editor,g=h.dom,j=h.getDoc(),i=h.selection,d=i.getRng(true),e=[],k=l.join("|"),m=this._getSeparators(),f=new RegExp("(^|["+m+"])("+k+")(?=["+m+"]|$)","g");this._walk(h.getBody(),function(o){if(o.nodeType==3){e.push(o)}});c(e,function(t){var r,q,o,s,p=t.nodeValue;if(f.test(p)){p=g.encode(p);q=g.create("span",{"class":"mceItemHidden"});if(tinymce.isIE){p=p.replace(f,"$1<mcespell>$2</mcespell>");while((s=p.indexOf("<mcespell>"))!=-1){o=p.substring(0,s);if(o.length){r=j.createTextNode(g.decode(o));q.appendChild(r)}p=p.substring(s+10);s=p.indexOf("</mcespell>");o=p.substring(0,s);p=p.substring(s+11);q.appendChild(g.create("span",{"class":"mceItemHiddenSpellWord"},o))}if(p.length){r=j.createTextNode(g.decode(p));q.appendChild(r)}}else{q.innerHTML=p.replace(f,'$1<span class="mceItemHiddenSpellWord">$2</span>')}g.replace(q,t)}});i.setRng(d)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){d=h.controlManager.createDropMenu("spellcheckermenu",{"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}if(h.getParam("show_ignore_words",true)){e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}})}if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});l=b.getPos(h.getContentAreaContainer());d.settings.offset_x=l.x;d.settings.offset_y=l.y;h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d8680ba..86fdfce
                                        t._done();\r
                        });\r
 \r
-                       ed.onInit.add(function() {\r
-                               if (ed.settings.content_css !== false)\r
-                                       ed.dom.loadCSS(url + '/css/content.css');\r
-                       });\r
+                       if (ed.settings.content_css !== false)\r
+                               ed.contentCSS.push(url + '/css/content.css');\r
 \r
                        ed.onClick.add(t._showMenu, t);\r
                        ed.onContextMenu.add(t._showMenu, t);\r
                                                var o = {icon : 1}, mi;\r
 \r
                                                o.onclick = function() {\r
+                                                       if (v == t.selectedLang) {\r
+                                                               return;\r
+                                                       }\r
                                                        mi.setSelected(1);\r
                                                        t.selectedItem.setSelected(0);\r
                                                        t.selectedItem = mi;\r
                },\r
 \r
                _removeWords : function(w) {\r
-                       var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();\r
+                       var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);\r
 \r
                        each(dom.select('span').reverse(), function(n) {\r
                                if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {\r
                                }\r
                        });\r
 \r
-                       se.moveToBookmark(b);\r
+                       se.setRng(r);\r
                },\r
 \r
                _markWords : function(wl) {\r
-                       var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = [];\r
-                       var se = ed.selection, b = se.getBookmark();\r
-\r
-                       each(wl, function(v) {\r
-                               w += (w ? '|' : '') + v;\r
-                       });\r
-\r
-                       r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');\r
-                       r2 = new RegExp('^(' + w + ')', 'g');\r
-                       r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');\r
-                       r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');\r
-                       r5 = new RegExp('(' + w + ')([' + re + '])', 'g');\r
+                       var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],\r
+                               w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');\r
 \r
                        // Collect all text nodes\r
-                       this._walk(this.editor.getBody(), function(n) {\r
+                       this._walk(ed.getBody(), function(n) {\r
                                if (n.nodeType == 3) {\r
                                        nl.push(n);\r
                                }\r
 \r
                        // Wrap incorrect words in spans\r
                        each(nl, function(n) {\r
-                               var v;\r
-\r
-                               if (n.nodeType == 3) {\r
-                                       v = n.nodeValue;\r
-\r
-                                       if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) {\r
-                                               v = dom.encode(v);\r
-                                               v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');\r
-                                               v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');\r
-\r
-                                               dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);\r
+                               var node, elem, txt, pos, v = n.nodeValue;\r
+\r
+                               if (rx.test(v)) {\r
+                                       // Encode the content\r
+                                       v = dom.encode(v);\r
+                                       // Create container element\r
+                                       elem = dom.create('span', {'class' : 'mceItemHidden'});\r
+\r
+                                       // Following code fixes IE issues by creating text nodes\r
+                                       // using DOM methods instead of innerHTML.\r
+                                       // Bug #3124: <PRE> elements content is broken after spellchecking.\r
+                                       // Bug #1408: Preceding whitespace characters are removed\r
+                                       // @TODO: I'm not sure that both are still issues on IE9.\r
+                                       if (tinymce.isIE) {\r
+                                               // Enclose mispelled words with temporal tag\r
+                                               v = v.replace(rx, '$1<mcespell>$2</mcespell>');\r
+                                               // Loop over the content finding mispelled words\r
+                                               while ((pos = v.indexOf('<mcespell>')) != -1) {\r
+                                                       // Add text node for the content before the word\r
+                                                       txt = v.substring(0, pos);\r
+                                                       if (txt.length) {\r
+                                                               node = doc.createTextNode(dom.decode(txt));\r
+                                                               elem.appendChild(node);\r
+                                                       }\r
+                                                       v = v.substring(pos+10);\r
+                                                       pos = v.indexOf('</mcespell>');\r
+                                                       txt = v.substring(0, pos);\r
+                                                       v = v.substring(pos+11);\r
+                                                       // Add span element for the word\r
+                                                       elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));\r
+                                               }\r
+                                               // Add text node for the rest of the content\r
+                                               if (v.length) {\r
+                                                       node = doc.createTextNode(dom.decode(v));\r
+                                                       elem.appendChild(node);\r
+                                               }\r
+                                       } else {\r
+                                               // Other browsers preserve whitespace characters on innerHTML usage\r
+                                               elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');\r
                                        }\r
+\r
+                                       // Finally, replace the node with the container\r
+                                       dom.replace(elem, n);\r
                                }\r
                        });\r
 \r
-                       se.moveToBookmark(b);\r
+                       se.setRng(r);\r
                },\r
 \r
                _showMenu : function(ed, e) {\r
                        e = 0; // Fixes IE memory leak\r
 \r
                        if (!m) {\r
-                               p1 = DOM.getPos(ed.getContentAreaContainer());\r
-                               //p2 = DOM.getPos(ed.getContainer());\r
-\r
-                               m = ed.controlManager.createDropMenu('spellcheckermenu', {\r
-                                       offset_x : p1.x,\r
-                                       offset_y : p1.y,\r
-                                       'class' : 'mceNoIcons'\r
-                               });\r
-\r
+                               m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});\r
                                t._menu = m;\r
                        }\r
 \r
                                        } else\r
                                                m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
 \r
-                                       ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');\r
-                                       m.add({\r
-                                               title : 'spellchecker.ignore_word',\r
-                                               onclick : function() {\r
-                                                       var word = wordSpan.innerHTML;\r
+                                       if (ed.getParam('show_ignore_words', true)) {\r
+                                               ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');\r
+                                               m.add({\r
+                                                       title : 'spellchecker.ignore_word',\r
+                                                       onclick : function() {\r
+                                                               var word = wordSpan.innerHTML;\r
 \r
-                                                       dom.remove(wordSpan, 1);\r
-                                                       t._checkDone();\r
+                                                               dom.remove(wordSpan, 1);\r
+                                                               t._checkDone();\r
 \r
-                                                       // tell the server if we need to\r
-                                                       if (ignoreRpc) {\r
-                                                               ed.setProgressState(1);\r
-                                                               t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {\r
-                                                                       ed.setProgressState(0);\r
-                                                               });\r
+                                                               // tell the server if we need to\r
+                                                               if (ignoreRpc) {\r
+                                                                       ed.setProgressState(1);\r
+                                                                       t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {\r
+                                                                               ed.setProgressState(0);\r
+                                                                       });\r
+                                                               }\r
                                                        }\r
-                                               }\r
-                                       });\r
+                                               });\r
 \r
-                                       m.add({\r
-                                               title : 'spellchecker.ignore_words',\r
-                                               onclick : function() {\r
-                                                       var word = wordSpan.innerHTML;\r
+                                               m.add({\r
+                                                       title : 'spellchecker.ignore_words',\r
+                                                       onclick : function() {\r
+                                                               var word = wordSpan.innerHTML;\r
 \r
-                                                       t._removeWords(dom.decode(word));\r
-                                                       t._checkDone();\r
+                                                               t._removeWords(dom.decode(word));\r
+                                                               t._checkDone();\r
 \r
-                                                       // tell the server if we need to\r
-                                                       if (ignoreRpc) {\r
-                                                               ed.setProgressState(1);\r
-                                                               t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {\r
-                                                                       ed.setProgressState(0);\r
-                                                               });\r
+                                                               // tell the server if we need to\r
+                                                               if (ignoreRpc) {\r
+                                                                       ed.setProgressState(1);\r
+                                                                       t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {\r
+                                                                               ed.setProgressState(0);\r
+                                                                       });\r
+                                                               }\r
                                                        }\r
-                                               }\r
-                                       });\r
-\r
+                                               });\r
+                                       }\r
 \r
                                        if (t.editor.getParam("spellchecker_enable_learn_rpc")) {\r
                                                m.add({\r
                                        m.update();\r
                                });\r
 \r
+                               p1 = DOM.getPos(ed.getContentAreaContainer());\r
+                               m.settings.offset_x = p1.x;\r
+                               m.settings.offset_y = p1.y;\r
+\r
                                ed.selection.select(wordSpan);\r
                                p1 = dom.getPos(wordSpan);\r
                                m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);\r
old mode 100755 (executable)
new mode 100644 (file)
index eb1f264..3b8f0ee
@@ -5,6 +5,7 @@ select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padd
 #box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;}\r
 #positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;}\r
 #positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;}\r
+.panel_toggle_insert_span {padding-top:10px;}\r
 .panel_wrapper div.current {padding-top:10px;height:230px;}\r
 .delim {border-left:1px solid gray;}\r
 .tdelim {border-bottom:1px solid gray;}\r
old mode 100755 (executable)
new mode 100644 (file)
index cab2153..dda9f92
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:320+parseInt(a.getLang("style.delta_height",0)),inline:1},{plugin_url:b,style_text:a.selection.getNode().style.cssText})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){var c=false;var f=a.selection.getSelectedBlocks();var d=[];if(f.length===1){d.push(a.selection.getNode().style.cssText)}else{tinymce.each(f,function(g){d.push(a.dom.getAttrib(g,"style"))});c=true}a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:340+parseInt(a.getLang("style.delta_height",0)),inline:1},{applyStyleToBlocks:c,plugin_url:b,styles:d})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 5f7755f..eaa7c77
                init : function(ed, url) {\r
                        // Register commands\r
                        ed.addCommand('mceStyleProps', function() {\r
+\r
+                               var applyStyleToBlocks = false;\r
+                               var blocks = ed.selection.getSelectedBlocks();\r
+                               var styles = [];\r
+\r
+                               if (blocks.length === 1) {\r
+                                       styles.push(ed.selection.getNode().style.cssText);\r
+                               }\r
+                               else {\r
+                                       tinymce.each(blocks, function(block) {\r
+                                               styles.push(ed.dom.getAttrib(block, 'style'));\r
+                                       });\r
+                                       applyStyleToBlocks = true;\r
+                               }\r
+\r
                                ed.windowManager.open({\r
                                        file : url + '/props.htm',\r
                                        width : 480 + parseInt(ed.getLang('style.delta_width', 0)),\r
-                                       height : 320 + parseInt(ed.getLang('style.delta_height', 0)),\r
+                                       height : 340 + parseInt(ed.getLang('style.delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
+                                       applyStyleToBlocks : applyStyleToBlocks,\r
                                        plugin_url : url,\r
-                                       style_text : ed.selection.getNode().style.cssText\r
+                                       styles : styles\r
                                });\r
                        });\r
 \r
@@ -52,4 +68,4 @@
 \r
        // Register plugin\r
        tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);\r
-})();
\ No newline at end of file
+})();\r
old mode 100755 (executable)
new mode 100644 (file)
index a8dd93d..0a8a8ec
@@ -27,10 +27,41 @@ var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;out
 var defaultBorderWidth = "thin;medium;thick";\r
 var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";\r
 \r
-function init() {\r
+function aggregateStyles(allStyles) {\r
+       var mergedStyles = {};\r
+\r
+       tinymce.each(allStyles, function(style) {\r
+               if (style !== '') {\r
+                       var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style);\r
+                       for (var name in parsedStyles) {\r
+                               if (parsedStyles.hasOwnProperty(name)) {\r
+                                       if (mergedStyles[name] === undefined) {\r
+                                               mergedStyles[name] = parsedStyles[name];\r
+                                       }\r
+                                       else if (name === 'text-decoration') {\r
+                                               if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) {\r
+                                                       mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name];\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       });\r
+\r
+  return mergedStyles;\r
+}\r
+\r
+var applyActionIsInsert;\r
+var existingStyles;\r
+\r
+function init(ed) {\r
        var ce = document.getElementById('container'), h;\r
 \r
-       ce.style.cssText = tinyMCEPopup.getWindowArg('style_text');\r
+       existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles'));\r
+       ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles);\r
+\r
+       applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false);\r
+       document.getElementById('toggle_insert_span').checked = applyActionIsInsert;\r
 \r
        h = getBrowserHTML('background_image_browser','background_image','image','advimage');\r
        document.getElementById("background_image_browser").innerHTML = h;\r
@@ -144,6 +175,8 @@ function setupFormData() {
        f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');\r
        f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');\r
        f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');\r
+       f.text_none.checked = inStr(ce.style.textDecoration, 'none');\r
+       updateTextDecorations();\r
 \r
        // Setup background fields\r
 \r
@@ -177,11 +210,7 @@ function setupFormData() {
 \r
        f.box_height.value = getNum(ce.style.height);\r
        selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height));\r
-\r
-       if (tinymce.isGecko)\r
-               selectByValue(f, 'box_float', ce.style.cssFloat, true, true);\r
-       else\r
-               selectByValue(f, 'box_float', ce.style.styleFloat, true, true);\r
+       selectByValue(f, 'box_float', ce.style.cssFloat || ce.style.styleFloat, true, true);\r
 \r
        selectByValue(f, 'box_clear', ce.style.clear, true, true);\r
 \r
@@ -370,13 +399,41 @@ function hasEqualValues(a) {
        return true;\r
 }\r
 \r
+function toggleApplyAction() {\r
+       applyActionIsInsert = ! applyActionIsInsert;\r
+}\r
+\r
 function applyAction() {\r
        var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;\r
 \r
        generateCSS();\r
 \r
        tinyMCEPopup.restoreSelection();\r
-       ed.dom.setAttrib(ed.selection.getNode(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText)));\r
+\r
+       var newStyles = tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText);\r
+\r
+       if (applyActionIsInsert) {\r
+               ed.formatter.register('plugin_style', {\r
+                       inline: 'span', styles: existingStyles\r
+               });\r
+               ed.formatter.remove('plugin_style');\r
+\r
+               ed.formatter.register('plugin_style', {\r
+                       inline: 'span', styles: newStyles\r
+               });\r
+               ed.formatter.apply('plugin_style');\r
+       } else {\r
+               var nodes;\r
+\r
+               if (tinyMCEPopup.getWindowArg('applyStyleToBlocks')) {\r
+                       nodes = ed.selection.getSelectedBlocks();\r
+               }\r
+               else {\r
+                       nodes = ed.selection.getNode();\r
+               }\r
+\r
+               ed.dom.setAttrib(nodes, 'style', tinyMCEPopup.editor.dom.serializeStyle(newStyles));\r
+       }\r
 }\r
 \r
 function updateAction() {\r
@@ -440,9 +497,7 @@ function generateCSS() {
        ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : "");\r
        ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : "");\r
        ce.style.styleFloat = f.box_float.value;\r
-\r
-       if (tinymce.isGecko)\r
-               ce.style.cssFloat = f.box_float.value;\r
+       ce.style.cssFloat = f.box_float.value;\r
 \r
        ce.style.clear = f.box_clear.value;\r
 \r
@@ -638,4 +693,17 @@ function synch(fr, to) {
                selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);\r
 }\r
 \r
+function updateTextDecorations(){\r
+       var el = document.forms[0].elements;\r
+\r
+       var textDecorations = ["text_underline", "text_overline", "text_linethrough", "text_blink"];\r
+       var noneChecked = el["text_none"].checked;\r
+       tinymce.each(textDecorations, function(id) {\r
+               el[id].disabled = noneChecked;\r
+               if (noneChecked) {\r
+                       el[id].checked = false;\r
+               }\r
+       });\r
+}\r
+\r
 tinyMCEPopup.onInit.add(init);\r
old mode 100755 (executable)
new mode 100644 (file)
index 5026313..35881b3
@@ -1,63 +1 @@
-tinyMCE.addI18n('en.style_dlg',{\r
-title:"Edit CSS Style",\r
-apply:"Apply",\r
-text_tab:"Text",\r
-background_tab:"Background",\r
-block_tab:"Block",\r
-box_tab:"Box",\r
-border_tab:"Border",\r
-list_tab:"List",\r
-positioning_tab:"Positioning",\r
-text_props:"Text",\r
-text_font:"Font",\r
-text_size:"Size",\r
-text_weight:"Weight",\r
-text_style:"Style",\r
-text_variant:"Variant",\r
-text_lineheight:"Line height",\r
-text_case:"Case",\r
-text_color:"Color",\r
-text_decoration:"Decoration",\r
-text_overline:"overline",\r
-text_underline:"underline",\r
-text_striketrough:"strikethrough",\r
-text_blink:"blink",\r
-text_none:"none",\r
-background_color:"Background color",\r
-background_image:"Background image",\r
-background_repeat:"Repeat",\r
-background_attachment:"Attachment",\r
-background_hpos:"Horizontal position",\r
-background_vpos:"Vertical position",\r
-block_wordspacing:"Word spacing",\r
-block_letterspacing:"Letter spacing",\r
-block_vertical_alignment:"Vertical alignment",\r
-block_text_align:"Text align",\r
-block_text_indent:"Text indent",\r
-block_whitespace:"Whitespace",\r
-block_display:"Display",\r
-box_width:"Width",\r
-box_height:"Height",\r
-box_float:"Float",\r
-box_clear:"Clear",\r
-padding:"Padding",\r
-same:"Same for all",\r
-top:"Top",\r
-right:"Right",\r
-bottom:"Bottom",\r
-left:"Left",\r
-margin:"Margin",\r
-style:"Style",\r
-width:"Width",\r
-height:"Height",\r
-color:"Color",\r
-list_type:"Type",\r
-bullet_image:"Bullet image",\r
-position:"Position",\r
-positioning_type:"Type",\r
-visibility:"Visibility",\r
-zindex:"Z-index",\r
-overflow:"Overflow",\r
-placement:"Placement",\r
-clip:"Clip"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"});
old mode 100755 (executable)
new mode 100644 (file)
index 549ed04..7dc087a
        <link href="css/props.css" rel="stylesheet" type="text/css" />
 </head>
 
-<body id="styleprops" style="display: none">
+<body id="styleprops" style="display: none" role="application" aria-labelledby="app_title">
+<span id="app_title" style="display:none">{#style_dlg.title}</span>
 <form onsubmit="updateAction();return false;" action="#">
 <div class="tabs">
        <ul>
-               <li id="text_tab" class="current"><span><a href="javascript:mcTabs.displayTab('text_tab','text_panel');" onMouseDown="return false;">{#style_dlg.text_tab}</a></span></li>
-               <li id="background_tab"><span><a href="javascript:mcTabs.displayTab('background_tab','background_panel');" onMouseDown="return false;">{#style_dlg.background_tab}</a></span></li>
-               <li id="block_tab"><span><a href="javascript:mcTabs.displayTab('block_tab','block_panel');" onMouseDown="return false;">{#style_dlg.block_tab}</a></span></li>
-               <li id="box_tab"><span><a href="javascript:mcTabs.displayTab('box_tab','box_panel');" onMouseDown="return false;">{#style_dlg.box_tab}</a></span></li>
-               <li id="border_tab"><span><a href="javascript:mcTabs.displayTab('border_tab','border_panel');" onMouseDown="return false;">{#style_dlg.border_tab}</a></span></li>
-               <li id="list_tab"><span><a href="javascript:mcTabs.displayTab('list_tab','list_panel');" onMouseDown="return false;">{#style_dlg.list_tab}</a></span></li>
-               <li id="positioning_tab"><span><a href="javascript:mcTabs.displayTab('positioning_tab','positioning_panel');" onMouseDown="return false;">{#style_dlg.positioning_tab}</a></span></li>
+               <li id="text_tab" class="current" aria-controls="text_panel"><span><a href="javascript:mcTabs.displayTab('text_tab','text_panel');" onMouseDown="return false;">{#style_dlg.text_tab}</a></span></li>
+               <li id="background_tab" aria-controls="background_panel"><span><a href="javascript:mcTabs.displayTab('background_tab','background_panel');" onMouseDown="return false;">{#style_dlg.background_tab}</a></span></li>
+               <li id="block_tab" aria-controls="block_panel"><span><a href="javascript:mcTabs.displayTab('block_tab','block_panel');" onMouseDown="return false;">{#style_dlg.block_tab}</a></span></li>
+               <li id="box_tab" aria-controls="box_panel"><span><a href="javascript:mcTabs.displayTab('box_tab','box_panel');" onMouseDown="return false;">{#style_dlg.box_tab}</a></span></li>
+               <li id="border_tab" aria-controls="border_panel"><span><a href="javascript:mcTabs.displayTab('border_tab','border_panel');" onMouseDown="return false;">{#style_dlg.border_tab}</a></span></li>
+               <li id="list_tab" aria-controls="list_panel"><span><a href="javascript:mcTabs.displayTab('list_tab','list_panel');" onMouseDown="return false;">{#style_dlg.list_tab}</a></span></li>
+               <li id="positioning_tab" aria-controls="positioning_panel"><span><a href="javascript:mcTabs.displayTab('positioning_tab','positioning_panel');" onMouseDown="return false;">{#style_dlg.positioning_tab}</a></span></li>
        </ul>
 </div>
 
 <div class="panel_wrapper">
 <div id="text_panel" class="panel current">
-       <table border="0" width="100%">
-               <tr>
-                       <td><label for="text_font">{#style_dlg.text_font}</label></td>
-                       <td colspan="3">
-                               <select id="text_font" name="text_font" class="mceEditableSelect mceFocus"></select>
-                       </td>
-               </tr>
-               <tr>
-                       <td><label for="text_size">{#style_dlg.text_size}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><select id="text_size" name="text_size" class="mceEditableSelect"></select></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="text_size_measurement" name="text_size_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td><label for="text_weight">{#style_dlg.text_weight}</label></td>
-                       <td>
-                               <select id="text_weight" name="text_weight"></select>
-                       </td>
-               </tr>
-               <tr>
-                       <td><label for="text_style">{#style_dlg.text_style}</label></td>
-                       <td>
-                               <select id="text_style" name="text_style" class="mceEditableSelect"></select>
-                       </td>
-                       <td><label for="text_variant">{#style_dlg.text_variant}</label></td>
-                       <td>
-                               <select id="text_variant" name="text_variant"></select>
-                       </td>
-               </tr>
-               <tr>
-                       <td><label for="text_lineheight">{#style_dlg.text_lineheight}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td>
-                                                       <select id="text_lineheight" name="text_lineheight" class="mceEditableSelect"></select>
-                                               </td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="text_lineheight_measurement" name="text_lineheight_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td><label for="text_case">{#style_dlg.text_case}</label></td>
-                       <td>
-                               <select id="text_case" name="text_case"></select>
-                       </td>
-               </tr>
-               <tr>
-                       <td><label for="text_color">{#style_dlg.text_color}</label></td>
-                       <td colspan="2">
-                               <table border="0" cellpadding="0" cellspacing="0">
-                                       <tr>
-                                               <td><input id="text_color" name="text_color" type="text" value="" size="9" onChange="updateColor('text_color_pick','text_color');" /></td>
-                                               <td id="text_color_pickcontainer">&nbsp;</td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-               <tr>
-                       <td valign="top" style="vertical-align: top; padding-top: 3px;">{#style_dlg.text_decoration}</td>
-                       <td colspan="2">
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><input id="text_underline" name="text_underline" class="checkbox" type="checkbox" /></td>
-                                               <td><label for="text_underline">{#style_dlg.text_underline}</label></td>
-                                       </tr>
-                                       <tr>
-                                               <td><input id="text_overline" name="text_overline" class="checkbox" type="checkbox" /></td>
-                                               <td><label for="text_overline">{#style_dlg.text_overline}</label></td>
-                                       </tr>
-                                       <tr>
-                                               <td><input id="text_linethrough" name="text_linethrough" class="checkbox" type="checkbox" /></td>
-                                               <td><label for="text_linethrough">{#style_dlg.text_striketrough}</label></td>
-                                       </tr>
-                                       <tr>
-                                               <td><input id="text_blink" name="text_blink" class="checkbox" type="checkbox" /></td>
-                                               <td><label for="text_blink">{#style_dlg.text_blink}</label></td>
-                                       </tr>
-                                       <tr>
-                                               <td><input id="text_none" name="text_none" class="checkbox" type="checkbox" /></td>
-                                               <td><label for="text_none">{#style_dlg.text_none}</label></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
+       <fieldset>
+               <legend>{#style_dlg.text}</legend>
+               <table role="presentation" border="0" width="100%">
+                       <tr>
+                               <td><label for="text_font">{#style_dlg.text_font}</label></td>
+                               <td colspan="3">
+                                       <select id="text_font" name="text_font" class="mceEditableSelect mceFocus"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_size">{#style_dlg.text_size}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="text_size" name="text_size" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="text_size_measurement_label" for="text_size_measurement" style="display: none; visibility: hidden;">Text Size Measurement Unit</label>
+                                                               <select id="text_size_measurement" name="text_size_measurement" aria-labelledby="text_size_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td><label for="text_weight">{#style_dlg.text_weight}</label></td>
+                               <td>
+                                       <select id="text_weight" name="text_weight"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_style">{#style_dlg.text_style}</label></td>
+                               <td>
+                                       <select id="text_style" name="text_style" class="mceEditableSelect"></select>
+                               </td>
+                               <td><label for="text_variant">{#style_dlg.text_variant}</label></td>
+                               <td>
+                                       <select id="text_variant" name="text_variant"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_lineheight">{#style_dlg.text_lineheight}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td>
+                                                               <select id="text_lineheight" name="text_lineheight" class="mceEditableSelect"></select>
+                                                       </td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="text_lineheight_measurement_label" for="text_lineheight_measurement" style="display: none; visibility: hidden;">Line Height Measurement Unit</label>
+                                                               <select id="text_lineheight_measurement" name="text_lineheight_measurement" aria-labelledby="text_lineheight_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td><label for="text_case">{#style_dlg.text_case}</label></td>
+                               <td>
+                                       <select id="text_case" name="text_case"></select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><label for="text_color">{#style_dlg.text_color}</label></td>
+                               <td colspan="2">
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td><input id="text_color" name="text_color" type="text" value="" size="9" onChange="updateColor('text_color_pick','text_color');" /></td>
+                                                       <td id="text_color_pickcontainer">&nbsp;</td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top" style="vertical-align: top; padding-top: 3px;">{#style_dlg.text_decoration}</td>
+                               <td colspan="2">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input id="text_underline" name="text_underline" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_underline">{#style_dlg.text_underline}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_overline" name="text_overline" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_overline">{#style_dlg.text_overline}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_linethrough" name="text_linethrough" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_linethrough">{#style_dlg.text_striketrough}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_blink" name="text_blink" class="checkbox" type="checkbox" /></td>
+                                                       <td><label for="text_blink">{#style_dlg.text_blink}</label></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input id="text_none" name="text_none" class="checkbox" type="checkbox" onclick="updateTextDecorations();"/></td>
+                                                       <td><label for="text_none">{#style_dlg.text_none}</label></td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
 </div>
 
 <div id="background_panel" class="panel">
-       <table border="0">
-               <tr>
-                       <td><label for="background_color">{#style_dlg.background_color}</label></td>
-                       <td>
-                               <table border="0" cellpadding="0" cellspacing="0">
-                                       <tr>
-                                               <td><input id="background_color" name="background_color" type="text" value="" size="9" onChange="updateColor('background_color_pick','background_color');" /></td>
-                                               <td id="background_color_pickcontainer">&nbsp;</td>
+       <fieldset>
+               <legend>{#style_dlg.background}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="background_color">{#style_dlg.background_color}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td><input id="background_color" name="background_color" type="text" value="" size="9" onChange="updateColor('background_color_pick','background_color');" /></td>
+                                                       <td id="background_color_pickcontainer">&nbsp;</td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="background_image">{#style_dlg.background_image}</label></td>
+                               <td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr> 
+                                               <td><input id="background_image" name="background_image" type="text" /></td> 
+                                               <td id="background_image_browser">&nbsp;</td>
                                        </tr>
-                               </table>
-                       </td>
-               </tr>
+                                       </table>
+                               </td>
+                       </tr>
 
-               <tr>
-                       <td><label for="background_image">{#style_dlg.background_image}</label></td>
-                       <td><table border="0" cellspacing="0" cellpadding="0">
-                               <tr> 
-                                 <td><input id="background_image" name="background_image" type="text" /></td> 
-                                 <td id="background_image_browser">&nbsp;</td>
-                               </tr>
-                               </table>
-                       </td>
-               </tr>
+                       <tr>
+                               <td><label for="background_repeat">{#style_dlg.background_repeat}</label></td>
+                               <td><select id="background_repeat" name="background_repeat" class="mceEditableSelect"></select></td>
+                       </tr>
 
-               <tr>
-                       <td><label for="background_repeat">{#style_dlg.background_repeat}</label></td>
-                       <td><select id="background_repeat" name="background_repeat" class="mceEditableSelect"></select></td>
-               </tr>
+                       <tr>
+                               <td><label for="background_attachment">{#style_dlg.background_attachment}</label></td>
+                               <td><select id="background_attachment" name="background_attachment" class="mceEditableSelect"></select></td>
+                       </tr>
 
-               <tr>
-                       <td><label for="background_attachment">{#style_dlg.background_attachment}</label></td>
-                       <td><select id="background_attachment" name="background_attachment" class="mceEditableSelect"></select></td>
-               </tr>
+                       <tr>
+                               <td><label for="background_hpos">{#style_dlg.background_hpos}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="background_hpos" name="background_hpos" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="background_hpos_measurement_label" for="background_hpos_measurement" style="display: none; visibility: hidden;">Horizontal position measurement unit</label>
+                                                               <select id="background_hpos_measurement" name="background_hpos_measurement" aria-labelledby="background_hpos_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
 
-               <tr>
-                       <td><label for="background_hpos">{#style_dlg.background_hpos}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><select id="background_hpos" name="background_hpos" class="mceEditableSelect"></select></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="background_hpos_measurement" name="background_hpos_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
+                       <tr>
+                               <td><label for="background_vpos">{#style_dlg.background_vpos}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="background_vpos" name="background_vpos" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
 
-               <tr>
-                       <td><label for="background_vpos">{#style_dlg.background_vpos}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><select id="background_vpos" name="background_vpos" class="mceEditableSelect"></select></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="background_vpos_measurement" name="background_vpos_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
+                                                               <label id="background_vpos_measurement_label" for="background_vpos_measurement" style="display: none; visibility: hidden;">Vertical position measurement unit</label>
+                                                               <select id="background_vpos_measurement" name="background_vpos_measurement" aria-labelledby="background_vpos_measurement_label">></select></td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+       </fieldset>
 </div>
 
 <div id="block_panel" class="panel">
-       <table border="0">
-               <tr>
-                       <td><label for="block_wordspacing">{#style_dlg.block_wordspacing}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><select id="block_wordspacing" name="block_wordspacing" class="mceEditableSelect"></select></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="block_wordspacing_measurement" name="block_wordspacing_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
+       <fieldset>
+               <legend>{#style_dlg.block}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="block_wordspacing">{#style_dlg.block_wordspacing}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="block_wordspacing" name="block_wordspacing" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_wordspacing_measurement_label" for="block_wordspacing_measurement" style="display: none; visibility: hidden;">Word spacing measurement unit</label>
+                                                               <select id="block_wordspacing_measurement" name="block_wordspacing_measurement" aria-labelledby="block_wordspacing_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
 
-               <tr>
-                       <td><label for="block_letterspacing">{#style_dlg.block_letterspacing}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><select id="block_letterspacing" name="block_letterspacing" class="mceEditableSelect"></select></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="block_letterspacing_measurement" name="block_letterspacing_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
+                       <tr>
+                               <td><label for="block_letterspacing">{#style_dlg.block_letterspacing}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><select id="block_letterspacing" name="block_letterspacing" class="mceEditableSelect"></select></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_letterspacing_measurement_label" for="block_letterspacing_measurement" style="display: none; visibility: hidden;">Letter spacing measurement unit</label>
+                                                               <select id="block_letterspacing_measurement" name="block_letterspacing_measurement" aria-labelledby="block_letterspacing_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
 
-               <tr>
-                       <td><label for="block_vertical_alignment">{#style_dlg.block_vertical_alignment}</label></td>
-                       <td><select id="block_vertical_alignment" name="block_vertical_alignment" class="mceEditableSelect"></select></td>
-               </tr>
+                       <tr>
+                               <td><label for="block_vertical_alignment">{#style_dlg.block_vertical_alignment}</label></td>
+                               <td><select id="block_vertical_alignment" name="block_vertical_alignment" class="mceEditableSelect"></select></td>
+                       </tr>
 
-               <tr>
-                       <td><label for="block_text_align">{#style_dlg.block_text_align}</label></td>
-                       <td><select id="block_text_align" name="block_text_align" class="mceEditableSelect"></select></td>
-               </tr>
+                       <tr>
+                               <td><label for="block_text_align">{#style_dlg.block_text_align}</label></td>
+                               <td><select id="block_text_align" name="block_text_align" class="mceEditableSelect"></select></td>
+                       </tr>
 
-               <tr>
-                       <td><label for="block_text_indent">{#style_dlg.block_text_indent}</label></td>
-                       <td>
-                               <table border="0" cellspacing="0" cellpadding="0">
-                                       <tr>
-                                               <td><input type="text" id="block_text_indent" name="block_text_indent" /></td>
-                                               <td>&nbsp;</td>
-                                               <td><select id="block_text_indent_measurement" name="block_text_indent_measurement"></select></td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
+                       <tr>
+                               <td><label for="block_text_indent">{#style_dlg.block_text_indent}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="block_text_indent" name="block_text_indent" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="block_text_indent_measurement_label" for="block_text_indent_measurement" style="display: none; visibility: hidden;">Text Indent Measurement Unit</label>
 
-               <tr>
-                       <td><label for="block_whitespace">{#style_dlg.block_whitespace}</label></td>
-                       <td><select id="block_whitespace" name="block_whitespace" class="mceEditableSelect"></select></td>
-               </tr>
+                                                               <select id="block_text_indent_measurement" name="block_text_indent_measurement" aria-labelledby="block_text_indent_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
 
-               <tr>
-                       <td><label for="block_display">{#style_dlg.block_display}</label></td>
-                       <td><select id="block_display" name="block_display" class="mceEditableSelect"></select></td>
-               </tr>
-       </table>
+                       <tr>
+                               <td><label for="block_whitespace">{#style_dlg.block_whitespace}</label></td>
+                               <td><select id="block_whitespace" name="block_whitespace" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="block_display">{#style_dlg.block_display}</label></td>
+                               <td><select id="block_display" name="block_display" class="mceEditableSelect"></select></td>
+                       </tr>
+               </table>
+       </fieldset>
 </div>
 
 <div id="box_panel" class="panel">
-<table border="0">
-       <tr>
-               <td><label for="box_width">{#style_dlg.box_width}</label></td>
-               <td>
-                       <table border="0" cellspacing="0" cellpadding="0">
-                               <tr>
-                                       <td><input type="text" id="box_width" name="box_width" class="mceEditableSelect" onChange="synch('box_width','positioning_width');" /></td>
-                                       <td>&nbsp;</td>
-                                       <td><select id="box_width_measurement" name="box_width_measurement"></select></td>
-                               </tr>
-                       </table>
-               </td>
-               <td>&nbsp;&nbsp;&nbsp;<label for="box_float">{#style_dlg.box_float}</label></td>
-               <td><select id="box_float" name="box_float" class="mceEditableSelect"></select></td>
-       </tr>
+       <fieldset>
+               <legend>{#style_dlg.box}</legend>
+               <table role="presentation" border="0">
+                       <tr>
+                               <td><label for="box_width">{#style_dlg.box_width}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_width" name="box_width" class="mceEditableSelect" onChange="synch('box_width','positioning_width');" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_width_measurement_label" for="box_width_measurement" style="display: none; visibility: hidden;">Box Width Measurement Unit</label>
+                                                               <select id="box_width_measurement" name="box_width_measurement" aria-labelledby="box_width_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td>&nbsp;&nbsp;&nbsp;<label for="box_float">{#style_dlg.box_float}</label></td>
+                               <td><select id="box_float" name="box_float" class="mceEditableSelect"></select></td>
+                       </tr>
+
+                       <tr>
+                               <td><label for="box_height">{#style_dlg.box_height}</label></td>
+                               <td>
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                               <tr>
+                                                       <td><input type="text" id="box_height" name="box_height" class="mceEditableSelect" onChange="synch('box_height','positioning_height');" /></td>
+                                                       <td>&nbsp;</td>
+                                                       <td>
+                                                               <label id="box_height_measurement_label" for="box_height_measurement" style="display: none; visibility: hidden;">Box Height Measurement Unit</label>
+                                                               <select id="box_height_measurement" name="box_height_measurement" aria-labelledby="box_height_measurement_label"></select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td>&nbsp;&nbsp;&nbsp;<label for="box_clear">{#style_dlg.box_clear}</label></td>
+                               <td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td>
+                       </tr>
+               </table>
+       </fieldset>
 
-       <tr>
-               <td><label for="box_height">{#style_dlg.box_height}</label></td>
-               <td>
-                       <table border="0" cellspacing="0" cellpadding="0">
-                               <tr>
-                                       <td><input type="text" id="box_height" name="box_height" class="mceEditableSelect" onChange="synch('box_height','positioning_height');" /></td>
-                                       <td>&nbsp;</td>
-                                       <td><select id="box_height_measurement" name="box_height_measurement"></select></td>
-                               </tr>
-                       </table>
-               </td>
-               <td>&nbsp;&nbsp;&nbsp;<label for="box_clear">{#style_dlg.box_clear}</label></td>
-               <td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td>
-       </tr>
-</table>
 <div style="float: left; width: 49%">
        <fieldset>
                <legend>{#style_dlg.padding}</legend>
 
-               <table border="0">
+               <table role="presentation" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td><input type="checkbox" id="box_padding_same" name="box_padding_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_padding');" /> <label for="box_padding_same">{#style_dlg.same}</label></td>
                        <tr>
                                <td><label for="box_padding_top">{#style_dlg.top}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_padding_top" name="box_padding_top" class="mceEditableSelect" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_padding_top_measurement" name="box_padding_top_measurement"></select></td>
+                                                       <td>
+                                                               <label id="box_padding_top_measurement_label" for="box_padding_top_measurement" style="display: none; visibility: hidden;">Padding Top Measurement Unit</label>
+                                                               <select id="box_padding_top_measurement" name="box_padding_top_measurement" aria-labelledby="box_padding_top_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_padding_right">{#style_dlg.right}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_padding_right" name="box_padding_right" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_padding_right_measurement" name="box_padding_right_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_padding_right_measurement_label" for="box_padding_right_measurement" style="display: none; visibility: hidden;">Padding Right Measurement Unit</label>
+                                                               <select id="box_padding_right_measurement" name="box_padding_right_measurement" disabled="disabled" aria-labelledby="box_padding_right_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_padding_bottom">{#style_dlg.bottom}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_padding_bottom" name="box_padding_bottom" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_padding_bottom_measurement" name="box_padding_bottom_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_padding_bottom_measurement_label" for="box_padding_bottom_measurement" style="display: none; visibility: hidden;">Padding Bottom Measurement Unit</label>
+                                                               <select id="box_padding_bottom_measurement" name="box_padding_bottom_measurement" disabled="disabled" aria-labelledby="box_padding_bottom_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_padding_left">{#style_dlg.left}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_padding_left" name="box_padding_left" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_padding_left_measurement" name="box_padding_left_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_padding_left_measurement_label" for="box_padding_left_measurement" style="display: none; visibility: hidden;">Padding Left Measurement Unit</label>
+                                                               <select id="box_padding_left_measurement" name="box_padding_left_measurement" disabled="disabled" aria-labelledby="box_padding_left_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
        <fieldset>
                <legend>{#style_dlg.margin}</legend>
 
-               <table border="0">
+               <table role="presentation" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td><input type="checkbox" id="box_margin_same" name="box_margin_same" class="checkbox" checked="checked" onClick="toggleSame(this,'box_margin');" /> <label for="box_margin_same">{#style_dlg.same}</label></td>
                        <tr>
                                <td><label for="box_margin_top">{#style_dlg.top}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_margin_top" name="box_margin_top" class="mceEditableSelect" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_margin_top_measurement" name="box_margin_top_measurement"></select></td>
+                                                       <td>
+                                                               <label id="box_margin_top_measurement_label" for="box_margin_top_measurement" style="display: none; visibility: hidden;">Margin Top Measurement Unit</label>
+                                                               <select id="box_margin_top_measurement" name="box_margin_top_measurement" aria-labelledby="box_margin_top_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_margin_right">{#style_dlg.right}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_margin_right" name="box_margin_right" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_margin_right_measurement" name="box_margin_right_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_margin_right_measurement_label" for="box_margin_right_measurement" style="display: none; visibility: hidden;">Margin Right Measurement Unit</label>
+                                                               <select id="box_margin_right_measurement" name="box_margin_right_measurement" disabled="disabled" aria-labelledby="box_margin_right_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_margin_bottom">{#style_dlg.bottom}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_margin_bottom" name="box_margin_bottom" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_margin_bottom_measurement" name="box_margin_bottom_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_margin_bottom_measurement_label" for="box_margin_bottom_measurement" style="display: none; visibility: hidden;">Margin Bottom Measurement Unit</label>
+                                                               <select id="box_margin_bottom_measurement" name="box_margin_bottom_measurement" disabled="disabled" aria-labelledby="box_margin_bottom_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td><label for="box_margin_left">{#style_dlg.left}</label></td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="box_margin_left" name="box_margin_left" class="mceEditableSelect" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="box_margin_left_measurement" name="box_margin_left_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="box_margin_left_measurement_label" for="box_margin_left_measurement" style="display: none; visibility: hidden;">Margin Left Measurement Unit</label>
+                                                               <select id="box_margin_left_measurement" name="box_margin_left_measurement" disabled="disabled" aria-labelledby="box_margin_left_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
 </div>
 
 <div id="border_panel" class="panel">
-<table border="0" cellspacing="0" cellpadding="0" width="100%">
-<tr>
-       <td class="tdelim">&nbsp;</td>
-       <td class="tdelim delim">&nbsp;</td>
-       <td class="tdelim">{#style_dlg.style}</td>
-       <td class="tdelim delim">&nbsp;</td>
-       <td class="tdelim">{#style_dlg.width}</td>
-       <td class="tdelim delim">&nbsp;</td>
-       <td class="tdelim">{#style_dlg.color}</td>
-</tr>
-
-<tr>
-       <td>&nbsp;</td>
-       <td class="delim">&nbsp;</td>
-       <td><input type="checkbox" id="border_style_same" name="border_style_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_style');" /> <label for="border_style_same">{#style_dlg.same}</label></td>
-       <td class="delim">&nbsp;</td>
-       <td><input type="checkbox" id="border_width_same" name="border_width_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_width');" /> <label for="border_width_same">{#style_dlg.same}</label></td>
-       <td class="delim">&nbsp;</td>
-       <td><input type="checkbox" id="border_color_same" name="border_color_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_color');" /> <label for="border_color_same">{#style_dlg.same}</label></td>
-</tr>
-
-<tr>
-       <td>{#style_dlg.top}</td>
-       <td class="delim">&nbsp;</td>
-       <td><select id="border_style_top" name="border_style_top" class="mceEditableSelect"></select></td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellspacing="0" cellpadding="0">
-                       <tr>
-                               <td><select id="border_width_top" name="border_width_top" class="mceEditableSelect"></select></td>
-                               <td>&nbsp;</td>
-                               <td><select id="border_width_top_measurement" name="border_width_top_measurement"></select></td>
-                       </tr>
-               </table>
-       </td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0">
-                       <tr>
-                               <td><input id="border_color_top" name="border_color_top" type="text" value="" size="9" onChange="updateColor('border_color_top_pick','border_color_top');" /></td>
-                               <td id="border_color_top_pickcontainer">&nbsp;</td>
-                       </tr>
-               </table>
-       </td>
-</tr>
-
-<tr>
-       <td>{#style_dlg.right}</td>
-       <td class="delim">&nbsp;</td>
-       <td><select id="border_style_right" name="border_style_right" class="mceEditableSelect" disabled="disabled"></select></td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellspacing="0" cellpadding="0">
-                       <tr>
-                               <td><select id="border_width_right" name="border_width_right" class="mceEditableSelect" disabled="disabled"></select></td>
-                               <td>&nbsp;</td>
-                               <td><select id="border_width_right_measurement" name="border_width_right_measurement" disabled="disabled"></select></td>
-                       </tr>
-               </table>
-       </td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0">
-                       <tr>
-                               <td><input id="border_color_right" name="border_color_right" type="text" value="" size="9" onChange="updateColor('border_color_right_pick','border_color_right');" disabled="disabled" /></td>
-                               <td id="border_color_right_pickcontainer">&nbsp;</td>
-                       </tr>
-               </table>
-       </td>
-</tr>
-
-<tr>
-       <td>{#style_dlg.bottom}</td>
-       <td class="delim">&nbsp;</td>
-       <td><select id="border_style_bottom" name="border_style_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellspacing="0" cellpadding="0">
-                       <tr>
-                               <td><select id="border_width_bottom" name="border_width_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
-                               <td>&nbsp;</td>
-                               <td><select id="border_width_bottom_measurement" name="border_width_bottom_measurement" disabled="disabled"></select></td>
-                       </tr>
-               </table>
-       </td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0">
-                       <tr>
-                               <td><input id="border_color_bottom" name="border_color_bottom" type="text" value="" size="9" onChange="updateColor('border_color_bottom_pick','border_color_bottom');" disabled="disabled" /></td>
-                               <td id="border_color_bottom_pickcontainer">&nbsp;</td>
-                       </tr>
-               </table>
-       </td>
-</tr>
-
-<tr>
-       <td>{#style_dlg.left}</td>
-       <td class="delim">&nbsp;</td>
-       <td><select id="border_style_left" name="border_style_left" class="mceEditableSelect" disabled="disabled"></select></td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellspacing="0" cellpadding="0">
-                       <tr>
-                               <td><select id="border_width_left" name="border_width_left" class="mceEditableSelect" disabled="disabled"></select></td>
-                               <td>&nbsp;</td>
-                               <td><select id="border_width_left_measurement" name="border_width_left_measurement" disabled="disabled"></select></td>
-                       </tr>
-               </table>
-       </td>
-       <td class="delim">&nbsp;</td>
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0">
-                       <tr>
-                               <td><input id="border_color_left" name="border_color_left" type="text" value="" size="9" onChange="updateColor('border_color_left_pick','border_color_left');" disabled="disabled" /></td>
-                               <td id="border_color_left_pickcontainer">&nbsp;</td>
-                       </tr>
+       <fieldset>
+               <legend>{#style_dlg.border}</legend>    
+               <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="100%">
+               <tr>
+                       <td class="tdelim">&nbsp;</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.style}</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.width}</td>
+                       <td class="tdelim delim">&nbsp;</td>
+                       <td class="tdelim">{#style_dlg.color}</td>
+               </tr>
+
+               <tr>
+                       <td>&nbsp;</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_style_same" name="border_style_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_style');" /> <label for="border_style_same">{#style_dlg.same}</label></td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_width_same" name="border_width_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_width');" /> <label for="border_width_same">{#style_dlg.same}</label></td>
+                       <td class="delim">&nbsp;</td>
+                       <td><input type="checkbox" id="border_color_same" name="border_color_same" class="checkbox" checked="checked" onClick="toggleSame(this,'border_color');" /> <label for="border_color_same">{#style_dlg.same}</label></td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.top}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_top" name="border_style_top" class="mceEditableSelect"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_top" name="border_width_top" class="mceEditableSelect"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_top_measurement_label" for="border_width_top_measurement" style="display: none; visibility: hidden;">Width top Measurement Unit</label>
+                                                       <select id="border_width_top_measurement" name="border_width_top_measurement" aria-labelledby="border_width_top_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_top" name="border_color_top" type="text" value="" size="9" onChange="updateColor('border_color_top_pick','border_color_top');" /></td>
+                                               <td id="border_color_top_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.right}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_right" name="border_style_right" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_right" name="border_width_right" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_right_measurement_label" for="border_width_right_measurement" style="display: none; visibility: hidden;">Width Right Measurement Unit</label>
+                                                       <select id="border_width_right_measurement" name="border_width_right_measurement" disabled="disabled" aria-labelledby="border_width_right_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_right" name="border_color_right" type="text" value="" size="9" onChange="updateColor('border_color_right_pick','border_color_right');" disabled="disabled" /></td>
+                                               <td id="border_color_right_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.bottom}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_bottom" name="border_style_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_bottom" name="border_width_bottom" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_bottom_measurement_label" for="border_width_bottom_measurement" style="display: none; visibility: hidden;">Width Bottom Measurement Unit</label>
+                                                       <select id="border_width_bottom_measurement" name="border_width_bottom_measurement" disabled="disabled" aria-labelledby="border_width_bottom_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_bottom" name="border_color_bottom" type="text" value="" size="9" onChange="updateColor('border_color_bottom_pick','border_color_bottom');" disabled="disabled" /></td>
+                                               <td id="border_color_bottom_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>{#style_dlg.left}</td>
+                       <td class="delim">&nbsp;</td>
+                       <td><select id="border_style_left" name="border_style_left" class="mceEditableSelect" disabled="disabled"></select></td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <td><select id="border_width_left" name="border_width_left" class="mceEditableSelect" disabled="disabled"></select></td>
+                                               <td>&nbsp;</td>
+                                               <td>
+                                                       <label id="border_width_left_measurement_label" for="border_width_left_measurement" style="display: none; visibility: hidden;">Width Left Measurement Unit</label>
+                                                       <select id="border_width_left_measurement" name="border_width_left_measurement" disabled="disabled" aria-labelledby="border_width_left_measurement_label"></select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td class="delim">&nbsp;</td>
+                       <td>
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                       <tr>
+                                               <td><input id="border_color_left" name="border_color_left" type="text" value="" size="9" onChange="updateColor('border_color_left_pick','border_color_left');" disabled="disabled" /></td>
+                                               <td id="border_color_left_pickcontainer">&nbsp;</td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
                </table>
-       </td>
-</tr>
-</table>
+       </fieldset>
 </div>
 
 <div id="list_panel" class="panel">
-       <table border="0">
+<fieldset>
+       <legend>{#style_dlg.list}</legend>
+       <table role="presentation" border="0">
                <tr>
                        <td><label for="list_type">{#style_dlg.list_type}</label></td>
                        <td><select id="list_type" name="list_type" class="mceEditableSelect"></select></td>
                        <td><select id="list_position" name="list_position" class="mceEditableSelect"></select></td>
                </tr>
        </table>
+</fieldset>
 </div>
 
 <div id="positioning_panel" class="panel">
-<table border="0">
+<fieldset>
+       <legend>{#style_dlg.position}</legend>
+<table role="presentation" border="0">
        <tr>
                <td><label for="positioning_type">{#style_dlg.positioning_type}</label></td>
                <td><select id="positioning_type" name="positioning_type" class="mceEditableSelect"></select></td>
        <tr>
                <td><label for="positioning_width">{#style_dlg.width}</label></td>
                <td>
-                       <table border="0" cellspacing="0" cellpadding="0">
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                        <td><input type="text" id="positioning_width" name="positioning_width" onChange="synch('positioning_width','box_width');" /></td>
                                        <td>&nbsp;</td>
-                                       <td><select id="positioning_width_measurement" name="positioning_width_measurement"></select></td>
+                                       <td>
+                                               <label id="positioning_width_measurement_label" for="positioning_width_measurement" style="display: none; visibility: hidden;">Positioning width Measurement Unit</label>
+                                               <select id="positioning_width_measurement" name="positioning_width_measurement" aria-labelledby="positioning_width_measurement_label"></select>
+                                       </td>
                                </tr>
                        </table>
                </td>
        <tr>
                <td><label for="positioning_height">{#style_dlg.height}</label></td>
                <td>
-                       <table border="0" cellspacing="0" cellpadding="0">
+                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                        <td><input type="text" id="positioning_height" name="positioning_height" onChange="synch('positioning_height','box_height');" /></td>
                                        <td>&nbsp;</td>
-                                       <td><select id="positioning_height_measurement" name="positioning_height_measurement"></select></td>
+                                       <td>
+                                               <label id="positioning_height_measurement_label" for="positioning_height_measurement" style="display: none; visibility: hidden;">Positioning Height Measurement Unit</label>
+                                               <select id="positioning_height_measurement" name="positioning_height_measurement" aria-labelledby="positioning_height_measurement_label"></select>
+                                       </td>
                                </tr>
                        </table>
                </td>
                <td><select id="positioning_overflow" name="positioning_overflow" class="mceEditableSelect"></select></td>
        </tr>
 </table>
+</fieldset>
 
 <div style="float: left; width: 49%">
        <fieldset>
                <legend>{#style_dlg.placement}</legend>
 
-               <table border="0">
+               <table role="presentation" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td><input type="checkbox" id="positioning_placement_same" name="positioning_placement_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_placement');" /> <label for="positioning_placement_same">{#style_dlg.same}</label></td>
                        <tr>
                                <td>{#style_dlg.top}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_placement_top" name="positioning_placement_top" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_placement_top_measurement" name="positioning_placement_top_measurement"></select></td>
+                                                       <td>
+                                                               <label id="positioning_placement_top_measurement_label" for="positioning_placement_top_measurement" style="display: none; visibility: hidden;">Placement Top Measurement Unit</label>
+                                                               <select id="positioning_placement_top_measurement" name="positioning_placement_top_measurement" aria-labelledby="positioning_placement_top_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.right}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_placement_right" name="positioning_placement_right" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_placement_right_measurement" name="positioning_placement_right_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_placement_right_measurement_label" for="positioning_placement_right_measurement" style="display: none; visibility: hidden;">Placement Right Measurement Unit</label>
+                                                               <select id="positioning_placement_right_measurement" name="positioning_placement_right_measurement" disabled="disabled" aria-labelledby="positioning_placement_right_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.bottom}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_placement_bottom" name="positioning_placement_bottom" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_placement_bottom_measurement" name="positioning_placement_bottom_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_placement_bottom_measurement_label" for="positioning_placement_bottom_measurement" style="display: none; visibility: hidden;">Placement Bottom Measurement Unit</label>
+                                                               <select id="positioning_placement_bottom_measurement" name="positioning_placement_bottom_measurement" disabled="disabled" aria-labelledby="positioning_placement_bottom_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.left}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_placement_left" name="positioning_placement_left" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_placement_left_measurement" name="positioning_placement_left_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_placement_left_measurement_label" for="positioning_placement_left_measurement" style="display: none; visibility: hidden;">Placement Left Measurement Unit</label>
+                                                               <select id="positioning_placement_left_measurement" name="positioning_placement_left_measurement" disabled="disabled" aria-labelledby="positioning_placement_left_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
        <fieldset>
                <legend>{#style_dlg.clip}</legend>
 
-               <table border="0">
+               <table role="presentation" border="0">
                        <tr>
                                <td>&nbsp;</td>
                                <td><input type="checkbox" id="positioning_clip_same" name="positioning_clip_same" class="checkbox" checked="checked" onClick="toggleSame(this,'positioning_clip');" /> <label for="positioning_clip_same">{#style_dlg.same}</label></td>
                        <tr>
                                <td>{#style_dlg.top}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_clip_top" name="positioning_clip_top" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_clip_top_measurement" name="positioning_clip_top_measurement"></select></td>
+                                                       <td>
+                                                               <label id="positioning_clip_top_measurement_label" for="positioning_clip_top_measurement" style="display: none; visibility: hidden;">Clip Top Measurement Unit</label>
+                                                               <select id="positioning_clip_top_measurement" name="positioning_clip_top_measurement" aria-labelledby="positioning_clip_top_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.right}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_clip_right" name="positioning_clip_right" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_clip_right_measurement" name="positioning_clip_right_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_clip_right_measurement_label" for="positioning_clip_right_measurement" style="display: none; visibility: hidden;">Clip Right Measurement Unit</label>
+                                                               <select id="positioning_clip_right_measurement" name="positioning_clip_right_measurement" disabled="disabled" aria-labelledby="positioning_clip_right_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.bottom}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_clip_bottom" name="positioning_clip_bottom" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_clip_bottom_measurement" name="positioning_clip_bottom_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_clip_bottom_measurement_label" for="positioning_clip_bottom_measurement" style="display: none; visibility: hidden;">Clip Bottom Measurement Unit</label>
+                                                               <select id="positioning_clip_bottom_measurement" name="positioning_clip_bottom_measurement" disabled="disabled" aria-labelledby="positioning_clip_bottom_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
                        <tr>
                                <td>{#style_dlg.left}</td>
                                <td>
-                                       <table border="0" cellspacing="0" cellpadding="0">
+                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                        <td><input type="text" id="positioning_clip_left" name="positioning_clip_left" disabled="disabled" /></td>
                                                        <td>&nbsp;</td>
-                                                       <td><select id="positioning_clip_left_measurement" name="positioning_clip_left_measurement" disabled="disabled"></select></td>
+                                                       <td>
+                                                               <label id="positioning_clip_left_measurement_label" for="positioning_clip_left_measurement" style="display: none; visibility: hidden;">Clip Left Measurement Unit</label>
+                                                               <select id="positioning_clip_left_measurement" name="positioning_clip_left_measurement" disabled="disabled" aria-labelledby="positioning_clip_left_measurement_label"></select>
+                                                       </td>
                                                </tr>
                                        </table>
                                </td>
 </div>
 </div>
 
+<div class="panel_toggle_insert_span">
+       <input type="checkbox" class="checkbox" id="toggle_insert_span" name="toggle_insert_span" onClick="toggleApplyAction();" />
+       <label for="toggle_insert_span">{#style_dlg.toggle_insert_span}</label>
+</div>
+
 <div class="mceActionPanel">
        <input type="submit" id="insert" name="insert" value="{#update}" />
        <input type="button" class="button" id="apply" name="apply" value="{#style_dlg.apply}" onClick="applyAction();" />
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/style/readme.txt b/library/tinymce/jscripts/tiny_mce/plugins/style/readme.txt
new file mode 100644 (file)
index 0000000..5bac302
--- /dev/null
@@ -0,0 +1,19 @@
+Edit CSS Style plug-in notes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Unlike WYSIWYG editor functionality that operates only on the selected text,
+typically by inserting new HTML elements with the specified styles.
+This plug-in operates on the HTML blocks surrounding the selected text.
+No new HTML elements are created.
+
+This plug-in only operates on the surrounding blocks and not the nearest
+parent node.  This means that if a block encapsulates a node,
+e.g <p><span>text</span></p>, then only the styles in the block are
+recognized, not those in the span.
+
+When selecting text that includes multiple blocks at the same level (peers),
+this plug-in accumulates the specified styles in all of the surrounding blocks
+and populates the dialogue checkboxes accordingly.  There is no differentiation
+between styles set in all the blocks versus styles set in some of the blocks.
+
+When the [Update] or [Apply] buttons are pressed, the styles selected in the
+checkboxes are applied to all blocks that surround the selected text.
old mode 100755 (executable)
new mode 100644 (file)
index 27d2440..42a82d1
@@ -1 +1 @@
-(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index c2be2f4..a1579c8
-/**\r
- * editor_plugin_src.js\r
- *\r
- * Copyright 2009, Moxiecode Systems AB\r
- * Released under LGPL License.\r
- *\r
- * License: http://tinymce.moxiecode.com/license\r
- * Contributing: http://tinymce.moxiecode.com/contributing\r
- */\r
-\r
-(function() {\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;\r
-\r
-       tinymce.create('tinymce.plugins.TabFocusPlugin', {\r
-               init : function(ed, url) {\r
-                       function tabCancel(ed, e) {\r
-                               if (e.keyCode === 9)\r
-                                       return Event.cancel(e);\r
-                       };\r
-\r
-                       function tabHandler(ed, e) {\r
-                               var x, i, f, el, v;\r
-\r
-                               function find(d) {\r
-                                       f = DOM.getParent(ed.id, 'form');\r
-                                       el = f.elements;\r
-\r
-                                       if (f) {\r
-                                               each(el, function(e, i) {\r
-                                                       if (e.id == ed.id) {\r
-                                                               x = i;\r
-                                                               return false;\r
-                                                       }\r
-                                               });\r
-\r
-                                               if (d > 0) {\r
-                                                       for (i = x + 1; i < el.length; i++) {\r
-                                                               if (el[i].type != 'hidden')\r
-                                                                       return el[i];\r
-                                                       }\r
-                                               } else {\r
-                                                       for (i = x - 1; i >= 0; i--) {\r
-                                                               if (el[i].type != 'hidden')\r
-                                                                       return el[i];\r
-                                                       }\r
-                                               }\r
-                                       }\r
-\r
-                                       return null;\r
-                               };\r
-\r
-                               if (e.keyCode === 9) {\r
-                                       v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));\r
-\r
-                                       if (v.length == 1) {\r
-                                               v[1] = v[0];\r
-                                               v[0] = ':prev';\r
-                                       }\r
-\r
-                                       // Find element to focus\r
-                                       if (e.shiftKey) {\r
-                                               if (v[0] == ':prev')\r
-                                                       el = find(-1);\r
-                                               else\r
-                                                       el = DOM.get(v[0]);\r
-                                       } else {\r
-                                               if (v[1] == ':next')\r
-                                                       el = find(1);\r
-                                               else\r
-                                                       el = DOM.get(v[1]);\r
-                                       }\r
-\r
-                                       if (el) {\r
-                                               if (ed = tinymce.get(el.id || el.name))\r
-                                                       ed.focus();\r
-                                               else\r
-                                                       window.setTimeout(function() {window.focus();el.focus();}, 10);\r
-\r
-                                               return Event.cancel(e);\r
-                                       }\r
-                               }\r
-                       };\r
-\r
-                       ed.onKeyUp.add(tabCancel);\r
-\r
-                       if (tinymce.isGecko) {\r
-                               ed.onKeyPress.add(tabHandler);\r
-                               ed.onKeyDown.add(tabCancel);\r
-                       } else\r
-                               ed.onKeyDown.add(tabHandler);\r
-\r
-                       ed.onInit.add(function() {\r
-                               each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {\r
-                                       Event.add(n, 'focus', function() {ed.focus();});\r
-                               });\r
-                       });\r
-               },\r
-\r
-               getInfo : function() {\r
-                       return {\r
-                               longname : 'Tabfocus',\r
-                               author : 'Moxiecode Systems AB',\r
-                               authorurl : 'http://tinymce.moxiecode.com',\r
-                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',\r
-                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
-                       };\r
-               }\r
-       });\r
-\r
-       // Register plugin\r
-       tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);\r
-})();
\ No newline at end of file
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
+
+       tinymce.create('tinymce.plugins.TabFocusPlugin', {
+               init : function(ed, url) {
+                       function tabCancel(ed, e) {
+                               if (e.keyCode === 9)
+                                       return Event.cancel(e);
+                       }
+
+                       function tabHandler(ed, e) {
+                               var x, i, f, el, v;
+
+                               function find(d) {
+                                       el = DOM.select(':input:enabled,*[tabindex]');
+
+                                       function canSelectRecursive(e) {
+                                               return e.nodeName==="BODY" || (e.type != 'hidden' &&
+                                                       !(e.style.display == "none") &&
+                                                       !(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
+                                       }
+                                       function canSelectInOldIe(el) {
+                                               return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
+                                       }
+                                       function isOldIe() {
+                                               return tinymce.isIE6 || tinymce.isIE7;
+                                       }
+                                       function canSelect(el) {
+                                               return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
+                                       }
+
+                                       each(el, function(e, i) {
+                                               if (e.id == ed.id) {
+                                                       x = i;
+                                                       return false;
+                                               }
+                                       });
+                                       if (d > 0) {
+                                               for (i = x + 1; i < el.length; i++) {
+                                                       if (canSelect(el[i]))
+                                                               return el[i];
+                                               }
+                                       } else {
+                                               for (i = x - 1; i >= 0; i--) {
+                                                       if (canSelect(el[i]))
+                                                               return el[i];
+                                               }
+                                       }
+
+                                       return null;
+                               }
+
+                               if (e.keyCode === 9) {
+                                       v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
+
+                                       if (v.length == 1) {
+                                               v[1] = v[0];
+                                               v[0] = ':prev';
+                                       }
+
+                                       // Find element to focus
+                                       if (e.shiftKey) {
+                                               if (v[0] == ':prev')
+                                                       el = find(-1);
+                                               else
+                                                       el = DOM.get(v[0]);
+                                       } else {
+                                               if (v[1] == ':next')
+                                                       el = find(1);
+                                               else
+                                                       el = DOM.get(v[1]);
+                                       }
+
+                                       if (el) {
+                                               if (el.id && (ed = tinymce.get(el.id || el.name)))
+                                                       ed.focus();
+                                               else
+                                                       window.setTimeout(function() {
+                                                               if (!tinymce.isWebKit)
+                                                                       window.focus();
+                                                               el.focus();
+                                                       }, 10);
+
+                                               return Event.cancel(e);
+                                       }
+                               }
+                       }
+
+                       ed.onKeyUp.add(tabCancel);
+
+                       if (tinymce.isGecko) {
+                               ed.onKeyPress.add(tabHandler);
+                               ed.onKeyDown.add(tabCancel);
+                       } else
+                               ed.onKeyDown.add(tabHandler);
+
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Tabfocus',
+                               author : 'Moxiecode Systems AB',
+                               authorurl : 'http://tinymce.moxiecode.com',
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
+})();
old mode 100755 (executable)
new mode 100644 (file)
index d243e1d..a72a8d6
@@ -5,16 +5,17 @@
        <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
        <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
        <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
        <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
        <script type="text/javascript" src="js/cell.js"></script>\r
        <link href="css/cell.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="tablecell" style="display: none">\r
+<body id="tablecell" style="display: none" role="application">\r
        <form onsubmit="updateAction();return false;" action="#">\r
                <div class="tabs">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
@@ -23,7 +24,7 @@
                                <fieldset>\r
                                        <legend>{#table_dlg.general_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td><label for="align">{#table_dlg.align}</label></td>\r
                                                        <td>\r
 \r
                                                <tr>\r
                                                        <td><label for="width">{#table_dlg.width}</label></td>\r
-                                                       <td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>\r
+                                                       <td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
 \r
                                                        <td><label for="height">{#table_dlg.height}</label></td>\r
-                                                       <td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>\r
+                                                       <td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
                                                </tr>\r
 \r
                                                <tr id="styleSelectRow">\r
@@ -92,7 +93,7 @@
                                <fieldset>\r
                                        <legend>{#table_dlg.advanced_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                                <tr>\r
                                                        <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
                                                        <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> \r
                                                <tr>\r
                                                        <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>\r
                                                                                <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
                                                        </td> \r
                                                </tr>\r
 \r
-                                               <tr>\r
-                                                       <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
+                                               <tr role="group" aria-labelledby="bordercolor_label">\r
+                                                       <td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>\r
                                                                                <td id="bordercolor_pickcontainer">&nbsp;</td>\r
                                                        </td> \r
                                                </tr>\r
 \r
-                                               <tr>\r
-                                                       <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
+                                               <tr role="group" aria-labelledby="bgcolor_label">\r
+                                                       <td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
                                                                                <td id="bgcolor_pickcontainer">&nbsp;</td>\r
                                <select id="action" name="action">\r
                                        <option value="cell">{#table_dlg.cell_cell}</option>\r
                                        <option value="row">{#table_dlg.cell_row}</option>\r
+                                       <option value="col">{#table_dlg.cell_col}</option>\r
                                        <option value="all">{#table_dlg.cell_all}</option>\r
                                </select>\r
                        </div>\r
old mode 100755 (executable)
new mode 100644 (file)
index 266d7d5..ad462f0
@@ -1 +1 @@
-(function(b){var c=b.each;function a(F,E,I){var e,J,B,n;r();n=E.getParent(I.getStart(),"th,td");if(n){J=D(n);B=G();n=v(J.x,J.y)}function w(L,K){L=L.cloneNode(K);L.removeAttribute("id");return L}function r(){var K=0;e=[];c(["thead","tbody","tfoot"],function(L){var M=E.select(L+" tr",F);c(M,function(N,O){O+=K;c(E.select("td,th",N),function(U,P){var Q,R,S,T;if(e[O]){while(e[O][P]){P++}}S=g(U,"rowspan");T=g(U,"colspan");for(R=O;R<O+S;R++){if(!e[R]){e[R]=[]}for(Q=P;Q<P+T;Q++){e[R][Q]={part:L,real:R==O&&Q==P,elm:U,rowspan:S,colspan:T}}}})});K+=M.length})}function v(K,M){var L;L=e[M];if(L){return L[K]}}function g(L,K){return parseInt(L.getAttribute(K)||1)}function h(K){return E.hasClass(K.elm,"mceSelected")||K==n}function j(){var K=[];c(F.rows,function(L){c(L.cells,function(M){if(E.hasClass(M,"mceSelected")||M==n.elm){K.push(L);return false}})});return K}function q(){var K=E.createRng();K.setStartAfter(F);K.setEndAfter(F);I.setRng(K);E.remove(F)}function d(K){var L;b.walk(K,function(N){var M;if(N.nodeType==3){c(E.getParents(N.parentNode,null,K).reverse(),function(O){O=w(O,false);if(!L){L=M=O}else{if(M){M.appendChild(O)}}M=O});if(M){M.innerHTML=b.isIE?"&nbsp;":'<br _mce_bogus="1" />'}return false}},"childNodes");K=w(K,false);K.rowSpan=K.colSpan=1;if(L){K.appendChild(L)}else{if(!b.isIE){K.innerHTML='<br _mce_bogus="1" />'}}return K}function p(){var K=E.createRng();c(E.select("tr",F),function(L){if(L.cells.length==0){E.remove(L)}});if(E.select("tr",F).length==0){K.setStartAfter(F);K.setEndAfter(F);I.setRng(K);E.remove(F);return}c(E.select("thead,tbody,tfoot",F),function(L){if(L.rows.length==0){E.remove(L)}});r();row=e[Math.min(e.length-1,J.y)];if(row){I.select(row[Math.min(row.length-1,J.x)].elm,true);I.collapse(true)}}function s(Q,O,S,P){var N,L,K,M,R;N=e[O][Q].elm.parentNode;for(K=1;K<=S;K++){N=E.getNext(N,"tr");if(N){for(L=Q;L>=0;L--){R=e[O+K][L].elm;if(R.parentNode==N){for(M=1;M<=P;M++){E.insertAfter(d(R),R)}break}}if(L==-1){for(M=1;M<=P;M++){N.insertBefore(d(N.cells[0]),N.cells[0])}}}}}function A(){c(e,function(K,L){c(K,function(N,M){var Q,P,R,O;if(h(N)){N=N.elm;Q=g(N,"colspan");P=g(N,"rowspan");if(Q>1||P>1){N.colSpan=N.rowSpan=1;for(O=0;O<Q-1;O++){E.insertAfter(d(N),N)}s(M,L,P-1,Q)}}})})}function o(S,P,V){var N,M,U,T,R,O,Q,K,S,L;if(S){pos=D(S);N=pos.x;M=pos.y;U=N+(P-1);T=M+(V-1)}else{N=J.x;M=J.y;U=B.x;T=B.y}Q=v(N,M);K=v(U,T);if(Q&&K&&Q.part==K.part){A();r();Q=v(N,M).elm;Q.colSpan=(U-N)+1;Q.rowSpan=(T-M)+1;for(O=M;O<=T;O++){for(R=N;R<=U;R++){S=e[O][R].elm;if(S!=Q){L=b.grep(S.childNodes);c(L,function(X,W){if(X.nodeName!="BR"||W!=L.length-1){Q.appendChild(X)}});E.remove(S)}}}p()}}function k(N){var K,P,M,O,Q,R,L,S;c(e,function(T,U){c(T,function(W,V){if(h(W)){W=W.elm;Q=W.parentNode;R=w(Q,false);K=U;if(N){return false}}});if(N){return !K}});for(O=0;O<e[0].length;O++){P=e[K][O].elm;if(P!=M){if(!N){rowSpan=g(P,"rowspan");if(rowSpan>1){P.rowSpan=rowSpan+1;continue}}else{if(K>0&&e[K-1][O]){S=e[K-1][O].elm;rowSpan=g(S,"rowspan");if(rowSpan>1){S.rowSpan=rowSpan+1;continue}}}L=d(P);L.colSpan=P.colSpan;R.appendChild(L);M=P}}if(R.hasChildNodes()){if(!N){E.insertAfter(R,Q)}else{Q.parentNode.insertBefore(R,Q)}}}function f(L){var M,K;c(e,function(N,O){c(N,function(Q,P){if(h(Q)){M=P;if(L){return false}}});if(L){return !M}});c(e,function(Q,R){var N=Q[M].elm,O,P;if(N!=K){P=g(N,"colspan");O=g(N,"rowspan");if(P==1){if(!L){E.insertAfter(d(N),N);s(M,R,O-1,P)}else{N.parentNode.insertBefore(d(N),N);s(M,R,O-1,P)}}else{N.colSpan++}K=N}})}function m(){var K=[];c(e,function(L,M){c(L,function(O,N){if(h(O)&&b.inArray(K,N)===-1){c(e,function(R){var P=R[N].elm,Q;Q=g(P,"colspan");if(Q>1){P.colSpan=Q-1}else{E.remove(P)}});K.push(N)}})});p()}function l(){var L;function K(O){var N,P,M;N=E.getNext(O,"tr");c(O.cells,function(Q){var R=g(Q,"rowspan");if(R>1){Q.rowSpan=R-1;P=D(Q);s(P.x,P.y,1,1)}});P=D(O.cells[0]);c(e[P.y],function(Q){var R;Q=Q.elm;if(Q!=M){R=g(Q,"rowspan");if(R<=1){E.remove(Q)}else{Q.rowSpan=R-1}M=Q}})}L=j();c(L.reverse(),function(M){K(M)});p()}function C(){var K=j();E.remove(K);p();return K}function H(){var K=j();c(K,function(M,L){K[L]=w(M,true)});return K}function z(M,L){var N=j(),K=N[L?0:N.length-1],O=K.cells.length;c(e,function(Q){var P;O=0;c(Q,function(S,R){if(S.real){O+=S.colspan}if(S.elm.parentNode==K){P=1}});if(P){return false}});if(!L){M.reverse()}c(M,function(R){var Q=R.cells.length,P;for(i=0;i<Q;i++){P=R.cells[i];P.colSpan=P.rowSpan=1}for(i=Q;i<O;i++){R.appendChild(d(R.cells[Q-1]))}for(i=O;i<Q;i++){E.remove(R.cells[i])}if(L){K.parentNode.insertBefore(R,K)}else{E.insertAfter(R,K)}})}function D(K){var L;c(e,function(M,N){c(M,function(P,O){if(P.elm==K){L={x:O,y:N};return false}});return !L});return L}function u(K){J=D(K)}function G(){var M,L,K;L=K=0;c(e,function(N,O){c(N,function(Q,P){var S,R;if(h(Q)){Q=e[O][P];if(P>L){L=P}if(O>K){K=O}if(Q.real){S=Q.colspan-1;R=Q.rowspan-1;if(S){if(P+S>L){L=P+S}}if(R){if(O+R>K){K=O+R}}}}})});return{x:L,y:K}}function t(Q){var N,M,S,R,L,K,O,P;B=D(Q);if(J&&B){N=Math.min(J.x,B.x);M=Math.min(J.y,B.y);S=Math.max(J.x,B.x);R=Math.max(J.y,B.y);L=S;K=R;for(y=M;y<=K;y++){Q=e[y][N];if(!Q.real){if(N-(Q.colspan-1)<N){N-=Q.colspan-1}}}for(x=N;x<=L;x++){Q=e[M][x];if(!Q.real){if(M-(Q.rowspan-1)<M){M-=Q.rowspan-1}}}for(y=M;y<=R;y++){for(x=N;x<=S;x++){Q=e[y][x];if(Q.real){O=Q.colspan-1;P=Q.rowspan-1;if(O){if(x+O>L){L=x+O}}if(P){if(y+P>K){K=y+P}}}}}E.removeClass(E.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=M;y<=K;y++){for(x=N;x<=L;x++){E.addClass(e[y][x].elm,"mceSelected")}}}}b.extend(this,{deleteTable:q,split:A,merge:o,insertRow:k,insertCol:f,deleteCols:m,deleteRows:l,cutRows:C,copyRows:H,pasteRows:z,getPos:D,setStartCell:u,setEndCell:t})}b.create("tinymce.plugins.TablePlugin",{init:function(e,f){var d,j;function h(m){var l=e.selection,k=e.dom.getParent(m||l.getNode(),"table");if(k){return new a(k,e.dom,l)}}function g(){e.getBody().style.webkitUserSelect="";e.dom.removeClass(e.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}c([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(k){e.addButton(k[0],{title:k[1],cmd:k[2],ui:k[3]})});if(!b.isIE){e.onClick.add(function(k,l){l=l.target;if(l.nodeName==="TABLE"){k.selection.select(l)}})}e.onNodeChange.add(function(l,k,o){var m;o=l.selection.getStart();m=l.dom.getParent(o,"td,th,caption");k.setActive("table",o.nodeName==="TABLE"||!!m);if(m&&m.nodeName==="CAPTION"){m=0}k.setDisabled("delete_table",!m);k.setDisabled("delete_col",!m);k.setDisabled("delete_table",!m);k.setDisabled("delete_row",!m);k.setDisabled("col_after",!m);k.setDisabled("col_before",!m);k.setDisabled("row_after",!m);k.setDisabled("row_before",!m);k.setDisabled("row_props",!m);k.setDisabled("cell_props",!m);k.setDisabled("split_cells",!m);k.setDisabled("merge_cells",!m)});e.onInit.add(function(l){var k,o,p=l.dom,m;d=l.windowManager;l.onMouseDown.add(function(q,r){if(r.button!=2){g();o=p.getParent(r.target,"td,th");k=p.getParent(o,"table")}});p.bind(l.getDoc(),"mouseover",function(t){var r,q,s=t.target;if(o&&(m||s!=o)&&(s.nodeName=="TD"||s.nodeName=="TH")){q=p.getParent(s,"table");if(q==k){if(!m){m=h(q);m.setStartCell(o);l.getBody().style.webkitUserSelect="none"}m.setEndCell(s)}r=l.selection.getSel();if(r.removeAllRanges){r.removeAllRanges()}else{r.empty()}t.preventDefault()}});l.onMouseUp.add(function(z,A){var r,t=z.selection,B,C=t.getSel(),q,u,s,w;if(o){if(m){z.getBody().style.webkitUserSelect=""}function v(D,F){var E=new b.dom.TreeWalker(D,D);do{if(D.nodeType==3&&b.trim(D.nodeValue).length!=0){if(F){r.setStart(D,0)}else{r.setEnd(D,D.nodeValue.length)}return}if(D.nodeName=="BR"){if(F){r.setStartBefore(D)}else{r.setEndBefore(D)}return}}while(D=(F?E.next():E.prev()))}B=p.select("td.mceSelected,th.mceSelected");if(B.length>0){r=p.createRng();u=B[0];w=B[B.length-1];v(u,1);q=new b.dom.TreeWalker(u,p.getParent(B[0],"table"));do{if(u.nodeName=="TD"||u.nodeName=="TH"){if(!p.hasClass(u,"mceSelected")){break}s=u}}while(u=q.next());v(s);t.setRng(r)}z.nodeChanged();o=m=k=null}});l.onKeyUp.add(function(q,r){g()});if(l&&l.plugins.contextmenu){l.plugins.contextmenu.onContextMenu.add(function(s,q,u){var v,t=l.selection,r=t.getNode()||l.getBody();if(l.dom.getParent(u,"td")||l.dom.getParent(u,"th")||l.dom.select("td.mceSelected,th.mceSelected").length){q.removeAll();if(r.nodeName=="A"&&!l.dom.getAttrib(r,"name")){q.add({title:"advanced.link_desc",icon:"link",cmd:l.plugins.advlink?"mceAdvLink":"mceLink",ui:true});q.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});q.addSeparator()}if(r.nodeName=="IMG"&&r.className.indexOf("mceItem")==-1){q.add({title:"advanced.image_desc",icon:"image",cmd:l.plugins.advimage?"mceAdvImage":"mceImage",ui:true});q.addSeparator()}q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});q.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});q.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});q.addSeparator();v=q.addMenu({title:"table.cell"});v.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});v.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});v.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});v=q.addMenu({title:"table.row"});v.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});v.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});v.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});v.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});v.addSeparator();v.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});v.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});v.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!j);v.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!j);v=q.addMenu({title:"table.col"});v.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});v.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});v.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!b.isIE){function n(){var q;for(q=l.getBody().lastChild;q&&q.nodeType==3&&!q.nodeValue.length;q=q.previousSibling){}if(q&&q.nodeName=="TABLE"){l.dom.add(l.getBody(),"p",null,'<br mce_bogus="1" />')}}if(b.isGecko){l.onKeyDown.add(function(r,t){var q,s,u=r.dom;if(t.keyCode==37||t.keyCode==38){q=r.selection.getRng();s=u.getParent(q.startContainer,"table");if(s&&r.getBody().firstChild==s){if(isAtStart(q,s)){q=u.createRng();q.setStartBefore(s);q.setEndBefore(s);r.selection.setRng(q);t.preventDefault()}}}})}l.onKeyUp.add(n);l.onSetContent.add(n);l.onVisualAid.add(n);l.onPreProcess.add(function(q,s){var r=s.node.lastChild;if(r&&r.childNodes.length==1&&r.firstChild.nodeName=="BR"){q.dom.remove(r)}});n()}});c({mceTableSplitCells:function(k){k.split()},mceTableMergeCells:function(l){var m,n,k;k=e.dom.getParent(e.selection.getNode(),"th,td");if(k){m=k.rowSpan;n=k.colSpan}if(!e.dom.select("td.mceSelected,th.mceSelected").length){d.open({url:f+"/merge_cells.htm",width:240+parseInt(e.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(e.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:m,cols:n,onaction:function(o){l.merge(k,o.cols,o.rows)},plugin_url:f})}else{l.merge()}},mceTableInsertRowBefore:function(k){k.insertRow(true)},mceTableInsertRowAfter:function(k){k.insertRow()},mceTableInsertColBefore:function(k){k.insertCol(true)},mceTableInsertColAfter:function(k){k.insertCol()},mceTableDeleteCol:function(k){k.deleteCols()},mceTableDeleteRow:function(k){k.deleteRows()},mceTableCutRow:function(k){j=k.cutRows()},mceTableCopyRow:function(k){j=k.copyRows()},mceTablePasteRowBefore:function(k){k.pasteRows(j,true)},mceTablePasteRowAfter:function(k){k.pasteRows(j)},mceTableDelete:function(k){k.deleteTable()}},function(l,k){e.addCommand(k,function(){var m=h();if(m){l(m);e.execCommand("mceRepaint");g()}})});c({mceInsertTable:function(k){d.open({url:f+"/table.htm",width:400+parseInt(e.getLang("table.table_delta_width",0)),height:320+parseInt(e.getLang("table.table_delta_height",0)),inline:1},{plugin_url:f,action:k?k.action:0})},mceTableRowProps:function(){d.open({url:f+"/row.htm",width:400+parseInt(e.getLang("table.rowprops_delta_width",0)),height:295+parseInt(e.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:f})},mceTableCellProps:function(){d.open({url:f+"/cell.htm",width:400+parseInt(e.getLang("table.cellprops_delta_width",0)),height:295+parseInt(e.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:f})}},function(l,k){e.addCommand(k,function(m,n){l(n)})})}});b.PluginManager.add("table",b.plugins.TablePlugin)})(tinymce);
\ No newline at end of file
+(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T<Q+U;T++){if(!g[T]){g[T]=[]}for(S=R;S<R+V;S++){g[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=g[O];if(N){return N[M]}}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];e(H.rows,function(N){e(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function f(M){var N;d.walk(M,function(P){var O;if(P.nodeType==3){e(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=d.isIE?"&nbsp;":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(f(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colSpan",(X-P)+1);s(T,"rowSpan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!g[R]||!g[R][U]){continue}V=g[R][U].elm;if(V!=T){N=d.grep(V.childNodes);e(N,function(Z){T.appendChild(Z)});if(N.length){N=d.grep(T.childNodes);Q=0;e(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;e(g,function(W,X){e(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<g[0].length;R++){if(!g[M][R]){continue}S=g[M][R].elm;if(S!=P){if(!Q){O=a(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colSpan",1);s(R,"rowSpan",1)}for(i=S;i<Q;i++){T.appendChild(f(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}})}function F(M){var N;e(g,function(O,P){e(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;e(g,function(P,Q){e(P,function(S,R){var U,T;if(j(S)){S=g[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=g[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=g[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD,TH");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(C,N){var L=d.VK;var Q=N.keyCode;function O(Y,U,S){var T=Y?"previousSibling":"nextSibling";var Z=C.dom.getParent(U,"tr");var X=Z[T];if(X){z(C,U,X,Y);d.dom.Event.cancel(S);return true}else{var aa=C.dom.getParent(Z,"table");var W=Z.parentNode;var R=W.nodeName.toLowerCase();if(R==="tbody"||R===(Y?"tfoot":"thead")){var V=w(Y,aa,W,"tbody");if(V!==null){return K(Y,V,U,S)}}return M(Y,Z,T,aa,S)}}function w(V,T,U,X){var S=C.dom.select(">"+X,T);var R=S.indexOf(U);if(V&&R===0||!V&&R===S.length-1){return B(V,T)}else{if(R===-1){var W=U.tagName.toLowerCase()==="thead"?0:S.length-1;return S[W]}else{return S[R+(V?-1:1)]}}}function B(U,T){var S=U?"thead":"tfoot";var R=C.dom.select(">"+S,T);return R.length!==0?R[0]:null}function K(V,T,S,U){var R=J(T,V);R&&z(C,S,R,V);d.dom.Event.cancel(U);return true}function M(Y,U,R,X,W){var S=X[R];if(S){F(S);return true}else{var V=C.dom.getParent(X,"td,th");if(V){return O(Y,V,W)}else{var T=J(U,!Y);F(T);return d.dom.Event.cancel(W)}}}function J(S,R){var T=S&&S[R?"lastChild":"firstChild"];return T&&T.nodeName==="BR"?C.dom.getParent(T,"td,th"):T}function F(R){C.selection.setCursorLocation(R,0)}function A(){return Q==L.UP||Q==L.DOWN}function D(R){var T=R.selection.getNode();var S=R.dom.getParent(T,"tr");return S!==null}function P(S){var R=0;var T=S;while(T.previousSibling){T=T.previousSibling;R=R+a(T,"colspan")}return R}function E(T,R){var U=0;var S=0;e(T.children,function(V,W){U=U+a(V,"colspan");S=W;if(U>R){return false}});return S}function z(T,W,Y,V){var X=P(T.dom.getParent(W,"td,th"));var S=E(Y,X);var R=Y.childNodes[S];var U=J(R,V);F(U||R)}function H(R){var T=C.selection.getNode();var U=C.dom.getParent(T,"td,th");var S=C.dom.getParent(R,"td,th");return U&&U!==S&&I(U,S)}function I(S,R){return C.dom.getParent(S,"TABLE")===C.dom.getParent(R,"TABLE")}if(A()&&D(C)){var G=C.selection.getNode();setTimeout(function(){if(H(G)){O(!N.shiftKey&&Q===L.UP,G,N)}},0)}}r.onKeyDown.add(v)}if(!d.isIE){function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){r.dom.add(r.getBody(),"p",null,'<br mce_bogus="1" />')}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&z.childNodes.length==1&&z.firstChild.nodeName=="BR"){w.dom.remove(z)}});if(d.isGecko){r.onKeyDown.add(function(z,B){if(B.keyCode===d.VK.ENTER&&B.shiftKey){var A=z.selection.getRng().startContainer;var C=q.getParent(A,"td,th");if(C){var w=z.getDoc().createTextNode("\uFEFF");q.insertAfter(w,A)}}})}s();r.startContent=r.getContent({format:"raw"})}});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce);
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index c2f307f..832b5e9
-/**\r
- * editor_plugin_src.js\r
- *\r
- * Copyright 2009, Moxiecode Systems AB\r
- * Released under LGPL License.\r
- *\r
- * License: http://tinymce.moxiecode.com/license\r
- * Contributing: http://tinymce.moxiecode.com/contributing\r
- */\r
-\r
-(function(tinymce) {\r
-       var each = tinymce.each;\r
-\r
-       /**\r
-        * Table Grid class.\r
-        */\r
-       function TableGrid(table, dom, selection) {\r
-               var grid, startPos, endPos, selectedCell;\r
-\r
-               buildGrid();\r
-               selectedCell = dom.getParent(selection.getStart(), 'th,td');\r
-               if (selectedCell) {\r
-                       startPos = getPos(selectedCell);\r
-                       endPos = findEndPos();\r
-                       selectedCell = getCell(startPos.x, startPos.y);\r
-               }\r
-\r
-               function cloneNode(node, children) {\r
-                       node = node.cloneNode(children);\r
-                       node.removeAttribute('id');\r
-\r
-                       return node;\r
-               }\r
-\r
-               function buildGrid() {\r
-                       var startY = 0;\r
-\r
-                       grid = [];\r
-\r
-                       each(['thead', 'tbody', 'tfoot'], function(part) {\r
-                               var rows = dom.select(part + ' tr', table);\r
-\r
-                               each(rows, function(tr, y) {\r
-                                       y += startY;\r
-\r
-                                       each(dom.select('td,th', tr), function(td, x) {\r
-                                               var x2, y2, rowspan, colspan;\r
-\r
-                                               // Skip over existing cells produced by rowspan\r
-                                               if (grid[y]) {\r
-                                                       while (grid[y][x])\r
-                                                               x++;\r
-                                               }\r
-\r
-                                               // Get col/rowspan from cell\r
-                                               rowspan = getSpanVal(td, 'rowspan');\r
-                                               colspan = getSpanVal(td, 'colspan');\r
-\r
-                                               // Fill out rowspan/colspan right and down\r
-                                               for (y2 = y; y2 < y + rowspan; y2++) {\r
-                                                       if (!grid[y2])\r
-                                                               grid[y2] = [];\r
-\r
-                                                       for (x2 = x; x2 < x + colspan; x2++) {\r
-                                                               grid[y2][x2] = {\r
-                                                                       part : part,\r
-                                                                       real : y2 == y && x2 == x,\r
-                                                                       elm : td,\r
-                                                                       rowspan : rowspan,\r
-                                                                       colspan : colspan\r
-                                                               };\r
-                                                       }\r
-                                               }\r
-                                       });\r
-                               });\r
-\r
-                               startY += rows.length;\r
-                       });\r
-               };\r
-\r
-               function getCell(x, y) {\r
-                       var row;\r
-\r
-                       row = grid[y];\r
-                       if (row)\r
-                               return row[x];\r
-               };\r
-\r
-               function getSpanVal(td, name) {\r
-                       return parseInt(td.getAttribute(name) || 1);\r
-               };\r
-\r
-               function isCellSelected(cell) {\r
-                       return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;\r
-               };\r
-\r
-               function getSelectedRows() {\r
-                       var rows = [];\r
-\r
-                       each(table.rows, function(row) {\r
-                               each(row.cells, function(cell) {\r
-                                       if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {\r
-                                               rows.push(row);\r
-                                               return false;\r
-                                       }\r
-                               });\r
-                       });\r
-\r
-                       return rows;\r
-               };\r
-\r
-               function deleteTable() {\r
-                       var rng = dom.createRng();\r
-\r
-                       rng.setStartAfter(table);\r
-                       rng.setEndAfter(table);\r
-\r
-                       selection.setRng(rng);\r
-\r
-                       dom.remove(table);\r
-               };\r
-\r
-               function cloneCell(cell) {\r
-                       var formatNode;\r
-\r
-                       // Clone formats\r
-                       tinymce.walk(cell, function(node) {\r
-                               var curNode;\r
-\r
-                               if (node.nodeType == 3) {\r
-                                       each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {\r
-                                               node = cloneNode(node, false);\r
-\r
-                                               if (!formatNode)\r
-                                                       formatNode = curNode = node;\r
-                                               else if (curNode)\r
-                                                       curNode.appendChild(node);\r
-\r
-                                               curNode = node;\r
-                                       });\r
-\r
-                                       // Add something to the inner node\r
-                                       if (curNode)\r
-                                               curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br _mce_bogus="1" />';\r
-\r
-                                       return false;\r
-                               }\r
-                       }, 'childNodes');\r
-\r
-                       cell = cloneNode(cell, false);\r
-                       cell.rowSpan = cell.colSpan = 1;\r
-\r
-                       if (formatNode) {\r
-                               cell.appendChild(formatNode);\r
-                       } else {\r
-                               if (!tinymce.isIE)\r
-                                       cell.innerHTML = '<br _mce_bogus="1" />';\r
-                       }\r
-\r
-                       return cell;\r
-               };\r
-\r
-               function cleanup() {\r
-                       var rng = dom.createRng();\r
-\r
-                       // Empty rows\r
-                       each(dom.select('tr', table), function(tr) {\r
-                               if (tr.cells.length == 0)\r
-                                       dom.remove(tr);\r
-                       });\r
-\r
-                       // Empty table\r
-                       if (dom.select('tr', table).length == 0) {\r
-                               rng.setStartAfter(table);\r
-                               rng.setEndAfter(table);\r
-                               selection.setRng(rng);\r
-                               dom.remove(table);\r
-                               return;\r
-                       }\r
-\r
-                       // Empty header/body/footer\r
-                       each(dom.select('thead,tbody,tfoot', table), function(part) {\r
-                               if (part.rows.length == 0)\r
-                                       dom.remove(part);\r
-                       });\r
-\r
-                       // Restore selection to start position if it still exists\r
-                       buildGrid();\r
-\r
-                       // Restore the selection to the closest table position\r
-                       row = grid[Math.min(grid.length - 1, startPos.y)];\r
-                       if (row) {\r
-                               selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);\r
-                               selection.collapse(true);\r
-                       }\r
-               };\r
-\r
-               function fillLeftDown(x, y, rows, cols) {\r
-                       var tr, x2, r, c, cell;\r
-\r
-                       tr = grid[y][x].elm.parentNode;\r
-                       for (r = 1; r <= rows; r++) {\r
-                               tr = dom.getNext(tr, 'tr');\r
-\r
-                               if (tr) {\r
-                                       // Loop left to find real cell\r
-                                       for (x2 = x; x2 >= 0; x2--) {\r
-                                               cell = grid[y + r][x2].elm;\r
-\r
-                                               if (cell.parentNode == tr) {\r
-                                                       // Append clones after\r
-                                                       for (c = 1; c <= cols; c++)\r
-                                                               dom.insertAfter(cloneCell(cell), cell);\r
-\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-\r
-                                       if (x2 == -1) {\r
-                                               // Insert nodes before first cell\r
-                                               for (c = 1; c <= cols; c++)\r
-                                                       tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);\r
-                                       }\r
-                               }\r
-                       }\r
-               };\r
-\r
-               function split() {\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       var colSpan, rowSpan, newCell, i;\r
-\r
-                                       if (isCellSelected(cell)) {\r
-                                               cell = cell.elm;\r
-                                               colSpan = getSpanVal(cell, 'colspan');\r
-                                               rowSpan = getSpanVal(cell, 'rowspan');\r
-\r
-                                               if (colSpan > 1 || rowSpan > 1) {\r
-                                                       cell.colSpan = cell.rowSpan = 1;\r
-\r
-                                                       // Insert cells right\r
-                                                       for (i = 0; i < colSpan - 1; i++)\r
-                                                               dom.insertAfter(cloneCell(cell), cell);\r
-\r
-                                                       fillLeftDown(x, y, rowSpan - 1, colSpan);\r
-                                               }\r
-                                       }\r
-                               });\r
-                       });\r
-               };\r
-\r
-               function merge(cell, cols, rows) {\r
-                       var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;\r
-\r
-                       // Use specified cell and cols/rows\r
-                       if (cell) {\r
-                               pos = getPos(cell);\r
-                               startX = pos.x;\r
-                               startY = pos.y;\r
-                               endX = startX + (cols - 1);\r
-                               endY = startY + (rows - 1);\r
-                       } else {\r
-                               // Use selection\r
-                               startX = startPos.x;\r
-                               startY = startPos.y;\r
-                               endX = endPos.x;\r
-                               endY = endPos.y;\r
-                       }\r
-\r
-                       // Find start/end cells\r
-                       startCell = getCell(startX, startY);\r
-                       endCell = getCell(endX, endY);\r
-\r
-                       // Check if the cells exists and if they are of the same part for example tbody = tbody\r
-                       if (startCell && endCell && startCell.part == endCell.part) {\r
-                               // Split and rebuild grid\r
-                               split();\r
-                               buildGrid();\r
-\r
-                               // Set row/col span to start cell\r
-                               startCell = getCell(startX, startY).elm;\r
-                               startCell.colSpan = (endX - startX) + 1;\r
-                               startCell.rowSpan = (endY - startY) + 1;\r
-\r
-                               // Remove other cells and add it's contents to the start cell\r
-                               for (y = startY; y <= endY; y++) {\r
-                                       for (x = startX; x <= endX; x++) {\r
-                                               cell = grid[y][x].elm;\r
-\r
-                                               if (cell != startCell) {\r
-                                                       // Move children to startCell\r
-                                                       children = tinymce.grep(cell.childNodes);\r
-                                                       each(children, function(node, i) {\r
-                                                               // Jump over last BR element\r
-                                                               if (node.nodeName != 'BR' || i != children.length - 1)\r
-                                                                       startCell.appendChild(node);\r
-                                                       });\r
-\r
-                                                       // Remove cell\r
-                                                       dom.remove(cell);\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // Remove empty rows etc and restore caret location\r
-                               cleanup();\r
-                       }\r
-               };\r
-\r
-               function insertRow(before) {\r
-                       var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;\r
-\r
-                       // Find first/last row\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       if (isCellSelected(cell)) {\r
-                                               cell = cell.elm;\r
-                                               rowElm = cell.parentNode;\r
-                                               newRow = cloneNode(rowElm, false);\r
-                                               posY = y;\r
-\r
-                                               if (before)\r
-                                                       return false;\r
-                                       }\r
-                               });\r
-\r
-                               if (before)\r
-                                       return !posY;\r
-                       });\r
-\r
-                       for (x = 0; x < grid[0].length; x++) {\r
-                               cell = grid[posY][x].elm;\r
-\r
-                               if (cell != lastCell) {\r
-                                       if (!before) {\r
-                                               rowSpan = getSpanVal(cell, 'rowspan');\r
-                                               if (rowSpan > 1) {\r
-                                                       cell.rowSpan = rowSpan + 1;\r
-                                                       continue;\r
-                                               }\r
-                                       } else {\r
-                                               // Check if cell above can be expanded\r
-                                               if (posY > 0 && grid[posY - 1][x]) {\r
-                                                       otherCell = grid[posY - 1][x].elm;\r
-                                                       rowSpan = getSpanVal(otherCell, 'rowspan');\r
-                                                       if (rowSpan > 1) {\r
-                                                               otherCell.rowSpan = rowSpan + 1;\r
-                                                               continue;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-\r
-                                       // Insert new cell into new row\r
-                                       newCell = cloneCell(cell)\r
-                                       newCell.colSpan = cell.colSpan;\r
-                                       newRow.appendChild(newCell);\r
-\r
-                                       lastCell = cell;\r
-                               }\r
-                       }\r
-\r
-                       if (newRow.hasChildNodes()) {\r
-                               if (!before)\r
-                                       dom.insertAfter(newRow, rowElm);\r
-                               else\r
-                                       rowElm.parentNode.insertBefore(newRow, rowElm);\r
-                       }\r
-               };\r
-\r
-               function insertCol(before) {\r
-                       var posX, lastCell;\r
-\r
-                       // Find first/last column\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       if (isCellSelected(cell)) {\r
-                                               posX = x;\r
-\r
-                                               if (before)\r
-                                                       return false;\r
-                                       }\r
-                               });\r
-\r
-                               if (before)\r
-                                       return !posX;\r
-                       });\r
-\r
-                       each(grid, function(row, y) {\r
-                               var cell = row[posX].elm, rowSpan, colSpan;\r
-\r
-                               if (cell != lastCell) {\r
-                                       colSpan = getSpanVal(cell, 'colspan');\r
-                                       rowSpan = getSpanVal(cell, 'rowspan');\r
-\r
-                                       if (colSpan == 1) {\r
-                                               if (!before) {\r
-                                                       dom.insertAfter(cloneCell(cell), cell);\r
-                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);\r
-                                               } else {\r
-                                                       cell.parentNode.insertBefore(cloneCell(cell), cell);\r
-                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);\r
-                                               }\r
-                                       } else\r
-                                               cell.colSpan++;\r
-\r
-                                       lastCell = cell;\r
-                               }\r
-                       });\r
-               };\r
-\r
-               function deleteCols() {\r
-                       var cols = [];\r
-\r
-                       // Get selected column indexes\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {\r
-                                               each(grid, function(row) {\r
-                                                       var cell = row[x].elm, colSpan;\r
-\r
-                                                       colSpan = getSpanVal(cell, 'colspan');\r
-\r
-                                                       if (colSpan > 1)\r
-                                                               cell.colSpan = colSpan - 1;\r
-                                                       else\r
-                                                               dom.remove(cell);\r
-                                               });\r
-\r
-                                               cols.push(x);\r
-                                       }\r
-                               });\r
-                       });\r
-\r
-                       cleanup();\r
-               };\r
-\r
-               function deleteRows() {\r
-                       var rows;\r
-\r
-                       function deleteRow(tr) {\r
-                               var nextTr, pos, lastCell;\r
-\r
-                               nextTr = dom.getNext(tr, 'tr');\r
-\r
-                               // Move down row spanned cells\r
-                               each(tr.cells, function(cell) {\r
-                                       var rowSpan = getSpanVal(cell, 'rowspan');\r
-\r
-                                       if (rowSpan > 1) {\r
-                                               cell.rowSpan = rowSpan - 1;\r
-                                               pos = getPos(cell);\r
-                                               fillLeftDown(pos.x, pos.y, 1, 1);\r
-                                       }\r
-                               });\r
-\r
-                               // Delete cells\r
-                               pos = getPos(tr.cells[0]);\r
-                               each(grid[pos.y], function(cell) {\r
-                                       var rowSpan;\r
-\r
-                                       cell = cell.elm;\r
-\r
-                                       if (cell != lastCell) {\r
-                                               rowSpan = getSpanVal(cell, 'rowspan');\r
-\r
-                                               if (rowSpan <= 1)\r
-                                                       dom.remove(cell);\r
-                                               else\r
-                                                       cell.rowSpan = rowSpan - 1;\r
-\r
-                                               lastCell = cell;\r
-                                       }\r
-                               });\r
-                       };\r
-\r
-                       // Get selected rows and move selection out of scope\r
-                       rows = getSelectedRows();\r
-\r
-                       // Delete all selected rows\r
-                       each(rows.reverse(), function(tr) {\r
-                               deleteRow(tr);\r
-                       });\r
-\r
-                       cleanup();\r
-               };\r
-\r
-               function cutRows() {\r
-                       var rows = getSelectedRows();\r
-\r
-                       dom.remove(rows);\r
-                       cleanup();\r
-\r
-                       return rows;\r
-               };\r
-\r
-               function copyRows() {\r
-                       var rows = getSelectedRows();\r
-\r
-                       each(rows, function(row, i) {\r
-                               rows[i] = cloneNode(row, true);\r
-                       });\r
-\r
-                       return rows;\r
-               };\r
-\r
-               function pasteRows(rows, before) {\r
-                       var selectedRows = getSelectedRows(),\r
-                               targetRow = selectedRows[before ? 0 : selectedRows.length - 1],\r
-                               targetCellCount = targetRow.cells.length;\r
-\r
-                       // Calc target cell count\r
-                       each(grid, function(row) {\r
-                               var match;\r
-\r
-                               targetCellCount = 0;\r
-                               each(row, function(cell, x) {\r
-                                       if (cell.real)\r
-                                               targetCellCount += cell.colspan;\r
-\r
-                                       if (cell.elm.parentNode == targetRow)\r
-                                               match = 1;\r
-                               });\r
-\r
-                               if (match)\r
-                                       return false;\r
-                       });\r
-\r
-                       if (!before)\r
-                               rows.reverse();\r
-\r
-                       each(rows, function(row) {\r
-                               var cellCount = row.cells.length, cell;\r
-\r
-                               // Remove col/rowspans\r
-                               for (i = 0; i < cellCount; i++) {\r
-                                       cell = row.cells[i];\r
-                                       cell.colSpan = cell.rowSpan = 1;\r
-                               }\r
-\r
-                               // Needs more cells\r
-                               for (i = cellCount; i < targetCellCount; i++)\r
-                                       row.appendChild(cloneCell(row.cells[cellCount - 1]));\r
-\r
-                               // Needs less cells\r
-                               for (i = targetCellCount; i < cellCount; i++)\r
-                                       dom.remove(row.cells[i]);\r
-\r
-                               // Add before/after\r
-                               if (before)\r
-                                       targetRow.parentNode.insertBefore(row, targetRow);\r
-                               else\r
-                                       dom.insertAfter(row, targetRow);\r
-                       });\r
-               };\r
-\r
-               function getPos(target) {\r
-                       var pos;\r
-\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       if (cell.elm == target) {\r
-                                               pos = {x : x, y : y};\r
-                                               return false;\r
-                                       }\r
-                               });\r
-\r
-                               return !pos;\r
-                       });\r
-\r
-                       return pos;\r
-               };\r
-\r
-               function setStartCell(cell) {\r
-                       startPos = getPos(cell);\r
-               };\r
-\r
-               function findEndPos() {\r
-                       var pos, maxX, maxY;\r
-\r
-                       maxX = maxY = 0;\r
-\r
-                       each(grid, function(row, y) {\r
-                               each(row, function(cell, x) {\r
-                                       var colSpan, rowSpan;\r
-\r
-                                       if (isCellSelected(cell)) {\r
-                                               cell = grid[y][x];\r
-\r
-                                               if (x > maxX)\r
-                                                       maxX = x;\r
-\r
-                                               if (y > maxY)\r
-                                                       maxY = y;\r
-\r
-                                               if (cell.real) {\r
-                                                       colSpan = cell.colspan - 1;\r
-                                                       rowSpan = cell.rowspan - 1;\r
-\r
-                                                       if (colSpan) {\r
-                                                               if (x + colSpan > maxX)\r
-                                                                       maxX = x + colSpan;\r
-                                                       }\r
-\r
-                                                       if (rowSpan) {\r
-                                                               if (y + rowSpan > maxY)\r
-                                                                       maxY = y + rowSpan;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               });\r
-                       });\r
-\r
-                       return {x : maxX, y : maxY};\r
-               };\r
-\r
-               function setEndCell(cell) {\r
-                       var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;\r
-\r
-                       endPos = getPos(cell);\r
-\r
-                       if (startPos && endPos) {\r
-                               // Get start/end positions\r
-                               startX = Math.min(startPos.x, endPos.x);\r
-                               startY = Math.min(startPos.y, endPos.y);\r
-                               endX = Math.max(startPos.x, endPos.x);\r
-                               endY = Math.max(startPos.y, endPos.y);\r
-\r
-                               // Expand end positon to include spans\r
-                               maxX = endX;\r
-                               maxY = endY;\r
-\r
-                               // Expand startX\r
-                               for (y = startY; y <= maxY; y++) {\r
-                                       cell = grid[y][startX];\r
-\r
-                                       if (!cell.real) {\r
-                                               if (startX - (cell.colspan - 1) < startX)\r
-                                                       startX -= cell.colspan - 1;\r
-                                       }\r
-                               }\r
-\r
-                               // Expand startY\r
-                               for (x = startX; x <= maxX; x++) {\r
-                                       cell = grid[startY][x];\r
-\r
-                                       if (!cell.real) {\r
-                                               if (startY - (cell.rowspan - 1) < startY)\r
-                                                       startY -= cell.rowspan - 1;\r
-                                       }\r
-                               }\r
-\r
-                               // Find max X, Y\r
-                               for (y = startY; y <= endY; y++) {\r
-                                       for (x = startX; x <= endX; x++) {\r
-                                               cell = grid[y][x];\r
-\r
-                                               if (cell.real) {\r
-                                                       colSpan = cell.colspan - 1;\r
-                                                       rowSpan = cell.rowspan - 1;\r
-\r
-                                                       if (colSpan) {\r
-                                                               if (x + colSpan > maxX)\r
-                                                                       maxX = x + colSpan;\r
-                                                       }\r
-\r
-                                                       if (rowSpan) {\r
-                                                               if (y + rowSpan > maxY)\r
-                                                                       maxY = y + rowSpan;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // Remove current selection\r
-                               dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');\r
-\r
-                               // Add new selection\r
-                               for (y = startY; y <= maxY; y++) {\r
-                                       for (x = startX; x <= maxX; x++)\r
-                                               dom.addClass(grid[y][x].elm, 'mceSelected');\r
-                               }\r
-                       }\r
-               };\r
-\r
-               // Expose to public\r
-               tinymce.extend(this, {\r
-                       deleteTable : deleteTable,\r
-                       split : split,\r
-                       merge : merge,\r
-                       insertRow : insertRow,\r
-                       insertCol : insertCol,\r
-                       deleteCols : deleteCols,\r
-                       deleteRows : deleteRows,\r
-                       cutRows : cutRows,\r
-                       copyRows : copyRows,\r
-                       pasteRows : pasteRows,\r
-                       getPos : getPos,\r
-                       setStartCell : setStartCell,\r
-                       setEndCell : setEndCell\r
-               });\r
-       };\r
-\r
-       tinymce.create('tinymce.plugins.TablePlugin', {\r
-               init : function(ed, url) {\r
-                       var winMan, clipboardRows;\r
-\r
-                       function createTableGrid(node) {\r
-                               var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');\r
-\r
-                               if (tblElm)\r
-                                       return new TableGrid(tblElm, ed.dom, selection);\r
-                       };\r
-\r
-                       function cleanup() {\r
-                               // Restore selection possibilities\r
-                               ed.getBody().style.webkitUserSelect = '';\r
-                               ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');\r
-                       };\r
-\r
-                       // Register buttons\r
-                       each([\r
-                               ['table', 'table.desc', 'mceInsertTable', true],\r
-                               ['delete_table', 'table.del', 'mceTableDelete'],\r
-                               ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],\r
-                               ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],\r
-                               ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],\r
-                               ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],\r
-                               ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],\r
-                               ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],\r
-                               ['row_props', 'table.row_desc', 'mceTableRowProps', true],\r
-                               ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],\r
-                               ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],\r
-                               ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]\r
-                       ], function(c) {\r
-                               ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});\r
-                       });\r
-\r
-                       // Select whole table is a table border is clicked\r
-                       if (!tinymce.isIE) {\r
-                               ed.onClick.add(function(ed, e) {\r
-                                       e = e.target;\r
-\r
-                                       if (e.nodeName === 'TABLE')\r
-                                               ed.selection.select(e);\r
-                               });\r
-                       }\r
-\r
-                       // Handle node change updates\r
-                       ed.onNodeChange.add(function(ed, cm, n) {\r
-                               var p;\r
-\r
-                               n = ed.selection.getStart();\r
-                               p = ed.dom.getParent(n, 'td,th,caption');\r
-                               cm.setActive('table', n.nodeName === 'TABLE' || !!p);\r
-\r
-                               // Disable table tools if we are in caption\r
-                               if (p && p.nodeName === 'CAPTION')\r
-                                       p = 0;\r
-\r
-                               cm.setDisabled('delete_table', !p);\r
-                               cm.setDisabled('delete_col', !p);\r
-                               cm.setDisabled('delete_table', !p);\r
-                               cm.setDisabled('delete_row', !p);\r
-                               cm.setDisabled('col_after', !p);\r
-                               cm.setDisabled('col_before', !p);\r
-                               cm.setDisabled('row_after', !p);\r
-                               cm.setDisabled('row_before', !p);\r
-                               cm.setDisabled('row_props', !p);\r
-                               cm.setDisabled('cell_props', !p);\r
-                               cm.setDisabled('split_cells', !p);\r
-                               cm.setDisabled('merge_cells', !p);\r
-                       });\r
-\r
-                       ed.onInit.add(function(ed) {\r
-                               var startTable, startCell, dom = ed.dom, tableGrid;\r
-\r
-                               winMan = ed.windowManager;\r
-\r
-                               // Add cell selection logic\r
-                               ed.onMouseDown.add(function(ed, e) {\r
-                                       if (e.button != 2) {\r
-                                               cleanup();\r
-\r
-                                               startCell = dom.getParent(e.target, 'td,th');\r
-                                               startTable = dom.getParent(startCell, 'table');\r
-                                       }\r
-                               });\r
-\r
-                               dom.bind(ed.getDoc(), 'mouseover', function(e) {\r
-                                       var sel, table, target = e.target;\r
-\r
-                                       if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {\r
-                                               table = dom.getParent(target, 'table');\r
-                                               if (table == startTable) {\r
-                                                       if (!tableGrid) {\r
-                                                               tableGrid = createTableGrid(table);\r
-                                                               tableGrid.setStartCell(startCell);\r
-\r
-                                                               ed.getBody().style.webkitUserSelect = 'none';\r
-                                                       }\r
-\r
-                                                       tableGrid.setEndCell(target);\r
-                                               }\r
-\r
-                                               // Remove current selection\r
-                                               sel = ed.selection.getSel();\r
-\r
-                                               if (sel.removeAllRanges)\r
-                                                       sel.removeAllRanges();\r
-                                               else\r
-                                                       sel.empty();\r
-\r
-                                               e.preventDefault();\r
-                                       }\r
-                               });\r
-\r
-                               ed.onMouseUp.add(function(ed, e) {\r
-                                       var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;\r
-\r
-                                       // Move selection to startCell\r
-                                       if (startCell) {\r
-                                               if (tableGrid)\r
-                                                       ed.getBody().style.webkitUserSelect = '';\r
-\r
-                                               function setPoint(node, start) {\r
-                                                       var walker = new tinymce.dom.TreeWalker(node, node);\r
-\r
-                                                       do {\r
-                                                               // Text node\r
-                                                               if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {\r
-                                                                       if (start)\r
-                                                                               rng.setStart(node, 0);\r
-                                                                       else\r
-                                                                               rng.setEnd(node, node.nodeValue.length);\r
-\r
-                                                                       return;\r
-                                                               }\r
-\r
-                                                               // BR element\r
-                                                               if (node.nodeName == 'BR') {\r
-                                                                       if (start)\r
-                                                                               rng.setStartBefore(node);\r
-                                                                       else\r
-                                                                               rng.setEndBefore(node);\r
-\r
-                                                                       return;\r
-                                                               }\r
-                                                       } while (node = (start ? walker.next() : walker.prev()));\r
-                                               };\r
-\r
-                                               // Try to expand text selection as much as we can only Gecko supports cell selection\r
-                                               selectedCells = dom.select('td.mceSelected,th.mceSelected');\r
-                                               if (selectedCells.length > 0) {\r
-                                                       rng = dom.createRng();\r
-                                                       node = selectedCells[0];\r
-                                                       endNode = selectedCells[selectedCells.length - 1];\r
-\r
-                                                       setPoint(node, 1);\r
-                                                       walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));\r
-\r
-                                                       do {\r
-                                                               if (node.nodeName == 'TD' || node.nodeName == 'TH') {\r
-                                                                       if (!dom.hasClass(node, 'mceSelected'))\r
-                                                                               break;\r
-\r
-                                                                       lastNode = node;\r
-                                                               }\r
-                                                       } while (node = walker.next());\r
-\r
-                                                       setPoint(lastNode);\r
-\r
-                                                       sel.setRng(rng);\r
-                                               }\r
-\r
-                                               ed.nodeChanged();\r
-                                               startCell = tableGrid = startTable = null;\r
-                                       }\r
-                               });\r
-\r
-                               ed.onKeyUp.add(function(ed, e) {\r
-                                       cleanup();\r
-                               });\r
-\r
-                               // Add context menu\r
-                               if (ed && ed.plugins.contextmenu) {\r
-                                       ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {\r
-                                               var sm, se = ed.selection, el = se.getNode() || ed.getBody();\r
-\r
-                                               if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {\r
-                                                       m.removeAll();\r
-\r
-                                                       if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {\r
-                                                               m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});\r
-                                                               m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});\r
-                                                               m.addSeparator();\r
-                                                       }\r
-\r
-                                                       if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {\r
-                                                               m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});\r
-                                                               m.addSeparator();\r
-                                                       }\r
-\r
-                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});\r
-                                                       m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});\r
-                                                       m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});\r
-                                                       m.addSeparator();\r
-\r
-                                                       // Cell menu\r
-                                                       sm = m.addMenu({title : 'table.cell'});\r
-                                                       sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});\r
-                                                       sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});\r
-                                                       sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});\r
-\r
-                                                       // Row menu\r
-                                                       sm = m.addMenu({title : 'table.row'});\r
-                                                       sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});\r
-                                                       sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});\r
-                                                       sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});\r
-                                                       sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});\r
-                                                       sm.addSeparator();\r
-                                                       sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});\r
-                                                       sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});\r
-                                                       sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);\r
-                                                       sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);\r
-\r
-                                                       // Column menu\r
-                                                       sm = m.addMenu({title : 'table.col'});\r
-                                                       sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});\r
-                                                       sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});\r
-                                                       sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});\r
-                                               } else\r
-                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});\r
-                                       });\r
-                               }\r
-\r
-                               // Fixes an issue on Gecko where it's impossible to place the caret behind a table\r
-                               // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled\r
-                               if (!tinymce.isIE) {\r
-                                       function fixTableCaretPos() {\r
-                                               var last;\r
-\r
-                                               // Skip empty text nodes form the end\r
-                                               for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;\r
-\r
-                                               if (last && last.nodeName == 'TABLE')\r
-                                                       ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');\r
-                                       };\r
-\r
-                                       // Fixes an bug where it's impossible to place the caret before a table in Gecko\r
-                                       // this fix solves it by detecting when the caret is at the beginning of such a table\r
-                                       // and then manually moves the caret infront of the table\r
-                                       if (tinymce.isGecko) {\r
-                                               ed.onKeyDown.add(function(ed, e) {\r
-                                                       var rng, table, dom = ed.dom;\r
-\r
-                                                       // On gecko it's not possible to place the caret before a table\r
-                                                       if (e.keyCode == 37 || e.keyCode == 38) {\r
-                                                               rng = ed.selection.getRng();\r
-                                                               table = dom.getParent(rng.startContainer, 'table');\r
-\r
-                                                               if (table && ed.getBody().firstChild == table) {\r
-                                                                       if (isAtStart(rng, table)) {\r
-                                                                               rng = dom.createRng();\r
-\r
-                                                                               rng.setStartBefore(table);\r
-                                                                               rng.setEndBefore(table);\r
-\r
-                                                                               ed.selection.setRng(rng);\r
-\r
-                                                                               e.preventDefault();\r
-                                                                       }\r
-                                                               }\r
-                                                       }\r
-                                               });\r
-                                       }\r
-\r
-                                       ed.onKeyUp.add(fixTableCaretPos);\r
-                                       ed.onSetContent.add(fixTableCaretPos);\r
-                                       ed.onVisualAid.add(fixTableCaretPos);\r
-\r
-                                       ed.onPreProcess.add(function(ed, o) {\r
-                                               var last = o.node.lastChild;\r
-\r
-                                               if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')\r
-                                                       ed.dom.remove(last);\r
-                                       });\r
-\r
-                                       fixTableCaretPos();\r
-                               }\r
-                       });\r
-\r
-                       // Register action commands\r
-                       each({\r
-                               mceTableSplitCells : function(grid) {\r
-                                       grid.split();\r
-                               },\r
-\r
-                               mceTableMergeCells : function(grid) {\r
-                                       var rowSpan, colSpan, cell;\r
-\r
-                                       cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');\r
-                                       if (cell) {\r
-                                               rowSpan = cell.rowSpan;\r
-                                               colSpan = cell.colSpan;\r
-                                       }\r
-\r
-                                       if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {\r
-                                               winMan.open({\r
-                                                       url : url + '/merge_cells.htm',\r
-                                                       width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),\r
-                                                       height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),\r
-                                                       inline : 1\r
-                                               }, {\r
-                                                       rows : rowSpan,\r
-                                                       cols : colSpan,\r
-                                                       onaction : function(data) {\r
-                                                               grid.merge(cell, data.cols, data.rows);\r
-                                                       },\r
-                                                       plugin_url : url\r
-                                               });\r
-                                       } else\r
-                                               grid.merge();\r
-                               },\r
-\r
-                               mceTableInsertRowBefore : function(grid) {\r
-                                       grid.insertRow(true);\r
-                               },\r
-\r
-                               mceTableInsertRowAfter : function(grid) {\r
-                                       grid.insertRow();\r
-                               },\r
-\r
-                               mceTableInsertColBefore : function(grid) {\r
-                                       grid.insertCol(true);\r
-                               },\r
-\r
-                               mceTableInsertColAfter : function(grid) {\r
-                                       grid.insertCol();\r
-                               },\r
-\r
-                               mceTableDeleteCol : function(grid) {\r
-                                       grid.deleteCols();\r
-                               },\r
-\r
-                               mceTableDeleteRow : function(grid) {\r
-                                       grid.deleteRows();\r
-                               },\r
-\r
-                               mceTableCutRow : function(grid) {\r
-                                       clipboardRows = grid.cutRows();\r
-                               },\r
-\r
-                               mceTableCopyRow : function(grid) {\r
-                                       clipboardRows = grid.copyRows();\r
-                               },\r
-\r
-                               mceTablePasteRowBefore : function(grid) {\r
-                                       grid.pasteRows(clipboardRows, true);\r
-                               },\r
-\r
-                               mceTablePasteRowAfter : function(grid) {\r
-                                       grid.pasteRows(clipboardRows);\r
-                               },\r
-\r
-                               mceTableDelete : function(grid) {\r
-                                       grid.deleteTable();\r
-                               }\r
-                       }, function(func, name) {\r
-                               ed.addCommand(name, function() {\r
-                                       var grid = createTableGrid();\r
-\r
-                                       if (grid) {\r
-                                               func(grid);\r
-                                               ed.execCommand('mceRepaint');\r
-                                               cleanup();\r
-                                       }\r
-                               });\r
-                       });\r
-\r
-                       // Register dialog commands\r
-                       each({\r
-                               mceInsertTable : function(val) {\r
-                                       winMan.open({\r
-                                               url : url + '/table.htm',\r
-                                               width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),\r
-                                               height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),\r
-                                               inline : 1\r
-                                       }, {\r
-                                               plugin_url : url,\r
-                                               action : val ? val.action : 0\r
-                                       });\r
-                               },\r
-\r
-                               mceTableRowProps : function() {\r
-                                       winMan.open({\r
-                                               url : url + '/row.htm',\r
-                                               width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),\r
-                                               height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),\r
-                                               inline : 1\r
-                                       }, {\r
-                                               plugin_url : url\r
-                                       });\r
-                               },\r
-\r
-                               mceTableCellProps : function() {\r
-                                       winMan.open({\r
-                                               url : url + '/cell.htm',\r
-                                               width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),\r
-                                               height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),\r
-                                               inline : 1\r
-                                       }, {\r
-                                               plugin_url : url\r
-                                       });\r
-                               }\r
-                       }, function(func, name) {\r
-                               ed.addCommand(name, function(ui, val) {\r
-                                       func(val);\r
-                               });\r
-                       });\r
-               }\r
-       });\r
-\r
-       // Register plugin\r
-       tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);\r
-})(tinymce);
\ No newline at end of file
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+       var each = tinymce.each;
+
+       // Checks if the selection/caret is at the start of the specified block element
+       function isAtStart(rng, par) {
+               var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
+
+               rng2.setStartBefore(par);
+               rng2.setEnd(rng.endContainer, rng.endOffset);
+
+               elm = doc.createElement('body');
+               elm.appendChild(rng2.cloneContents());
+
+               // Check for text characters of other elements that should be treated as content
+               return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
+       };
+
+       function getSpanVal(td, name) {
+               return parseInt(td.getAttribute(name) || 1);
+       }
+
+       /**
+        * Table Grid class.
+        */
+       function TableGrid(table, dom, selection) {
+               var grid, startPos, endPos, selectedCell;
+
+               buildGrid();
+               selectedCell = dom.getParent(selection.getStart(), 'th,td');
+               if (selectedCell) {
+                       startPos = getPos(selectedCell);
+                       endPos = findEndPos();
+                       selectedCell = getCell(startPos.x, startPos.y);
+               }
+
+               function cloneNode(node, children) {
+                       node = node.cloneNode(children);
+                       node.removeAttribute('id');
+
+                       return node;
+               }
+
+               function buildGrid() {
+                       var startY = 0;
+
+                       grid = [];
+
+                       each(['thead', 'tbody', 'tfoot'], function(part) {
+                               var rows = dom.select('> ' + part + ' tr', table);
+
+                               each(rows, function(tr, y) {
+                                       y += startY;
+
+                                       each(dom.select('> td, > th', tr), function(td, x) {
+                                               var x2, y2, rowspan, colspan;
+
+                                               // Skip over existing cells produced by rowspan
+                                               if (grid[y]) {
+                                                       while (grid[y][x])
+                                                               x++;
+                                               }
+
+                                               // Get col/rowspan from cell
+                                               rowspan = getSpanVal(td, 'rowspan');
+                                               colspan = getSpanVal(td, 'colspan');
+
+                                               // Fill out rowspan/colspan right and down
+                                               for (y2 = y; y2 < y + rowspan; y2++) {
+                                                       if (!grid[y2])
+                                                               grid[y2] = [];
+
+                                                       for (x2 = x; x2 < x + colspan; x2++) {
+                                                               grid[y2][x2] = {
+                                                                       part : part,
+                                                                       real : y2 == y && x2 == x,
+                                                                       elm : td,
+                                                                       rowspan : rowspan,
+                                                                       colspan : colspan
+                                                               };
+                                                       }
+                                               }
+                                       });
+                               });
+
+                               startY += rows.length;
+                       });
+               };
+
+               function getCell(x, y) {
+                       var row;
+
+                       row = grid[y];
+                       if (row)
+                               return row[x];
+               };
+
+               function setSpanVal(td, name, val) {
+                       if (td) {
+                               val = parseInt(val);
+
+                               if (val === 1)
+                                       td.removeAttribute(name, 1);
+                               else
+                                       td.setAttribute(name, val, 1);
+                       }
+               }
+
+               function isCellSelected(cell) {
+                       return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
+               };
+
+               function getSelectedRows() {
+                       var rows = [];
+
+                       each(table.rows, function(row) {
+                               each(row.cells, function(cell) {
+                                       if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
+                                               rows.push(row);
+                                               return false;
+                                       }
+                               });
+                       });
+
+                       return rows;
+               };
+
+               function deleteTable() {
+                       var rng = dom.createRng();
+
+                       rng.setStartAfter(table);
+                       rng.setEndAfter(table);
+
+                       selection.setRng(rng);
+
+                       dom.remove(table);
+               };
+
+               function cloneCell(cell) {
+                       var formatNode;
+
+                       // Clone formats
+                       tinymce.walk(cell, function(node) {
+                               var curNode;
+
+                               if (node.nodeType == 3) {
+                                       each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
+                                               node = cloneNode(node, false);
+
+                                               if (!formatNode)
+                                                       formatNode = curNode = node;
+                                               else if (curNode)
+                                                       curNode.appendChild(node);
+
+                                               curNode = node;
+                                       });
+
+                                       // Add something to the inner node
+                                       if (curNode)
+                                               curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />';
+
+                                       return false;
+                               }
+                       }, 'childNodes');
+
+                       cell = cloneNode(cell, false);
+                       setSpanVal(cell, 'rowSpan', 1);
+                       setSpanVal(cell, 'colSpan', 1);
+
+                       if (formatNode) {
+                               cell.appendChild(formatNode);
+                       } else {
+                               if (!tinymce.isIE)
+                                       cell.innerHTML = '<br data-mce-bogus="1" />';
+                       }
+
+                       return cell;
+               };
+
+               function cleanup() {
+                       var rng = dom.createRng();
+
+                       // Empty rows
+                       each(dom.select('tr', table), function(tr) {
+                               if (tr.cells.length == 0)
+                                       dom.remove(tr);
+                       });
+
+                       // Empty table
+                       if (dom.select('tr', table).length == 0) {
+                               rng.setStartAfter(table);
+                               rng.setEndAfter(table);
+                               selection.setRng(rng);
+                               dom.remove(table);
+                               return;
+                       }
+
+                       // Empty header/body/footer
+                       each(dom.select('thead,tbody,tfoot', table), function(part) {
+                               if (part.rows.length == 0)
+                                       dom.remove(part);
+                       });
+
+                       // Restore selection to start position if it still exists
+                       buildGrid();
+
+                       // Restore the selection to the closest table position
+                       row = grid[Math.min(grid.length - 1, startPos.y)];
+                       if (row) {
+                               selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
+                               selection.collapse(true);
+                       }
+               };
+
+               function fillLeftDown(x, y, rows, cols) {
+                       var tr, x2, r, c, cell;
+
+                       tr = grid[y][x].elm.parentNode;
+                       for (r = 1; r <= rows; r++) {
+                               tr = dom.getNext(tr, 'tr');
+
+                               if (tr) {
+                                       // Loop left to find real cell
+                                       for (x2 = x; x2 >= 0; x2--) {
+                                               cell = grid[y + r][x2].elm;
+
+                                               if (cell.parentNode == tr) {
+                                                       // Append clones after
+                                                       for (c = 1; c <= cols; c++)
+                                                               dom.insertAfter(cloneCell(cell), cell);
+
+                                                       break;
+                                               }
+                                       }
+
+                                       if (x2 == -1) {
+                                               // Insert nodes before first cell
+                                               for (c = 1; c <= cols; c++)
+                                                       tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
+                                       }
+                               }
+                       }
+               };
+
+               function split() {
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       var colSpan, rowSpan, newCell, i;
+
+                                       if (isCellSelected(cell)) {
+                                               cell = cell.elm;
+                                               colSpan = getSpanVal(cell, 'colspan');
+                                               rowSpan = getSpanVal(cell, 'rowspan');
+
+                                               if (colSpan > 1 || rowSpan > 1) {
+                                                       setSpanVal(cell, 'rowSpan', 1);
+                                                       setSpanVal(cell, 'colSpan', 1);
+
+                                                       // Insert cells right
+                                                       for (i = 0; i < colSpan - 1; i++)
+                                                               dom.insertAfter(cloneCell(cell), cell);
+
+                                                       fillLeftDown(x, y, rowSpan - 1, colSpan);
+                                               }
+                                       }
+                               });
+                       });
+               };
+
+               function merge(cell, cols, rows) {
+                       var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
+
+                       // Use specified cell and cols/rows
+                       if (cell) {
+                               pos = getPos(cell);
+                               startX = pos.x;
+                               startY = pos.y;
+                               endX = startX + (cols - 1);
+                               endY = startY + (rows - 1);
+                       } else {
+                               // Use selection
+                               startX = startPos.x;
+                               startY = startPos.y;
+                               endX = endPos.x;
+                               endY = endPos.y;
+                       }
+
+                       // Find start/end cells
+                       startCell = getCell(startX, startY);
+                       endCell = getCell(endX, endY);
+
+                       // Check if the cells exists and if they are of the same part for example tbody = tbody
+                       if (startCell && endCell && startCell.part == endCell.part) {
+                               // Split and rebuild grid
+                               split();
+                               buildGrid();
+
+                               // Set row/col span to start cell
+                               startCell = getCell(startX, startY).elm;
+                               setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
+                               setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
+
+                               // Remove other cells and add it's contents to the start cell
+                               for (y = startY; y <= endY; y++) {
+                                       for (x = startX; x <= endX; x++) {
+                                               if (!grid[y] || !grid[y][x])
+                                                       continue;
+
+                                               cell = grid[y][x].elm;
+
+                                               if (cell != startCell) {
+                                                       // Move children to startCell
+                                                       children = tinymce.grep(cell.childNodes);
+                                                       each(children, function(node) {
+                                                               startCell.appendChild(node);
+                                                       });
+
+                                                       // Remove bogus nodes if there is children in the target cell
+                                                       if (children.length) {
+                                                               children = tinymce.grep(startCell.childNodes);
+                                                               count = 0;
+                                                               each(children, function(node) {
+                                                                       if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
+                                                                               startCell.removeChild(node);
+                                                               });
+                                                       }
+                                                       
+                                                       // Remove cell
+                                                       dom.remove(cell);
+                                               }
+                                       }
+                               }
+
+                               // Remove empty rows etc and restore caret location
+                               cleanup();
+                       }
+               };
+
+               function insertRow(before) {
+                       var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
+
+                       // Find first/last row
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell)) {
+                                               cell = cell.elm;
+                                               rowElm = cell.parentNode;
+                                               newRow = cloneNode(rowElm, false);
+                                               posY = y;
+
+                                               if (before)
+                                                       return false;
+                                       }
+                               });
+
+                               if (before)
+                                       return !posY;
+                       });
+
+                       for (x = 0; x < grid[0].length; x++) {
+                               // Cell not found could be because of an invalid table structure
+                               if (!grid[posY][x])
+                                       continue;
+
+                               cell = grid[posY][x].elm;
+
+                               if (cell != lastCell) {
+                                       if (!before) {
+                                               rowSpan = getSpanVal(cell, 'rowspan');
+                                               if (rowSpan > 1) {
+                                                       setSpanVal(cell, 'rowSpan', rowSpan + 1);
+                                                       continue;
+                                               }
+                                       } else {
+                                               // Check if cell above can be expanded
+                                               if (posY > 0 && grid[posY - 1][x]) {
+                                                       otherCell = grid[posY - 1][x].elm;
+                                                       rowSpan = getSpanVal(otherCell, 'rowSpan');
+                                                       if (rowSpan > 1) {
+                                                               setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
+                                                               continue;
+                                                       }
+                                               }
+                                       }
+
+                                       // Insert new cell into new row
+                                       newCell = cloneCell(cell);
+                                       setSpanVal(newCell, 'colSpan', cell.colSpan);
+
+                                       newRow.appendChild(newCell);
+
+                                       lastCell = cell;
+                               }
+                       }
+
+                       if (newRow.hasChildNodes()) {
+                               if (!before)
+                                       dom.insertAfter(newRow, rowElm);
+                               else
+                                       rowElm.parentNode.insertBefore(newRow, rowElm);
+                       }
+               };
+
+               function insertCol(before) {
+                       var posX, lastCell;
+
+                       // Find first/last column
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell)) {
+                                               posX = x;
+
+                                               if (before)
+                                                       return false;
+                                       }
+                               });
+
+                               if (before)
+                                       return !posX;
+                       });
+
+                       each(grid, function(row, y) {
+                               var cell, rowSpan, colSpan;
+
+                               if (!row[posX])
+                                       return;
+
+                               cell = row[posX].elm;
+                               if (cell != lastCell) {
+                                       colSpan = getSpanVal(cell, 'colspan');
+                                       rowSpan = getSpanVal(cell, 'rowspan');
+
+                                       if (colSpan == 1) {
+                                               if (!before) {
+                                                       dom.insertAfter(cloneCell(cell), cell);
+                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);
+                                               } else {
+                                                       cell.parentNode.insertBefore(cloneCell(cell), cell);
+                                                       fillLeftDown(posX, y, rowSpan - 1, colSpan);
+                                               }
+                                       } else
+                                               setSpanVal(cell, 'colSpan', cell.colSpan + 1);
+
+                                       lastCell = cell;
+                               }
+                       });
+               };
+
+               function deleteCols() {
+                       var cols = [];
+
+                       // Get selected column indexes
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
+                                               each(grid, function(row) {
+                                                       var cell = row[x].elm, colSpan;
+
+                                                       colSpan = getSpanVal(cell, 'colSpan');
+
+                                                       if (colSpan > 1)
+                                                               setSpanVal(cell, 'colSpan', colSpan - 1);
+                                                       else
+                                                               dom.remove(cell);
+                                               });
+
+                                               cols.push(x);
+                                       }
+                               });
+                       });
+
+                       cleanup();
+               };
+
+               function deleteRows() {
+                       var rows;
+
+                       function deleteRow(tr) {
+                               var nextTr, pos, lastCell;
+
+                               nextTr = dom.getNext(tr, 'tr');
+
+                               // Move down row spanned cells
+                               each(tr.cells, function(cell) {
+                                       var rowSpan = getSpanVal(cell, 'rowSpan');
+
+                                       if (rowSpan > 1) {
+                                               setSpanVal(cell, 'rowSpan', rowSpan - 1);
+                                               pos = getPos(cell);
+                                               fillLeftDown(pos.x, pos.y, 1, 1);
+                                       }
+                               });
+
+                               // Delete cells
+                               pos = getPos(tr.cells[0]);
+                               each(grid[pos.y], function(cell) {
+                                       var rowSpan;
+
+                                       cell = cell.elm;
+
+                                       if (cell != lastCell) {
+                                               rowSpan = getSpanVal(cell, 'rowSpan');
+
+                                               if (rowSpan <= 1)
+                                                       dom.remove(cell);
+                                               else
+                                                       setSpanVal(cell, 'rowSpan', rowSpan - 1);
+
+                                               lastCell = cell;
+                                       }
+                               });
+                       };
+
+                       // Get selected rows and move selection out of scope
+                       rows = getSelectedRows();
+
+                       // Delete all selected rows
+                       each(rows.reverse(), function(tr) {
+                               deleteRow(tr);
+                       });
+
+                       cleanup();
+               };
+
+               function cutRows() {
+                       var rows = getSelectedRows();
+
+                       dom.remove(rows);
+                       cleanup();
+
+                       return rows;
+               };
+
+               function copyRows() {
+                       var rows = getSelectedRows();
+
+                       each(rows, function(row, i) {
+                               rows[i] = cloneNode(row, true);
+                       });
+
+                       return rows;
+               };
+
+               function pasteRows(rows, before) {
+                       var selectedRows = getSelectedRows(),
+                               targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
+                               targetCellCount = targetRow.cells.length;
+
+                       // Calc target cell count
+                       each(grid, function(row) {
+                               var match;
+
+                               targetCellCount = 0;
+                               each(row, function(cell, x) {
+                                       if (cell.real)
+                                               targetCellCount += cell.colspan;
+
+                                       if (cell.elm.parentNode == targetRow)
+                                               match = 1;
+                               });
+
+                               if (match)
+                                       return false;
+                       });
+
+                       if (!before)
+                               rows.reverse();
+
+                       each(rows, function(row) {
+                               var cellCount = row.cells.length, cell;
+
+                               // Remove col/rowspans
+                               for (i = 0; i < cellCount; i++) {
+                                       cell = row.cells[i];
+                                       setSpanVal(cell, 'colSpan', 1);
+                                       setSpanVal(cell, 'rowSpan', 1);
+                               }
+
+                               // Needs more cells
+                               for (i = cellCount; i < targetCellCount; i++)
+                                       row.appendChild(cloneCell(row.cells[cellCount - 1]));
+
+                               // Needs less cells
+                               for (i = targetCellCount; i < cellCount; i++)
+                                       dom.remove(row.cells[i]);
+
+                               // Add before/after
+                               if (before)
+                                       targetRow.parentNode.insertBefore(row, targetRow);
+                               else
+                                       dom.insertAfter(row, targetRow);
+                       });
+               };
+
+               function getPos(target) {
+                       var pos;
+
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       if (cell.elm == target) {
+                                               pos = {x : x, y : y};
+                                               return false;
+                                       }
+                               });
+
+                               return !pos;
+                       });
+
+                       return pos;
+               };
+
+               function setStartCell(cell) {
+                       startPos = getPos(cell);
+               };
+
+               function findEndPos() {
+                       var pos, maxX, maxY;
+
+                       maxX = maxY = 0;
+
+                       each(grid, function(row, y) {
+                               each(row, function(cell, x) {
+                                       var colSpan, rowSpan;
+
+                                       if (isCellSelected(cell)) {
+                                               cell = grid[y][x];
+
+                                               if (x > maxX)
+                                                       maxX = x;
+
+                                               if (y > maxY)
+                                                       maxY = y;
+
+                                               if (cell.real) {
+                                                       colSpan = cell.colspan - 1;
+                                                       rowSpan = cell.rowspan - 1;
+
+                                                       if (colSpan) {
+                                                               if (x + colSpan > maxX)
+                                                                       maxX = x + colSpan;
+                                                       }
+
+                                                       if (rowSpan) {
+                                                               if (y + rowSpan > maxY)
+                                                                       maxY = y + rowSpan;
+                                                       }
+                                               }
+                                       }
+                               });
+                       });
+
+                       return {x : maxX, y : maxY};
+               };
+
+               function setEndCell(cell) {
+                       var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
+
+                       endPos = getPos(cell);
+
+                       if (startPos && endPos) {
+                               // Get start/end positions
+                               startX = Math.min(startPos.x, endPos.x);
+                               startY = Math.min(startPos.y, endPos.y);
+                               endX = Math.max(startPos.x, endPos.x);
+                               endY = Math.max(startPos.y, endPos.y);
+
+                               // Expand end positon to include spans
+                               maxX = endX;
+                               maxY = endY;
+
+                               // Expand startX
+                               for (y = startY; y <= maxY; y++) {
+                                       cell = grid[y][startX];
+
+                                       if (!cell.real) {
+                                               if (startX - (cell.colspan - 1) < startX)
+                                                       startX -= cell.colspan - 1;
+                                       }
+                               }
+
+                               // Expand startY
+                               for (x = startX; x <= maxX; x++) {
+                                       cell = grid[startY][x];
+
+                                       if (!cell.real) {
+                                               if (startY - (cell.rowspan - 1) < startY)
+                                                       startY -= cell.rowspan - 1;
+                                       }
+                               }
+
+                               // Find max X, Y
+                               for (y = startY; y <= endY; y++) {
+                                       for (x = startX; x <= endX; x++) {
+                                               cell = grid[y][x];
+
+                                               if (cell.real) {
+                                                       colSpan = cell.colspan - 1;
+                                                       rowSpan = cell.rowspan - 1;
+
+                                                       if (colSpan) {
+                                                               if (x + colSpan > maxX)
+                                                                       maxX = x + colSpan;
+                                                       }
+
+                                                       if (rowSpan) {
+                                                               if (y + rowSpan > maxY)
+                                                                       maxY = y + rowSpan;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               // Remove current selection
+                               dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+
+                               // Add new selection
+                               for (y = startY; y <= maxY; y++) {
+                                       for (x = startX; x <= maxX; x++) {
+                                               if (grid[y][x])
+                                                       dom.addClass(grid[y][x].elm, 'mceSelected');
+                                       }
+                               }
+                       }
+               };
+
+               // Expose to public
+               tinymce.extend(this, {
+                       deleteTable : deleteTable,
+                       split : split,
+                       merge : merge,
+                       insertRow : insertRow,
+                       insertCol : insertCol,
+                       deleteCols : deleteCols,
+                       deleteRows : deleteRows,
+                       cutRows : cutRows,
+                       copyRows : copyRows,
+                       pasteRows : pasteRows,
+                       getPos : getPos,
+                       setStartCell : setStartCell,
+                       setEndCell : setEndCell
+               });
+       };
+
+       tinymce.create('tinymce.plugins.TablePlugin', {
+               init : function(ed, url) {
+                       var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload
+
+                       function createTableGrid(node) {
+                               var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
+
+                               if (tblElm)
+                                       return new TableGrid(tblElm, ed.dom, selection);
+                       };
+
+                       function cleanup() {
+                               // Restore selection possibilities
+                               ed.getBody().style.webkitUserSelect = '';
+
+                               if (hasCellSelection) {
+                                       ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+                                       hasCellSelection = false;
+                               }
+                       };
+
+                       // Register buttons
+                       each([
+                               ['table', 'table.desc', 'mceInsertTable', true],
+                               ['delete_table', 'table.del', 'mceTableDelete'],
+                               ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
+                               ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
+                               ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
+                               ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
+                               ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
+                               ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
+                               ['row_props', 'table.row_desc', 'mceTableRowProps', true],
+                               ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
+                               ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
+                               ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
+                       ], function(c) {
+                               ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+                       });
+
+                       // Select whole table is a table border is clicked
+                       if (!tinymce.isIE) {
+                               ed.onClick.add(function(ed, e) {
+                                       e = e.target;
+
+                                       if (e.nodeName === 'TABLE') {
+                                               ed.selection.select(e);
+                                               ed.nodeChanged();
+                                       }
+                               });
+                       }
+
+                       ed.onPreProcess.add(function(ed, args) {
+                               var nodes, i, node, dom = ed.dom, value;
+
+                               nodes = dom.select('table', args.node);
+                               i = nodes.length;
+                               while (i--) {
+                                       node = nodes[i];
+                                       dom.setAttrib(node, 'data-mce-style', '');
+
+                                       if ((value = dom.getAttrib(node, 'width'))) {
+                                               dom.setStyle(node, 'width', value);
+                                               dom.setAttrib(node, 'width', '');
+                                       }
+
+                                       if ((value = dom.getAttrib(node, 'height'))) {
+                                               dom.setStyle(node, 'height', value);
+                                               dom.setAttrib(node, 'height', '');
+                                       }
+                               }
+                       });
+
+                       // Handle node change updates
+                       ed.onNodeChange.add(function(ed, cm, n) {
+                               var p;
+
+                               n = ed.selection.getStart();
+                               p = ed.dom.getParent(n, 'td,th,caption');
+                               cm.setActive('table', n.nodeName === 'TABLE' || !!p);
+
+                               // Disable table tools if we are in caption
+                               if (p && p.nodeName === 'CAPTION')
+                                       p = 0;
+
+                               cm.setDisabled('delete_table', !p);
+                               cm.setDisabled('delete_col', !p);
+                               cm.setDisabled('delete_table', !p);
+                               cm.setDisabled('delete_row', !p);
+                               cm.setDisabled('col_after', !p);
+                               cm.setDisabled('col_before', !p);
+                               cm.setDisabled('row_after', !p);
+                               cm.setDisabled('row_before', !p);
+                               cm.setDisabled('row_props', !p);
+                               cm.setDisabled('cell_props', !p);
+                               cm.setDisabled('split_cells', !p);
+                               cm.setDisabled('merge_cells', !p);
+                       });
+
+                       ed.onInit.add(function(ed) {
+                               var startTable, startCell, dom = ed.dom, tableGrid;
+
+                               winMan = ed.windowManager;
+
+                               // Add cell selection logic
+                               ed.onMouseDown.add(function(ed, e) {
+                                       if (e.button != 2) {
+                                               cleanup();
+
+                                               startCell = dom.getParent(e.target, 'td,th');
+                                               startTable = dom.getParent(startCell, 'table');
+                                       }
+                               });
+
+                               dom.bind(ed.getDoc(), 'mouseover', function(e) {
+                                       var sel, table, target = e.target;
+
+                                       if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
+                                               table = dom.getParent(target, 'table');
+                                               if (table == startTable) {
+                                                       if (!tableGrid) {
+                                                               tableGrid = createTableGrid(table);
+                                                               tableGrid.setStartCell(startCell);
+
+                                                               ed.getBody().style.webkitUserSelect = 'none';
+                                                       }
+
+                                                       tableGrid.setEndCell(target);
+                                                       hasCellSelection = true;
+                                               }
+
+                                               // Remove current selection
+                                               sel = ed.selection.getSel();
+
+                                               try {
+                                                       if (sel.removeAllRanges)
+                                                               sel.removeAllRanges();
+                                                       else
+                                                               sel.empty();
+                                               } catch (ex) {
+                                                       // IE9 might throw errors here
+                                               }
+
+                                               e.preventDefault();
+                                       }
+                               });
+
+                               ed.onMouseUp.add(function(ed, e) {
+                                       var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
+
+                                       // Move selection to startCell
+                                       if (startCell) {
+                                               if (tableGrid)
+                                                       ed.getBody().style.webkitUserSelect = '';
+
+                                               function setPoint(node, start) {
+                                                       var walker = new tinymce.dom.TreeWalker(node, node);
+
+                                                       do {
+                                                               // Text node
+                                                               if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+                                                                       if (start)
+                                                                               rng.setStart(node, 0);
+                                                                       else
+                                                                               rng.setEnd(node, node.nodeValue.length);
+
+                                                                       return;
+                                                               }
+
+                                                               // BR element
+                                                               if (node.nodeName == 'BR') {
+                                                                       if (start)
+                                                                               rng.setStartBefore(node);
+                                                                       else
+                                                                               rng.setEndBefore(node);
+
+                                                                       return;
+                                                               }
+                                                       } while (node = (start ? walker.next() : walker.prev()));
+                                               }
+
+                                               // Try to expand text selection as much as we can only Gecko supports cell selection
+                                               selectedCells = dom.select('td.mceSelected,th.mceSelected');
+                                               if (selectedCells.length > 0) {
+                                                       rng = dom.createRng();
+                                                       node = selectedCells[0];
+                                                       endNode = selectedCells[selectedCells.length - 1];
+                                                       rng.setStartBefore(node);
+                                                       rng.setEndAfter(node);
+
+                                                       setPoint(node, 1);
+                                                       walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
+
+                                                       do {
+                                                               if (node.nodeName == 'TD' || node.nodeName == 'TH') {
+                                                                       if (!dom.hasClass(node, 'mceSelected'))
+                                                                               break;
+
+                                                                       lastNode = node;
+                                                               }
+                                                       } while (node = walker.next());
+
+                                                       setPoint(lastNode);
+
+                                                       sel.setRng(rng);
+                                               }
+
+                                               ed.nodeChanged();
+                                               startCell = tableGrid = startTable = null;
+                                       }
+                               });
+
+                               ed.onKeyUp.add(function(ed, e) {
+                                       cleanup();
+                               });
+
+                               ed.onKeyDown.add(function (ed, e) {
+                                       fixTableCellSelection(ed);
+                               });
+
+                               ed.onMouseDown.add(function (ed, e) {
+                                       if (e.button != 2) {
+                                               fixTableCellSelection(ed);
+                                       }
+                               });
+                               function tableCellSelected(ed, rng, n, currentCell) {
+                                       // The decision of when a table cell is selected is somewhat involved.  The fact that this code is
+                                       // required is actually a pointer to the root cause of this bug. A cell is selected when the start 
+                                       // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
+                                       // or the parent of the table (in the case of the selection containing the last cell of a table).
+                                       var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'), 
+                                       tableParent, allOfCellSelected, tableCellSelection;
+                                       if (table) 
+                                       tableParent = table.parentNode;
+                                       allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE && 
+                                               rng.startOffset == 0 && 
+                                               rng.endOffset == 0 && 
+                                               currentCell && 
+                                               (n.nodeName=="TR" || n==tableParent);
+                                       tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;          
+                                       return  allOfCellSelected || tableCellSelection;
+                                       // return false;
+                               }
+                               
+                               // this nasty hack is here to work around some WebKit selection bugs.
+                               function fixTableCellSelection(ed) {
+                                       if (!tinymce.isWebKit)
+                                               return;
+
+                                       var rng = ed.selection.getRng();
+                                       var n = ed.selection.getNode();
+                                       var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH');
+                               
+                                       if (!tableCellSelected(ed, rng, n, currentCell))
+                                               return;
+                                               if (!currentCell) {
+                                                       currentCell=n;
+                                               }
+                                       
+                                       // Get the very last node inside the table cell
+                                       var end = currentCell.lastChild;
+                                       while (end.lastChild)
+                                               end = end.lastChild;
+                                       
+                                       // Select the entire table cell. Nothing outside of the table cell should be selected.
+                                       rng.setEnd(end, end.nodeValue.length);
+                                       ed.selection.setRng(rng);
+                               }
+                               ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
+
+                               // Add context menu
+                               if (ed && ed.plugins.contextmenu) {
+                                       ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+                                               var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+
+                                               if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
+                                                       m.removeAll();
+
+                                                       if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+                                                               m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+                                                               m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+                                                               m.addSeparator();
+                                                       }
+
+                                                       if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+                                                               m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+                                                               m.addSeparator();
+                                                       }
+
+                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
+                                                       m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
+                                                       m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
+                                                       m.addSeparator();
+
+                                                       // Cell menu
+                                                       sm = m.addMenu({title : 'table.cell'});
+                                                       sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
+                                                       sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
+                                                       sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
+
+                                                       // Row menu
+                                                       sm = m.addMenu({title : 'table.row'});
+                                                       sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
+                                                       sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+                                                       sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+                                                       sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+                                                       sm.addSeparator();
+                                                       sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+                                                       sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+                                                       sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
+                                                       sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
+
+                                                       // Column menu
+                                                       sm = m.addMenu({title : 'table.col'});
+                                                       sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+                                                       sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+                                                       sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+                                               } else
+                                                       m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
+                                       });
+                               }
+
+                               // Fix to allow navigating up and down in a table in WebKit browsers.
+                               if (tinymce.isWebKit) {
+                                       function moveSelection(ed, e) {
+                                               var VK = tinymce.VK;
+                                               var key = e.keyCode;
+
+                                               function handle(upBool, sourceNode, event) {
+                                                       var siblingDirection = upBool ? 'previousSibling' : 'nextSibling';
+                                                       var currentRow = ed.dom.getParent(sourceNode, 'tr');
+                                                       var siblingRow = currentRow[siblingDirection];
+
+                                                       if (siblingRow) {
+                                                               moveCursorToRow(ed, sourceNode, siblingRow, upBool);
+                                                               tinymce.dom.Event.cancel(event);
+                                                               return true;
+                                                       } else {
+                                                               var tableNode = ed.dom.getParent(currentRow, 'table');
+                                                               var middleNode = currentRow.parentNode;
+                                                               var parentNodeName = middleNode.nodeName.toLowerCase();
+                                                               if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) {
+                                                                       var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody');
+                                                                       if (targetParent !== null) {
+                                                                               return moveToRowInTarget(upBool, targetParent, sourceNode, event);
+                                                                       }
+                                                               }
+                                                               return escapeTable(upBool, currentRow, siblingDirection, tableNode, event);
+                                                       }
+                                               }
+
+                                               function getTargetParent(upBool, topNode, secondNode, nodeName) {
+                                                       var tbodies = ed.dom.select('>' + nodeName, topNode);
+                                                       var position = tbodies.indexOf(secondNode);
+                                                       if (upBool && position === 0 || !upBool && position === tbodies.length - 1) {
+                                                               return getFirstHeadOrFoot(upBool, topNode);
+                                                       } else if (position === -1) {
+                                                               var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1;
+                                                               return tbodies[topOrBottom];
+                                                       } else {
+                                                               return tbodies[position + (upBool ? -1 : 1)];
+                                                       }
+                                               }
+
+                                               function getFirstHeadOrFoot(upBool, parent) {
+                                                       var tagName = upBool ? 'thead' : 'tfoot';
+                                                       var headOrFoot = ed.dom.select('>' + tagName, parent);
+                                                       return headOrFoot.length !== 0 ? headOrFoot[0] : null;
+                                               }
+
+                                               function moveToRowInTarget(upBool, targetParent, sourceNode, event) {
+                                                       var targetRow = getChildForDirection(targetParent, upBool);
+                                                       targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool);
+                                                       tinymce.dom.Event.cancel(event);
+                                                       return true;
+                                               }
+
+                                               function escapeTable(upBool, currentRow, siblingDirection, table, event) {
+                                                       var tableSibling = table[siblingDirection];
+                                                       if (tableSibling) {
+                                                               moveCursorToStartOfElement(tableSibling);
+                                                               return true;
+                                                       } else {
+                                                               var parentCell = ed.dom.getParent(table, 'td,th');
+                                                               if (parentCell) {
+                                                                       return handle(upBool, parentCell, event);
+                                                               } else {
+                                                                       var backUpSibling = getChildForDirection(currentRow, !upBool);
+                                                                       moveCursorToStartOfElement(backUpSibling);
+                                                                       return tinymce.dom.Event.cancel(event);
+                                                               }
+                                                       }
+                                               }
+
+                                               function getChildForDirection(parent, up) {
+                                                       var child =  parent && parent[up ? 'lastChild' : 'firstChild'];
+                                                       // BR is not a valid table child to return in this case we return the table cell
+                                                       return child && child.nodeName === 'BR' ? ed.dom.getParent(child, 'td,th') : child;
+                                               }
+
+                                               function moveCursorToStartOfElement(n) {
+                                                       ed.selection.setCursorLocation(n, 0);
+                                               }
+
+                                               function isVerticalMovement() {
+                                                       return key == VK.UP || key == VK.DOWN;
+                                               }
+
+                                               function isInTable(ed) {
+                                                       var node = ed.selection.getNode();
+                                                       var currentRow = ed.dom.getParent(node, 'tr');
+                                                       return currentRow !== null;
+                                               }
+
+                                               function columnIndex(column) {
+                                                       var colIndex = 0;
+                                                       var c = column;
+                                                       while (c.previousSibling) {
+                                                               c = c.previousSibling;
+                                                               colIndex = colIndex + getSpanVal(c, "colspan");
+                                                       }
+                                                       return colIndex;
+                                               }
+
+                                               function findColumn(rowElement, columnIndex) {
+                                                       var c = 0;
+                                                       var r = 0;
+                                                       each(rowElement.children, function(cell, i) {
+                                                               c = c + getSpanVal(cell, "colspan");
+                                                               r = i;
+                                                               if (c > columnIndex)
+                                                                       return false;
+                                                       });
+                                                       return r;
+                                               }
+
+                                               function moveCursorToRow(ed, node, row, upBool) {
+                                                       var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th'));
+                                                       var tgtColumnIndex = findColumn(row, srcColumnIndex);
+                                                       var tgtNode = row.childNodes[tgtColumnIndex];
+                                                       var rowCellTarget = getChildForDirection(tgtNode, upBool);
+                                                       moveCursorToStartOfElement(rowCellTarget || tgtNode);
+                                               }
+
+                                               function shouldFixCaret(preBrowserNode) {
+                                                       var newNode = ed.selection.getNode();
+                                                       var newParent = ed.dom.getParent(newNode, 'td,th');
+                                                       var oldParent = ed.dom.getParent(preBrowserNode, 'td,th');
+                                                       return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent)
+                                               }
+
+                                               function checkSameParentTable(nodeOne, NodeTwo) {
+                                                       return ed.dom.getParent(nodeOne, 'TABLE') === ed.dom.getParent(NodeTwo, 'TABLE');
+                                               }
+
+                                               if (isVerticalMovement() && isInTable(ed)) {
+                                                       var preBrowserNode = ed.selection.getNode();
+                                                       setTimeout(function() {
+                                                               if (shouldFixCaret(preBrowserNode)) {
+                                                                       handle(!e.shiftKey && key === VK.UP, preBrowserNode, e);
+                                                               }
+                                                       }, 0);
+                                               }
+                                       }
+
+                                       ed.onKeyDown.add(moveSelection);
+                               }
+                                                               
+                               // Fixes an issue on Gecko where it's impossible to place the caret behind a table
+                               // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
+                               if (!tinymce.isIE) {
+                                       function fixTableCaretPos() {
+                                               var last;
+
+                                               // Skip empty text nodes form the end
+                                               for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
+
+                                               if (last && last.nodeName == 'TABLE')
+                                                       ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
+                                       };
+
+                                       // Fixes an bug where it's impossible to place the caret before a table in Gecko
+                                       // this fix solves it by detecting when the caret is at the beginning of such a table
+                                       // and then manually moves the caret infront of the table
+                                       if (tinymce.isGecko) {
+                                               ed.onKeyDown.add(function(ed, e) {
+                                                       var rng, table, dom = ed.dom;
+
+                                                       // On gecko it's not possible to place the caret before a table
+                                                       if (e.keyCode == 37 || e.keyCode == 38) {
+                                                               rng = ed.selection.getRng();
+                                                               table = dom.getParent(rng.startContainer, 'table');
+
+                                                               if (table && ed.getBody().firstChild == table) {
+                                                                       if (isAtStart(rng, table)) {
+                                                                               rng = dom.createRng();
+
+                                                                               rng.setStartBefore(table);
+                                                                               rng.setEndBefore(table);
+
+                                                                               ed.selection.setRng(rng);
+
+                                                                               e.preventDefault();
+                                                                       }
+                                                               }
+                                                       }
+                                               });
+                                       }
+
+                                       ed.onKeyUp.add(fixTableCaretPos);
+                                       ed.onSetContent.add(fixTableCaretPos);
+                                       ed.onVisualAid.add(fixTableCaretPos);
+
+                                       ed.onPreProcess.add(function(ed, o) {
+                                               var last = o.node.lastChild;
+
+                                               if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
+                                                       ed.dom.remove(last);
+                                       });
+
+
+                                       /**
+                                        * Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
+                                        */
+                                       if (tinymce.isGecko) {
+                                               ed.onKeyDown.add(function(ed, e) {
+                                                       if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) {
+                                                               var node = ed.selection.getRng().startContainer;
+                                                               var tableCell = dom.getParent(node, 'td,th');
+                                                               if (tableCell) {
+                                                                       var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF");
+                                                                       dom.insertAfter(zeroSizedNbsp, node);
+                                                               }
+                                                       }
+                                               });
+                                       }
+
+
+                                       fixTableCaretPos();
+                                       ed.startContent = ed.getContent({format : 'raw'});
+                               }
+                       });
+
+                       // Register action commands
+                       each({
+                               mceTableSplitCells : function(grid) {
+                                       grid.split();
+                               },
+
+                               mceTableMergeCells : function(grid) {
+                                       var rowSpan, colSpan, cell;
+
+                                       cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
+                                       if (cell) {
+                                               rowSpan = cell.rowSpan;
+                                               colSpan = cell.colSpan;
+                                       }
+
+                                       if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
+                                               winMan.open({
+                                                       url : url + '/merge_cells.htm',
+                                                       width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
+                                                       height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
+                                                       inline : 1
+                                               }, {
+                                                       rows : rowSpan,
+                                                       cols : colSpan,
+                                                       onaction : function(data) {
+                                                               grid.merge(cell, data.cols, data.rows);
+                                                       },
+                                                       plugin_url : url
+                                               });
+                                       } else
+                                               grid.merge();
+                               },
+
+                               mceTableInsertRowBefore : function(grid) {
+                                       grid.insertRow(true);
+                               },
+
+                               mceTableInsertRowAfter : function(grid) {
+                                       grid.insertRow();
+                               },
+
+                               mceTableInsertColBefore : function(grid) {
+                                       grid.insertCol(true);
+                               },
+
+                               mceTableInsertColAfter : function(grid) {
+                                       grid.insertCol();
+                               },
+
+                               mceTableDeleteCol : function(grid) {
+                                       grid.deleteCols();
+                               },
+
+                               mceTableDeleteRow : function(grid) {
+                                       grid.deleteRows();
+                               },
+
+                               mceTableCutRow : function(grid) {
+                                       clipboardRows = grid.cutRows();
+                               },
+
+                               mceTableCopyRow : function(grid) {
+                                       clipboardRows = grid.copyRows();
+                               },
+
+                               mceTablePasteRowBefore : function(grid) {
+                                       grid.pasteRows(clipboardRows, true);
+                               },
+
+                               mceTablePasteRowAfter : function(grid) {
+                                       grid.pasteRows(clipboardRows);
+                               },
+
+                               mceTableDelete : function(grid) {
+                                       grid.deleteTable();
+                               }
+                       }, function(func, name) {
+                               ed.addCommand(name, function() {
+                                       var grid = createTableGrid();
+
+                                       if (grid) {
+                                               func(grid);
+                                               ed.execCommand('mceRepaint');
+                                               cleanup();
+                                       }
+                               });
+                       });
+
+                       // Register dialog commands
+                       each({
+                               mceInsertTable : function(val) {
+                                       winMan.open({
+                                               url : url + '/table.htm',
+                                               width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
+                                               height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url,
+                                               action : val ? val.action : 0
+                                       });
+                               },
+
+                               mceTableRowProps : function() {
+                                       winMan.open({
+                                               url : url + '/row.htm',
+                                               width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
+                                               height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url
+                                       });
+                               },
+
+                               mceTableCellProps : function() {
+                                       winMan.open({
+                                               url : url + '/cell.htm',
+                                               width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
+                                               height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
+                                               inline : 1
+                                       }, {
+                                               plugin_url : url
+                                       });
+                               }
+                       }, function(func, name) {
+                               ed.addCommand(name, function(ui, val) {
+                                       func(val);
+                               });
+                       });
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})(tinymce);
old mode 100755 (executable)
new mode 100644 (file)
index b5fc1fd..d6f3290
@@ -63,6 +63,11 @@ function init() {
 function updateAction() {\r
        var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];\r
 \r
+       if (!AutoValidator.validate(formObj)) {\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
+               return false;\r
+       }\r
+\r
        tinyMCEPopup.restoreSelection();\r
        el = ed.selection.getStart();\r
        tdElm = ed.dom.getParent(el, "td,th");\r
@@ -83,8 +88,6 @@ function updateAction() {
                return;\r
        }\r
 \r
-       ed.execCommand('mceBeginUndoLevel');\r
-\r
        switch (getSelectValue(formObj, 'action')) {\r
                case "cell":\r
                        var celltype = getSelectValue(formObj, 'celltype');\r
@@ -125,6 +128,36 @@ function updateAction() {
 \r
                        break;\r
 \r
+               case "col":\r
+                       var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");\r
+\r
+                       if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                               cell = nextCell(cell);\r
+\r
+                       do {\r
+                               if (cell == tdElm)\r
+                                       break;\r
+                               col += cell.getAttribute("colspan");\r
+                       } while ((cell = nextCell(cell)) != null);\r
+\r
+                       for (var i=0; i<rows.length; i++) {\r
+                               cell = rows[i].firstChild;\r
+\r
+                               if (cell.nodeName != "TD" && cell.nodeName != "TH")\r
+                                       cell = nextCell(cell);\r
+\r
+                               curr = 0;\r
+                               do {\r
+                                       if (curr == col) {\r
+                                               cell = updateCell(cell, true);\r
+                                               break;\r
+                                       }\r
+                                       curr += cell.getAttribute("colspan");\r
+                               } while ((cell = nextCell(cell)) != null);\r
+                       }\r
+\r
+                       break;\r
+\r
                case "all":\r
                        var rows = tableElm.getElementsByTagName("tr");\r
 \r
@@ -166,15 +199,15 @@ function updateCell(td, skip_id) {
        var dom = ed.dom;\r
 \r
        if (!skip_id)\r
-               td.setAttribute('id', formObj.id.value);\r
-\r
-       td.setAttribute('align', formObj.align.value);\r
-       td.setAttribute('vAlign', formObj.valign.value);\r
-       td.setAttribute('lang', formObj.lang.value);\r
-       td.setAttribute('dir', getSelectValue(formObj, 'dir'));\r
-       td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));\r
-       td.setAttribute('scope', formObj.scope.value);\r
-       ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));\r
+               dom.setAttrib(td, 'id', formObj.id.value);\r
+\r
+       dom.setAttrib(td, 'align', formObj.align.value);\r
+       dom.setAttrib(td, 'vAlign', formObj.valign.value);\r
+       dom.setAttrib(td, 'lang', formObj.lang.value);\r
+       dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));\r
+       dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));\r
+       dom.setAttrib(td, 'scope', formObj.scope.value);\r
+       dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));\r
 \r
        // Clear deprecated attributes\r
        ed.dom.setAttrib(td, 'width', '');\r
old mode 100755 (executable)
new mode 100644 (file)
index 70d95b6..a13d695
@@ -56,6 +56,11 @@ function updateAction() {
        var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];\r
        var action = getSelectValue(formObj, 'action');\r
 \r
+       if (!AutoValidator.validate(formObj)) {\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
+               return false;\r
+       }\r
+\r
        tinyMCEPopup.restoreSelection();\r
        trElm = dom.getParent(inst.selection.getStart(), "tr");\r
        tableElm = dom.getParent(inst.selection.getStart(), "table");\r
@@ -80,8 +85,6 @@ function updateAction() {
                return;\r
        }\r
 \r
-       inst.execCommand('mceBeginUndoLevel');\r
-\r
        switch (action) {\r
                case "row":\r
                        updateRow(trElm);\r
@@ -123,19 +126,19 @@ function updateRow(tr_elm, skip_id, skip_parent) {
 \r
        // Update row element\r
        if (!skip_id)\r
-               tr_elm.setAttribute('id', formObj.id.value);\r
+               dom.setAttrib(tr_elm, 'id', formObj.id.value);\r
 \r
-       tr_elm.setAttribute('align', getSelectValue(formObj, 'align'));\r
-       tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));\r
-       tr_elm.setAttribute('lang', formObj.lang.value);\r
-       tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));\r
-       tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));\r
+       dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));\r
+       dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));\r
+       dom.setAttrib(tr_elm, 'lang', formObj.lang.value);\r
+       dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));\r
+       dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));\r
        dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));\r
 \r
        // Clear deprecated attributes\r
-       tr_elm.setAttribute('background', '');\r
-       tr_elm.setAttribute('bgColor', '');\r
-       tr_elm.setAttribute('height', '');\r
+       dom.setAttrib(tr_elm, 'background', '');\r
+       dom.setAttrib(tr_elm, 'bgColor', '');\r
+       dom.setAttrib(tr_elm, 'height', '');\r
 \r
        // Set styles\r
        tr_elm.style.height = getCSSSize(formObj.height.value);\r
@@ -163,13 +166,10 @@ function updateRow(tr_elm, skip_id, skip_parent) {
                if (newParent == null) {\r
                        newParent = doc.createElement(dest);\r
 \r
-                       if (dest == "thead") {\r
-                               if (theTable.firstChild.nodeName == 'CAPTION')\r
-                                       inst.dom.insertAfter(newParent, theTable.firstChild);\r
-                               else\r
-                                       theTable.insertBefore(newParent, theTable.firstChild);\r
-                       } else\r
-                               theTable.appendChild(newParent);\r
+                       if (theTable.firstChild.nodeName == 'CAPTION')\r
+                               inst.dom.insertAfter(newParent, theTable.firstChild);\r
+                       else\r
+                               theTable.insertBefore(newParent, theTable.firstChild);\r
                }\r
 \r
                // append the row to the new parent\r
old mode 100755 (executable)
new mode 100644 (file)
index d1b42c2..0aafb5f
@@ -12,7 +12,7 @@ function insertTable() {
        tinyMCEPopup.restoreSelection();\r
 \r
        if (!AutoValidator.validate(formObj)) {\r
-               tinyMCEPopup.alert(inst.getLang('invalid_data'));\r
+               tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');\r
                return false;\r
        }\r
 \r
@@ -21,7 +21,7 @@ function insertTable() {
        // Get form data\r
        cols = formObj.elements['cols'].value;\r
        rows = formObj.elements['rows'].value;\r
-       border = formObj.elements['border'].value != "" ? formObj.elements['border'].value  : 0;\r
+       border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;\r
        cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";\r
        cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";\r
        align = getSelectValue(formObj, "align");\r
@@ -58,11 +58,21 @@ function insertTable() {
 \r
        // Update table\r
        if (action == "update") {\r
-               inst.execCommand('mceBeginUndoLevel');\r
-\r
                dom.setAttrib(elm, 'cellPadding', cellpadding, true);\r
                dom.setAttrib(elm, 'cellSpacing', cellspacing, true);\r
-               dom.setAttrib(elm, 'border', border);\r
+\r
+               if (!isCssSize(border)) {\r
+                       dom.setAttrib(elm, 'border', border);\r
+               } else {\r
+                       dom.setAttrib(elm, 'border', '');\r
+               }\r
+\r
+               if (border == '') {\r
+                       dom.setStyle(elm, 'border-width', '');\r
+                       dom.setStyle(elm, 'border', '');\r
+                       dom.setAttrib(elm, 'border', '');\r
+               }\r
+\r
                dom.setAttrib(elm, 'align', align);\r
                dom.setAttrib(elm, 'frame', frame);\r
                dom.setAttrib(elm, 'rules', rules);\r
@@ -82,7 +92,7 @@ function insertTable() {
                        capEl = elm.ownerDocument.createElement('caption');\r
 \r
                        if (!tinymce.isIE)\r
-                               capEl.innerHTML = '<br _mce_bogus="1"/>';\r
+                               capEl.innerHTML = '<br data-mce-bogus="1"/>';\r
 \r
                        elm.insertBefore(capEl, elm.firstChild);\r
                }\r
@@ -121,7 +131,7 @@ function insertTable() {
                if (bordercolor != "") {\r
                        elm.style.borderColor = bordercolor;\r
                        elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;\r
-                       elm.style.borderWidth = border == "" ? "1px" : border;\r
+                       elm.style.borderWidth = cssSize(border);\r
                } else\r
                        elm.style.borderColor = '';\r
 \r
@@ -134,7 +144,7 @@ function insertTable() {
                //elm.outerHTML = elm.outerHTML;\r
 \r
                inst.nodeChanged();\r
-               inst.execCommand('mceEndUndoLevel');\r
+               inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});\r
 \r
                // Repaint if dimensions changed\r
                if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)\r
@@ -148,10 +158,13 @@ function insertTable() {
        html += '<table';\r
 \r
        html += makeAttrib('id', id);\r
-       html += makeAttrib('border', border);\r
+       if (!isCssSize(border)) {\r
+               html += makeAttrib('border', border);\r
+       }\r
+\r
        html += makeAttrib('cellpadding', cellpadding);\r
        html += makeAttrib('cellspacing', cellspacing);\r
-       html += makeAttrib('_mce_new', '1');\r
+       html += makeAttrib('data-mce-new', '1');\r
 \r
        if (width && inst.settings.inline_styles) {\r
                if (style)\r
@@ -187,7 +200,7 @@ function insertTable() {
 \r
        if (caption) {\r
                if (!tinymce.isIE)\r
-                       html += '<caption><br _mce_bogus="1"/></caption>';\r
+                       html += '<caption><br data-mce-bogus="1"/></caption>';\r
                else\r
                        html += '<caption></caption>';\r
        }\r
@@ -197,7 +210,7 @@ function insertTable() {
 \r
                for (var x=0; x<cols; x++) {\r
                        if (!tinymce.isIE)\r
-                               html += '<td><br _mce_bogus="1"/></td>';\r
+                               html += '<td><br data-mce-bogus="1"/></td>';\r
                        else\r
                                html += '<td></td>';\r
                }\r
@@ -207,8 +220,6 @@ function insertTable() {
 \r
        html += "</table>";\r
 \r
-       inst.execCommand('mceBeginUndoLevel');\r
-\r
        // Move table\r
        if (inst.settings.fix_table_elements) {\r
                var patt = '';\r
@@ -231,17 +242,26 @@ function insertTable() {
        } else\r
                inst.execCommand('mceInsertContent', false, html);\r
 \r
-       tinymce.each(dom.select('table[_mce_new]'), function(node) {\r
-               var td = dom.select('td', node);\r
-\r
-               inst.selection.select(td[0], true);\r
-               inst.selection.collapse();\r
+       tinymce.each(dom.select('table[data-mce-new]'), function(node) {
+               var tdorth = dom.select('td,th', node);\r
+
+               // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document\r
+               if (tinymce.isIE && node.nextSibling == null) {\r
+                       dom.insertAfter(dom.create('p'), node);\r
+               }
+\r
+               try {\r
+                       // IE9 might fail to do this selection \r
+                       inst.selection.setCursorLocation(tdorth[0], 0);\r
+               } catch (ex) {\r
+                       // Ignore\r
+               }\r
 \r
-               dom.setAttrib(node, '_mce_new', '');\r
+               dom.setAttrib(node, 'data-mce-new', '');\r
        });\r
 \r
        inst.addVisual();\r
-       inst.execCommand('mceEndUndoLevel');\r
+       inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});\r
 \r
        tinyMCEPopup.close();\r
 }\r
@@ -279,7 +299,7 @@ function init() {
 \r
        var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');\r
        var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";\r
-       var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame;\r
+       var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = "";\r
        var inst = tinyMCEPopup.editor, dom = inst.dom;\r
        var formObj = document.forms[0];\r
        var elm = dom.getParent(inst.selection.getNode(), "table");\r
@@ -383,6 +403,20 @@ function changedSize() {
        formObj.style.value = dom.serializeStyle(st);\r
 }\r
 \r
+function isCssSize(value) {\r
+       return /^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)$/.test(value);\r
+}\r
+\r
+function cssSize(value, def) {\r
+       value = tinymce.trim(value || def);\r
+\r
+       if (!isCssSize(value)) {\r
+               return parseInt(value, 10) + 'px';\r
+       }\r
+\r
+       return value;\r
+}\r
+\r
 function changedBackgroundImage() {\r
        var formObj = document.forms[0];\r
        var st = dom.parseStyle(formObj.style.value);\r
@@ -397,8 +431,14 @@ function changedBorder() {
        var st = dom.parseStyle(formObj.style.value);\r
 \r
        // Update border width if the element has a color\r
-       if (formObj.border.value != "" && formObj.bordercolor.value != "")\r
-               st['border-width'] = formObj.border.value + "px";\r
+       if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != ""))\r
+               st['border-width'] = cssSize(formObj.border.value);\r
+       else {\r
+               if (!formObj.border.value) {\r
+                       st['border'] = '';\r
+                       st['border-width'] = '';\r
+               }\r
+       }\r
 \r
        formObj.style.value = dom.serializeStyle(st);\r
 }\r
@@ -414,7 +454,7 @@ function changedColor() {
 \r
                // Add border-width if it's missing\r
                if (!st['border-width'])\r
-                       st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";\r
+                       st['border-width'] = cssSize(formObj.border.value, 1);\r
        }\r
 \r
        formObj.style.value = dom.serializeStyle(st);\r
old mode 100755 (executable)
new mode 100644 (file)
index 000332a..463e09e
@@ -1,74 +1 @@
-tinyMCE.addI18n('en.table_dlg',{\r
-general_tab:"General",\r
-advanced_tab:"Advanced",\r
-general_props:"General properties",\r
-advanced_props:"Advanced properties",\r
-rowtype:"Row in table part",\r
-title:"Insert/Modify table",\r
-width:"Width",\r
-height:"Height",\r
-cols:"Cols",\r
-rows:"Rows",\r
-cellspacing:"Cellspacing",\r
-cellpadding:"Cellpadding",\r
-border:"Border",\r
-align:"Alignment",\r
-align_default:"Default",\r
-align_left:"Left",\r
-align_right:"Right",\r
-align_middle:"Center",\r
-row_title:"Table row properties",\r
-cell_title:"Table cell properties",\r
-cell_type:"Cell type",\r
-valign:"Vertical alignment",\r
-align_top:"Top",\r
-align_bottom:"Bottom",\r
-bordercolor:"Border color",\r
-bgcolor:"Background color",\r
-merge_cells_title:"Merge table cells",\r
-id:"Id",\r
-style:"Style",\r
-langdir:"Language direction",\r
-langcode:"Language code",\r
-mime:"Target MIME type",\r
-ltr:"Left to right",\r
-rtl:"Right to left",\r
-bgimage:"Background image",\r
-summary:"Summary",\r
-td:"Data",\r
-th:"Header",\r
-cell_cell:"Update current cell",\r
-cell_row:"Update all cells in row",\r
-cell_all:"Update all cells in table",\r
-row_row:"Update current row",\r
-row_odd:"Update odd rows in table",\r
-row_even:"Update even rows in table",\r
-row_all:"Update all rows in table",\r
-thead:"Table Head",\r
-tbody:"Table Body",\r
-tfoot:"Table Foot",\r
-scope:"Scope",\r
-rowgroup:"Row Group",\r
-colgroup:"Col Group",\r
-col_limit:"You've exceeded the maximum number of columns of {$cols}.",\r
-row_limit:"You've exceeded the maximum number of rows of {$rows}.",\r
-cell_limit:"You've exceeded the maximum number of cells of {$cells}.",\r
-missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.",\r
-caption:"Table caption",\r
-frame:"Frame",\r
-frame_none:"none",\r
-frame_groups:"groups",\r
-frame_rows:"rows",\r
-frame_cols:"cols",\r
-frame_all:"all",\r
-rules:"Rules",\r
-rules_void:"void",\r
-rules_above:"above",\r
-rules_below:"below",\r
-rules_hsides:"hsides",\r
-rules_lhs:"lhs",\r
-rules_rhs:"rhs",\r
-rules_vsides:"vsides",\r
-rules_box:"box",\r
-rules_border:"border"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 9736ed8..d231090
@@ -7,20 +7,20 @@
        <script type="text/javascript" src="../../utils/validate.js"></script>\r
        <script type="text/javascript" src="js/merge_cells.js"></script>\r
 </head>\r
-<body style="margin: 8px">\r
+<body style="margin: 8px" role="application">\r
 <form onsubmit="MergeCellsDialog.merge();return false;" action="#">\r
        <fieldset>\r
                <legend>{#table_dlg.merge_cells_title}</legend>\r
-                 <table border="0" cellpadding="0" cellspacing="3" width="100%">\r
-                         <tr>\r
-                               <td>{#table_dlg.cols}:</td>\r
-                               <td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>\r
-                         </tr>\r
-                         <tr>\r
-                               <td>{#table_dlg.rows}:</td>\r
-                               <td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>\r
-                         </tr>\r
-                 </table>\r
+               <table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">\r
+                       <tr>\r
+                               <td><label for="numcols">{#table_dlg.cols}</label>:</td>\r
+                               <td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>\r
+                       </tr>\r
+                       <tr>\r
+                               <td><label for="numrows">{#table_dlg.rows}</label>:</td>\r
+                               <td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>\r
+                       </tr>\r
+               </table>\r
        </fieldset>\r
 \r
        <div class="mceActionPanel">\r
old mode 100755 (executable)
new mode 100644 (file)
index 092e6c8..1885401
@@ -5,16 +5,17 @@
        <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
        <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
        <script type="text/javascript" src="../../utils/form_utils.js"></script>\r
+       <script type="text/javascript" src="../../utils/validate.js"></script>\r
        <script type="text/javascript" src="../../utils/editable_selects.js"></script>\r
        <script type="text/javascript" src="js/row.js"></script>\r
        <link href="css/row.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="tablerow" style="display: none">\r
+<body id="tablerow" style="display: none" role="application">\r
        <form onsubmit="updateAction();return false;" action="#">\r
                <div class="tabs">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
@@ -23,7 +24,7 @@
                                <fieldset>\r
                                        <legend>{#table_dlg.general_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
                                                <tr>\r
                                                        <td><label for="rowtype">{#table_dlg.rowtype}</label></td>\r
                                                        <td class="col2">\r
@@ -70,7 +71,7 @@
 \r
                                                <tr>\r
                                                        <td><label for="height">{#table_dlg.height}</label></td>\r
-                                                       <td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>\r
+                                                       <td class="col2"><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
                                                </tr>\r
                                        </table>\r
                                </fieldset>\r
@@ -80,7 +81,7 @@
                                <fieldset>\r
                                        <legend>{#table_dlg.advanced_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                                <tr>\r
                                                        <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
                                                        <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> \r
                                                <tr>\r
                                                        <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>\r
                                                                                <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
                                                </tr>\r
 \r
                                                <tr>\r
-                                                       <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
+                                                       <td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <span role="group" aria-labelledby="bgcolor_label">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
                                                                                <td id="bgcolor_pickcontainer">&nbsp;</td>\r
                                                                        </tr>\r
                                                                </table>\r
+                                                               </span>\r
                                                        </td> \r
                                                </tr>\r
                                        </table>\r
old mode 100755 (executable)
new mode 100644 (file)
index f269039..b92fa74
        <script type="text/javascript" src="js/table.js"></script>\r
        <link href="css/table.css" rel="stylesheet" type="text/css" />\r
 </head>\r
-<body id="table" style="display: none">\r
+<body id="table" style="display: none" role="application" aria-labelledby="app_title">\r
+       <span style="display:none;" id="app_title">{#table_dlg.title}</span>\r
        <form onsubmit="insertTable();return false;" action="#">\r
                <div class="tabs">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
-                               <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
+                               <li id="general_tab" aria-controls="general_panel" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>\r
+                               <li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
                        <div id="general_panel" class="panel current">\r
                                <fieldset>\r
                                        <legend>{#table_dlg.general_props}</legend>\r
-                                         <table border="0" cellpadding="4" cellspacing="0" width="100%">\r
-                                                         <tr>\r
-                                                               <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>\r
-                                                               <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td>\r
-                                                               <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>\r
-                                                               <td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>\r
-                                                         </tr>\r
-                                                         <tr>\r
-                                                               <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>\r
-                                                               <td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
-                                                               <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>\r
-                                                               <td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
-                                                         </tr>\r
-                                                         <tr>\r
-                                                               <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>\r
-                                                               <td><select id="align" name="align">\r
-                                                                       <option value="">{#not_set}</option>\r
-                                                                       <option value="center">{#table_dlg.align_middle}</option>\r
-                                                                       <option value="left">{#table_dlg.align_left}</option>\r
-                                                                       <option value="right">{#table_dlg.align_right}</option>\r
-                                                                 </select></td>\r
-                                                               <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>\r
-                                                               <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>\r
-                                                         </tr>\r
-                                                         <tr id="width_row">\r
-                                                               <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>\r
-                                                               <td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>\r
-                                                               <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>\r
-                                                               <td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>\r
-                                                         </tr>\r
-                                                         <tr id="styleSelectRow">\r
-                                                               <td><label id="classlabel" for="class">{#class_name}</label></td>\r
-                                                               <td colspan="3">\r
-                                                                <select id="class" name="class" class="mceEditableSelect">\r
-                                                                       <option value="" selected="selected">{#not_set}</option>\r
-                                                                </select></td>\r
-                                                         </tr>\r
-                                                         <tr>\r
-                                                               <td class="column1"><label for="caption">{#table_dlg.caption}</label></td> \r
-                                                               <td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> \r
-                                                         </tr>\r
-                                                       </table>\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">\r
+                                               <tr>\r
+                                                       <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>\r
+                                                       <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" aria-required="true" /></td>\r
+                                                       <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>\r
+                                                       <td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" aria-required="true" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>\r
+                                                       <td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
+                                                       <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>\r
+                                                       <td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>\r
+                                                       <td><select id="align" name="align">\r
+                                                               <option value="">{#not_set}</option>\r
+                                                               <option value="center">{#table_dlg.align_middle}</option>\r
+                                                               <option value="left">{#table_dlg.align_left}</option>\r
+                                                               <option value="right">{#table_dlg.align_right}</option>\r
+                                                       </select></td>\r
+                                                       <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>\r
+                                                       <td><input id="border" name="border" type="text" value="" size="3" maxlength="5" onchange="changedBorder();" class="size" /></td>\r
+                                               </tr>\r
+                                               <tr id="width_row">\r
+                                                       <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>\r
+                                                       <td><input name="width" type="text" id="width" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                                       <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>\r
+                                                       <td><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>\r
+                                               </tr>\r
+                                               <tr id="styleSelectRow" >\r
+                                                       <td><label id="classlabel" for="class">{#class_name}</label></td>\r
+                                                       <td colspan="3" >\r
+                                                        <select id="class" name="class" class="mceEditableSelect">\r
+                                                               <option value="" selected="selected">{#not_set}</option>\r
+                                                        </select></td>\r
+                                               </tr>\r
+                                               <tr>\r
+                                                       <td class="column1" ><label for="caption">{#table_dlg.caption}</label></td> \r
+                                                       <td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> \r
+                                               </tr>\r
+                                       </table>\r
                                </fieldset>\r
                        </div>\r
 \r
@@ -72,7 +73,7 @@
                                <fieldset>\r
                                        <legend>{#table_dlg.advanced_props}</legend>\r
 \r
-                                       <table border="0" cellpadding="0" cellspacing="4">\r
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                                <tr>\r
                                                        <td class="column1"><label for="id">{#table_dlg.id}</label></td> \r
                                                        <td><input id="id" name="id" type="text" value="" class="advfield" /></td> \r
@@ -98,7 +99,7 @@
                                                <tr>\r
                                                        <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" aria-labelledby="backgroundimage_label" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>\r
                                                                                <td id="backgroundimagebrowsercontainer">&nbsp;</td>\r
                                                        </td> \r
                                                </tr>\r
 \r
-                                               <tr>\r
-                                                       <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
+                                               <tr role="group" aria-labelledby="bordercolor_label">\r
+                                                       <td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>\r
                                                                                <td id="bordercolor_pickcontainer">&nbsp;</td>\r
                                                        </td> \r
                                                </tr>\r
 \r
-                                               <tr>\r
-                                                       <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
+                                               <tr role="group" aria-labelledby="bgcolor_label">\r
+                                                       <td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> \r
                                                        <td>\r
-                                                               <table border="0" cellpadding="0" cellspacing="0">\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
                                                                        <tr>\r
                                                                                <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>\r
                                                                                <td id="bgcolor_pickcontainer">&nbsp;</td>\r
old mode 100755 (executable)
new mode 100644 (file)
index 24045d7..bc3045d
@@ -42,7 +42,7 @@ var TemplateDialog = {
 \r
                if (e) {\r
                        e.style.height = Math.abs(h) + 'px';\r
-                       e.style.width  = Math.abs(w - 5) + 'px';\r
+                       e.style.width = Math.abs(w - 5) + 'px';\r
                }\r
        },\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 2471c3f..83e599d
@@ -1,15 +1 @@
-tinyMCE.addI18n('en.template_dlg',{\r
-title:"Templates",\r
-label:"Template",\r
-desc_label:"Description",\r
-desc:"Insert predefined template content",\r
-select:"Select a template",\r
-preview:"Preview",\r
-warning:"Warning: Updating a template with a different one may cause data loss.",\r
-mdate_format:"%Y-%m-%d %H:%M:%S",\r
-cdate_format:"%Y-%m-%d %H:%M:%S",\r
-months_long:"January,February,March,April,May,June,July,August,September,October,November,December",\r
-months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",\r
-day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",\r
-day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.template_dlg',{title:"Templates",label:"Template","desc_label":"Description",desc:"Insert Predefined Template Content",select:"Select a Template",preview:"Preview",warning:"Warning: Updating a template with a different one may cause data loss.","mdate_format":"%Y-%m-%d %H:%M:%S","cdate_format":"%Y-%m-%d %H:%M:%S","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"});
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/css/visualblocks.css b/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/css/visualblocks.css
new file mode 100644 (file)
index 0000000..17b9aef
--- /dev/null
@@ -0,0 +1,19 @@
+p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, blockquote, address, pre {display: block; padding-top: 10px; border: 1px dashed #BBB; background: transparent no-repeat}\r
+p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, address, pre {margin-left: 3px}\r
+section, article, address, hgroup, aside {margin: 1em 0 0 3px}\r
+\r
+p {background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7)}\r
+h1 {background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==)}\r
+h2 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==)}\r
+h3 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7)}\r
+h4 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==)}\r
+h5 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==)}\r
+h6 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==)}\r
+div {background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7)}\r
+section {background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=)}\r
+article {background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7)}\r
+blockquote {background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7)}\r
+address {background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=)}\r
+pre {background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==)}\r
+hgroup {background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7)}\r
+aside {background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=)}\r
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js
new file mode 100644 (file)
index 0000000..62cc2e4
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.VisualBlocks",{init:function(a,b){var c;if(!window.NodeList){return}a.addCommand("mceVisualBlocks",function(){var e=a.dom,d;if(!c){c=e.uniqueId();d=e.create("link",{id:c,rel:"stylesheet",href:b+"/css/visualblocks.css"});a.getDoc().getElementsByTagName("head")[0].appendChild(d)}else{d=e.get(c);d.disabled=!d.disabled}a.controlManager.setActive("visualblocks",!d.disabled)});a.addButton("visualblocks",{title:"visualblocks.desc",cmd:"mceVisualBlocks"});a.onInit.add(function(){if(a.settings.visualblocks_default_state){a.execCommand("mceVisualBlocks")}})},getInfo:function(){return{longname:"Visual blocks",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("visualblocks",tinymce.plugins.VisualBlocks)})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..e74c0bd
--- /dev/null
@@ -0,0 +1,63 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2012, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.VisualBlocks', {\r
+               init : function(ed, url) {\r
+                       var cssId;\r
+\r
+                       // We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects\r
+                       if (!window.NodeList) {\r
+                               return;\r
+                       }\r
+\r
+                       ed.addCommand('mceVisualBlocks', function() {\r
+                               var dom = ed.dom, linkElm;\r
+\r
+                               if (!cssId) {\r
+                                       cssId = dom.uniqueId();\r
+                                       linkElm = dom.create('link', {\r
+                                               id: cssId,\r
+                                               rel : 'stylesheet',\r
+                                               href : url + '/css/visualblocks.css'\r
+                                       });\r
+\r
+                                       ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);\r
+                               } else {\r
+                                       linkElm = dom.get(cssId);\r
+                                       linkElm.disabled = !linkElm.disabled;\r
+                               }\r
+\r
+                               ed.controlManager.setActive('visualblocks', !linkElm.disabled);\r
+                       });\r
+\r
+                       ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'});\r
+\r
+                       ed.onInit.add(function() {\r
+                               if (ed.settings.visualblocks_default_state) {\r
+                                       ed.execCommand('mceVisualBlocks');\r
+                               }\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Visual blocks',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks);\r
+})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 53d31c4..1a148e8
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.VisualChars",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceVisualChars",c._toggleVisualChars,c);a.addButton("visualchars",{title:"visualchars.desc",cmd:"mceVisualChars"});a.onBeforeGetContent.add(function(d,e){if(c.state){c.state=true;c._toggleVisualChars()}})},getInfo:function(){return{longname:"Visual characters",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_toggleVisualChars:function(){var m=this,g=m.editor,a,e,f,k=g.getDoc(),l=g.getBody(),j,n=g.selection,c;m.state=!m.state;g.controlManager.setActive("visualchars",m.state);if(m.state){a=[];tinymce.walk(l,function(b){if(b.nodeType==3&&b.nodeValue&&b.nodeValue.indexOf("\u00a0")!=-1){a.push(b)}},"childNodes");for(e=0;e<a.length;e++){j=a[e].nodeValue;j=j.replace(/(\u00a0+)/g,'<span class="mceItemHidden mceVisualNbsp">$1</span>');j=j.replace(/\u00a0/g,"\u00b7");g.dom.setOuterHTML(a[e],j,k)}}else{a=tinymce.grep(g.dom.select("span",l),function(b){return g.dom.hasClass(b,"mceVisualNbsp")});for(e=0;e<a.length;e++){g.dom.setOuterHTML(a[e],a[e].innerHTML.replace(/(&middot;|\u00b7)/g,"&nbsp;"),k)}}}});tinymce.PluginManager.add("visualchars",tinymce.plugins.VisualChars)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.VisualChars",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceVisualChars",c._toggleVisualChars,c);a.addButton("visualchars",{title:"visualchars.desc",cmd:"mceVisualChars"});a.onBeforeGetContent.add(function(d,e){if(c.state&&e.format!="raw"&&!e.draft){c.state=true;c._toggleVisualChars(false)}})},getInfo:function(){return{longname:"Visual characters",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_toggleVisualChars:function(m){var p=this,k=p.editor,a,g,j,n=k.getDoc(),o=k.getBody(),l,q=k.selection,e,c,f;p.state=!p.state;k.controlManager.setActive("visualchars",p.state);if(m){f=q.getBookmark()}if(p.state){a=[];tinymce.walk(o,function(b){if(b.nodeType==3&&b.nodeValue&&b.nodeValue.indexOf("\u00a0")!=-1){a.push(b)}},"childNodes");for(g=0;g<a.length;g++){l=a[g].nodeValue;l=l.replace(/(\u00a0)/g,'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');c=k.dom.create("div",null,l);while(node=c.lastChild){k.dom.insertAfter(node,a[g])}k.dom.remove(a[g])}}else{a=k.dom.select("span.mceItemNbsp",o);for(g=a.length-1;g>=0;g--){k.dom.remove(a[g],1)}}q.moveToBookmark(f)}});tinymce.PluginManager.add("visualchars",tinymce.plugins.VisualChars)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 0a5275f..df98590
@@ -22,9 +22,9 @@
                        ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'});\r
 \r
                        ed.onBeforeGetContent.add(function(ed, o) {\r
-                               if (t.state) {\r
+                               if (t.state && o.format != 'raw' && !o.draft) {\r
                                        t.state = true;\r
-                                       t._toggleVisualChars();\r
+                                       t._toggleVisualChars(false);\r
                                }\r
                        });\r
                },\r
 \r
                // Private methods\r
 \r
-               _toggleVisualChars : function() {\r
-                       var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo;\r
+               _toggleVisualChars : function(bookmark) {\r
+                       var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo, div, bm;\r
 \r
                        t.state = !t.state;\r
                        ed.controlManager.setActive('visualchars', t.state);\r
 \r
+                       if (bookmark)\r
+                               bm = s.getBookmark();\r
+\r
                        if (t.state) {\r
                                nl = [];\r
                                tinymce.walk(b, function(n) {\r
                                                nl.push(n);\r
                                }, 'childNodes');\r
 \r
-                               for (i=0; i<nl.length; i++) {\r
+                               for (i = 0; i < nl.length; i++) {\r
                                        nv = nl[i].nodeValue;\r
-                                       nv = nv.replace(/(\u00a0+)/g, '<span class="mceItemHidden mceVisualNbsp">$1</span>');\r
-                                       nv = nv.replace(/\u00a0/g, '\u00b7');\r
-                                       ed.dom.setOuterHTML(nl[i], nv, d);\r
+                                       nv = nv.replace(/(\u00a0)/g, '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');\r
+\r
+                                       div = ed.dom.create('div', null, nv);\r
+                                       while (node = div.lastChild)\r
+                                               ed.dom.insertAfter(node, nl[i]);\r
+\r
+                                       ed.dom.remove(nl[i]);\r
                                }\r
                        } else {\r
-                               nl = tinymce.grep(ed.dom.select('span', b), function(n) {\r
-                                       return ed.dom.hasClass(n, 'mceVisualNbsp');\r
-                               });\r
+                               nl = ed.dom.select('span.mceItemNbsp', b);\r
 \r
-                               for (i=0; i<nl.length; i++)\r
-                                       ed.dom.setOuterHTML(nl[i], nl[i].innerHTML.replace(/(&middot;|\u00b7)/g, '&nbsp;'), d);\r
+                               for (i = nl.length - 1; i >= 0; i--)\r
+                                       ed.dom.remove(nl[i], 1);\r
                        }\r
+\r
+                       s.moveToBookmark(bm);\r
                }\r
        });\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index a099e6a..42ece20
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/\S\s+/g);c.cleanre=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$¿'"_+=\\\/-]*/g);c.id=a.id+"-word-count";a.onPostRender.add(function(f,e){var g,h;h=f.getParam("wordcount_target_id");if(!h){g=tinymce.DOM.get(f.id+"_path_row");if(g){tinymce.DOM.add(g.parentNode,"div",{style:"float: right"},f.getLang("wordcount.words","Words: ")+'<span id="'+c.id+'">0</span>')}}else{tinymce.DOM.add(h,"span",{},'<span id="'+c.id+'">0</span>')}});a.onInit.add(function(e){e.selection.onSetContent.add(function(){c._count(e)});c._count(e)});a.onSetContent.add(function(e){c._count(e)});a.onKeyUp.add(function(f,g){if(g.keyCode==d){return}if(13==g.keyCode||8==d||46==d){c._count(f)}d=g.keyCode})},_count:function(b){var c=this,a=0;if(c.block){return}c.block=1;setTimeout(function(){var d=b.getContent({format:"raw"});if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(c.cleanre,"");d.replace(c.countre,function(){a++})}tinymce.DOM.setHTML(c.id,a.toString());setTimeout(function(){c.block=0},2000)},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 5cb92fa..34b2655
@@ -9,17 +9,19 @@
  */\r
 \r
 (function() {\r
-    tinymce.create('tinymce.plugins.WordCount', {\r
+       tinymce.create('tinymce.plugins.WordCount', {\r
                block : 0,\r
                id : null,\r
                countre : null,\r
                cleanre : null,\r
 \r
                init : function(ed, url) {\r
-                       var t = this, last = 0;\r
+                       var t = this, last = 0, VK = tinymce.VK;\r
 \r
-                       t.countre = ed.getParam('wordcount_countregex', /\S\s+/g);\r
-                       t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$¿'"_+=\\\/-]*/g);\r
+                       t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == &rsquo;\r
+                       t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);\r
+                       t.update_rate = ed.getParam('wordcount_update_rate', 2000);\r
+                       t.update_on_delete = ed.getParam('wordcount_update_on_delete', false);\r
                        t.id = ed.id + '-word-count';\r
 \r
                        ed.onPostRender.add(function(ed, cm) {\r
 \r
                                        if (row)\r
                                                tinymce.DOM.add(row.parentNode, 'div', {'style': 'float: right'}, ed.getLang('wordcount.words', 'Words: ') + '<span id="' + t.id + '">0</span>');\r
-                               } else\r
+                               } else {\r
                                        tinymce.DOM.add(id, 'span', {}, '<span id="' + t.id + '">0</span>');\r
+                               }\r
                        });\r
 \r
-            ed.onInit.add(function(ed) {\r
+                       ed.onInit.add(function(ed) {\r
                                ed.selection.onSetContent.add(function() {\r
                                        t._count(ed);\r
                                });\r
                                t._count(ed);\r
                        });\r
 \r
-                       ed.onKeyUp.add(function(ed, e) {\r
-                               if (e.keyCode == last)\r
-                                       return;\r
+                       function checkKeys(key) {\r
+                               return key !== last && (key === VK.ENTER || last === VK.SPACEBAR || checkDelOrBksp(last));\r
+                       }\r
 \r
-                               if (13 == e.keyCode || 8 == last || 46 == last)\r
+                       function checkDelOrBksp(key) {\r
+                               return key === VK.DELETE || key === VK.BACKSPACE;\r
+                       }\r
+\r
+                       ed.onKeyUp.add(function(ed, e) {\r
+                               if (checkKeys(e.keyCode) || t.update_on_delete && checkDelOrBksp(e.keyCode)) {\r
                                        t._count(ed);\r
+                               }\r
 \r
                                last = e.keyCode;\r
                        });\r
                },\r
 \r
+               _getCount : function(ed) {\r
+                       var tc = 0;\r
+                       var tx = ed.getContent({ format: 'raw' });\r
+\r
+                       if (tx) {\r
+                                       tx = tx.replace(/\.\.\./g, ' '); // convert ellipses to spaces\r
+                                       tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' '); // remove html tags and space chars\r
+\r
+                                       // deal with html entities\r
+                                       tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, ' ');\r
+                                       tx = tx.replace(this.cleanre, ''); // remove numbers and punctuation\r
+\r
+                                       var wordArray = tx.match(this.countre);\r
+                                       if (wordArray) {\r
+                                                       tc = wordArray.length;\r
+                                       }\r
+                       }\r
+\r
+                       return tc;\r
+               },\r
+\r
                _count : function(ed) {\r
-                       var t = this, tc = 0;\r
+                       var t = this;\r
 \r
                        // Keep multiple calls from happening at the same time\r
                        if (t.block)\r
                        t.block = 1;\r
 \r
                        setTimeout(function() {\r
-                               var tx = ed.getContent({format : 'raw'});\r
-\r
-                               if (tx) {\r
-                                       tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' '); // remove html tags and space chars\r
-                                       tx = tx.replace(t.cleanre, ''); // remove numbers and punctuation\r
-                                       tx.replace(t.countre, function() {tc++;}); // count the words\r
+                               if (!ed.destroyed) {\r
+                                       var tc = t._getCount(ed);\r
+                                       tinymce.DOM.setHTML(t.id, tc.toString());\r
+                                       setTimeout(function() {t.block = 0;}, t.update_rate);\r
                                }\r
-\r
-                               tinymce.DOM.setHTML(t.id, tc.toString());\r
-\r
-                               setTimeout(function() {t.block = 0;}, 2000);\r
                        }, 1);\r
                },\r
 \r
-        getInfo: function() {\r
+               getInfo: function() {\r
                        return {\r
                                longname : 'Word Count plugin',\r
                                author : 'Moxiecode Systems AB',\r
                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount',\r
                                version : tinymce.majorVersion + "." + tinymce.minorVersion\r
                        };\r
-        }\r
-    });\r
+               }\r
+       });\r
 \r
-    tinymce.PluginManager.add('wordcount', tinymce.plugins.WordCount);\r
+       tinymce.PluginManager.add('wordcount', tinymce.plugins.WordCount);\r
 })();\r
old mode 100755 (executable)
new mode 100644 (file)
index 3aeac0d..30a894f
        <script type="text/javascript" src="js/abbr.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
 </head>\r
-<body style="display: none">\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_abbr_element}</span>\r
 <form onsubmit="insertAbbr();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
                        <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
                </ul>\r
        </div>\r
@@ -23,7 +24,7 @@
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
@@ -41,7 +42,7 @@
                                                </td>\r
                                        </tr>\r
                                        <tr>\r
-                                               <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
                                                <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
                                        </tr>\r
                                        <tr>\r
@@ -67,7 +68,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index 31ee7b7..c109345
        <script type="text/javascript" src="js/acronym.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
 </head>\r
-<body style="display: none">\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_acronym_element}</span>\r
 <form onsubmit="insertAcronym();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
                        <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
                </ul>\r
        </div>\r
@@ -23,7 +24,7 @@
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
@@ -41,7 +42,7 @@
                                                </td>\r
                                        </tr>\r
                                        <tr>\r
-                                               <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
                                                <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
                                        </tr>\r
                                        <tr>\r
@@ -67,7 +68,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index 17054da..e8d606a
@@ -9,12 +9,13 @@
        <script type="text/javascript" src="js/attributes.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/attributes.css" />\r
 </head>\r
-<body style="display: none">\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.attribs_title}</span>\r
 <form onsubmit="insertAction();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_attrib_tab}</a></span></li>\r
-                       <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_events_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_attrib_tab}</a></span></li>\r
+                       <li id="events_tab" aria-controls="events_panel"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_events_tab}</a></span></li>\r
                </ul>\r
        </div>\r
 \r
@@ -22,7 +23,7 @@
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.attribute_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="mceFocus" /></td> \r
@@ -75,7 +76,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.attribute_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index d0a3e3a..0ac6bdb
        <script type="text/javascript" src="js/cite.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
 </head>\r
-<body style="display: none">\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_cite_element}</span>\r
 <form onsubmit="insertCite();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
                        <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
                </ul>\r
        </div>\r
@@ -23,7 +24,7 @@
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td> \r
@@ -67,7 +68,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index 8b07fa8..5f66751
        <script type="text/javascript" src="js/del.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
 </head>\r
-<body id="xhtmlxtrasins" style="display: none">\r
+<body id="xhtmlxtrasins" style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_del_element}</span>\r
 <form onsubmit="insertDel();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
                        <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
                </ul>\r
        </div>\r
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td>\r
                                                <td>\r
-                                                       <table border="0" cellspacing="0" cellpadding="0">\r
+                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                                <tr> \r
                                                                        <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> \r
-                                                                       <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
+                                                                       <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse" role="button" aria-labelledby="datetimelabel"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
                                                                </tr>\r
                                                        </table>\r
                                                </td>\r
@@ -43,7 +44,7 @@
                        </fieldset>\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="field" /></td> \r
@@ -61,7 +62,7 @@
                                                </td>\r
                                        </tr>\r
                                        <tr>\r
-                                               <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
                                                <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
                                        </tr>\r
                                        <tr>\r
@@ -87,7 +88,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index e519526..9b98a51
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(b,c){b.addCommand("mceCite",function(){b.windowManager.open({file:c+"/cite.htm",width:350+parseInt(b.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:c})});b.addCommand("mceAcronym",function(){b.windowManager.open({file:c+"/acronym.htm",width:350+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAbbr",function(){b.windowManager.open({file:c+"/abbr.htm",width:350+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceDel",function(){b.windowManager.open({file:c+"/del.htm",width:340+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceIns",function(){b.windowManager.open({file:c+"/ins.htm",width:340+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAttributes",function(){b.windowManager.open({file:c+"/attributes.htm",width:380,height:370,inline:1},{plugin_url:c})});b.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});b.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});b.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});b.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});b.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});b.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});if(tinymce.isIE){function a(d,e){if(e.set){e.content=e.content.replace(/<abbr([^>]+)>/gi,"<html:abbr $1>");e.content=e.content.replace(/<\/abbr>/gi,"</html:abbr>")}}b.onBeforeSetContent.add(a);b.onPostProcess.add(a)}b.onNodeChange.add(function(e,d,g,f){g=e.dom.getParent(g,"CITE,ACRONYM,ABBR,DEL,INS");d.setDisabled("cite",f);d.setDisabled("acronym",f);d.setDisabled("abbr",f);d.setDisabled("del",f);d.setDisabled("ins",f);d.setDisabled("attribs",g&&g.nodeName=="BODY");d.setActive("cite",0);d.setActive("acronym",0);d.setActive("abbr",0);d.setActive("del",0);d.setActive("ins",0);if(g){do{d.setDisabled(g.nodeName.toLowerCase(),0);d.setActive(g.nodeName.toLowerCase(),1)}while(g=g.parentNode)}});b.onPreInit.add(function(){b.dom.create("abbr")})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(a,b){a.addCommand("mceCite",function(){a.windowManager.open({file:b+"/cite.htm",width:350+parseInt(a.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAcronym",function(){a.windowManager.open({file:b+"/acronym.htm",width:350+parseInt(a.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.acronym_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAbbr",function(){a.windowManager.open({file:b+"/abbr.htm",width:350+parseInt(a.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.abbr_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceDel",function(){a.windowManager.open({file:b+"/del.htm",width:340+parseInt(a.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.del_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceIns",function(){a.windowManager.open({file:b+"/ins.htm",width:340+parseInt(a.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.ins_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAttributes",function(){a.windowManager.open({file:b+"/attributes.htm",width:380+parseInt(a.getLang("xhtmlxtras.attr_delta_width",0)),height:370+parseInt(a.getLang("xhtmlxtras.attr_delta_height",0)),inline:1},{plugin_url:b})});a.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});a.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});a.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});a.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});a.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});a.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});a.onNodeChange.add(function(d,c,f,e){f=d.dom.getParent(f,"CITE,ACRONYM,ABBR,DEL,INS");c.setDisabled("cite",e);c.setDisabled("acronym",e);c.setDisabled("abbr",e);c.setDisabled("del",e);c.setDisabled("ins",e);c.setDisabled("attribs",f&&f.nodeName=="BODY");c.setActive("cite",0);c.setActive("acronym",0);c.setActive("abbr",0);c.setActive("del",0);c.setActive("ins",0);if(f){do{c.setDisabled(f.nodeName.toLowerCase(),0);c.setActive(f.nodeName.toLowerCase(),1)}while(f=f.parentNode)}});a.onPreInit.add(function(){a.dom.create("abbr")})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 9b51b83..f240572
@@ -27,7 +27,7 @@
                                ed.windowManager.open({\r
                                        file : url + '/acronym.htm',\r
                                        width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
-                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
+                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url\r
@@ -38,7 +38,7 @@
                                ed.windowManager.open({\r
                                        file : url + '/abbr.htm',\r
                                        width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
-                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
+                                       height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url\r
@@ -49,7 +49,7 @@
                                ed.windowManager.open({\r
                                        file : url + '/del.htm',\r
                                        width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
-                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
+                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url\r
@@ -60,7 +60,7 @@
                                ed.windowManager.open({\r
                                        file : url + '/ins.htm',\r
                                        width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
-                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
+                                       height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url\r
@@ -70,8 +70,8 @@
                        ed.addCommand('mceAttributes', function() {\r
                                ed.windowManager.open({\r
                                        file : url + '/attributes.htm',\r
-                                       width : 380,\r
-                                       height : 370,\r
+                                       width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),\r
+                                       height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),\r
                                        inline : 1\r
                                }, {\r
                                        plugin_url : url\r
                        ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});\r
                        ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});\r
 \r
-                       if (tinymce.isIE) {\r
-                               function fix(ed, o) {\r
-                                       if (o.set) {\r
-                                               o.content = o.content.replace(/<abbr([^>]+)>/gi, '<html:abbr $1>');\r
-                                               o.content = o.content.replace(/<\/abbr>/gi, '</html:abbr>');\r
-                                       }\r
-                               };\r
-\r
-                               ed.onBeforeSetContent.add(fix);\r
-                               ed.onPostProcess.add(fix);\r
-                       }\r
-\r
                        ed.onNodeChange.add(function(ed, cm, n, co) {\r
                                n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 6c5470c..d001ac7
        <script type="text/javascript" src="js/ins.js"></script>\r
        <link rel="stylesheet" type="text/css" href="css/popup.css" />\r
 </head>\r
-<body id="xhtmlxtrasins" style="display: none">\r
+<body id="xhtmlxtrasins" style="display: none" role="application" aria-labelledby="app_title">\r
+<span style="display:none;" id="app_title">{#xhtmlxtras_dlg.title_ins_element}</span>\r
 <form onsubmit="insertIns();return false;" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
+                       <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>\r
                        <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->\r
                </ul>\r
        </div>\r
                <div id="general_panel" class="panel current">\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td> \r
                                                <td>\r
-                                                       <table border="0" cellspacing="0" cellpadding="0">\r
+                                                       <table role="presentation" border="0" cellspacing="0" cellpadding="0">\r
                                                                <tr> \r
                                                                        <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td> \r
-                                                                       <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
+                                                                       <td ><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse" role="button" aria-labelledby="datetimelabel"><span class="datetime" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>\r
                                                                </tr>\r
                                                        </table>\r
                                                </td>\r
                                        </tr>\r
-                                       <tr>\r
+                                       <tr >\r
                                                <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td> \r
                                                <td><input id="cite" name="cite" type="text" value="" class="field" /></td> \r
                                        </tr>\r
@@ -43,9 +44,9 @@
                        </fieldset>\r
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>\r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
-                                               <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
+                                               <td  class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td> \r
                                                <td><input id="title" name="title" type="text" value="" class="field" /></td> \r
                                        </tr>\r
                                        <tr>\r
@@ -61,7 +62,7 @@
                                                </td>\r
                                        </tr>\r
                                        <tr>\r
-                                               <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
+                                               <td class="label"><label id="stylelabel" for="style">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td> \r
                                                <td><input id="style" name="style" type="text" value="" class="field" /></td> \r
                                        </tr>\r
                                        <tr>\r
@@ -87,7 +88,7 @@
                        <fieldset>\r
                                <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>\r
 \r
-                               <table border="0" cellpadding="0" cellspacing="4">\r
+                               <table role="presentation" border="0" cellpadding="0" cellspacing="4">\r
                                        <tr>\r
                                                <td class="label"><label for="onfocus">onfocus</label>:</td> \r
                                                <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td> \r
old mode 100755 (executable)
new mode 100644 (file)
index d62a219..9c99995
@@ -53,7 +53,6 @@ function insertAction() {
        var inst = tinyMCEPopup.editor;\r
        var elm = inst.selection.getNode();\r
 \r
-       tinyMCEPopup.execCommand("mceBeginUndoLevel");  \r
        setAllAttribs(elm);\r
        tinyMCEPopup.execCommand("mceEndUndoLevel");\r
        tinyMCEPopup.close();\r
@@ -72,21 +71,7 @@ function setAttrib(elm, attrib, value) {
                        value = valueElm.value;\r
        }\r
 \r
-       if (value != "") {\r
-               dom.setAttrib(elm, attrib.toLowerCase(), value);\r
-\r
-               if (attrib == "style")\r
-                       attrib = "style.cssText";\r
-\r
-               if (attrib.substring(0, 2) == 'on')\r
-                       value = 'return true;' + value;\r
-\r
-               if (attrib == "class")\r
-                       attrib = "className";\r
-\r
-               elm[attrib]=value;\r
-       } else\r
-               elm.removeAttribute(attrib);\r
+       dom.setAttrib(elm, attrib.toLowerCase(), value);\r
 }\r
 \r
 function setAllAttribs(elm) {\r
old mode 100755 (executable)
new mode 100644 (file)
index 9e5d8c5..1f957dc
@@ -21,17 +21,17 @@ function setElementAttribs(elm) {
        setAllCommonAttribs(elm);\r
        setAttrib(elm, 'datetime');\r
        setAttrib(elm, 'cite');\r
+       elm.removeAttribute('data-mce-new');\r
 }\r
 \r
 function insertDel() {\r
        var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');\r
 \r
-       tinyMCEPopup.execCommand('mceBeginUndoLevel');\r
        if (elm == null) {\r
                var s = SXE.inst.selection.getContent();\r
                if(s.length > 0) {\r
                        insertInlineElement('del');\r
-                       var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});\r
+                       var elementArray = SXE.inst.dom.select('del[data-mce-new]');\r
                        for (var i=0; i<elementArray.length; i++) {\r
                                var elm = elementArray[i];\r
                                setElementAttribs(elm);\r
@@ -45,16 +45,6 @@ function insertDel() {
        tinyMCEPopup.close();\r
 }\r
 \r
-function insertInlineElement(en) {\r
-       var ed = tinyMCEPopup.editor, dom = ed.dom;\r
-\r
-       ed.getDoc().execCommand('FontName', false, 'mceinline');\r
-       tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) {\r
-               if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')\r
-                       dom.replace(dom.create(en), n, 1);\r
-       });\r
-}\r
-\r
 function removeDel() {\r
        SXE.removeElement('del');\r
        tinyMCEPopup.close();\r
old mode 100755 (executable)
new mode 100644 (file)
index 5b494a5..4e5d9c3
@@ -154,7 +154,6 @@ SXE.initElementDialog = function(element_name) {
 SXE.insertElement = function(element_name) {\r
        var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()), h, tagName;\r
 \r
-       tinyMCEPopup.execCommand('mceBeginUndoLevel');\r
        if (elm == null) {\r
                var s = SXE.inst.selection.getContent();\r
                if(s.length > 0) {\r
@@ -165,11 +164,11 @@ SXE.insertElement = function(element_name) {
                        for (var i=0; i<elementArray.length; i++) {\r
                                var elm = elementArray[i];\r
 \r
-                               if (SXE.inst.dom.getAttrib(elm, '_mce_new')) {\r
+                               if (SXE.inst.dom.getAttrib(elm, 'data-mce-new')) {\r
                                        elm.id = '';\r
                                        elm.setAttribute('id', '');\r
                                        elm.removeAttribute('id');\r
-                                       elm.removeAttribute('_mce_new');\r
+                                       elm.removeAttribute('data-mce-new');\r
 \r
                                        setAllCommonAttribs(elm);\r
                                }\r
@@ -186,7 +185,6 @@ SXE.removeElement = function(element_name){
        element_name = element_name.toLowerCase();\r
        elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());\r
        if(elm && elm.nodeName.toUpperCase() == element_name.toUpperCase()){\r
-               tinyMCEPopup.execCommand('mceBeginUndoLevel');\r
                tinyMCE.execCommand('mceRemoveNode', false, elm);\r
                SXE.inst.nodeChanged();\r
                tinyMCEPopup.execCommand('mceEndUndoLevel');\r
@@ -226,6 +224,6 @@ function insertInlineElement(en) {
        ed.getDoc().execCommand('FontName', false, 'mceinline');\r
        tinymce.each(dom.select('span,font'), function(n) {\r
                if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')\r
-                       dom.replace(dom.create(en, {_mce_new : 1}), n, 1);\r
+                       dom.replace(dom.create(en, {'data-mce-new' : 1}), n, 1);\r
        });\r
 }\r
old mode 100755 (executable)
new mode 100644 (file)
index 3774f0a..c4addfb
@@ -21,16 +21,17 @@ function setElementAttribs(elm) {
        setAllCommonAttribs(elm);\r
        setAttrib(elm, 'datetime');\r
        setAttrib(elm, 'cite');\r
+       elm.removeAttribute('data-mce-new');\r
 }\r
 \r
 function insertIns() {\r
        var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS');\r
-       tinyMCEPopup.execCommand('mceBeginUndoLevel');\r
+\r
        if (elm == null) {\r
                var s = SXE.inst.selection.getContent();\r
                if(s.length > 0) {\r
-                       insertInlineElement('INS');\r
-                       var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';});\r
+                       insertInlineElement('ins');\r
+                       var elementArray = SXE.inst.dom.select('ins[data-mce-new]');\r
                        for (var i=0; i<elementArray.length; i++) {\r
                                var elm = elementArray[i];\r
                                setElementAttribs(elm);\r
@@ -49,14 +50,4 @@ function removeIns() {
        tinyMCEPopup.close();\r
 }\r
 \r
-function insertInlineElement(en) {\r
-       var ed = tinyMCEPopup.editor, dom = ed.dom;\r
-\r
-       ed.getDoc().execCommand('FontName', false, 'mceinline');\r
-       tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) {\r
-               if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')\r
-                       dom.replace(dom.create(en), n, 1);\r
-       });\r
-}\r
-\r
 tinyMCEPopup.onInit.add(init);\r
old mode 100755 (executable)
new mode 100644 (file)
index 45b6b26..c4569f8
@@ -1,32 +1 @@
-tinyMCE.addI18n('en.xhtmlxtras_dlg',{\r
-attribute_label_title:"Title",\r
-attribute_label_id:"ID",\r
-attribute_label_class:"Class",\r
-attribute_label_style:"Style",\r
-attribute_label_cite:"Cite",\r
-attribute_label_datetime:"Date/Time",\r
-attribute_label_langdir:"Text Direction",\r
-attribute_option_ltr:"Left to right",\r
-attribute_option_rtl:"Right to left",\r
-attribute_label_langcode:"Language",\r
-attribute_label_tabindex:"TabIndex",\r
-attribute_label_accesskey:"AccessKey",\r
-attribute_events_tab:"Events",\r
-attribute_attrib_tab:"Attributes",\r
-general_tab:"General",\r
-attrib_tab:"Attributes",\r
-events_tab:"Events",\r
-fieldset_general_tab:"General Settings",\r
-fieldset_attrib_tab:"Element Attributes",\r
-fieldset_events_tab:"Element Events",\r
-title_ins_element:"Insertion Element",\r
-title_del_element:"Deletion Element",\r
-title_acronym_element:"Acronym Element",\r
-title_abbr_element:"Abbreviation Element",\r
-title_cite_element:"Citation Element",\r
-remove:"Remove",\r
-insert_date:"Insert current date/time",\r
-option_ltr:"Left to right",\r
-option_rtl:"Right to left",\r
-attribs_title:"Insert/Edit Attributes"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.xhtmlxtras_dlg',{"attribs_title":"Insert/Edit Attributes","option_rtl":"Right to Left","option_ltr":"Left to Right","insert_date":"Insert Current Date/Time",remove:"Remove","title_cite_element":"Citation Element","title_abbr_element":"Abbreviation Element","title_acronym_element":"Acronym Element","title_del_element":"Deletion Element","title_ins_element":"Insertion Element","fieldset_events_tab":"Element Events","fieldset_attrib_tab":"Element Attributes","fieldset_general_tab":"General Settings","events_tab":"Events","attrib_tab":"Attributes","general_tab":"General","attribute_attrib_tab":"Attributes","attribute_events_tab":"Events","attribute_label_accesskey":"AccessKey","attribute_label_tabindex":"TabIndex","attribute_label_langcode":"Language","attribute_option_rtl":"Right to Left","attribute_option_ltr":"Left to Right","attribute_label_langdir":"Text Direction","attribute_label_datetime":"Date/Time","attribute_label_cite":"Cite","attribute_label_style":"Style","attribute_label_class":"Class","attribute_label_id":"ID","attribute_label_title":"Title"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 267f837..7a97cb7
@@ -9,9 +9,9 @@
 <body id="about" style="display: none">\r
                <div class="tabs">\r
                        <ul>\r
-                               <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>\r
-                               <li id="help_tab" style="display:none"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>\r
-                               <li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>\r
+                               <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>\r
+                               <li id="help_tab" style="display:none" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>\r
+                               <li id="plugins_tab" aria-controls="plugins_panel"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>\r
                        </ul>\r
                </div>\r
 \r
@@ -26,8 +26,6 @@
 \r
                                <div id="buttoncontainer">\r
                                        <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>\r
-                                       <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="Hosted By Sourceforge" border="0" /></a>\r
-                                       <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="Also on freshmeat" border="0" /></a>\r
                                </div>\r
                        </div>\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 2bc63fc..75c93b7
@@ -5,15 +5,15 @@
        <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
        <script type="text/javascript" src="js/anchor.js"></script>\r
 </head>\r
-<body style="display: none">\r
+<body style="display: none" role="application" aria-labelledby="app_title">\r
 <form onsubmit="AnchorDialog.update();return false;" action="#">\r
-       <table border="0" cellpadding="4" cellspacing="0">\r
+       <table border="0" cellpadding="4" cellspacing="0" role="presentation">\r
                <tr>\r
-                       <td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>\r
+                       <td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>\r
                </tr>\r
                <tr>\r
-                       <td class="nowrap">{#advanced_dlg.anchor_name}:</td>\r
-                       <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>\r
+                       <td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>\r
+                       <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>\r
                </tr>\r
        </table>\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 3991b81..d4b6bdf
@@ -5,48 +5,51 @@
        <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
        <script type="text/javascript" src="js/charmap.js"></script>\r
 </head>\r
-<body id="charmap" style="display:none">\r
-<table align="center" border="0" cellspacing="0" cellpadding="2">\r
-    <tr>\r
-        <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td>\r
-    </tr>\r
-    <tr>\r
-        <td id="charmapView" rowspan="2" align="left" valign="top">\r
+<body id="charmap" style="display:none" role="application">\r
+<table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">\r
+       <tr>\r
+               <td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>\r
+       </tr>\r
+       <tr>\r
+               <td id="charmapView" rowspan="2" align="left" valign="top">\r
                        <!-- Chars will be rendered here -->\r
-        </td>\r
-        <td width="100" align="center" valign="top">\r
-            <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px">\r
-                <tr>\r
-                    <td id="codeV">&nbsp;</td>\r
-                </tr>\r
-                <tr>\r
-                    <td id="codeN">&nbsp;</td>\r
-                </tr>\r
-            </table>\r
-        </td>\r
-    </tr>\r
-    <tr>\r
-        <td valign="bottom" style="padding-bottom: 3px;">\r
-            <table width="100" align="center" border="0" cellpadding="2" cellspacing="0">\r
-                <tr>\r
-                    <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">HTML-Code</td>\r
-                </tr>\r
-                <tr>\r
-                    <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>\r
-                </tr>\r
-                <tr>\r
-                    <td style="font-size: 1px;">&nbsp;</td>\r
-                </tr>\r
-                <tr>\r
-                    <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">NUM-Code</td>\r
-                </tr>\r
-                <tr>\r
-                    <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>\r
-                </tr>\r
-            </table>\r
-        </td>\r
-    </tr>\r
+               </td>\r
+               <td width="100" align="center" valign="top">\r
+                       <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px" role="presentation">\r
+                               <tr>\r
+                                       <td id="codeV">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td id="codeN">&nbsp;</td>\r
+                               </tr>\r
+                       </table>\r
+               </td>\r
+       </tr>\r
+       <tr>\r
+               <td valign="bottom" style="padding-bottom: 3px;">\r
+                       <table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">\r
+                               <tr>\r
+                                       <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 1px;">&nbsp;</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>\r
+                               </tr>\r
+                       </table>\r
+               </td>\r
+       </tr>\r
+       <tr>\r
+               <td colspan="2" id="charmap_usage">{#advanced_dlg.charmap_usage}</td>\r
+       </tr>\r
+       \r
 </table>\r
-\r
 </body>\r
 </html>\r
old mode 100755 (executable)
new mode 100644 (file)
index 096e755..ad1bb0f
@@ -6,13 +6,14 @@
        <script type="text/javascript" src="../../utils/mctabs.js"></script>\r
        <script type="text/javascript" src="js/color_picker.js"></script>\r
 </head>\r
-<body id="colorpicker" style="display: none">\r
+<body id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">\r
+       <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>\r
 <form onsubmit="insertAction();return false" action="#">\r
        <div class="tabs">\r
                <ul>\r
-                       <li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>\r
-                       <li id="rgb_tab"><span><a href="javascript:;" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>\r
-                       <li id="named_tab"><span><a  href="javascript:;" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>\r
+                       <li id="picker_tab" aria-controls="picker_panel" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>\r
+                       <li id="rgb_tab" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>\r
+                       <li id="named_tab" aria-controls="named_panel"><span><a  href="javascript:;" onclick="javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>\r
                </ul>\r
        </div>\r
 \r
@@ -34,7 +35,7 @@
 \r
                <div id="rgb_panel" class="panel">\r
                        <fieldset>\r
-                               <legend>{#advanced_dlg.colorpicker_palette_title}</legend>\r
+                               <legend id="webcolors_title">{#advanced_dlg.colorpicker_palette_title}</legend>\r
                                <div id="webcolors">\r
                                        <!-- Gets filled with web safe colors-->\r
                                </div>\r
@@ -44,9 +45,9 @@
                </div>\r
 \r
                <div id="named_panel" class="panel">\r
-                       <fieldset>\r
-                               <legend>{#advanced_dlg.colorpicker_named_title}</legend>\r
-                               <div id="namedcolors">\r
+                       <fieldset id="named_picker_label">\r
+                               <legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>\r
+                               <div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">\r
                                        <!-- Gets filled with named colors-->\r
                                </div>\r
 \r
@@ -65,7 +66,7 @@
                <div id="preview"></div>\r
 \r
                <div id="previewblock">\r
-                       <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text mceFocus" />\r
+                       <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />\r
                </div>\r
        </div>\r
 </form>\r
old mode 100755 (executable)
new mode 100644 (file)
index dc61977..a887018
@@ -1 +1 @@
-(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l)}if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(p[0]==o){i.formatter.remove(o)}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){i.execCommand("FontName",false,l);k.select(function(m){return l==m});return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(o){return i==o});return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=this.settings,m=d.get(j.id+"_tbl"),n=d.get(j.id+"_ifr");i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);d.setStyle(m,"height","");d.setStyle(n,"height",l);if(k.theme_advanced_resize_horizontal){d.setStyle(m,"width","");d.setStyle(n,"width",i);if(i<m.clientWidth){d.setStyle(n,"width",m.clientWidth)}}},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:n,ch:E})}}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(r,z,l,x,j){var C=this,i,y=0,B,u,D=C.settings,A,k,w,m,q;e.each(C.stateControls,function(n){z.setActive(n,r.queryCommandState(C.controls[n][1]))});function o(p){var s,n=j.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s<n.length;s++){if(t(n[s])){return n[s]}}}z.setActive("visualaid",r.hasVisual);z.setDisabled("undo",!r.undoManager.hasUndo()&&!r.typing);z.setDisabled("redo",!r.undoManager.hasRedo());z.setDisabled("outdent",!r.queryCommandState("Outdent"));i=o("A");if(u=z.get("link")){if(!i||!i.name){u.setDisabled(!i&&x);u.setActive(!!i)}}if(u=z.get("unlink")){u.setDisabled(!i&&x);u.setActive(!!i&&!i.name)}if(u=z.get("anchor")){u.setActive(!!i&&i.name)}i=o("IMG");if(u=z.get("image")){u.setActive(!!i&&l.className.indexOf("mceItem")==-1)}if(u=z.get("styleselect")){C._importClasses();m=[];f(u.items,function(n){m.push(n.value)});q=r.formatter.matchAll(m);u.select(q[0])}if(u=z.get("formatselect")){i=o(d.isBlock);if(i){u.select(i.nodeName.toLowerCase())}}o(function(p){if(p.nodeName==="SPAN"){if(!A&&p.className){A=p.className}if(!k&&p.style.fontSize){k=p.style.fontSize}if(!w&&p.style.fontFamily){w=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(u=z.get("fontselect")){u.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==w})}if(u=z.get("fontsizeselect")){if(D.theme_advanced_runtime_fontsize&&!k&&!A){k=r.dom.getStyle(l,"fontSize",true)}u.select(function(n){if(n.fontSize&&n.fontSize===k){return true}if(n["class"]&&n["class"]===A){return true}})}if(D.theme_advanced_path&&D.theme_advanced_statusbar_location){i=d.get(r.id+"_path")||d.add(r.id+"_path_row","span",{id:r.id+"_path"});d.setHTML(i,"");o(function(E){var p=E.nodeName.toLowerCase(),s,v,t="";if(E.nodeType!=1||E.nodeName==="BR"||(d.hasClass(E,"mceItemHidden")||d.hasClass(E,"mceItemRemoved"))){return}if(B=d.getAttrib(E,"mce_name")){p=B}if(e.isIE&&E.scopeName!=="HTML"){p=E.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(B=d.getAttrib(E,"src")){t+="src: "+B+" "}break;case"a":if(B=d.getAttrib(E,"name")){t+="name: "+B+" ";p+="#"+B}if(B=d.getAttrib(E,"href")){t+="href: "+B+" "}break;case"font":if(B=d.getAttrib(E,"face")){t+="font: "+B+" "}if(B=d.getAttrib(E,"size")){t+="size: "+B+" "}if(B=d.getAttrib(E,"color")){t+="color: "+B+" "}break;case"span":if(B=d.getAttrib(E,"style")){t+="style: "+B+" "}break}if(B=d.getAttrib(E,"id")){t+="id: "+B+" "}if(B=E.className){B=B.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(B){t+="class: "+B+" ";if(d.isBlock(E)||p=="img"||p=="span"){p+="."+B}}}p=p.replace(/(html:)/g,"");p={name:p,node:E,title:t};C.onResolveName.dispatch(C,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(y++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},r.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
+(function(h){var i=h.DOM,g=h.dom.Event,c=h.extend,f=h.each,a=h.util.Cookie,e,d=h.explode;function b(m,k){var q,p=m.dom,n="",o,l;previewStyles=m.settings.preview_styles;if(previewStyles===false){return""}if(!previewStyles){previewStyles="font-family font-size font-weight text-decoration text-transform color background-color"}function j(r){return r.replace(/%(\w+)/g,"")}name=k.block||k.inline||"span";q=p.create(name);f(k.styles,function(s,r){s=j(s);if(s){p.setStyle(q,r,s)}});f(k.attributes,function(s,r){s=j(s);if(s){p.setAttrib(q,r,s)}});f(k.classes,function(r){r=j(r);if(!p.hasClass(q,r)){p.addClass(q,r)}});p.setStyles(q,{position:"absolute",left:-65535});m.getBody().appendChild(q);o=p.getStyle(m.getBody(),"fontSize",true);o=/px$/.test(o)?parseInt(o,10):0;f(previewStyles.split(" "),function(r){var s=p.getStyle(q,r,true);if(r=="font-size"){if(/em|%$/.test(s)){if(o===0){return}s=parseFloat(s,10)/(/%$/.test(s)?100:1);s=(s*o)+"px"}}n+=r+":"+s+";"});p.remove(q);return n}h.ThemeManager.requireLangPack("advanced");h.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(k,l){var m=this,n,j,p;m.editor=k;m.url=l;m.onResolveName=new h.util.Dispatcher(this);k.forcedHighContrastMode=k.settings.detect_highcontrast&&m._isHighContrast();k.settings.skin=k.forcedHighContrastMode?"highcontrast":k.settings.skin;m.settings=n=c({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:k.settings.readonly},k.settings);if(!n.font_size_style_values){n.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(h.is(n.theme_advanced_font_sizes,"string")){n.font_size_style_values=h.explode(n.font_size_style_values);n.font_size_classes=h.explode(n.font_size_classes||"");p={};k.settings.theme_advanced_font_sizes=n.theme_advanced_font_sizes;f(k.getParam("theme_advanced_font_sizes","","hash"),function(r,q){var o;if(q==r&&r>=1&&r<=7){q=r+" ("+m.sizes[r-1]+"pt)";o=n.font_size_classes[r-1];r=n.font_size_style_values[r-1]||(m.sizes[r-1]+"pt")}if(/^\s*\./.test(r)){o=r.replace(/\./g,"")}p[q]=o?{"class":o}:{fontSize:r}});n.theme_advanced_font_sizes=p}if((j=n.theme_advanced_path_location)&&j!="none"){n.theme_advanced_statusbar_location=n.theme_advanced_path_location}if(n.theme_advanced_statusbar_location=="none"){n.theme_advanced_statusbar_location=0}if(k.settings.content_css!==false){k.contentCSS.push(k.baseURI.toAbsolute(l+"/skins/"+k.settings.skin+"/content.css"))}k.onInit.add(function(){if(!k.settings.readonly){k.onNodeChange.add(m._nodeChanged,m);k.onKeyUp.add(m._updateUndoStatus,m);k.onMouseUp.add(m._updateUndoStatus,m);k.dom.bind(k.dom.getRoot(),"dragend",function(){m._updateUndoStatus(k)})}});k.onSetProgressState.add(function(r,o,s){var t,u=r.id,q;if(o){m.progressTimer=setTimeout(function(){t=r.getContainer();t=t.insertBefore(i.create("DIV",{style:"position:relative"}),t.firstChild);q=i.get(r.id+"_tbl");i.add(t,"div",{id:u+"_blocker","class":"mceBlocker",style:{width:q.clientWidth+2,height:q.clientHeight+2}});i.add(t,"div",{id:u+"_progress","class":"mceProgress",style:{left:q.clientWidth/2,top:q.clientHeight/2}})},s||0)}else{i.remove(u+"_blocker");i.remove(u+"_progress");clearTimeout(m.progressTimer)}});i.loadCSS(n.editor_css?k.documentBaseURI.toAbsolute(n.editor_css):l+"/skins/"+k.settings.skin+"/ui.css");if(n.skin_variant){i.loadCSS(l+"/skins/"+k.settings.skin+"/ui_"+n.skin_variant+".css")}},_isHighContrast:function(){var j,k=i.add(i.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});j=(i.getStyle(k,"background-color",true)+"").toLowerCase().replace(/ /g,"");i.remove(k);return j!="rgb(171,239,86)"&&j!="#abef56"},createControl:function(m,j){var k,l;if(l=j.createControl(m)){return l}switch(m){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((k=this.controls[m])){return j.createButton(m,{title:"advanced."+k[0],cmd:k[1],ui:k[2],value:k[3]})}},execCommand:function(l,k,m){var j=this["_"+l];if(j){j.call(this,k,m);return true}return false},_importClasses:function(l){var j=this.editor,k=j.controlManager.get("styleselect");if(k.getLength()==0){f(j.dom.getClasses(),function(q,m){var p="style_"+m,n;n={inline:"span",attributes:{"class":q["class"]},selector:"*"};j.formatter.register(p,n);k.add(q["class"],p,{style:function(){return b(j,n)}})})}},_createStyleSelect:function(o){var l=this,j=l.editor,k=j.controlManager,m;m=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(q){var r,n=[],p;f(m.items,function(s){n.push(s.value)});j.focus();j.undoManager.add();r=j.formatter.matchAll(n);h.each(r,function(s){if(!q||s==q){if(s){j.formatter.remove(s)}p=true}});if(!p){j.formatter.apply(q)}j.undoManager.add();j.nodeChanged();return false}});j.onPreInit.add(function(){var p=0,n=j.getParam("style_formats");if(n){f(n,function(q){var r,s=0;f(q,function(){s++});if(s>1){r=q.name=q.name||"style_"+(p++);j.formatter.register(r,q);m.add(q.title,r,{style:function(){return b(j,q)}})}else{m.add(q.title)}})}else{f(j.getParam("theme_advanced_styles","","hash"),function(t,s){var r,q;if(t){r="style_"+(p++);q={inline:"span",classes:t,selector:"*"};j.formatter.register(r,q);m.add(l.editor.translate(s),r,{style:function(){return b(j,q)}})}})}});if(m.getLength()==0){m.onPostRender.add(function(p,q){if(!m.NativeListBox){g.add(q.id+"_text","focus",l._importClasses,l);g.add(q.id+"_text","mousedown",l._importClasses,l);g.add(q.id+"_open","focus",l._importClasses,l);g.add(q.id+"_open","mousedown",l._importClasses,l)}else{g.add(q.id,"focus",l._importClasses,l)}})}return m},_createFontSelect:function(){var l,k=this,j=k.editor;l=j.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(m){var n=l.items[l.selectedIndex];if(!m&&n){j.execCommand("FontName",false,n.value);return}j.execCommand("FontName",false,m);l.select(function(o){return m==o});if(n&&n.value==m){l.select(null)}return false}});if(l){f(j.getParam("theme_advanced_fonts",k.settings.theme_advanced_fonts,"hash"),function(n,m){l.add(j.translate(m),n,{style:n.indexOf("dings")==-1?"font-family:"+n:""})})}return l},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(o){var p=n.items[n.selectedIndex];if(!o&&p){p=p.value;if(p["class"]){k.formatter.toggle("fontsize_class",{value:p["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,p.fontSize)}return}if(o["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}n.select(function(q){return o==q});if(p&&(p.value.fontSize==o.fontSize||p.value["class"]&&p.value["class"]==o["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(p,o){var q=p.fontSize;if(q>=1&&q<=7){q=m.sizes[parseInt(q)-1]+"pt"}n.add(o,p,{style:"font-size:"+q,"class":"mceFontSize"+(l++)+(" "+(p["class"]||""))})})}return n},_createBlockFormats:function(){var l,j={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},k=this;l=k.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(m){k.editor.execCommand("FormatBlock",false,m);return false}});if(l){f(k.editor.getParam("theme_advanced_blockformats",k.settings.theme_advanced_blockformats,"hash"),function(n,m){l.add(k.editor.translate(m!=n?m:j[n]),n,{"class":"mce_formatPreview mce_"+n,style:function(){return b(k.editor,{block:n})}})})}return l},_createForeColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_text_colors){m.colors=j}if(l.theme_advanced_default_foreground_color){m.default_color=l.theme_advanced_default_foreground_color}m.title="advanced.forecolor_desc";m.cmd="ForeColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("forecolor",m);return n},_createBackColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_background_colors){m.colors=j}if(l.theme_advanced_default_background_color){m.default_color=l.theme_advanced_default_background_color}m.title="advanced.backcolor_desc";m.cmd="HiliteColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("backcolor",m);return n},renderUI:function(l){var q,m,r,w=this,u=w.editor,x=w.settings,v,k,j;if(u.settings){u.settings.aria_label=x.aria_label+u.getLang("advanced.help_shortcut")}q=k=i.create("span",{role:"application","aria-labelledby":u.id+"_voice",id:u.id+"_parent","class":"mceEditor "+u.settings.skin+"Skin"+(x.skin_variant?" "+u.settings.skin+"Skin"+w._ufirst(x.skin_variant):"")});i.add(q,"span",{"class":"mceVoiceLabel",style:"display:none;",id:u.id+"_voice"},x.aria_label);if(!i.boxModel){q=i.add(q,"div",{"class":"mceOldBoxModel"})}q=v=i.add(q,"table",{role:"presentation",id:u.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});q=r=i.add(q,"tbody");switch((x.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":m=w._rowLayout(x,r,l);break;case"customlayout":m=u.execCallback("theme_advanced_custom_layout",x,r,l,k);break;default:m=w._simpleLayout(x,r,l,k)}q=l.targetNode;j=v.rows;i.addClass(j[0],"mceFirst");i.addClass(j[j.length-1],"mceLast");f(i.select("tr",r),function(o){i.addClass(o.firstChild,"mceFirst");i.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(i.get(x.theme_advanced_toolbar_container)){i.get(x.theme_advanced_toolbar_container).appendChild(k)}else{i.insertAfter(k,q)}g.add(u.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){w._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return false}});if(!u.getParam("accessibility_focus")){g.add(i.add(k,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(u.id).focus()})}if(x.theme_advanced_toolbar_location=="external"){l.deltaHeight=0}w.deltaHeight=l.deltaHeight;l.targetNode=null;u.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){if(h.isWebKit){window.focus()}w.toolbarGroup.focus();return g.cancel(n)}else{if(n.keyCode===o){i.get(p.id+"_path_row").focus();return g.cancel(n)}}}});u.addShortcut("alt+0","","mceShortcuts",w);return{iframeContainer:m,editorContainer:u.id+"_parent",sizeContainer:v,deltaHeight:l.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:h.majorVersion+"."+h.minorVersion}},resizeBy:function(j,k){var l=i.get(this.editor.id+"_ifr");this.resizeTo(l.clientWidth+j,l.clientHeight+k)},resizeTo:function(j,n,l){var k=this.editor,m=this.settings,o=i.get(k.id+"_tbl"),p=i.get(k.id+"_ifr");j=Math.max(m.theme_advanced_resizing_min_width||100,j);n=Math.max(m.theme_advanced_resizing_min_height||100,n);j=Math.min(m.theme_advanced_resizing_max_width||65535,j);n=Math.min(m.theme_advanced_resizing_max_height||65535,n);i.setStyle(o,"height","");i.setStyle(p,"height",n);if(m.theme_advanced_resize_horizontal){i.setStyle(o,"width","");i.setStyle(p,"width",j);if(j<o.clientWidth){j=o.clientWidth;i.setStyle(p,"width",o.clientWidth)}}if(l&&m.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+k.id+"_size",{cw:j,ch:n})}},destroy:function(){var j=this.editor.id;g.clear(j+"_resize");g.clear(j+"_path_row");g.clear(j+"_external_close")},_simpleLayout:function(z,u,l,j){var y=this,v=y.editor,w=z.theme_advanced_toolbar_location,q=z.theme_advanced_statusbar_location,m,k,r,x;if(z.readonly){m=i.add(u,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"});return k}if(w=="top"){y._addToolbars(u,l)}if(w=="external"){m=x=i.create("div",{style:"position:relative"});m=i.add(m,"div",{id:v.id+"_external","class":"mceExternalToolbar"});i.add(m,"a",{id:v.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});m=i.add(m,"table",{id:v.id+"_tblext",cellSpacing:0,cellPadding:0});r=i.add(m,"tbody");if(j.firstChild.className=="mceOldBoxModel"){j.firstChild.appendChild(x)}else{j.insertBefore(x,j.firstChild)}y._addToolbars(r,l);v.onMouseUp.add(function(){var o=i.get(v.id+"_external");i.show(o);i.hide(e);var n=g.add(v.id+"_external_close","click",function(){i.hide(v.id+"_external");g.remove(v.id+"_external_close","click",n)});i.show(o);i.setStyle(o,"top",0-i.getRect(v.id+"_tblext").h-1);i.hide(o);i.show(o);o.style.filter="";e=v.id+"_external";o=null})}if(q=="top"){y._addStatusBar(u,l)}if(!z.theme_advanced_toolbar_container){m=i.add(u,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"})}if(w=="bottom"){y._addToolbars(u,l)}if(q=="bottom"){y._addStatusBar(u,l)}return k},_rowLayout:function(x,p,l){var w=this,q=w.editor,v,y,j=q.controlManager,m,k,u,r;v=x.theme_advanced_containers_default_class||"";y=x.theme_advanced_containers_default_align||"center";f(d(x.theme_advanced_containers||""),function(s,o){var n=x["theme_advanced_container_"+s]||"";switch(s.toLowerCase()){case"mceeditor":m=i.add(p,"tr");m=k=i.add(m,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":w._addStatusBar(p,l);break;default:r=(x["theme_advanced_container_"+s+"_align"]||y).toLowerCase();r="mce"+w._ufirst(r);m=i.add(i.add(p,"tr"),"td",{"class":"mceToolbar "+(x["theme_advanced_container_"+s+"_class"]||v)+" "+r||y});u=j.createToolbar("toolbar"+o);w._addControls(n,u);i.setHTML(m,u.renderHTML());l.deltaHeight-=x.theme_advanced_row_height}});return k},_addControls:function(k,j){var l=this,m=l.settings,n,o=l.editor.controlManager;if(m.theme_advanced_disable&&!l._disabled){n={};f(d(m.theme_advanced_disable),function(p){n[p]=1});l._disabled=n}else{n=l._disabled}f(d(k),function(q){var p;if(n&&n[q]){return}if(q=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(r){r=l.createControl(r,o);if(r){j.add(r)}});return}p=l.createControl(q,o);if(p){j.add(p)}})},_addToolbars:function(x,k){var A=this,p,m,r=A.editor,B=A.settings,z,j=r.controlManager,u,l,q=[],y,w;w=j.createToolbarGroup("toolbargroup",{name:r.getLang("advanced.toolbar"),tab_focus_toolbar:r.getParam("theme_advanced_tab_focus_toolbar")});A.toolbarGroup=w;y=B.theme_advanced_toolbar_align.toLowerCase();y="mce"+A._ufirst(y);l=i.add(i.add(x,"tr",{role:"presentation"}),"td",{"class":"mceToolbar "+y,role:"presentation"});for(p=1;(z=B["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(B["theme_advanced_buttons"+p+"_add"]){z+=","+B["theme_advanced_buttons"+p+"_add"]}if(B["theme_advanced_buttons"+p+"_add_before"]){z=B["theme_advanced_buttons"+p+"_add_before"]+","+z}A._addControls(z,m);w.add(m);k.deltaHeight-=B.theme_advanced_row_height}q.push(w.renderHTML());q.push(i.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));i.setHTML(l,q.join(""))},_addStatusBar:function(p,k){var l,w=this,q=w.editor,x=w.settings,j,u,v,m;l=i.add(p,"tr");l=m=i.add(l,"td",{"class":"mceStatusbar"});l=i.add(l,"div",{id:q.id+"_path_row",role:"group","aria-labelledby":q.id+"_path_voice"});if(x.theme_advanced_path){i.add(l,"span",{id:q.id+"_path_voice"},q.translate("advanced.path"));i.add(l,"span",{},": ")}else{i.add(l,"span",{},"&#160;")}if(x.theme_advanced_resizing){i.add(m,"a",{id:q.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize",tabIndex:"-1"});if(x.theme_advanced_resizing_use_cookie){q.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+q.id+"_size"),r=i.get(q.id+"_tbl");if(!n){return}w.resizeTo(n.cw,n.ch)})}q.onPostRender.add(function(){g.add(q.id+"_resize","click",function(n){n.preventDefault()});g.add(q.id+"_resize","mousedown",function(E){var t,r,s,o,D,A,B,G,n,F,y;function z(H){H.preventDefault();n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F)}function C(H){g.remove(i.doc,"mousemove",t);g.remove(q.getDoc(),"mousemove",r);g.remove(i.doc,"mouseup",s);g.remove(q.getDoc(),"mouseup",o);n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F,true)}E.preventDefault();D=E.screenX;A=E.screenY;y=i.get(w.editor.id+"_ifr");B=n=y.clientWidth;G=F=y.clientHeight;t=g.add(i.doc,"mousemove",z);r=g.add(q.getDoc(),"mousemove",z);s=g.add(i.doc,"mouseup",C);o=g.add(q.getDoc(),"mouseup",C)})})}k.deltaHeight-=21;l=p=null},_updateUndoStatus:function(k){var j=k.controlManager,l=k.undoManager;j.setDisabled("undo",!l.hasUndo()&&!l.typing);j.setDisabled("redo",!l.hasRedo())},_nodeChanged:function(o,u,E,r,F){var z=this,D,G=0,y,H,A=z.settings,x,l,w,C,m,k,j;h.each(z.stateControls,function(n){u.setActive(n,o.queryCommandState(z.controls[n][1]))});function q(p){var s,n=F.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s<n.length;s++){if(t(n[s])){return n[s]}}}u.setActive("visualaid",o.hasVisual);z._updateUndoStatus(o);u.setDisabled("outdent",!o.queryCommandState("Outdent"));D=q("A");if(H=u.get("link")){if(!D||!D.name){H.setDisabled(!D&&r);H.setActive(!!D)}}if(H=u.get("unlink")){H.setDisabled(!D&&r);H.setActive(!!D&&!D.name)}if(H=u.get("anchor")){H.setActive(!r&&!!D&&D.name)}D=q("IMG");if(H=u.get("image")){H.setActive(!r&&!!D&&E.className.indexOf("mceItem")==-1)}if(H=u.get("styleselect")){z._importClasses();k=[];f(H.items,function(n){k.push(n.value)});j=o.formatter.matchAll(k);H.select(j[0]);h.each(j,function(p,n){if(n>0){H.mark(p)}})}if(H=u.get("formatselect")){D=q(i.isBlock);if(D){H.select(D.nodeName.toLowerCase())}}q(function(p){if(p.nodeName==="SPAN"){if(!x&&p.className){x=p.className}}if(o.dom.is(p,A.theme_advanced_font_selector)){if(!l&&p.style.fontSize){l=p.style.fontSize}if(!w&&p.style.fontFamily){w=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}if(!C&&p.style.color){C=p.style.color}if(!m&&p.style.backgroundColor){m=p.style.backgroundColor}}return false});if(H=u.get("fontselect")){H.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==w})}if(H=u.get("fontsizeselect")){if(A.theme_advanced_runtime_fontsize&&!l&&!x){l=o.dom.getStyle(E,"fontSize",true)}H.select(function(n){if(n.fontSize&&n.fontSize===l){return true}if(n["class"]&&n["class"]===x){return true}})}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_path&&A.theme_advanced_statusbar_location){D=i.get(o.id+"_path")||i.add(o.id+"_path_row","span",{id:o.id+"_path"});if(z.statusKeyboardNavigation){z.statusKeyboardNavigation.destroy();z.statusKeyboardNavigation=null}i.setHTML(D,"");q(function(I){var p=I.nodeName.toLowerCase(),s,v,t="";if(I.nodeType!=1||p==="br"||I.getAttribute("data-mce-bogus")||i.hasClass(I,"mceItemHidden")||i.hasClass(I,"mceItemRemoved")){return}if(h.isIE&&I.scopeName!=="HTML"){p=I.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(y=i.getAttrib(I,"src")){t+="src: "+y+" "}break;case"a":if(y=i.getAttrib(I,"name")){t+="name: "+y+" ";p+="#"+y}if(y=i.getAttrib(I,"href")){t+="href: "+y+" "}break;case"font":if(y=i.getAttrib(I,"face")){t+="font: "+y+" "}if(y=i.getAttrib(I,"size")){t+="size: "+y+" "}if(y=i.getAttrib(I,"color")){t+="color: "+y+" "}break;case"span":if(y=i.getAttrib(I,"style")){t+="style: "+y+" "}break}if(y=i.getAttrib(I,"id")){t+="id: "+y+" "}if(y=I.className){y=y.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(y){t+="class: "+y+" ";if(i.isBlock(I)||p=="img"||p=="span"){p+="."+y}}}p=p.replace(/(html:)/g,"");p={name:p,node:I,title:t};z.onResolveName.dispatch(z,p);t=p.title;p=p.name;v=i.create("a",{href:"javascript:;",role:"button",onmousedown:"return false;",title:t,"class":"mcePath_"+(G++)},p);if(D.hasChildNodes()){D.insertBefore(i.create("span",{"aria-hidden":"true"},"\u00a0\u00bb "),D.firstChild);D.insertBefore(v,D.firstChild)}else{D.appendChild(v)}},o.getBody());if(i.select("a",D).length>0){z.statusKeyboardNavigation=new h.ui.KeyboardNavigation({root:o.id+"_path_row",items:i.select("a",D),excludeFromTabOrder:true,onCancel:function(){o.focus()}},i)}}},_sel:function(j){this.editor.execCommand("mceSelectNodeDepth",false,j)},_mceInsertAnchor:function(l,k){var j=this.editor;j.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(j.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(j.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var j=this.editor;j.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(j.getLang("advanced.charmap_delta_width",0)),height:265+parseInt(j.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var j=this.editor;j.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var j=this.editor;j.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(l,k){var j=this.editor;k=k||{};j.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(j.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(j.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:k.color,func:k.func,theme_url:this.url})},_mceCodeEditor:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(j.getParam("theme_advanced_source_editor_width",720)),height:parseInt(j.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(k,l){var j=this.editor;if(j.dom.getAttrib(j.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}j.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(j.getLang("advanced.image_delta_width",0)),height:275+parseInt(j.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(j.getLang("advanced.link_delta_width",0)),height:200+parseInt(j.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var j=this.editor;j.windowManager.confirm("advanced.newdocument",function(k){if(k){j.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var j=this;this._mceColorPicker(0,{color:j.fgColor,func:function(k){j.fgColor=k;j.editor.execCommand("ForeColor",false,k)}})},_mceBackColor:function(){var j=this;this._mceColorPicker(0,{color:j.bgColor,func:function(k){j.bgColor=k;j.editor.execCommand("HiliteColor",false,k)}})},_ufirst:function(j){return j.substring(0,1).toUpperCase()+j.substring(1)}});h.ThemeManager.add("advanced",h.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 279ca35..d94c8e4
 (function(tinymce) {\r
        var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;\r
 \r
+       // Generates a preview for a format\r
+       function getPreviewCss(ed, fmt) {\r
+               var previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;\r
+\r
+               previewStyles = ed.settings.preview_styles;\r
+\r
+               // No preview forced\r
+               if (previewStyles === false)\r
+                       return '';\r
+\r
+               // Default preview\r
+               if (!previewStyles)\r
+                       previewStyles = 'font-family font-size font-weight text-decoration text-transform color background-color';\r
+\r
+               // Removes any variables since these can't be previewed\r
+               function removeVars(val) {\r
+                       return val.replace(/%(\w+)/g, '');\r
+               };\r
+\r
+               // Create block/inline element to use for preview\r
+               name = fmt.block || fmt.inline || 'span';\r
+               previewElm = dom.create(name);\r
+\r
+               // Add format styles to preview element\r
+               each(fmt.styles, function(value, name) {\r
+                       value = removeVars(value);\r
+\r
+                       if (value)\r
+                               dom.setStyle(previewElm, name, value);\r
+               });\r
+\r
+               // Add attributes to preview element\r
+               each(fmt.attributes, function(value, name) {\r
+                       value = removeVars(value);\r
+\r
+                       if (value)\r
+                               dom.setAttrib(previewElm, name, value);\r
+               });\r
+\r
+               // Add classes to preview element\r
+               each(fmt.classes, function(value) {\r
+                       value = removeVars(value);\r
+\r
+                       if (!dom.hasClass(previewElm, value))\r
+                               dom.addClass(previewElm, value);\r
+               });\r
+\r
+               // Add the previewElm outside the visual area\r
+               dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF});\r
+               ed.getBody().appendChild(previewElm);\r
+\r
+               // Get parent container font size so we can compute px values out of em/% for older IE:s\r
+               parentFontSize = dom.getStyle(ed.getBody(), 'fontSize', true);\r
+               parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;\r
+\r
+               each(previewStyles.split(' '), function(name) {\r
+                       var value = dom.getStyle(previewElm, name, true);\r
+\r
+                       // Old IE won't calculate the font size so we need to do that manually\r
+                       if (name == 'font-size') {\r
+                               if (/em|%$/.test(value)) {\r
+                                       if (parentFontSize === 0) {\r
+                                               return;\r
+                                       }\r
+\r
+                                       // Convert font size from em/% to px\r
+                                       value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);\r
+                                       value = (value * parentFontSize) + 'px';\r
+                               }\r
+                       }\r
+\r
+                       previewCss += name + ':' + value + ';';\r
+               });\r
+\r
+               dom.remove(previewElm);\r
+\r
+               return previewCss;\r
+       };\r
+\r
        // Tell it to load theme specific language pack(s)\r
        tinymce.ThemeManager.requireLangPack('advanced');\r
 \r
                        t.url = url;\r
                        t.onResolveName = new tinymce.util.Dispatcher(this);\r
 \r
+                       ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();\r
+                       ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;\r
+\r
                        // Default settings\r
                        t.settings = s = extend({\r
                                theme_advanced_path : true,\r
                                theme_advanced_resize_horizontal : 1,\r
                                theme_advanced_resizing_use_cookie : 1,\r
                                theme_advanced_font_sizes : "1,2,3,4,5,6,7",\r
+                               theme_advanced_font_selector : "span",\r
+                               theme_advanced_show_current_color: 0,\r
                                readonly : ed.settings.readonly\r
                        }, ed.settings);\r
 \r
                        if (s.theme_advanced_statusbar_location == 'none')\r
                                s.theme_advanced_statusbar_location = 0;\r
 \r
+                       if (ed.settings.content_css !== false)\r
+                               ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));\r
+\r
                        // Init editor\r
                        ed.onInit.add(function() {\r
-                               if (!ed.settings.readonly)\r
+                               if (!ed.settings.readonly) {\r
                                        ed.onNodeChange.add(t._nodeChanged, t);\r
-\r
-                               if (ed.settings.content_css !== false)\r
-                                       ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));\r
+                                       ed.onKeyUp.add(t._updateUndoStatus, t);\r
+                                       ed.onMouseUp.add(t._updateUndoStatus, t);\r
+                                       ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {\r
+                                               t._updateUndoStatus(ed);\r
+                                       });\r
+                               }\r
                        });\r
 \r
                        ed.onSetProgressState.add(function(ed, b, ti) {\r
                                DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");\r
                },\r
 \r
+               _isHighContrast : function() {\r
+                       var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});\r
+\r
+                       actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');\r
+                       DOM.remove(div);\r
+\r
+                       return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';\r
+               },\r
+\r
                createControl : function(n, cf) {\r
                        var cd, c;\r
 \r
 \r
                        if (ctrl.getLength() == 0) {\r
                                each(ed.dom.getClasses(), function(o, idx) {\r
-                                       var name = 'style_' + idx;\r
+                                       var name = 'style_' + idx, fmt;\r
 \r
-                                       ed.formatter.register(name, {\r
+                                       fmt = {\r
                                                inline : 'span',\r
                                                attributes : {'class' : o['class']},\r
                                                selector : '*'\r
-                                       });\r
+                                       };\r
+\r
+                                       ed.formatter.register(name, fmt);\r
 \r
-                                       ctrl.add(o['class'], name);\r
+                                       ctrl.add(o['class'], name, {\r
+                                               style: function() {\r
+                                                       return getPreviewCss(ed, fmt);\r
+                                               }\r
+                                       });\r
                                });\r
                        }\r
                },\r
                        ctrl = ctrlMan.createListBox('styleselect', {\r
                                title : 'advanced.style_select',\r
                                onselect : function(name) {\r
-                                       var matches, formatNames = [];\r
+                                       var matches, formatNames = [], removedFormat;\r
 \r
                                        each(ctrl.items, function(item) {\r
                                                formatNames.push(item.value);\r
                                        ed.focus();\r
                                        ed.undoManager.add();\r
 \r
-                                       // Toggle off the current format\r
+                                       // Toggle off the current format(s)\r
                                        matches = ed.formatter.matchAll(formatNames);\r
-                                       if (matches[0] == name)\r
-                                               ed.formatter.remove(name);\r
-                                       else\r
+                                       tinymce.each(matches, function(match) {\r
+                                               if (!name || match == name) {\r
+                                                       if (match)\r
+                                                               ed.formatter.remove(match);\r
+\r
+                                                       removedFormat = true;\r
+                                               }\r
+                                       });\r
+\r
+                                       if (!removedFormat)\r
                                                ed.formatter.apply(name);\r
 \r
                                        ed.undoManager.add();\r
                        });\r
 \r
                        // Handle specified format\r
-                       ed.onInit.add(function() {\r
+                       ed.onPreInit.add(function() {\r
                                var counter = 0, formats = ed.getParam('style_formats');\r
 \r
                                if (formats) {\r
                                                if (keys > 1) {\r
                                                        name = fmt.name = fmt.name || 'style_' + (counter++);\r
                                                        ed.formatter.register(name, fmt);\r
-                                                       ctrl.add(fmt.title, name);\r
+                                                       ctrl.add(fmt.title, name, {\r
+                                                               style: function() {\r
+                                                                       return getPreviewCss(ed, fmt);\r
+                                                               }\r
+                                                       });\r
                                                } else\r
                                                        ctrl.add(fmt.title);\r
                                        });\r
                                } else {\r
                                        each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {\r
-                                               var name;\r
+                                               var name, fmt;\r
 \r
                                                if (val) {\r
                                                        name = 'style_' + (counter++);\r
-\r
-                                                       ed.formatter.register(name, {\r
+                                                       fmt = {\r
                                                                inline : 'span',\r
                                                                classes : val,\r
                                                                selector : '*'\r
-                                                       });\r
+                                                       };\r
 \r
-                                                       ctrl.add(t.editor.translate(key), name);\r
+                                                       ed.formatter.register(name, fmt);\r
+                                                       ctrl.add(t.editor.translate(key), name, {\r
+                                                               style: function() {\r
+                                                                       return getPreviewCss(ed, fmt);\r
+                                                               }\r
+                                                       });\r
                                                }\r
                                        });\r
                                }\r
                        c = ed.controlManager.createListBox('fontselect', {\r
                                title : 'advanced.fontdefault',\r
                                onselect : function(v) {\r
+                                       var cur = c.items[c.selectedIndex];\r
+\r
+                                       if (!v && cur) {\r
+                                               ed.execCommand('FontName', false, cur.value);\r
+                                               return;\r
+                                       }\r
+\r
                                        ed.execCommand('FontName', false, v);\r
 \r
                                        // Fake selection, execCommand will fire a nodeChange and update the selection\r
                                                return v == sv;\r
                                        });\r
 \r
+                                       if (cur && cur.value == v) {\r
+                                               c.select(null);\r
+                                       }\r
+\r
                                        return false; // No auto select\r
                                }\r
                        });\r
                        var t = this, ed = t.editor, c, i = 0, cl = [];\r
 \r
                        c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {\r
+                               var cur = c.items[c.selectedIndex];\r
+\r
+                               if (!v && cur) {\r
+                                       cur = cur.value;\r
+\r
+                                       if (cur['class']) {\r
+                                               ed.formatter.toggle('fontsize_class', {value : cur['class']});\r
+                                               ed.undoManager.add();\r
+                                               ed.nodeChanged();\r
+                                       } else {\r
+                                               ed.execCommand('FontSize', false, cur.fontSize);\r
+                                       }\r
+\r
+                                       return;\r
+                               }\r
+\r
                                if (v['class']) {\r
                                        ed.focus();\r
                                        ed.undoManager.add();\r
                                        return v == sv;\r
                                });\r
 \r
+                               if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) {\r
+                                       c.select(null);\r
+                               }\r
+\r
                                return false; // No auto select\r
                        }});\r
 \r
                                samp : 'advanced.samp'\r
                        }, t = this;\r
 \r
-                       c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});\r
+                       c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', onselect : function(v) {\r
+                               t.editor.execCommand('FormatBlock', false, v);\r
+                               return false;\r
+                       }});\r
+\r
                        if (c) {\r
                                each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {\r
-                                       c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});\r
+                                       c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v, style: function() {\r
+                                               return getPreviewCss(t.editor, {block: v});\r
+                                       }});\r
                                });\r
                        }\r
 \r
                renderUI : function(o) {\r
                        var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;\r
 \r
-                       n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});\r
+                       if (ed.settings) {\r
+                               ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');\r
+                       }\r
+\r
+                       // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.\r
+                       // Maybe actually inherit it from the original textara?\r
+                       n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});\r
+                       DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);\r
 \r
                        if (!DOM.boxModel)\r
                                n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});\r
 \r
-                       n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});\r
+                       n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});\r
                        n = tb = DOM.add(n, 'tbody');\r
 \r
                        switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {\r
                        n = o.targetNode;\r
 \r
                        // Add classes to first and last TRs\r
-                       nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8\r
+                       nl = sc.rows;\r
                        DOM.addClass(nl[0], 'mceFirst');\r
                        DOM.addClass(nl[nl.length - 1], 'mceLast');\r
 \r
 \r
                                if (e.nodeName == 'A') {\r
                                        t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));\r
-\r
-                                       return Event.cancel(e);\r
+                                       return false;\r
                                }\r
                        });\r
 /*\r
                        t.deltaHeight = o.deltaHeight;\r
                        o.targetNode = null;\r
 \r
+                       ed.onKeyDown.add(function(ed, evt) {\r
+                               var DOM_VK_F10 = 121, DOM_VK_F11 = 122;\r
+\r
+                               if (evt.altKey) {\r
+                                       if (evt.keyCode === DOM_VK_F10) {\r
+                                               // Make sure focus is given to toolbar in Safari.\r
+                                               // We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame\r
+                                               if (tinymce.isWebKit) {\r
+                                                       window.focus();\r
+                                               }\r
+                                               t.toolbarGroup.focus();\r
+                                               return Event.cancel(evt);\r
+                                       } else if (evt.keyCode === DOM_VK_F11) {\r
+                                               DOM.get(ed.id + '_path_row').focus();\r
+                                               return Event.cancel(evt);\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       // alt+0 is the UK recommended shortcut for accessing the list of access controls.\r
+                       ed.addShortcut('alt+0', '', 'mceShortcuts', t);\r
+\r
                        return {\r
                                iframeContainer : ic,\r
                                editorContainer : ed.id + '_parent',\r
                },\r
 \r
                resizeBy : function(dw, dh) {\r
-                       var e = DOM.get(this.editor.id + '_tbl');\r
+                       var e = DOM.get(this.editor.id + '_ifr');\r
 \r
                        this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);\r
                },\r
 \r
-               resizeTo : function(w, h) {\r
+               resizeTo : function(w, h, store) {\r
                        var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');\r
 \r
                        // Boundery fix box\r
                                DOM.setStyle(ifr, 'width', w);\r
 \r
                                // Make sure that the size is never smaller than the over all ui\r
-                               if (w < e.clientWidth)\r
+                               if (w < e.clientWidth) {\r
+                                       w = e.clientWidth;\r
                                        DOM.setStyle(ifr, 'width', e.clientWidth);\r
+                               }\r
+                       }\r
+\r
+                       // Store away the size\r
+                       if (store && s.theme_advanced_resizing_use_cookie) {\r
+                               Cookie.setHash("TinyMCE_" + ed.id + "_size", {\r
+                                       cw : w,\r
+                                       ch : h\r
+                               });\r
                        }\r
                },\r
 \r
                        each(explode(s.theme_advanced_containers || ''), function(c, i) {\r
                                var v = s['theme_advanced_container_' + c] || '';\r
 \r
-                               switch (v.toLowerCase()) {\r
+                               switch (c.toLowerCase()) {\r
                                        case 'mceeditor':\r
                                                n = DOM.add(tb, 'tr');\r
                                                n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});\r
                },\r
 \r
                _addToolbars : function(c, o) {\r
-                       var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a;\r
+                       var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;\r
 \r
-                       a = s.theme_advanced_toolbar_align.toLowerCase();\r
-                       a = 'mce' + t._ufirst(a);\r
+                       toolbarGroup = cf.createToolbarGroup('toolbargroup', {\r
+                               'name': ed.getLang('advanced.toolbar'),\r
+                               'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')\r
+                       });\r
 \r
-                       n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a});\r
+                       t.toolbarGroup = toolbarGroup;\r
 \r
-                       if (!ed.getParam('accessibility_focus'))\r
-                               h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));\r
+                       a = s.theme_advanced_toolbar_align.toLowerCase();\r
+                       a = 'mce' + t._ufirst(a);\r
 \r
-                       h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));\r
+                       n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});\r
 \r
                        // Create toolbar and add the controls\r
                        for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {\r
                                        v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;\r
 \r
                                t._addControls(v, tb);\r
-\r
-                               //n.appendChild(n = tb.render());\r
-                               h.push(tb.renderHTML());\r
+                               toolbarGroup.add(tb);\r
 \r
                                o.deltaHeight -= s.theme_advanced_row_height;\r
                        }\r
-\r
+                       h.push(toolbarGroup.renderHTML());\r
                        h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));\r
                        DOM.setHTML(n, h.join(''));\r
                },\r
                        var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;\r
 \r
                        n = DOM.add(tb, 'tr');\r
-                       n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});\r
-                       n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&#160;');\r
-                       DOM.add(n, 'a', {href : '#', accesskey : 'x'});\r
+                       n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); \r
+                       n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});\r
+                       if (s.theme_advanced_path) {\r
+                               DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));\r
+                               DOM.add(n, 'span', {}, ': ');\r
+                       } else {\r
+                               DOM.add(n, 'span', {}, '&#160;');\r
+                       }\r
+                       \r
 \r
                        if (s.theme_advanced_resizing) {\r
-                               DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});\r
+                               DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});\r
 \r
                                if (s.theme_advanced_resizing_use_cookie) {\r
                                        ed.onPostRender.add(function() {\r
                                }\r
 \r
                                ed.onPostRender.add(function() {\r
+                                       Event.add(ed.id + '_resize', 'click', function(e) {\r
+                                               e.preventDefault();\r
+                                       });\r
+\r
                                        Event.add(ed.id + '_resize', 'mousedown', function(e) {\r
                                                var mouseMoveHandler1, mouseMoveHandler2,\r
                                                        mouseUpHandler1, mouseUpHandler2,\r
                                                        startX, startY, startWidth, startHeight, width, height, ifrElm;\r
 \r
                                                function resizeOnMove(e) {\r
+                                                       e.preventDefault();\r
+\r
                                                        width = startWidth + (e.screenX - startX);\r
                                                        height = startHeight + (e.screenY - startY);\r
 \r
                                                        Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);\r
                                                        Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);\r
 \r
-                                                       // Store away the size\r
-                                                       if (s.theme_advanced_resizing_use_cookie) {\r
-                                                               Cookie.setHash("TinyMCE_" + ed.id + "_size", {\r
-                                                                       cw : width,\r
-                                                                       ch : height\r
-                                                               });\r
-                                                       }\r
+                                                       width = startWidth + (e.screenX - startX);\r
+                                                       height = startHeight + (e.screenY - startY);\r
+                                                       t.resizeTo(width, height, true);\r
                                                };\r
 \r
                                                e.preventDefault();\r
                        n = tb = null;\r
                },\r
 \r
+               _updateUndoStatus : function(ed) {\r
+                       var cm = ed.controlManager, um = ed.undoManager;\r
+\r
+                       cm.setDisabled('undo', !um.hasUndo() && !um.typing);\r
+                       cm.setDisabled('redo', !um.hasRedo());\r
+               },\r
+\r
                _nodeChanged : function(ed, cm, n, co, ob) {\r
-                       var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;\r
+                       var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;\r
 \r
                        tinymce.each(t.stateControls, function(c) {\r
                                cm.setActive(c, ed.queryCommandState(t.controls[c][1]));\r
                        };\r
 \r
                        cm.setActive('visualaid', ed.hasVisual);\r
-                       cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);\r
-                       cm.setDisabled('redo', !ed.undoManager.hasRedo());\r
+                       t._updateUndoStatus(ed);\r
                        cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));\r
 \r
                        p = getParent('A');\r
                        }\r
 \r
                        if (c = cm.get('anchor')) {\r
-                               c.setActive(!!p && p.name);\r
+                               c.setActive(!co && !!p && p.name);\r
                        }\r
 \r
                        p = getParent('IMG');\r
                        if (c = cm.get('image'))\r
-                               c.setActive(!!p && n.className.indexOf('mceItem') == -1);\r
+                               c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);\r
 \r
                        if (c = cm.get('styleselect')) {\r
                                t._importClasses();\r
 \r
                                matches = ed.formatter.matchAll(formatNames);\r
                                c.select(matches[0]);\r
+                               tinymce.each(matches, function(match, index) {\r
+                                       if (index > 0) {\r
+                                               c.mark(match);\r
+                                       }\r
+                               });\r
                        }\r
 \r
                        if (c = cm.get('formatselect')) {\r
                                if (n.nodeName === 'SPAN') {\r
                                        if (!cl && n.className)\r
                                                cl = n.className;\r
+                               }\r
 \r
+                               if (ed.dom.is(n, s.theme_advanced_font_selector)) {\r
                                        if (!fz && n.style.fontSize)\r
                                                fz = n.style.fontSize;\r
 \r
                                        if (!fn && n.style.fontFamily)\r
                                                fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();\r
+                                       \r
+                                       if (!fc && n.style.color)\r
+                                               fc = n.style.color;\r
+\r
+                                       if (!bc && n.style.backgroundColor)\r
+                                               bc = n.style.backgroundColor;\r
                                }\r
 \r
                                return false;\r
                                                return true;\r
                                });\r
                        }\r
+                       \r
+                       if (s.theme_advanced_show_current_color) {\r
+                               function updateColor(controlId, color) {\r
+                                       if (c = cm.get(controlId)) {\r
+                                               if (!color)\r
+                                                       color = c.settings.default_color;\r
+                                               if (color !== c.value) {\r
+                                                       c.displayColor(color);\r
+                                               }\r
+                                       }\r
+                               }\r
+                               updateColor('forecolor', fc);\r
+                               updateColor('backcolor', bc);\r
+                       }\r
+\r
+                       if (s.theme_advanced_show_current_color) {\r
+                               function updateColor(controlId, color) {\r
+                                       if (c = cm.get(controlId)) {\r
+                                               if (!color)\r
+                                                       color = c.settings.default_color;\r
+                                               if (color !== c.value) {\r
+                                                       c.displayColor(color);\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               updateColor('forecolor', fc);\r
+                               updateColor('backcolor', bc);\r
+                       }\r
 \r
                        if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {\r
                                p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});\r
+\r
+                               if (t.statusKeyboardNavigation) {\r
+                                       t.statusKeyboardNavigation.destroy();\r
+                                       t.statusKeyboardNavigation = null;\r
+                               }\r
+\r
                                DOM.setHTML(p, '');\r
 \r
                                getParent(function(n) {\r
                                        var na = n.nodeName.toLowerCase(), u, pi, ti = '';\r
 \r
-                                       /*if (n.getAttribute('_mce_bogus'))\r
-                                               return;\r
-*/\r
-                                       // Ignore non element and hidden elements\r
-                                       if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))\r
+                                       // Ignore non element and bogus/hidden elements\r
+                                       if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))\r
                                                return;\r
 \r
-                                       // Fake name\r
-                                       if (v = DOM.getAttrib(n, 'mce_name'))\r
-                                               na = v;\r
-\r
                                        // Handle prefix\r
                                        if (tinymce.isIE && n.scopeName !== 'HTML')\r
                                                na = n.scopeName + ':' + na;\r
                                        na = na.name;\r
 \r
                                        //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";\r
-                                       pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);\r
+                                       pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);\r
 \r
                                        if (p.hasChildNodes()) {\r
-                                               p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild);\r
+                                               p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);\r
                                                p.insertBefore(pi, p.firstChild);\r
                                        } else\r
                                                p.appendChild(pi);\r
                                }, ed.getBody());\r
+\r
+                               if (DOM.select('a', p).length > 0) {\r
+                                       t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({\r
+                                               root: ed.id + "_path_row",\r
+                                               items: DOM.select('a', p),\r
+                                               excludeFromTabOrder: true,\r
+                                               onCancel: function() {\r
+                                                       ed.focus();\r
+                                               }\r
+                                       }, DOM);\r
+                               }\r
                        }\r
                },\r
 \r
                        var ed = this.editor;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/anchor.htm',\r
+                               url : this.url + '/anchor.htm',\r
                                width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),\r
                                height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),\r
                                inline : true\r
                        var ed = this.editor;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/charmap.htm',\r
+                               url : this.url + '/charmap.htm',\r
                                width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),\r
-                               height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),\r
+                               height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),\r
                                inline : true\r
                        }, {\r
                                theme_url : this.url\r
                        var ed = this.editor;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/about.htm',\r
+                               url : this.url + '/about.htm',\r
                                width : 480,\r
                                height : 380,\r
                                inline : true\r
                        });\r
                },\r
 \r
+               _mceShortcuts : function() {\r
+                       var ed = this.editor;\r
+                       ed.windowManager.open({\r
+                               url: this.url + '/shortcuts.htm',\r
+                               width: 480,\r
+                               height: 380,\r
+                               inline: true\r
+                       }, {\r
+                               theme_url: this.url\r
+                       });\r
+               },\r
+\r
                _mceColorPicker : function(u, v) {\r
                        var ed = this.editor;\r
 \r
                        v = v || {};\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/color_picker.htm',\r
+                               url : this.url + '/color_picker.htm',\r
                                width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),\r
                                height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),\r
                                close_previous : false,\r
                        var ed = this.editor;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/source_editor.htm',\r
+                               url : this.url + '/source_editor.htm',\r
                                width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),\r
                                height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),\r
                                inline : true,\r
                        var ed = this.editor;\r
 \r
                        // Internal image object like a flash placeholder\r
-                       if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)\r
+                       if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)\r
                                return;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/image.htm',\r
+                               url : this.url + '/image.htm',\r
                                width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),\r
                                height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),\r
                                inline : true\r
                        var ed = this.editor;\r
 \r
                        ed.windowManager.open({\r
-                               url : tinymce.baseURL + '/themes/advanced/link.htm',\r
+                               url : this.url + '/link.htm',\r
                                width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),\r
                                height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),\r
                                inline : true\r
        });\r
 \r
        tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);\r
-}(tinymce));
\ No newline at end of file
+}(tinymce));\r
old mode 100755 (executable)
new mode 100644 (file)
index f30d670..b8ba729
 \r
        <div class="panel_wrapper">\r
                <div id="general_panel" class="panel current">\r
-     <table border="0" cellpadding="4" cellspacing="0">\r
-          <tr>\r
-            <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>\r
-            <td><table border="0" cellspacing="0" cellpadding="0">\r
-                <tr>\r
-                  <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>\r
-                  <td id="srcbrowsercontainer">&nbsp;</td>\r
-                </tr>\r
-              </table></td>\r
-          </tr>\r
-                 <tr>\r
-                       <td><label for="image_list">{#advanced_dlg.image_list}</label></td>\r
-                       <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>\r
-                 </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>\r
-            <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>\r
-          </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>\r
-            <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">\r
-                <option value="">{#not_set}</option>\r
-                <option value="baseline">{#advanced_dlg.image_align_baseline}</option>\r
-                <option value="top">{#advanced_dlg.image_align_top}</option>\r
-                <option value="middle">{#advanced_dlg.image_align_middle}</option>\r
-                <option value="bottom">{#advanced_dlg.image_align_bottom}</option>\r
-                <option value="text-top">{#advanced_dlg.image_align_texttop}</option>\r
-                <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>\r
-                <option value="left">{#advanced_dlg.image_align_left}</option>\r
-                <option value="right">{#advanced_dlg.image_align_right}</option>\r
-              </select></td>\r
-          </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>\r
-            <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />\r
-              x\r
-              <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>\r
-          </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>\r
-            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
-          </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>\r
-            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
-          </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>\r
-            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
-          </tr>\r
-        </table>\r
+                       <table border="0" cellpadding="4" cellspacing="0">\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>\r
+                                       <td><table border="0" cellspacing="0" cellpadding="0">\r
+                                               <tr>\r
+                                                       <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>\r
+                                                       <td id="srcbrowsercontainer">&nbsp;</td>\r
+                                               </tr>\r
+                                       </table></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="image_list">{#advanced_dlg.image_list}</label></td>\r
+                                       <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>\r
+                                       <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>\r
+                                       <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">\r
+                                               <option value="">{#not_set}</option>\r
+                                               <option value="baseline">{#advanced_dlg.image_align_baseline}</option>\r
+                                               <option value="top">{#advanced_dlg.image_align_top}</option>\r
+                                               <option value="middle">{#advanced_dlg.image_align_middle}</option>\r
+                                               <option value="bottom">{#advanced_dlg.image_align_bottom}</option>\r
+                                               <option value="text-top">{#advanced_dlg.image_align_texttop}</option>\r
+                                               <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>\r
+                                               <option value="left">{#advanced_dlg.image_align_left}</option>\r
+                                               <option value="right">{#advanced_dlg.image_align_right}</option>\r
+                                       </select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>\r
+                                       <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />\r
+                                        x \r
+                                       <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                               <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>\r
+                               <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>\r
+                                       <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>\r
+                                       <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>\r
+                               </tr>\r
+                       </table>\r
                </div>\r
        </div>\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index b4c542d..b1a377a
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/colorpicker.jpg and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/colorpicker.jpg differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/flash.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/flash.gif
new file mode 100644 (file)
index 0000000..dec3f7c
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/flash.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/iframe.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/iframe.gif
new file mode 100644 (file)
index 0000000..410c7ad
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/iframe.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/pagebreak.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/pagebreak.gif
new file mode 100644 (file)
index 0000000..acdf408
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/pagebreak.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/quicktime.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/quicktime.gif
new file mode 100644 (file)
index 0000000..8f10e7a
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/quicktime.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/realmedia.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/realmedia.gif
new file mode 100644 (file)
index 0000000..fdfe0b9
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/realmedia.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/shockwave.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/shockwave.gif
new file mode 100644 (file)
index 0000000..9314d04
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/shockwave.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/trans.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/trans.gif
new file mode 100644 (file)
index 0000000..3884865
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/trans.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/video.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/video.gif
new file mode 100644 (file)
index 0000000..3570104
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/video.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/img/windowsmedia.gif b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/windowsmedia.gif
new file mode 100644 (file)
index 0000000..ab50f2d
Binary files /dev/null and b/library/tinymce/jscripts/tiny_mce/themes/advanced/img/windowsmedia.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 5cee9ed..5b35845
@@ -66,6 +66,7 @@ function insertHelpIFrame() {
                html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';\r
                document.getElementById('iframecontainer').innerHTML = html;\r
                document.getElementById('help_tab').style.display = 'block';\r
+               document.getElementById('help_tab').setAttribute("aria-hidden", "false");\r
        }\r
 }\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 7fe7810..2940db3
@@ -19,16 +19,23 @@ var AnchorDialog = {
        update : function() {\r
                var ed = this.editor, elm, name = document.forms[0].anchorName.value;\r
 \r
+               if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {\r
+                       tinyMCEPopup.alert('advanced_dlg.anchor_invalid');\r
+                       return;\r
+               }\r
+\r
                tinyMCEPopup.restoreSelection();\r
 \r
                if (this.action != 'update')\r
                        ed.selection.collapse(1);\r
 \r
                elm = ed.dom.getParent(ed.selection.getNode(), 'A');\r
-               if (elm)\r
+               if (elm) {\r
+                       elm.setAttribute('name', name);\r
                        elm.name = name;\r
-               else\r
-                       ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));\r
+               } else\r
+                       // create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it\r
+                       ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, '\uFEFF'));\r
 \r
                tinyMCEPopup.close();\r
        }\r
old mode 100755 (executable)
new mode 100644 (file)
index 8c5aea1..bb18695
@@ -173,7 +173,7 @@ var charmap = [
        ['&yacute;',  '&#253;',  true, 'y - acute'],\r
        ['&thorn;',   '&#254;',  true, 'thorn'],\r
        ['&yuml;',    '&#255;',  true, 'y - diaeresis'],\r
-    ['&Alpha;',   '&#913;',  true, 'Alpha'],\r
+       ['&Alpha;',   '&#913;',  true, 'Alpha'],\r
        ['&Beta;',    '&#914;',  true, 'Beta'],\r
        ['&Gamma;',   '&#915;',  true, 'Gamma'],\r
        ['&Delta;',   '&#916;',  true, 'Delta'],\r
@@ -258,8 +258,8 @@ var charmap = [
        ['&rfloor;',  '&#8971;', false,'right floor'],\r
        ['&lang;',    '&#9001;', false,'left-pointing angle bracket'],\r
        ['&rang;',    '&#9002;', false,'right-pointing angle bracket'],\r
-       ['&loz;',     '&#9674;', true,'lozenge'],\r
-       ['&spades;',  '&#9824;', false,'black spade suit'],\r
+       ['&loz;',     '&#9674;', true, 'lozenge'],\r
+       ['&spades;',  '&#9824;', true, 'black spade suit'],\r
        ['&clubs;',   '&#9827;', true, 'black club suit'],\r
        ['&hearts;',  '&#9829;', true, 'black heart suit'],\r
        ['&diams;',   '&#9830;', true, 'black diamond suit'],\r
@@ -275,19 +275,46 @@ var charmap = [
 \r
 tinyMCEPopup.onInit.add(function() {\r
        tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());\r
+       addKeyboardNavigation();\r
 });\r
 \r
+function addKeyboardNavigation(){\r
+       var tableElm, cells, settings;\r
+\r
+       cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");\r
+\r
+       settings ={\r
+               root: "charmapgroup",\r
+               items: cells\r
+       };\r
+       cells[0].tabindex=0;\r
+       tinyMCEPopup.dom.addClass(cells[0], "mceFocus");\r
+       if (tinymce.isGecko) {\r
+               cells[0].focus();               \r
+       } else {\r
+               setTimeout(function(){\r
+                       cells[0].focus();\r
+               }, 100);\r
+       }\r
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);\r
+}\r
+\r
 function renderCharMapHTML() {\r
        var charsPerRow = 20, tdWidth=20, tdHeight=20, i;\r
-       var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';\r
+       var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+\r
+       '<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + \r
+       '"><tr height="' + tdHeight + '">';\r
        var cols=-1;\r
 \r
        for (i=0; i<charmap.length; i++) {\r
+               var previewCharFn;\r
+\r
                if (charmap[i][2]==true) {\r
                        cols++;\r
+                       previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';\r
                        html += ''\r
                                + '<td class="charmap">'\r
-                               + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'\r
+                               + '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'\r
                                + charmap[i][1]\r
                                + '</a></td>';\r
                        if ((cols+1) % charsPerRow == 0)\r
@@ -301,7 +328,8 @@ function renderCharMapHTML() {
                        html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';\r
        }\r
 \r
-       html += '</tr></table>';\r
+       html += '</tr></table></div>';\r
+       html = html.replace(/<tr height="20"><\/tr>/g, '');\r
 \r
        return html;\r
 }\r
old mode 100755 (executable)
new mode 100644 (file)
index fd9700f..cc891c1
-tinyMCEPopup.requireLangPack();\r
-\r
-var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;\r
-\r
-var colors = [\r
-       "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",\r
-       "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",\r
-       "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",\r
-       "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",\r
-       "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",\r
-       "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",\r
-       "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",\r
-       "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",\r
-       "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",\r
-       "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",\r
-       "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",\r
-       "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",\r
-       "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",\r
-       "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",\r
-       "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",\r
-       "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",\r
-       "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",\r
-       "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",\r
-       "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",\r
-       "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",\r
-       "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",\r
-       "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",\r
-       "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",\r
-       "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",\r
-       "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",\r
-       "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",\r
-       "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"\r
-];\r
-\r
-var named = {\r
-       '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',\r
-       '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown',\r
-       '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue',\r
-       '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod',\r
-       '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen',\r
-       '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue',\r
-       '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue',\r
-       '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen',\r
-       '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey',\r
-       '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory',\r
-       '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue',\r
-       '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen',\r
-       '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey',\r
-       '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',\r
-       '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue',\r
-       '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin',\r
-       '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid',\r
-       '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff',\r
-       '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue',\r
-       '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver',\r
-       '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen',\r
-       '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',\r
-       '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'\r
-};\r
-\r
-function init() {\r
-       var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));\r
-\r
-       tinyMCEPopup.resizeToInnerSize();\r
-\r
-       generatePicker();\r
-\r
-       if (inputColor) {\r
-               changeFinalColor(inputColor);\r
-\r
-               col = convertHexToRGB(inputColor);\r
-\r
-               if (col)\r
-                       updateLight(col.r, col.g, col.b);\r
-       }\r
-}\r
-\r
-function insertAction() {\r
-       var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');\r
-\r
-       tinyMCEPopup.restoreSelection();\r
-\r
-       if (f)\r
-               f(color);\r
-\r
-       tinyMCEPopup.close();\r
-}\r
-\r
-function showColor(color, name) {\r
-       if (name)\r
-               document.getElementById("colorname").innerHTML = name;\r
-\r
-       document.getElementById("preview").style.backgroundColor = color;\r
-       document.getElementById("color").value = color.toLowerCase();\r
-}\r
-\r
-function convertRGBToHex(col) {\r
-       var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");\r
-\r
-       if (!col)\r
-               return col;\r
-\r
-       var rgb = col.replace(re, "$1,$2,$3").split(',');\r
-       if (rgb.length == 3) {\r
-               r = parseInt(rgb[0]).toString(16);\r
-               g = parseInt(rgb[1]).toString(16);\r
-               b = parseInt(rgb[2]).toString(16);\r
-\r
-               r = r.length == 1 ? '0' + r : r;\r
-               g = g.length == 1 ? '0' + g : g;\r
-               b = b.length == 1 ? '0' + b : b;\r
-\r
-               return "#" + r + g + b;\r
-       }\r
-\r
-       return col;\r
-}\r
-\r
-function convertHexToRGB(col) {\r
-       if (col.indexOf('#') != -1) {\r
-               col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');\r
-\r
-               r = parseInt(col.substring(0, 2), 16);\r
-               g = parseInt(col.substring(2, 4), 16);\r
-               b = parseInt(col.substring(4, 6), 16);\r
-\r
-               return {r : r, g : g, b : b};\r
-       }\r
-\r
-       return null;\r
-}\r
-\r
-function generatePicker() {\r
-       var el = document.getElementById('light'), h = '', i;\r
-\r
-       for (i = 0; i < detail; i++){\r
-               h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'\r
-               + ' onclick="changeFinalColor(this.style.backgroundColor)"'\r
-               + ' onmousedown="isMouseDown = true; return false;"'\r
-               + ' onmouseup="isMouseDown = false;"'\r
-               + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'\r
-               + ' onmouseover="isMouseOver = true;"'\r
-               + ' onmouseout="isMouseOver = false;"'\r
-               + '></div>';\r
-       }\r
-\r
-       el.innerHTML = h;\r
-}\r
-\r
-function generateWebColors() {\r
-       var el = document.getElementById('webcolors'), h = '', i;\r
-\r
-       if (el.className == 'generated')\r
-               return;\r
-\r
-       h += '<table border="0" cellspacing="1" cellpadding="0">'\r
-               + '<tr>';\r
-\r
-       for (i=0; i<colors.length; i++) {\r
-               h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'\r
-                       + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'\r
-                       + '</a></td>';\r
-               if ((i+1) % 18 == 0)\r
-                       h += '</tr><tr>';\r
-       }\r
-\r
-       h += '</table>';\r
-\r
-       el.innerHTML = h;\r
-       el.className = 'generated';\r
-}\r
-\r
-function generateNamedColors() {\r
-       var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;\r
-\r
-       if (el.className == 'generated')\r
-               return;\r
-\r
-       for (n in named) {\r
-               v = named[n];\r
-               h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n +  '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'\r
-       }\r
-\r
-       el.innerHTML = h;\r
-       el.className = 'generated';\r
-}\r
-\r
-function dechex(n) {\r
-       return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);\r
-}\r
-\r
-function computeColor(e) {\r
-       var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;\r
-\r
-       x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);\r
-       y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);\r
-\r
-       partWidth = document.getElementById('colors').width / 6;\r
-       partDetail = detail / 2;\r
-       imHeight = document.getElementById('colors').height;\r
-\r
-       r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;\r
-       g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255     + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);\r
-       b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);\r
-\r
-       coef = (imHeight - y) / imHeight;\r
-       r = 128 + (r - 128) * coef;\r
-       g = 128 + (g - 128) * coef;\r
-       b = 128 + (b - 128) * coef;\r
-\r
-       changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));\r
-       updateLight(r, g, b);\r
-}\r
-\r
-function updateLight(r, g, b) {\r
-       var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;\r
-\r
-       for (i=0; i<detail; i++) {\r
-               if ((i>=0) && (i<partDetail)) {\r
-                       finalCoef = i / partDetail;\r
-                       finalR = dechex(255 - (255 - r) * finalCoef);\r
-                       finalG = dechex(255 - (255 - g) * finalCoef);\r
-                       finalB = dechex(255 - (255 - b) * finalCoef);\r
-               } else {\r
-                       finalCoef = 2 - i / partDetail;\r
-                       finalR = dechex(r * finalCoef);\r
-                       finalG = dechex(g * finalCoef);\r
-                       finalB = dechex(b * finalCoef);\r
-               }\r
-\r
-               color = finalR + finalG + finalB;\r
-\r
-               setCol('gs' + i, '#'+color);\r
-       }\r
-}\r
-\r
-function changeFinalColor(color) {\r
-       if (color.indexOf('#') == -1)\r
-               color = convertRGBToHex(color);\r
-\r
-       setCol('preview', color);\r
-       document.getElementById('color').value = color;\r
-}\r
-\r
-function setCol(e, c) {\r
-       try {\r
-               document.getElementById(e).style.backgroundColor = c;\r
-       } catch (ex) {\r
-               // Ignore IE warning\r
-       }\r
-}\r
-\r
-tinyMCEPopup.onInit.add(init);\r
+tinyMCEPopup.requireLangPack();
+
+var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
+
+var colors = [
+       "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
+       "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
+       "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
+       "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
+       "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
+       "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
+       "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
+       "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
+       "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
+       "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
+       "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
+       "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
+       "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
+       "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
+       "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
+       "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
+       "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
+       "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
+       "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
+       "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
+       "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
+       "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
+       "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
+       "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
+       "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
+       "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
+       "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
+];
+
+var named = {
+       '#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
+       '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
+       '#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
+       '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
+       '#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
+       '#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
+       '#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
+       '#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
+       '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
+       '#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
+       '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
+       '#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
+       '#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
+       '#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
+       '#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
+       '#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
+       '#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
+       '#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
+       '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
+       '#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
+       '#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
+       '#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
+       '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
+};
+
+var namedLookup = {};
+
+function init() {
+       var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
+
+       tinyMCEPopup.resizeToInnerSize();
+
+       generatePicker();
+       generateWebColors();
+       generateNamedColors();
+
+       if (inputColor) {
+               changeFinalColor(inputColor);
+
+               col = convertHexToRGB(inputColor);
+
+               if (col)
+                       updateLight(col.r, col.g, col.b);
+       }
+
+       for (key in named) {
+               value = named[key];
+               namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
+       }
+}
+
+function toHexColor(color) {
+       var matches, red, green, blue, toInt = parseInt;
+
+       function hex(value) {
+               value = parseInt(value).toString(16);
+
+               return value.length > 1 ? value : '0' + value; // Padd with leading zero
+       };
+
+       color = tinymce.trim(color);
+       color = color.replace(/^[#]/, '').toLowerCase();  // remove leading '#'
+       color = namedLookup[color] || color;
+
+       matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color);
+
+       if (matches) {
+               red   = toInt(matches[1]);
+               green = toInt(matches[2]);
+               blue  = toInt(matches[3]);
+       } else {
+               matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color);
+
+               if (matches) {
+                       red   = toInt(matches[1], 16);
+                       green = toInt(matches[2], 16);
+                       blue  = toInt(matches[3], 16);
+               } else {
+                       matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color);
+
+                       if (matches) {
+                               red   = toInt(matches[1] + matches[1], 16);
+                               green = toInt(matches[2] + matches[2], 16);
+                               blue  = toInt(matches[3] + matches[3], 16);
+                       } else {
+                               return '';
+                       }
+               }
+       }
+
+       return '#' + hex(red) + hex(green) + hex(blue);
+}
+
+function insertAction() {
+       var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+       var hexColor = toHexColor(color);
+
+       if (hexColor === '') {
+               var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value');
+               tinyMCEPopup.alert(text + ': ' + color);
+       }
+       else {
+               tinyMCEPopup.restoreSelection();
+
+               if (f)
+                       f(hexColor);
+
+               tinyMCEPopup.close();
+       }
+}
+
+function showColor(color, name) {
+       if (name)
+               document.getElementById("colorname").innerHTML = name;
+
+       document.getElementById("preview").style.backgroundColor = color;
+       document.getElementById("color").value = color.toUpperCase();
+}
+
+function convertRGBToHex(col) {
+       var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+       if (!col)
+               return col;
+
+       var rgb = col.replace(re, "$1,$2,$3").split(',');
+       if (rgb.length == 3) {
+               r = parseInt(rgb[0]).toString(16);
+               g = parseInt(rgb[1]).toString(16);
+               b = parseInt(rgb[2]).toString(16);
+
+               r = r.length == 1 ? '0' + r : r;
+               g = g.length == 1 ? '0' + g : g;
+               b = b.length == 1 ? '0' + b : b;
+
+               return "#" + r + g + b;
+       }
+
+       return col;
+}
+
+function convertHexToRGB(col) {
+       if (col.indexOf('#') != -1) {
+               col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+
+               r = parseInt(col.substring(0, 2), 16);
+               g = parseInt(col.substring(2, 4), 16);
+               b = parseInt(col.substring(4, 6), 16);
+
+               return {r : r, g : g, b : b};
+       }
+
+       return null;
+}
+
+function generatePicker() {
+       var el = document.getElementById('light'), h = '', i;
+
+       for (i = 0; i < detail; i++){
+               h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+               + ' onclick="changeFinalColor(this.style.backgroundColor)"'
+               + ' onmousedown="isMouseDown = true; return false;"'
+               + ' onmouseup="isMouseDown = false;"'
+               + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+               + ' onmouseover="isMouseOver = true;"'
+               + ' onmouseout="isMouseOver = false;"'
+               + '></div>';
+       }
+
+       el.innerHTML = h;
+}
+
+function generateWebColors() {
+       var el = document.getElementById('webcolors'), h = '', i;
+
+       if (el.className == 'generated')
+               return;
+
+       // TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
+       h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
+               + '<tr>';
+
+       for (i=0; i<colors.length; i++) {
+               h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+                       + '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+               }
+               h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
+               h += '</a></td>';
+               if ((i+1) % 18 == 0)
+                       h += '</tr><tr>';
+       }
+
+       h += '</table></div>';
+
+       el.innerHTML = h;
+       el.className = 'generated';
+
+       paintCanvas(el);
+       enableKeyboardNavigation(el.firstChild);
+}
+
+function paintCanvas(el) {
+       tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
+               var context;
+               if (canvas.getContext && (context = canvas.getContext("2d"))) {
+                       context.fillStyle = canvas.getAttribute('data-color');
+                       context.fillRect(0, 0, 10, 10);
+               }
+       });
+}
+function generateNamedColors() {
+       var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
+
+       if (el.className == 'generated')
+               return;
+
+       for (n in named) {
+               v = named[n];
+               h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+               }
+               h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
+               h += '</a>';
+               i++;
+       }
+
+       el.innerHTML = h;
+       el.className = 'generated';
+
+       paintCanvas(el);
+       enableKeyboardNavigation(el);
+}
+
+function enableKeyboardNavigation(el) {
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
+               root: el,
+               items: tinyMCEPopup.dom.select('a', el)
+       }, tinyMCEPopup.dom);
+}
+
+function dechex(n) {
+       return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
+}
+
+function computeColor(e) {
+       var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target);
+
+       x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0);
+       y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0);
+
+       partWidth = document.getElementById('colors').width / 6;
+       partDetail = detail / 2;
+       imHeight = document.getElementById('colors').height;
+
+       r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
+       g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255     + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
+       b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
+
+       coef = (imHeight - y) / imHeight;
+       r = 128 + (r - 128) * coef;
+       g = 128 + (g - 128) * coef;
+       b = 128 + (b - 128) * coef;
+
+       changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
+       updateLight(r, g, b);
+}
+
+function updateLight(r, g, b) {
+       var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
+
+       for (i=0; i<detail; i++) {
+               if ((i>=0) && (i<partDetail)) {
+                       finalCoef = i / partDetail;
+                       finalR = dechex(255 - (255 - r) * finalCoef);
+                       finalG = dechex(255 - (255 - g) * finalCoef);
+                       finalB = dechex(255 - (255 - b) * finalCoef);
+               } else {
+                       finalCoef = 2 - i / partDetail;
+                       finalR = dechex(r * finalCoef);
+                       finalG = dechex(g * finalCoef);
+                       finalB = dechex(b * finalCoef);
+               }
+
+               color = finalR + finalG + finalB;
+
+               setCol('gs' + i, '#'+color);
+       }
+}
+
+function changeFinalColor(color) {
+       if (color.indexOf('#') == -1)
+               color = convertRGBToHex(color);
+
+       setCol('preview', color);
+       document.getElementById('color').value = color;
+}
+
+function setCol(e, c) {
+       try {
+               document.getElementById(e).style.backgroundColor = c;
+       } catch (ex) {
+               // Ignore IE warning
+       }
+}
+
+tinyMCEPopup.onInit.add(init);
old mode 100755 (executable)
new mode 100644 (file)
index 6423d90..6c2489a
@@ -18,7 +18,7 @@ var ImageDialog = {
 \r
                e = ed.selection.getNode();\r
 \r
-               this.fillFileList('image_list', 'tinyMCEImageList');\r
+               this.fillFileList('image_list', tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'));\r
 \r
                if (e.nodeName == 'IMG') {\r
                        f.src.value = ed.dom.getAttrib(e, 'src');\r
@@ -39,7 +39,7 @@ var ImageDialog = {
        fillFileList : function(id, l) {\r
                var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;\r
 \r
-               l = window[l];\r
+               l = typeof(l) === 'function' ? l() : window[l];\r
 \r
                if (l && l.length > 0) {\r
                        lst.options[lst.options.length] = new Option('', '');\r
@@ -77,7 +77,7 @@ var ImageDialog = {
                        args.style = this.styleVal;\r
 \r
                tinymce.extend(args, {\r
-                       src : f.src.value,\r
+                       src : f.src.value.replace(/ /g, '%20'),\r
                        alt : f.alt.value,\r
                        width : f.width.value,\r
                        height : f.height.value\r
@@ -87,10 +87,16 @@ var ImageDialog = {
 \r
                if (el && el.nodeName == 'IMG') {\r
                        ed.dom.setAttribs(el, args);\r
+                       tinyMCEPopup.editor.execCommand('mceRepaint');\r
+                       tinyMCEPopup.editor.focus();\r
                } else {\r
-                       ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});\r
-                       ed.dom.setAttribs('__mce_tmp', args);\r
-                       ed.dom.setAttrib('__mce_tmp', 'id', '');\r
+                       tinymce.each(args, function(value, name) {\r
+                               if (value === "") {\r
+                                       delete args[name];\r
+                               }\r
+                       });\r
+\r
+                       ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});\r
                        ed.undoManager.add();\r
                }\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index f67a5bc..53ff409
@@ -31,7 +31,7 @@ var LinkDialog = {
        },\r
 \r
        update : function() {\r
-               var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;\r
+               var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20');\r
 \r
                tinyMCEPopup.restoreSelection();\r
                e = ed.dom.getParent(ed.selection.getNode(), 'A');\r
@@ -39,7 +39,6 @@ var LinkDialog = {
                // Remove element if there is no href\r
                if (!f.href.value) {\r
                        if (e) {\r
-                               tinyMCEPopup.execCommand("mceBeginUndoLevel");\r
                                b = ed.selection.getBookmark();\r
                                ed.dom.remove(e, 1);\r
                                ed.selection.moveToBookmark(b);\r
@@ -49,19 +48,17 @@ var LinkDialog = {
                        }\r
                }\r
 \r
-               tinyMCEPopup.execCommand("mceBeginUndoLevel");\r
-\r
                // Create new anchor elements\r
                if (e == null) {\r
                        ed.getDoc().execCommand("unlink", false, null);\r
-                       tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});\r
+                       tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});\r
 \r
                        tinymce.each(ed.dom.select("a"), function(n) {\r
                                if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {\r
                                        e = n;\r
 \r
                                        ed.dom.setAttribs(e, {\r
-                                               href : f.href.value,\r
+                                               href : href,\r
                                                title : f.linktitle.value,\r
                                                target : f.target_list ? getSelectValue(f, "target_list") : null,\r
                                                'class' : f.class_list ? getSelectValue(f, "class_list") : null\r
@@ -70,7 +67,7 @@ var LinkDialog = {
                        });\r
                } else {\r
                        ed.dom.setAttribs(e, {\r
-                               href : f.href.value,\r
+                               href : href,\r
                                title : f.linktitle.value,\r
                                target : f.target_list ? getSelectValue(f, "target_list") : null,\r
                                'class' : f.class_list ? getSelectValue(f, "class_list") : null\r
old mode 100755 (executable)
new mode 100644 (file)
index 2793286..dd5e366
@@ -16,7 +16,7 @@ function onLoadInit() {
        document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});\r
 \r
        if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {\r
-               setWrap('soft');\r
+               turnWrapOn();\r
                document.getElementById('wraped').checked = true;\r
        }\r
 \r
@@ -37,26 +37,42 @@ function setWrap(val) {
        }\r
 }\r
 \r
-function toggleWordWrap(elm) {\r
-       if (elm.checked)\r
-               setWrap('soft');\r
-       else\r
-               setWrap('off');\r
+function setWhiteSpaceCss(value) {\r
+       var el = document.getElementById('htmlSource');\r
+       tinymce.DOM.setStyle(el, 'white-space', value);\r
 }\r
 \r
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;\r
+function turnWrapOff() {\r
+       if (tinymce.isWebKit) {\r
+               setWhiteSpaceCss('pre');\r
+       } else {\r
+               setWrap('off');\r
+       }\r
+}\r
 \r
-function resizeInputs() {\r
-       var el = document.getElementById('htmlSource');\r
+function turnWrapOn() {\r
+       if (tinymce.isWebKit) {\r
+               setWhiteSpaceCss('pre-wrap');\r
+       } else {\r
+               setWrap('soft');\r
+       }\r
+}\r
 \r
-       if (!tinymce.isIE) {\r
-                wHeight = self.innerHeight - 65;\r
-                wWidth = self.innerWidth - 16;\r
+function toggleWordWrap(elm) {\r
+       if (elm.checked) {\r
+               turnWrapOn();\r
        } else {\r
-                wHeight = document.body.clientHeight - 70;\r
-                wWidth = document.body.clientWidth - 16;\r
+               turnWrapOff();\r
        }\r
+}\r
+\r
+function resizeInputs() {\r
+       var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
 \r
-       el.style.height = Math.abs(wHeight) + 'px';\r
-       el.style.width  = Math.abs(wWidth) + 'px';\r
+       el = document.getElementById('htmlSource');\r
+\r
+       if (el) {\r
+               el.style.width = (vp.w - 20) + 'px';\r
+               el.style.height = (vp.h - 65) + 'px';\r
+       }\r
 }\r
old mode 100755 (executable)
new mode 100644 (file)
index 502b008..6e58481
@@ -1,62 +1 @@
-tinyMCE.addI18n('en.advanced',{\r
-style_select:"Styles",\r
-font_size:"Font size",\r
-fontdefault:"Font family",\r
-block:"Format",\r
-paragraph:"Paragraph",\r
-div:"Div",\r
-address:"Address",\r
-pre:"Preformatted",\r
-h1:"Heading 1",\r
-h2:"Heading 2",\r
-h3:"Heading 3",\r
-h4:"Heading 4",\r
-h5:"Heading 5",\r
-h6:"Heading 6",\r
-blockquote:"Blockquote",\r
-code:"Code",\r
-samp:"Code sample",\r
-dt:"Definition term ",\r
-dd:"Definition description",\r
-bold_desc:"Bold (Ctrl+B)",\r
-italic_desc:"Italic (Ctrl+I)",\r
-underline_desc:"Underline (Ctrl+U)",\r
-striketrough_desc:"Strikethrough",\r
-justifyleft_desc:"Align left",\r
-justifycenter_desc:"Align center",\r
-justifyright_desc:"Align right",\r
-justifyfull_desc:"Align full",\r
-bullist_desc:"Unordered list",\r
-numlist_desc:"Ordered list",\r
-outdent_desc:"Outdent",\r
-indent_desc:"Indent",\r
-undo_desc:"Undo (Ctrl+Z)",\r
-redo_desc:"Redo (Ctrl+Y)",\r
-link_desc:"Insert/edit link",\r
-unlink_desc:"Unlink",\r
-image_desc:"Insert/edit image",\r
-cleanup_desc:"Cleanup messy code",\r
-code_desc:"Edit BBcode Source",\r
-sub_desc:"Subscript",\r
-sup_desc:"Superscript",\r
-hr_desc:"Insert horizontal ruler",\r
-removeformat_desc:"Remove formatting",\r
-custom1_desc:"Your custom description here",\r
-forecolor_desc:"Select text color",\r
-backcolor_desc:"Select background color",\r
-charmap_desc:"Insert custom character",\r
-visualaid_desc:"Toggle guidelines/invisible elements",\r
-anchor_desc:"Insert/edit anchor",\r
-cut_desc:"Cut",\r
-copy_desc:"Copy",\r
-paste_desc:"Paste",\r
-image_props_desc:"Image properties",\r
-newdocument_desc:"New document",\r
-help_desc:"Help",\r
-blockquote_desc:"Blockquote",\r
-clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?",\r
-path:"Path",\r
-newdocument:"Are you sure you want clear all contents?",\r
-toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",\r
-more_colors:"More colors"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.advanced',{"underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)",dd:"Definition Description",dt:"Definition Term ",samp:"Code Sample",code:"Code",blockquote:"Block Quote",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1",pre:"Preformatted",address:"Address",div:"DIV",paragraph:"Paragraph",block:"Format",fontdefault:"Font Family","font_size":"Font Size","style_select":"Styles","anchor_delta_height":"","anchor_delta_width":"","charmap_delta_height":"","charmap_delta_width":"","colorpicker_delta_height":"","colorpicker_delta_width":"","link_delta_height":"","link_delta_width":"","image_delta_height":"","image_delta_width":"","more_colors":"More Colors...","toolbar_focus":"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",newdocument:"Are you sure you want clear all contents?",path:"Path","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","blockquote_desc":"Block Quote","help_desc":"Help","newdocument_desc":"New Document","image_props_desc":"Image Properties","paste_desc":"Paste (Ctrl+V)","copy_desc":"Copy (Ctrl+C)","cut_desc":"Cut (Ctrl+X)","anchor_desc":"Insert/Edit Anchor","visualaid_desc":"show/Hide Guidelines/Invisible Elements","charmap_desc":"Insert Special Character","backcolor_desc":"Select Background Color","forecolor_desc":"Select Text Color","custom1_desc":"Your Custom Description Here","removeformat_desc":"Remove Formatting","hr_desc":"Insert Horizontal Line","sup_desc":"Superscript","sub_desc":"Subscript","code_desc":"Edit HTML Source","cleanup_desc":"Cleanup Messy Code","image_desc":"Insert/Edit Image","unlink_desc":"Unlink","link_desc":"Insert/Edit Link","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","indent_desc":"Increase Indent","outdent_desc":"Decrease Indent","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","justifyfull_desc":"Align Full","justifyright_desc":"Align Right","justifycenter_desc":"Align Center","justifyleft_desc":"Align Left","striketrough_desc":"Strikethrough","help_shortcut":"Press ALT-F10 for toolbar. Press ALT-0 for help","rich_text_area":"Rich Text Area","shortcuts_desc":"Accessability Help",toolbar:"Toolbar"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index ea5a6da..50cd87e
@@ -1,51 +1 @@
-tinyMCE.addI18n('en.advanced_dlg',{\r
-about_title:"About TinyMCE",\r
-about_general:"About",\r
-about_help:"Help",\r
-about_license:"License",\r
-about_plugins:"Plugins",\r
-about_plugin:"Plugin",\r
-about_author:"Author",\r
-about_version:"Version",\r
-about_loaded:"Loaded plugins",\r
-anchor_title:"Insert/edit anchor",\r
-anchor_name:"Anchor name",\r
-code_title:"BBcode Source Editor",\r
-code_wordwrap:"Word wrap",\r
-colorpicker_title:"Select a color",\r
-colorpicker_picker_tab:"Picker",\r
-colorpicker_picker_title:"Color picker",\r
-colorpicker_palette_tab:"Palette",\r
-colorpicker_palette_title:"Palette colors",\r
-colorpicker_named_tab:"Named",\r
-colorpicker_named_title:"Named colors",\r
-colorpicker_color:"Color:",\r
-colorpicker_name:"Name:",\r
-charmap_title:"Select custom character",\r
-image_title:"Insert/edit image",\r
-image_src:"Image URL",\r
-image_alt:"Image description",\r
-image_list:"Image list",\r
-image_border:"Border",\r
-image_dimensions:"Dimensions",\r
-image_vspace:"Vertical space",\r
-image_hspace:"Horizontal space",\r
-image_align:"Alignment",\r
-image_align_baseline:"Baseline",\r
-image_align_top:"Top",\r
-image_align_middle:"Middle",\r
-image_align_bottom:"Bottom",\r
-image_align_texttop:"Text top",\r
-image_align_textbottom:"Text bottom",\r
-image_align_left:"Left",\r
-image_align_right:"Right",\r
-link_title:"Insert/edit link",\r
-link_url:"Link URL",\r
-link_target:"Target",\r
-link_target_same:"Open link in the same window",\r
-link_target_blank:"Open link in a new window",\r
-link_titlefield:"Title",\r
-link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",\r
-link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",\r
-link_list:"Link list"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","invalid_color_value":"Invalid color value","":""});
old mode 100755 (executable)
new mode 100644 (file)
index 7565b9a..5d9dea9
 \r
        <div class="panel_wrapper">\r
                <div id="general_panel" class="panel current">\r
-\r
-               <table border="0" cellpadding="4" cellspacing="0">\r
-          <tr>\r
-            <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>\r
-            <td><table border="0" cellspacing="0" cellpadding="0"> \r
-                                 <tr> \r
-                                       <td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> \r
-                                       <td id="hrefbrowsercontainer">&nbsp;</td>\r
-                                 </tr> \r
-                               </table></td>\r
-          </tr>\r
-                 <tr>\r
-                       <td><label for="link_list">{#advanced_dlg.link_list}</label></td>\r
-                       <td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>\r
-                 </tr>\r
-               <tr>\r
-                       <td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>\r
-                       <td><select id="target_list" name="target_list"></select></td>\r
-               </tr>\r
-          <tr>\r
-            <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>\r
-            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>\r
-          </tr>\r
-                       <tr>\r
-                               <td><label for="class_list">{#class_name}</label></td>\r
-                               <td><select id="class_list" name="class_list"></select></td>\r
-                       </tr>\r
-        </table>\r
+                       <table border="0" cellpadding="4" cellspacing="0">\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>\r
+                                       <td><table border="0" cellspacing="0" cellpadding="0"> \r
+                                               <tr> \r
+                                                       <td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> \r
+                                                       <td id="hrefbrowsercontainer">&nbsp;</td>\r
+                                               </tr> \r
+                                       </table></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="link_list">{#advanced_dlg.link_list}</label></td>\r
+                                       <td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>\r
+                                       <td><select id="target_list" name="target_list"></select></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>\r
+                                       <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td><label for="class_list">{#class_name}</label></td>\r
+                                       <td><select id="class_list" name="class_list"></select></td>\r
+                               </tr>\r
+                       </table>\r
                </div>\r
        </div>\r
 \r
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/shortcuts.htm b/library/tinymce/jscripts/tiny_mce/themes/advanced/shortcuts.htm
new file mode 100644 (file)
index 0000000..20ec2f5
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+       <head>\r
+               <title>{#advanced_dlg.accessibility_help}</title>\r
+               <script type="text/javascript" src="../../tiny_mce_popup.js"></script>\r
+               <script type="text/javascript">tinyMCEPopup.requireLangPack();</script>\r
+       </head>\r
+       <body id="content">\r
+               <h1>{#advanced_dlg.accessibility_usage_title}</h1>\r
+               <h2>Toolbars</h2>\r
+               <p>Press ALT-F10 to move focus to the toolbars. Navigate through the buttons using the arrow keys.\r
+               Press enter to activate a button and return focus to the editor.\r
+               Press escape to return focus to the editor without performing any actions.</p>\r
+               \r
+               <h2>Status Bar</h2>\r
+               <p>To access the editor status bar, press ALT-F11. Use the left and right arrow keys to navigate between elements in the path.\r
+               Press enter or space to select an element. Press escape to return focus to the editor without changing the selection.</p>\r
+               \r
+               <h2>Context Menu</h2>\r
+               <p>Press shift-F10 to activate the context menu. Use the up and down arrow keys to move between menu items. To open sub-menus press the right arrow key.\r
+               To close submenus press the left arrow key.  Press escape to close the context menu.</p>\r
+               \r
+               <h1>Keyboard Shortcuts</h1>\r
+               <table>\r
+                       <thead>\r
+                               <tr>\r
+                                       <th>Keystroke</th>\r
+                                       <th>Function</th>\r
+                               </tr>\r
+                       </thead>\r
+                       <tbody>\r
+                               <tr>\r
+                                       <td>Control-B</td><td>Bold</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-I</td><td>Italic</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-Z</td><td>Undo</td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <td>Control-Y</td><td>Redo</td>\r
+                               </tr>\r
+                       </tbody>\r
+               </table>\r
+       </body>\r
+</html>\r
old mode 100755 (executable)
new mode 100644 (file)
index 444063a..52a1d67
@@ -1,6 +1,7 @@
 body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}\r
 body {background:#FFF;}\r
 body.mceForceColors {background:#FFF; color:#000;}\r
+body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;}\r
 h1 {font-size: 2em}\r
 h2 {font-size: 1.5em}\r
 h3 {font-size: 1.17em}\r
@@ -8,28 +9,17 @@ h4 {font-size: 1em}
 h5 {font-size: .83em}\r
 h6 {font-size: .75em}\r
 .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
-a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(img/items.gif) no-repeat 0 0;}\r
+a.mceItemAnchor {display:inline-block; -webkit-user-select:all; -webkit-user-modify:read-only; -moz-user-select:all; -moz-user-modify:read-only; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat center center}\r
+span.mceItemNbsp {background: #DDD}\r
 td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
 img {border:0;}\r
-table {cursor:default}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
 table td, table th {cursor:text}\r
 ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
 del {color:red; text-decoration:line-through}\r
 cite {border-bottom:1px dashed blue}\r
 acronym {border-bottom:1px dotted #CCC; cursor:help}\r
 abbr {border-bottom:1px dashed #CCC; cursor:help}\r
-code {\r
-       font-family: Courier, monospace;\r
-       white-space: pre;\r
-       display: block;\r
-       overflow: auto;\r
-       border: 1px solid #444;\r
-       background: #EEE;\r
-       color: #444;\r
-       padding: 10px;\r
-       margin-top: 20px;\r
-}\r
-\r
 \r
 /* IE */\r
 * html body {\r
@@ -45,3 +35,17 @@ scrollbar-track-color:#F5F5F5;
 \r
 img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
 font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
+\r
+.mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}\r
+.mceItemShockWave {background-image:url(../../img/shockwave.gif)}\r
+.mceItemFlash {background-image:url(../../img/flash.gif)}\r
+.mceItemQuickTime {background-image:url(../../img/quicktime.gif)}\r
+.mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}\r
+.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}\r
+.mceItemVideo {background-image:url(../../img/video.gif)}\r
+.mceItemAudio {background-image:url(../../img/video.gif)}\r
+.mceItemEmbeddedAudio {background-image:url(../../img/video.gif)}\r
+.mceItemIframe {background-image:url(../../img/iframe.gif)}\r
+.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}\r
+.mceHideBrInPre pre br {display: none}\r
old mode 100755 (executable)
new mode 100644 (file)
index 7dd5841..1e53560
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/buttons.png and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/buttons.png differ
old mode 100755 (executable)
new mode 100644 (file)
index 2eafd79..d2f9367
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/items.gif and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/items.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index ce4be63..06812cb
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif differ
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/content.css b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/content.css
new file mode 100644 (file)
index 0000000..fe09e21
--- /dev/null
@@ -0,0 +1,25 @@
+body, td, pre { margin:8px;}\r
+body.mceForceColors {background:#FFF; color:#000;}\r
+h1 {font-size: 2em}\r
+h2 {font-size: 1.5em}\r
+h3 {font-size: 1.17em}\r
+h4 {font-size: 1em}\r
+h5 {font-size: .83em}\r
+h6 {font-size: .75em}\r
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(../default/img/items.gif) no-repeat 0 0;}\r
+span.mceItemNbsp {background: #DDD}\r
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
+img {border:0;}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
+table td, table th {cursor:text}\r
+ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
+del {color:red; text-decoration:line-through}\r
+cite {border-bottom:1px dashed blue}\r
+acronym {border-bottom:1px dotted #CCC; cursor:help}\r
+abbr {border-bottom:1px dashed #CCC; cursor:help}\r
+\r
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
+font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
+.mceHideBrInPre pre br {display: none}\r
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css
new file mode 100644 (file)
index 0000000..b2ed097
--- /dev/null
@@ -0,0 +1,105 @@
+/* Generic */\r
+body {\r
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;\r
+background:#F0F0EE;
+color: black;\r
+padding:0;\r
+margin:8px 8px 0 8px;\r
+}\r
+\r
+html {background:#F0F0EE; color:#000;}\r
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+textarea {resize:none;outline:none;}\r
+a:link, a:visited {color:black;background-color:transparent;}\r
+a:hover {color:#2B6FB6;background-color:transparent;}\r
+.nowrap {white-space: nowrap}\r
+\r
+/* Forms */\r
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}\r
+legend {color:#2B6FB6; font-weight:bold;}\r
+label.msg {display:none;}\r
+label.invalid {color:#EE0000; display:inline;background-color:transparent;}\r
+input.invalid {border:1px solid #EE0000;background-color:transparent;}\r
+input {background:#FFF; border:1px solid #CCC;color:black;}\r
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}\r
+input, select, textarea {border:1px solid #808080;}\r
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}\r
+.input_noborder {border:0;}\r
+\r
+/* Buttons */\r
+#insert, #cancel, input.button, .updateButton {\r
+font-weight:bold;\r
+width:94px; height:23px;\r
+cursor:pointer;\r
+padding-bottom:2px;\r
+float:left;\r
+}\r
+\r
+#cancel {float:right}\r
+\r
+/* Browse */\r
+a.pickcolor, a.browse {text-decoration:none}\r
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}\r
+.mceOldBoxModel a.browse span {width:22px; height:20px;}\r
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}\r
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}\r
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}\r
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}\r
+a.pickcolor:hover span {background-color:#B2BBD0;}\r
+a.pickcolor:hover span.disabled {}\r
+\r
+/* Charmap */\r
+table.charmap {border:1px solid #AAA; text-align:center}\r
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}\r
+#charmap a {display:block; color:#000; text-decoration:none; border:0}\r
+#charmap a:hover {background:#CCC;color:#2B6FB6}\r
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}\r
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}\r
+\r
+/* Source */\r
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}\r
+.mceActionPanel {margin-top:5px;}\r
+\r
+/* Tabs classes */\r
+.tabs {width:100%; height:18px; line-height:normal;}\r
+.tabs ul {margin:0; padding:0; list-style:none;}\r
+.tabs li {float:left; border: 1px solid black; border-bottom:0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block; cursor:pointer;}\r
+.tabs li.current {font-weight: bold; margin-right:2px;}\r
+.tabs span {float:left; display:block; padding:0px 10px 0 0;}\r
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}\r
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}\r
+\r
+/* Panels */\r
+.panel_wrapper div.panel {display:none;}\r
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}\r
+.panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;}\r
+\r
+/* Columns */\r
+.column {float:left;}\r
+.properties {width:100%;}\r
+.properties .column1 {}\r
+.properties .column2 {text-align:left;}\r
+\r
+/* Titles */\r
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}\r
+h3 {font-size:14px;}\r
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}\r
+\r
+/* Dialog specific */\r
+#link .panel_wrapper, #link div.current {height:125px;}\r
+#image .panel_wrapper, #image div.current {height:200px;}\r
+#plugintable thead {font-weight:bold; background:#DDD;}\r
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}\r
+#plugintable {width:96%; margin-top:10px;}\r
+#pluginscontainer {height:290px; overflow:auto;}\r
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}\r
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}\r
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}\r
+#colorpicker #light div {overflow:hidden;}\r
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}\r
+#colorpicker .panel_wrapper div.current {height:175px;}\r
+#colorpicker #namedcolors {width:150px;}\r
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
+#colorpicker #colornamecontainer {margin-top:5px;}\r
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css
new file mode 100644 (file)
index 0000000..a2cfcc3
--- /dev/null
@@ -0,0 +1,102 @@
+/* Reset */\r
+.highcontrastSkin table, .highcontrastSkin tbody, .highcontrastSkin a, .highcontrastSkin img, .highcontrastSkin tr, .highcontrastSkin div, .highcontrastSkin td, .highcontrastSkin iframe, .highcontrastSkin span, .highcontrastSkin *, .highcontrastSkin .mceText {border:0; margin:0; padding:0; vertical-align:baseline; border-collapse:separate;}\r
+.highcontrastSkin a:hover, .highcontrastSkin a:link, .highcontrastSkin a:visited, .highcontrastSkin a:active {text-decoration:none; font-weight:normal; cursor:default;}\r
+.highcontrastSkin table td {vertical-align:middle}\r
+\r
+.highcontrastSkin .mceIconOnly {display: block !important;}\r
+\r
+/* External */\r
+.highcontrastSkin .mceExternalToolbar {position:absolute; border:1px solid; border-bottom:0; display:none; background-color: white;}\r
+.highcontrastSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}\r
+.highcontrastSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px;}\r
+\r
+/* Layout */\r
+.highcontrastSkin table.mceLayout {border: 1px solid;}\r
+.highcontrastSkin .mceIframeContainer {border-top:1px solid; border-bottom:1px solid}\r
+.highcontrastSkin .mceStatusbar a:hover {text-decoration:underline}\r
+.highcontrastSkin .mceStatusbar {display:block; line-height:1.5em; overflow:visible;}\r
+.highcontrastSkin .mceStatusbar div {float:left}\r
+.highcontrastSkin .mceStatusbar a.mceResize {display:block; float:right; width:20px; height:20px; cursor:se-resize; outline:0}\r
+\r
+.highcontrastSkin .mceToolbar td { display: inline-block; float: left;}\r
+.highcontrastSkin .mceToolbar tr { display: block;}\r
+.highcontrastSkin .mceToolbar table { display: block; }\r
+\r
+/* Button */\r
+\r
+.highcontrastSkin .mceButton { display:block; margin: 2px; padding: 5px 10px;border: 1px solid; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; height: 2em;}\r
+.highcontrastSkin .mceButton .mceVoiceLabel { height: 100%; vertical-align: center; line-height: 2em}\r
+.highcontrastSkin .mceButtonDisabled .mceVoiceLabel { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}\r
+.highcontrastSkin .mceButtonActive, .highcontrastSkin .mceButton:focus, .highcontrastSkin .mceButton:active { border: 5px solid; padding: 1px 6px;-webkit-focus-ring-color:none;outline:none;}\r
+\r
+/* Separator */\r
+.highcontrastSkin .mceSeparator {display:block; width:16px; height:26px;}\r
+\r
+/* ListBox */\r
+.highcontrastSkin .mceListBox { display: block; margin:2px;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceListBox .mceText {padding: 5px 6px;  line-height: 2em; width: 15ex; overflow: hidden;}\r
+.highcontrastSkin .mceListBoxDisabled .mceText { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}\r
+.highcontrastSkin .mceListBox a.mceText { padding: 5px 10px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}\r
+.highcontrastSkin .mceListBox a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}\r
+.highcontrastSkin .mceListBox:focus a.mceText, .highcontrastSkin .mceListBox:active a.mceText { border-width: 5px; padding: 1px 10px 1px 6px;}\r
+.highcontrastSkin .mceListBox:focus a.mceOpen, .highcontrastSkin .mceListBox:active a.mceOpen { border-width: 5px; padding: 1px 0px 1px 4px;}\r
+\r
+.highcontrastSkin .mceListBoxMenu {overflow-y:auto}\r
+\r
+/* SplitButton */\r
+.highcontrastSkin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}\r
+\r
+.highcontrastSkin .mceSplitButton { border-collapse: collapse; margin: 2px; height: 2em; line-height: 2em;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceSplitButton td { display: table-cell; float: none; margin: 0; padding: 0; height: 2em;}\r
+.highcontrastSkin .mceSplitButton tr { display: table-row; }\r
+.highcontrastSkin table.mceSplitButton  { display: table; }\r
+.highcontrastSkin .mceSplitButton a.mceAction { padding: 5px 10px; display: block; height: 2em; line-height: 2em; overflow: hidden; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}\r
+.highcontrastSkin .mceSplitButton a.mceOpen { padding: 5px 4px;  display: block; height: 2em; line-height: 2em; border: 1px solid; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}\r
+.highcontrastSkin .mceSplitButton .mceVoiceLabel { height: 2em; vertical-align: center; line-height: 2em; } \r
+.highcontrastSkin .mceSplitButton:focus a.mceAction, .highcontrastSkin .mceSplitButton:active a.mceAction { border-width: 5px; border-right-width: 1px; padding: 1px 10px 1px 6px;-webkit-focus-ring-color:none;outline:none;}\r
+.highcontrastSkin .mceSplitButton:focus a.mceOpen, .highcontrastSkin .mceSplitButton:active a.mceOpen { border-width: 5px; border-left-width: 1px; padding: 1px 0px 1px 4px;-webkit-focus-ring-color:none;outline:none;}\r
+\r
+/* Menu */\r
+.highcontrastSkin .mceNoIcons span.mceIcon {width:0;}\r
+.highcontrastSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid; }\r
+.highcontrastSkin .mceMenu table {background:white; color: black}\r
+.highcontrastSkin .mceNoIcons a .mceText {padding-left:10px}\r
+.highcontrastSkin .mceMenu a, .highcontrastSkin .mceMenu span, .highcontrastSkin .mceMenu {display:block;background:white; color: black}\r
+.highcontrastSkin .mceMenu td {height:2em}\r
+.highcontrastSkin .mceMenu a {position:relative;padding:3px 0 4px 0; display: block;}\r
+.highcontrastSkin .mceMenu .mceText {position:relative; display:block; cursor:default; margin:0; padding:0 25px 0 25px;}\r
+.highcontrastSkin .mceMenu pre.mceText {font-family:Monospace}\r
+.highcontrastSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:26px;}\r
+.highcontrastSkin td.mceMenuItemSeparator {border-top:1px solid; height:1px}\r
+.highcontrastSkin .mceMenuItemTitle a {border:0; border-bottom:1px solid}\r
+.highcontrastSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px}\r
+.highcontrastSkin .mceNoIcons .mceMenuItemSelected span.mceText:before {content: "\2713\A0";}\r
+.highcontrastSkin .mceMenu span.mceMenuLine {display:none}\r
+.highcontrastSkin .mceMenuItemSub a .mceText:after {content: "\A0\25B8"}\r
+.highcontrastSkin .mceMenuItem td, .highcontrastSkin .mceMenuItem th {line-height: normal}\r
+\r
+/* ColorSplitButton */\r
+.highcontrastSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid; color: #000}\r
+.highcontrastSkin .mceColorSplitMenu td {padding:2px}\r
+.highcontrastSkin .mceColorSplitMenu a {display:block; width:16px; height:16px; overflow:hidden; color:#000; margin: 0; padding: 0;}\r
+.highcontrastSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}\r
+.highcontrastSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}\r
+.highcontrastSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid; background-color:#B6BDD2}\r
+.highcontrastSkin a.mceMoreColors:hover {border:1px solid #0A246A; color: #000;}\r
+.highcontrastSkin .mceColorPreview {display:none;}\r
+.highcontrastSkin .mce_forecolor span.mceAction, .highcontrastSkin .mce_backcolor span.mceAction {height:17px;overflow:hidden}\r
+\r
+/* Progress,Resize */\r
+.highcontrastSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}\r
+.highcontrastSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}\r
+\r
+/* Formats */\r
+.highcontrastSkin .mce_p span.mceText {}\r
+.highcontrastSkin .mce_address span.mceText {font-style:italic}\r
+.highcontrastSkin .mce_pre span.mceText {font-family:monospace}\r
+.highcontrastSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}\r
+.highcontrastSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}\r
+.highcontrastSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}\r
+.highcontrastSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}\r
+.highcontrastSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}\r
+.highcontrastSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}\r
old mode 100755 (executable)
new mode 100644 (file)
index 3cea5ff..3537c8b
@@ -9,9 +9,10 @@ h5 {font-size: .83em}
 h6 {font-size: .75em}\r
 .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}\r
 a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(../default/img/items.gif) no-repeat 0 0;}\r
+span.mceItemNbsp {background: #DDD}\r
 td.mceSelected, th.mceSelected {background-color:#3399ff !important}\r
 img {border:0;}\r
-table {cursor:default}\r
+table, img, hr, .mceItemAnchor {cursor:default}\r
 table td, table th {cursor:text}\r
 ins {border-bottom:1px solid green; text-decoration: none; color:green}\r
 del {color:red; text-decoration:line-through}\r
@@ -33,3 +34,16 @@ scrollbar-track-color:#F5F5F5;
 \r
 img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}\r
 font[face=mceinline] {font-family:inherit !important}\r
+*[contentEditable]:focus {outline:0}\r
+\r
+.mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}\r
+.mceItemShockWave {background-image:url(../../img/shockwave.gif)}\r
+.mceItemFlash {background-image:url(../../img/flash.gif)}\r
+.mceItemQuickTime {background-image:url(../../img/quicktime.gif)}\r
+.mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}\r
+.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}\r
+.mceItemVideo {background-image:url(../../img/video.gif)}\r
+.mceItemAudio {background-image:url(../../img/video.gif)}\r
+.mceItemIframe {background-image:url(../../img/iframe.gif)}\r
+.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}\r
+.mceHideBrInPre pre br {display: none}\r
old mode 100755 (executable)
new mode 100644 (file)
index e3af139..ec08772
@@ -114,3 +114,4 @@ h3 {font-size:14px;}
 #colorpicker #namedcolors {width:150px;}\r
 #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}\r
 #colorpicker #colornamecontainer {margin-top:5px;}\r
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}\r
old mode 100755 (executable)
new mode 100644 (file)
index 12cfb41..13a5cb0
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png differ
old mode 100755 (executable)
new mode 100644 (file)
index 8996c74..7fc57f2
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png differ
old mode 100755 (executable)
new mode 100644 (file)
index bd5d255..c0dcc6c
Binary files a/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png and b/library/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png differ
old mode 100755 (executable)
new mode 100644 (file)
index a625397..7b5103b
@@ -4,8 +4,8 @@
 .o2k7Skin table td {vertical-align:middle}\r
 \r
 /* Containers */\r
-.o2k7Skin table {background:#E5EFFD}\r
-.o2k7Skin iframe {display:block; background:#FFF}\r
+.o2k7Skin table {background:transparent}\r
+.o2k7Skin iframe {display:block;}\r
 .o2k7Skin .mceToolbar {height:26px}\r
 \r
 /* External */\r
@@ -19,7 +19,8 @@
 .o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}\r
 .o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}\r
 .o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}\r
-.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}\r
+.o2k7Skin td.mceToolbar{background:#E5EFFD}\r
+.o2k7Skin .mceStatusbar {background:#E5EFFD; display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}\r
 .o2k7Skin .mceStatusbar div {float:left; padding:2px}\r
 .o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}\r
 .o2k7Skin .mceStatusbar a:hover {text-decoration:underline}\r
 .o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}\r
 \r
 /* ListBox */\r
-.o2k7Skin .mceListBox {margin-left:3px}\r
+.o2k7Skin .mceListBox  {padding-left: 3px}\r
 .o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block}\r
 .o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}\r
 .o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0}\r
 .o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF}\r
 .o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px}\r
 .o2k7Skin .mceListBoxDisabled .mceText {color:gray}\r
-.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden}\r
+.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden; margin-left:3px}\r
 .o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px}\r
 .o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}\r
 \r
 /* SplitButton */\r
-.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px}\r
+.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px; direction:ltr}\r
 .o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}\r
 .o2k7Skin .mceSplitButton a.mceAction {width:22px}\r
 .o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}\r
 .o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}\r
 .o2k7Skin .mceMenu span.mceMenuLine {display:none}\r
 .o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}\r
+.o2k7Skin .mceMenuItem td, .o2k7Skin .mceMenuItem th {line-height: normal}\r
 \r
 /* Progress,Resize */\r
 .o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}\r
 .o2k7Skin span.mce_pagebreak {background-position:0 -40px}\r
 .o2k7Skin span.mce_restoredraft {background-position:-20px -40px}\r
 .o2k7Skin span.mce_spellchecker {background-position:-540px -20px}\r
+.o2k7Skin span.mce_visualblocks {background-position: -40px -40px}\r
old mode 100755 (executable)
new mode 100644 (file)
index 153f0c3..50c9b76
@@ -1,6 +1,6 @@
 /* Black */\r
 .o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)}\r
-.o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}\r
+.o2k7SkinBlack td.mceToolbar, .o2k7SkinBlack td.mceStatusbar, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}\r
 .o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}\r
 .o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}\r
 .o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}\r
old mode 100755 (executable)
new mode 100644 (file)
index 7fe3b45..960a8e4
@@ -1,5 +1,5 @@
 /* Silver */\r
 .o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)}\r
-.o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}\r
+.o2k7SkinSilver td.mceToolbar, .o2k7SkinSilver td.mceStatusbar, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}\r
 .o2k7SkinSilver .mceListBox .mceText {background:#FFF}\r
 .o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}\r
old mode 100755 (executable)
new mode 100644 (file)
index 5957bbd..3c6d658
@@ -6,7 +6,7 @@
 </head>\r
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">\r
        <form name="source" onsubmit="saveContent();return false;" action="#">\r
-               <div style="float: left" class="title">{#advanced_dlg.code_title}</div>\r
+               <div style="float: left" class="title"><label for="htmlSource">{#advanced_dlg.code_title}</label></div>\r
 \r
                <div id="wrapline" style="float: right">\r
                        <input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>\r
@@ -17,8 +17,8 @@
                <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>\r
 \r
                <div class="mceActionPanel">\r
-                       <input type="submit" name="insert" value="{#update}" id="insert" />\r
-                       <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />\r
+                       <input type="submit" role="button" name="insert" value="{#update}" id="insert" />\r
+                       <input type="button" role="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />\r
                </div>\r
        </form>\r
 </body>\r
old mode 100755 (executable)
new mode 100644 (file)
index ed89abc..4b3209c
@@ -1 +1 @@
-(function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})});c.dom.loadCSS(d+"/skins/"+f.skin+"/content.css")});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})();
\ No newline at end of file
+(function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.contentCSS.push(d+"/skins/"+f.skin+"/content.css");c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})})});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 4b862d4..01ce87c
@@ -19,6 +19,7 @@
                        var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;\r
 \r
                        t.editor = ed;\r
+                       ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");\r
 \r
                        ed.onInit.add(function() {\r
                                ed.onNodeChange.add(function(ed, cm) {\r
@@ -26,8 +27,6 @@
                                                cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));\r
                                        });\r
                                });\r
-\r
-                               ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css");\r
                        });\r
 \r
                        DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");\r
old mode 100755 (executable)
new mode 100644 (file)
index 16af141..6fcbcb5
Binary files a/library/tinymce/jscripts/tiny_mce/themes/simple/img/icons.gif and b/library/tinymce/jscripts/tiny_mce/themes/simple/img/icons.gif differ
old mode 100755 (executable)
new mode 100644 (file)
index 9f08f10..088ed0f
@@ -1,11 +1 @@
-tinyMCE.addI18n('en.simple',{\r
-bold_desc:"Bold (Ctrl+B)",\r
-italic_desc:"Italic (Ctrl+I)",\r
-underline_desc:"Underline (Ctrl+U)",\r
-striketrough_desc:"Strikethrough",\r
-bullist_desc:"Unordered list",\r
-numlist_desc:"Ordered list",\r
-undo_desc:"Undo (Ctrl+Z)",\r
-redo_desc:"Redo (Ctrl+Y)",\r
-cleanup_desc:"Cleanup messy code"\r
-});
\ No newline at end of file
+tinyMCE.addI18n('en.simple',{"cleanup_desc":"Cleanup Messy Code","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","striketrough_desc":"Strikethrough","underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)"});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index e9eb3ac..2d09557
@@ -1 +1 @@
-(function(c){var a=/^\s*|\s*$/g,d;var b={majorVersion:"3",minorVersion:"3.7",releaseDate:"2010-06-10",_init:function(){var r=this,o=document,m=navigator,f=m.userAgent,l,e,k,j,h,q;r.isOpera=c.opera&&opera.buildNumber;r.isWebKit=/WebKit/.test(f);r.isIE=!r.isWebKit&&!r.isOpera&&(/MSIE/gi).test(f)&&(/Explorer/gi).test(m.appName);r.isIE6=r.isIE&&/MSIE [56]/.test(f);r.isGecko=!r.isWebKit&&/Gecko/.test(f);r.isMac=f.indexOf("Mac")!=-1;r.isAir=/adobeair/i.test(f);r.isIDevice=/(iPad|iPhone)/.test(f);if(c.tinyMCEPreInit){r.suffix=tinyMCEPreInit.suffix;r.baseURL=tinyMCEPreInit.base;r.query=tinyMCEPreInit.query;return}r.suffix="";e=o.getElementsByTagName("base");for(l=0;l<e.length;l++){if(q=e[l].href){if(/^https?:\/\/[^\/]+$/.test(q)){q+="/"}j=q?q.match(/.*\//)[0]:""}}function g(i){if(i.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(i.src)){if(/_(src|dev)\.js/g.test(i.src)){r.suffix="_src"}if((h=i.src.indexOf("?"))!=-1){r.query=i.src.substring(h+1)}r.baseURL=i.src.substring(0,i.src.lastIndexOf("/"));if(j&&r.baseURL.indexOf("://")==-1&&r.baseURL.indexOf("/")!==0){r.baseURL=j+r.baseURL}return r.baseURL}return null}e=o.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}k=o.getElementsByTagName("head")[0];if(k){e=k.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}}return},is:function(f,e){if(!e){return f!==d}if(e=="array"&&(f.hasOwnProperty&&f instanceof Array)){return true}return typeof(f)==e},each:function(h,e,g){var i,f;if(!h){return 0}g=g||h;if(h.length!==d){for(i=0,f=h.length;i<f;i++){if(e.call(g,h[i],i,h)===false){return 0}}}else{for(i in h){if(h.hasOwnProperty(i)){if(e.call(g,h[i],i,h)===false){return 0}}}}return 1},map:function(e,g){var h=[];b.each(e,function(f){h.push(g(f))});return h},grep:function(e,g){var h=[];b.each(e,function(f){if(!g||g(f)){h.push(f)}});return h},inArray:function(f,g){var h,e;if(f){for(h=0,e=f.length;h<e;h++){if(f[h]===g){return h}}}return -1},extend:function(k,j){var h,g,f=arguments;for(h=1,g=f.length;h<g;h++){j=f[h];b.each(j,function(e,i){if(e!==d){k[i]=e}})}return k},trim:function(e){return(e?""+e:"").replace(a,"")},create:function(m,e){var l=this,f,h,i,j,g,k=0;m=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(m);i=m[3].match(/(^|\.)(\w+)$/i)[2];h=l.createNS(m[3].replace(/\.\w+$/,""));if(h[i]){return}if(m[2]=="static"){h[i]=e;if(this.onCreate){this.onCreate(m[2],m[3],h[i])}return}if(!e[i]){e[i]=function(){};k=1}h[i]=e[i];l.extend(h[i].prototype,e);if(m[5]){f=l.resolve(m[5]).prototype;j=m[5].match(/\.(\w+)$/i)[1];g=h[i];if(k){h[i]=function(){return f[j].apply(this,arguments)}}else{h[i]=function(){this.parent=f[j];return g.apply(this,arguments)}}h[i].prototype[i]=h[i];l.each(f,function(o,p){h[i].prototype[p]=f[p]});l.each(e,function(o,p){if(f[p]){h[i].prototype[p]=function(){this.parent=f[p];return o.apply(this,arguments)}}else{if(p!=i){h[i].prototype[p]=o}}})}l.each(e["static"],function(o,p){h[i][p]=o});if(this.onCreate){this.onCreate(m[2],m[3],h[i].prototype)}},walk:function(h,g,i,e){e=e||this;if(h){if(i){h=h[i]}b.each(h,function(j,f){if(g.call(e,j,f,i)===false){return false}b.walk(j,g,i,e)})}},createNS:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0;f<h.length;f++){e=h[f];if(!g[e]){g[e]={}}g=g[e]}return g},resolve:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0,e=h.length;f<e;f++){g=g[h[f]];if(!g){break}}return g},addUnload:function(i,h){var g=this;i={func:i,scope:h||this};if(!g.unloads){function e(){var f=g.unloads,k,l;if(f){for(l in f){k=f[l];if(k&&k.func){k.func.call(k.scope,1)}}if(c.detachEvent){c.detachEvent("onbeforeunload",j);c.detachEvent("onunload",e)}else{if(c.removeEventListener){c.removeEventListener("unload",e,false)}}g.unloads=k=f=w=e=0;if(c.CollectGarbage){CollectGarbage()}}}function j(){var k=document;if(k.readyState=="interactive"){function f(){k.detachEvent("onstop",f);if(e){e()}k=0}if(k){k.attachEvent("onstop",f)}c.setTimeout(function(){if(k){k.detachEvent("onstop",f)}},0)}}if(c.attachEvent){c.attachEvent("onunload",e);c.attachEvent("onbeforeunload",j)}else{if(c.addEventListener){c.addEventListener("unload",e,false)}}g.unloads=[i]}else{g.unloads.push(i)}return i},removeUnload:function(h){var e=this.unloads,g=null;b.each(e,function(j,f){if(j&&j.func==h){e.splice(f,1);g=h;return false}});return g},explode:function(e,f){return e?b.map(e.split(f||","),b.trim):e},_addVer:function(f){var e;if(!this.query){return f}e=(f.indexOf("?")==-1?"?":"&")+this.query;if(f.indexOf("#")==-1){return f+e}return f.replace("#",e+"#")}};b._init();c.tinymce=c.tinyMCE=b})(window);tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about|data):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(m){var k=m.each,j=m.is,i=m.isWebKit,d=m.isIE,a=/^(H[1-6R]|P|DIV|ADDRESS|PRE|FORM|T(ABLE|BODY|HEAD|FOOT|H|R|D)|LI|OL|UL|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|MENU|ISINDEX|SAMP)$/,e=g("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),f=g("src,href,style,coords,shape"),c={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"},n=/[<>&\"]/g,b=/^([a-z0-9],?)+$/i,h=/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)(\s*\/?)>/g,l=/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;function g(q){var p={},o;q=q.split(",");for(o=q.length;o>=0;o--){p[q[o]]=1}return p}m.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(u,q){var p=this,o;p.doc=u;p.win=window;p.files={};p.cssFlicker=false;p.counter=0;p.boxModel=!m.isIE||u.compatMode=="CSS1Compat";p.stdMode=u.documentMode===8;p.settings=q=m.extend({keep_values:false,hex_colors:1,process_html:1},q);if(m.isIE6){try{u.execCommand("BackgroundImageCache",false,true)}catch(r){p.cssFlicker=true}}if(q.valid_styles){p._styles={};k(q.valid_styles,function(t,s){p._styles[s]=m.explode(t)})}m.addUnload(p.destroy,p)},getRoot:function(){var o=this,p=o.settings;return(p&&o.get(p.root_element))||o.doc.body},getViewPort:function(p){var q,o;p=!p?this.win:p;q=p.document;o=this.boxModel?q.documentElement:q.body;return{x:p.pageXOffset||o.scrollLeft,y:p.pageYOffset||o.scrollTop,w:p.innerWidth||o.clientWidth,h:p.innerHeight||o.clientHeight}},getRect:function(s){var r,o=this,q;s=o.get(s);r=o.getPos(s);q=o.getSize(s);return{x:r.x,y:r.y,w:q.w,h:q.h}},getSize:function(r){var p=this,o,q;r=p.get(r);o=p.getStyle(r,"width");q=p.getStyle(r,"height");if(o.indexOf("px")===-1){o=0}if(q.indexOf("px")===-1){q=0}return{w:parseInt(o)||r.offsetWidth||r.clientWidth,h:parseInt(q)||r.offsetHeight||r.clientHeight}},getParent:function(q,p,o){return this.getParents(q,p,o,false)},getParents:function(z,v,s,y){var q=this,p,u=q.settings,x=[];z=q.get(z);y=y===undefined;if(u.strict_root){s=s||q.getRoot()}if(j(v,"string")){p=v;if(v==="*"){v=function(o){return o.nodeType==1}}else{v=function(o){return q.is(o,p)}}}while(z){if(z==s||!z.nodeType||z.nodeType===9){break}if(!v||v(z)){if(y){x.push(z)}else{return z}}z=z.parentNode}return y?x:null},get:function(o){var p;if(o&&this.doc&&typeof(o)=="string"){p=o;o=this.doc.getElementById(o);if(o&&o.id!==p){return this.doc.getElementsByName(p)[1]}}return o},getNext:function(p,o){return this._findSib(p,o,"nextSibling")},getPrev:function(p,o){return this._findSib(p,o,"previousSibling")},select:function(q,p){var o=this;return m.dom.Sizzle(q,o.get(p)||o.get(o.settings.root_element)||o.doc,[])},is:function(q,o){var p;if(q.length===undefined){if(o==="*"){return q.nodeType==1}if(b.test(o)){o=o.toLowerCase().split(/,/);q=q.nodeName.toLowerCase();for(p=o.length-1;p>=0;p--){if(o[p]==q){return true}}return false}}return m.dom.Sizzle.matches(o,q.nodeType?[q]:q).length>0},add:function(s,v,o,r,u){var q=this;return this.run(s,function(y){var x,t;x=j(v,"string")?q.doc.createElement(v):v;q.setAttribs(x,o);if(r){if(r.nodeType){x.appendChild(r)}else{q.setHTML(x,r)}}return !u?y.appendChild(x):x})},create:function(q,o,p){return this.add(this.doc.createElement(q),q,o,p,1)},createHTML:function(v,p,s){var u="",r=this,q;u+="<"+v;for(q in p){if(p.hasOwnProperty(q)){u+=" "+q+'="'+r.encode(p[q])+'"'}}if(m.is(s)){return u+">"+s+"</"+v+">"}return u+" />"},remove:function(o,p){return this.run(o,function(r){var q,s;q=r.parentNode;if(!q){return null}if(p){while(s=r.firstChild){if(!m.isIE||s.nodeType!==3||s.nodeValue){q.insertBefore(s,r)}else{r.removeChild(s)}}}return q.removeChild(r)})},setStyle:function(r,o,p){var q=this;return q.run(r,function(v){var u,t;u=v.style;o=o.replace(/-(\D)/g,function(x,s){return s.toUpperCase()});if(q.pixelStyles.test(o)&&(m.is(p,"number")||/^[\-0-9\.]+$/.test(p))){p+="px"}switch(o){case"opacity":if(d){u.filter=p===""?"":"alpha(opacity="+(p*100)+")";if(!r.currentStyle||!r.currentStyle.hasLayout){u.display="inline-block"}}u[o]=u["-moz-opacity"]=u["-khtml-opacity"]=p||"";break;case"float":d?u.styleFloat=p:u.cssFloat=p;break;default:u[o]=p||""}if(q.settings.update_styles){q.setAttrib(v,"_mce_style")}})},getStyle:function(r,o,q){r=this.get(r);if(!r){return false}if(this.doc.defaultView&&q){o=o.replace(/[A-Z]/g,function(s){return"-"+s});try{return this.doc.defaultView.getComputedStyle(r,null).getPropertyValue(o)}catch(p){return null}}o=o.replace(/-(\D)/g,function(t,s){return s.toUpperCase()});if(o=="float"){o=d?"styleFloat":"cssFloat"}if(r.currentStyle&&q){return r.currentStyle[o]}return r.style[o]},setStyles:function(u,v){var q=this,r=q.settings,p;p=r.update_styles;r.update_styles=0;k(v,function(o,s){q.setStyle(u,s,o)});r.update_styles=p;if(r.update_styles){q.setAttrib(u,r.cssText)}},setAttrib:function(q,r,o){var p=this;if(!q||!r){return}if(p.settings.strict){r=r.toLowerCase()}return this.run(q,function(u){var t=p.settings;switch(r){case"style":if(!j(o,"string")){k(o,function(s,x){p.setStyle(u,x,s)});return}if(t.keep_values){if(o&&!p._isRes(o)){u.setAttribute("_mce_style",o,2)}else{u.removeAttribute("_mce_style",2)}}u.style.cssText=o;break;case"class":u.className=o||"";break;case"src":case"href":if(t.keep_values){if(t.url_converter){o=t.url_converter.call(t.url_converter_scope||p,o,r,u)}p.setAttrib(u,"_mce_"+r,o,2)}break;case"shape":u.setAttribute("_mce_style",o);break}if(j(o)&&o!==null&&o.length!==0){u.setAttribute(r,""+o,2)}else{u.removeAttribute(r,2)}})},setAttribs:function(q,r){var p=this;return this.run(q,function(o){k(r,function(s,t){p.setAttrib(o,t,s)})})},getAttrib:function(r,s,q){var o,p=this;r=p.get(r);if(!r||r.nodeType!==1){return false}if(!j(q)){q=""}if(/^(src|href|style|coords|shape)$/.test(s)){o=r.getAttribute("_mce_"+s);if(o){return o}}if(d&&p.props[s]){o=r[p.props[s]];o=o&&o.nodeValue?o.nodeValue:o}if(!o){o=r.getAttribute(s,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(s)){if(r[p.props[s]]===true&&o===""){return s}return o?s:""}if(r.nodeName==="FORM"&&r.getAttributeNode(s)){return r.getAttributeNode(s).nodeValue}if(s==="style"){o=o||r.style.cssText;if(o){o=p.serializeStyle(p.parseStyle(o),r.nodeName);if(p.settings.keep_values&&!p._isRes(o)){r.setAttribute("_mce_style",o)}}}if(i&&s==="class"&&o){o=o.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(d){switch(s){case"rowspan":case"colspan":if(o===1){o=""}break;case"size":if(o==="+0"||o===20||o===0){o=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(o===0){o=""}break;case"hspace":if(o===-1){o=""}break;case"maxlength":case"tabindex":if(o===32768||o===2147483647||o==="32768"){o=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(o===65535){return s}return q;case"shape":o=o.toLowerCase();break;default:if(s.indexOf("on")===0&&o){o=(""+o).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(o!==undefined&&o!==null&&o!=="")?""+o:q},getPos:function(A,s){var p=this,o=0,z=0,u,v=p.doc,q;A=p.get(A);s=s||v.body;if(A){if(d&&!p.stdMode){A=A.getBoundingClientRect();u=p.boxModel?v.documentElement:v.body;o=p.getStyle(p.select("html")[0],"borderWidth");o=(o=="medium"||p.boxModel&&!p.isIE6)&&2||o;A.top+=p.win.self!=p.win.top?2:0;return{x:A.left+u.scrollLeft-o,y:A.top+u.scrollTop-o}}q=A;while(q&&q!=s&&q.nodeType){o+=q.offsetLeft||0;z+=q.offsetTop||0;q=q.offsetParent}q=A.parentNode;while(q&&q!=s&&q.nodeType){o-=q.scrollLeft||0;z-=q.scrollTop||0;q=q.parentNode}}return{x:o,y:z}},parseStyle:function(r){var u=this,v=u.settings,x={};if(!r){return x}function p(D,A,C){var z,B,o,y;z=x[D+"-top"+A];if(!z){return}B=x[D+"-right"+A];if(z!=B){return}o=x[D+"-bottom"+A];if(B!=o){return}y=x[D+"-left"+A];if(o!=y){return}x[C]=y;delete x[D+"-top"+A];delete x[D+"-right"+A];delete x[D+"-bottom"+A];delete x[D+"-left"+A]}function q(y,s,o,A){var z;z=x[s];if(!z){return}z=x[o];if(!z){return}z=x[A];if(!z){return}x[y]=x[s]+" "+x[o]+" "+x[A];delete x[s];delete x[o];delete x[A]}r=r.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");k(r.split(";"),function(s){var o,t=[];if(s){s=s.replace(/_MCE_SEMI_/g,";");s=s.replace(/url\([^\)]+\)/g,function(y){t.push(y);return"url("+t.length+")"});s=s.split(":");o=m.trim(s[1]);o=o.replace(/url\(([^\)]+)\)/g,function(z,y){return t[parseInt(y)-1]});o=o.replace(/rgb\([^\)]+\)/g,function(y){return u.toHex(y)});if(v.url_converter){o=o.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(y,z){return"url("+v.url_converter.call(v.url_converter_scope||u,u.decode(z),"style",null)+")"})}x[m.trim(s[0]).toLowerCase()]=o}});p("border","","border");p("border","-width","border-width");p("border","-color","border-color");p("border","-style","border-style");p("padding","","padding");p("margin","","margin");q("border","border-width","border-style","border-color");if(d){if(x.border=="medium none"){x.border=""}}return x},serializeStyle:function(v,p){var q=this,r="";function u(s,o){if(o&&s){if(o.indexOf("-")===0){return}switch(o){case"font-weight":if(s==700){s="bold"}break;case"color":case"background-color":s=s.toLowerCase();break}r+=(r?" ":"")+o+": "+s+";"}}if(p&&q._styles){k(q._styles["*"],function(o){u(v[o],o)});k(q._styles[p.toLowerCase()],function(o){u(v[o],o)})}else{k(v,u)}return r},loadCSS:function(o){var q=this,r=q.doc,p;if(!o){o=""}p=q.select("head")[0];k(o.split(","),function(s){var t;if(q.files[s]){return}q.files[s]=true;t=q.create("link",{rel:"stylesheet",href:m._addVer(s)});if(d&&r.documentMode){t.onload=function(){r.recalc();t.onload=null}}p.appendChild(t)})},addClass:function(o,p){return this.run(o,function(q){var r;if(!p){return 0}if(this.hasClass(q,p)){return q.className}r=this.removeClass(q,p);return q.className=(r!=""?(r+" "):"")+p})},removeClass:function(q,r){var o=this,p;return o.run(q,function(t){var s;if(o.hasClass(t,r)){if(!p){p=new RegExp("(^|\\s+)"+r+"(\\s+|$)","g")}s=t.className.replace(p," ");s=m.trim(s!=" "?s:"");t.className=s;if(!s){t.removeAttribute("class");t.removeAttribute("className")}return s}return t.className})},hasClass:function(p,o){p=this.get(p);if(!p||!o){return false}return(" "+p.className+" ").indexOf(" "+o+" ")!==-1},show:function(o){return this.setStyle(o,"display","block")},hide:function(o){return this.setStyle(o,"display","none")},isHidden:function(o){o=this.get(o);return !o||o.style.display=="none"||this.getStyle(o,"display")=="none"},uniqueId:function(o){return(!o?"mce_":o)+(this.counter++)},setHTML:function(q,p){var o=this;return this.run(q,function(v){var r,t,s,z,u,r;p=o.processHTML(p);if(d){function y(){while(v.firstChild){v.firstChild.removeNode()}try{v.innerHTML="<br />"+p;v.removeChild(v.firstChild)}catch(x){r=o.create("div");r.innerHTML="<br />"+p;k(r.childNodes,function(B,A){if(A){v.appendChild(B)}})}}if(o.settings.fix_ie_paragraphs){p=p.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 _mce_keep="true">&nbsp;</p>')}y();if(o.settings.fix_ie_paragraphs){s=v.getElementsByTagName("p");for(t=s.length-1,r=0;t>=0;t--){z=s[t];if(!z.hasChildNodes()){if(!z._mce_keep){r=1;break}z.removeAttribute("_mce_keep")}}}if(r){p=p.replace(/<p ([^>]+)>|<p>/ig,'<div $1 _mce_tmp="1">');p=p.replace(/<\/p>/gi,"</div>");y();if(o.settings.fix_ie_paragraphs){s=v.getElementsByTagName("DIV");for(t=s.length-1;t>=0;t--){z=s[t];if(z._mce_tmp){u=o.doc.createElement("p");z.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(A,x){var B;if(x!=="_mce_tmp"){B=z.getAttribute(x);if(!B&&x==="class"){B=z.className}u.setAttribute(x,B)}});for(r=0;r<z.childNodes.length;r++){u.appendChild(z.childNodes[r].cloneNode(true))}z.swapNode(u)}}}}}else{v.innerHTML=p}return p})},processHTML:function(r){var p=this,q=p.settings,v=[];if(!q.process_html){return r}if(d){r=r.replace(/&apos;/g,"&#39;");r=r.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}r=r.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(q.keep_values){if(/<script|noscript|style/i.test(r)){function o(t){t=t.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");t=t.replace(/^[\r\n]*|[\r\n]*$/g,"");t=t.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");t=t.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return t}r=r.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi,function(s,x,t){if(!x){x=' type="text/javascript"'}x=x.replace(/src=\"([^\"]+)\"?/i,function(y,z){if(q.url_converter){z=p.encode(q.url_converter.call(q.url_converter_scope||p,p.decode(z),"src","script"))}return'_mce_src="'+z+'"'});if(m.trim(t)){v.push(o(t));t="<!--\nMCE_SCRIPT:"+(v.length-1)+"\n// -->"}return"<mce:script"+x+">"+t+"</mce:script>"});r=r.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi,function(s,x,t){if(t){v.push(o(t));t="<!--\nMCE_SCRIPT:"+(v.length-1)+"\n-->"}return"<mce:style"+x+">"+t+"</mce:style><style "+x+' _mce_bogus="1">'+t+"</style>"});r=r.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(s,x,t){return"<mce:noscript"+x+"><!--"+p.encode(t).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}r=r.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");function u(s){return s.replace(h,function(y,z,x,t){return"<"+z+x.replace(l,function(B,A,E,D,C){var F;A=A.toLowerCase();E=E||D||C||"";if(e[A]){if(E==="false"||E==="0"){return}return A+'="'+A+'"'}if(f[A]&&x.indexOf("_mce_"+A)==-1){F=p.decode(E);if(q.url_converter&&(A=="src"||A=="href")){F=q.url_converter.call(q.url_converter_scope||p,F,A,z)}if(A=="style"){F=p.serializeStyle(p.parseStyle(F),A)}return A+'="'+E+'" _mce_'+A+'="'+p.encode(F)+'"'}return B})+t+">"})}r=u(r);r=r.replace(/MCE_SCRIPT:([0-9]+)/g,function(t,s){return v[s]})}return r},getOuterHTML:function(o){var p;o=this.get(o);if(!o){return null}if(o.outerHTML!==undefined){return o.outerHTML}p=(o.ownerDocument||this.doc).createElement("body");p.appendChild(o.cloneNode(true));return p.innerHTML},setOuterHTML:function(r,p,s){var o=this;function q(u,t,x){var y,v;v=x.createElement("body");v.innerHTML=t;y=v.lastChild;while(y){o.insertAfter(y.cloneNode(true),u);y=y.previousSibling}o.remove(u)}return this.run(r,function(u){u=o.get(u);if(u.nodeType==1){s=s||u.ownerDocument||o.doc;if(d){try{if(d&&u.nodeType==1){u.outerHTML=p}else{q(u,p,s)}}catch(t){q(u,p,s)}}else{q(u,p,s)}}})},decode:function(p){var q,r,o;if(/&[\w#]+;/.test(p)){q=this.doc.createElement("div");q.innerHTML=p;r=q.firstChild;o="";if(r){do{o+=r.nodeValue}while(r=r.nextSibling)}return o||p}return p},encode:function(o){return(""+o).replace(n,function(p){return c[p]})},insertAfter:function(o,p){p=this.get(p);return this.run(o,function(r){var q,s;q=p.parentNode;s=p.nextSibling;if(s){q.insertBefore(r,s)}else{q.appendChild(r)}return r})},isBlock:function(o){if(o.nodeType&&o.nodeType!==1){return false}o=o.nodeName||o;return a.test(o)},replace:function(s,r,p){var q=this;if(j(r,"array")){s=s.cloneNode(true)}return q.run(r,function(t){if(p){k(m.grep(t.childNodes),function(o){s.appendChild(o)})}return t.parentNode.replaceChild(s,t)})},rename:function(r,o){var q=this,p;if(r.nodeName!=o.toUpperCase()){p=q.create(o);k(q.getAttribs(r),function(s){q.setAttrib(p,s.nodeName,q.getAttrib(r,s.nodeName))});q.replace(p,r,1)}return p||r},findCommonAncestor:function(q,o){var r=q,p;while(r){p=o;while(p&&r!=p){p=p.parentNode}if(r==p){break}r=r.parentNode}if(!r&&q.ownerDocument){return q.ownerDocument.documentElement}return r},toHex:function(o){var q=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(o);function p(r){r=parseInt(r).toString(16);return r.length>1?r:"0"+r}if(q){o="#"+p(q[1])+p(q[2])+p(q[3]);return o}return o},getClasses:function(){var s=this,o=[],r,u={},v=s.settings.class_filter,q;if(s.classes){return s.classes}function x(t){k(t.imports,function(y){x(y)});k(t.cssRules||t.rules,function(y){switch(y.type||1){case 1:if(y.selectorText){k(y.selectorText.split(","),function(z){z=z.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(z)||!/\.[\w\-]+$/.test(z)){return}q=z;z=z.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(v&&!(z=v(z,q))){return}if(!u[z]){o.push({"class":z});u[z]=1}})}break;case 3:x(y.styleSheet);break}})}try{k(s.doc.styleSheets,x)}catch(p){}if(o.length>0){s.classes=o}return o},run:function(u,r,q){var p=this,v;if(p.doc&&typeof(u)==="string"){u=p.get(u)}if(!u){return false}q=q||this;if(!u.nodeType&&(u.length||u.length===0)){v=[];k(u,function(s,o){if(s){if(typeof(s)=="string"){s=p.doc.getElementById(s)}v.push(r.call(q,s,o))}});return v}return r.call(q,u)},getAttribs:function(q){var p;q=this.get(q);if(!q){return[]}if(d){p=[];if(q.nodeName=="OBJECT"){return q.attributes}if(q.nodeName==="OPTION"&&this.getAttrib(q,"selected")){p.push({specified:1,nodeName:"selected"})}q.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(o){p.push({specified:1,nodeName:o})});return p}return q.attributes},destroy:function(p){var o=this;if(o.events){o.events.destroy()}o.win=o.doc=o.root=o.events=null;if(!p){m.removeUnload(o.destroy)}},createRng:function(){var o=this.doc;return o.createRange?o.createRange():new m.dom.Range(this)},nodeIndex:function(s,t){var o=0,q,r,p;if(s){for(q=s.nodeType,s=s.previousSibling,r=s;s;s=s.previousSibling){p=s.nodeType;if(t&&p==3){if(p==q||!s.nodeValue.length){continue}}o++;q=p}}return o},split:function(u,s,y){var z=this,o=z.createRng(),v,q,x;function p(A){var t,r=A.childNodes;if(A.nodeType==1&&A.getAttribute("_mce_type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){p(r[t])}if(A.nodeType!=9){if(A.nodeType==3&&A.nodeValue.length>0){return}if(A.nodeType==1){r=A.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("_mce_type")=="bookmark"){A.parentNode.insertBefore(r[0],A)}if(r.length||/^(br|hr|input|img)$/i.test(A.nodeName)){return}}z.remove(A)}return A}if(u&&s){o.setStart(u.parentNode,z.nodeIndex(u));o.setEnd(s.parentNode,z.nodeIndex(s));v=o.extractContents();o=z.createRng();o.setStart(s.parentNode,z.nodeIndex(s)+1);o.setEnd(u.parentNode,z.nodeIndex(u)+1);q=o.extractContents();x=u.parentNode;x.insertBefore(p(v),u);if(y){x.replaceChild(y,s)}else{x.insertBefore(s,u)}x.insertBefore(p(q),u);z.remove(u);return y||s}},bind:function(s,o,r,q){var p=this;if(!p.events){p.events=new m.dom.EventUtils()}return p.events.add(s,o,r,q||this)},unbind:function(r,o,q){var p=this;if(!p.events){p.events=new m.dom.EventUtils()}return p.events.remove(r,o,q)},_findSib:function(r,o,p){var q=this,s=o;if(r){if(j(s,"string")){s=function(t){return q.is(t,o)}}for(r=r[p];r;r=r[p]){if(s(r)){return r}}}return null},_isRes:function(o){return/^(top|left|bottom|right|width|height)/i.test(o)||/;\s*(top|left|bottom|right|width|height)/i.test(o)}});m.DOM=new m.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(W,X){var Z=N[h],Y=N[U],V=N[P],t=N[z];if(W===0){return G(Z,Y,Z,Y)}if(W===1){return G(Z,Y,V,t)}if(W===2){return G(V,t,V,t)}if(W===3){return G(V,t,Z,Y)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z<Y){return -1}return 1}aa=V;while(aa&&aa.parentNode!=X){aa=aa.parentNode}if(aa){W=0;t=X.firstChild;while(t!=aa&&W<Z){W++;t=t.nextSibling}if(Z<=W){return -1}return 1}aa=X;while(aa&&aa.parentNode!=V){aa=aa.parentNode}if(aa){W=0;t=V.firstChild;while(t!=aa&&W<Y){W++;t=t.nextSibling}if(W<Y){return -1}return 1}ab=c.findCommonAncestor(X,V);ad=X;while(ad&&ad.parentNode!=ab){ad=ad.parentNode}if(!ad){ad=ab}ac=V;while(ac&&ac.parentNode!=ab){ac=ac.parentNode}if(!ac){ac=ab}if(ad==ac){return 0}t=ab.firstChild;while(t){if(t==ad){return -1}if(t==ac){return 1}t=t.nextSibling}}function B(V,Y,X){var t,W;if(V){N[h]=Y;N[U]=X}else{N[P]=Y;N[z]=X}t=N[P];while(t.parentNode){t=t.parentNode}W=N[h];while(W.parentNode){W=W.parentNode}if(W==t){if(G(N[h],N[U],N[P],N[z])>0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(g){var i=this,j="\uFEFF",e,h,d=g.dom,c=true,f=false;function b(){var n=g.getRng(),k=d.createRng(),m,o;m=n.item?n.item(0):n.parentElement();if(m.ownerDocument!=d.doc){return k}if(n.item||!m.hasChildNodes()){k.setStart(m.parentNode,d.nodeIndex(m));k.setEnd(k.startContainer,k.startOffset+1);return k}o=g.isCollapsed();function l(s){var u,q,t,p,A=0,x,y,z,r,v;r=n.duplicate();r.collapse(s);u=d.create("a");z=r.parentElement();if(!z.hasChildNodes()){k[s?"setStart":"setEnd"](z,0);return}z.appendChild(u);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){k[s?"setStartAfter":"setEndAfter"](z);d.remove(u);return}p=tinymce.grep(z.childNodes);x=p.length-1;while(A<=x){y=Math.floor((A+x)/2);z.insertBefore(u,p[y]);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){A=y+1}else{if(v<0){x=y-1}else{found=true;break}}}q=v>0||y==0?u.nextSibling:u.previousSibling;if(q.nodeType==1){d.remove(u);t=d.nodeIndex(q);q=q.parentNode;if(!s||y>0){t++}}else{if(v>0||y==0){r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=r.text.length}else{r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=q.nodeValue.length-r.text.length}d.remove(u)}k[s?"setStart":"setEnd"](q,t)}l(true);if(!o){l()}return k}this.addRange=function(l){var t,A,z=g.dom.doc,r=z.body,u,n,y,o,s,k,p,q,x,m;this.destroy();y=l.startContainer;o=l.startOffset;s=l.endContainer;k=l.endOffset;t=r.createTextRange();if(y==z||s==z){t=r.createTextRange();t.collapse();t.select();return}if(y.nodeType==1&&y.hasChildNodes()){q=y.childNodes.length-1;if(o>q){x=1;y=y.childNodes[q]}else{y=y.childNodes[o]}if(y.nodeType==3){o=0}}if(s.nodeType==1&&s.hasChildNodes()){q=s.childNodes.length-1;if(k==0){m=1;s=s.childNodes[0]}else{s=s.childNodes[Math.min(q,k-1)];if(s.nodeType==3){k=s.nodeValue.length}}}if(y==s&&y.nodeType==1){if(/^(IMG|TABLE)$/.test(y.nodeName)&&o!=k){t=r.createControlRange();t.addElement(y)}else{t=r.createTextRange();if(!y.hasChildNodes()&&y.canHaveHTML){y.innerHTML=j}t.moveToElementText(y);if(y.innerHTML==j){t.collapse(c);y.removeChild(y.firstChild)}}if(o==k){t.collapse(k<=l.endContainer.childNodes.length-1)}t.select();t.scrollIntoView();return}t=r.createTextRange();p=z.createElement("span");p.innerHTML=" ";if(y.nodeType==3){if(x){d.insertAfter(p,y)}else{y.parentNode.insertBefore(p,y)}t.moveToElementText(p);p.parentNode.removeChild(p);if(o>0){t.move("character",o)}}else{t.moveToElementText(y);if(x){t.collapse(f)}}if(y==s&&y.nodeType==3){try{t.moveEnd("character",k-o);t.select();t.scrollIntoView()}catch(v){}return}A=r.createTextRange();if(s.nodeType==3){s.parentNode.insertBefore(p,s);A.moveToElementText(p);p.parentNode.removeChild(p);A.move("character",k);t.setEndPoint("EndToStart",A)}else{A.moveToElementText(s);A.collapse(!!m);t.setEndPoint("EndToEnd",A)}t.select();t.scrollIntoView()};this.getRangeAt=function(){if(!e||!tinymce.dom.RangeUtils.compareRanges(h,g.getRng())){e=b();h=g.getRng()}try{e.startContainer.nextSibling}catch(k){e=b();h=null}return e};this.destroy=function(){h=e=null};if(g.dom.boxModel){(function(){var q=d.doc,l=q.body,n,o;q.documentElement.unselectable=c;function p(r,u){var s=l.createTextRange();try{s.moveToPoint(r,u)}catch(t){s=null}return s}function m(s){var r;if(s.button){r=p(s.x,s.y);if(r){if(r.compareEndPoints("StartToStart",o)>0){r.setEndPoint("StartToStart",o)}else{r.setEndPoint("EndToEnd",o)}r.select()}}else{k()}}function k(){d.unbind(q,"mouseup",k);d.unbind(q,"mousemove",m);n=0}d.bind(q,"mousedown",function(r){if(r.target.nodeName==="HTML"){if(n){k()}n=1;o=p(r.x,r.y);if(o){d.bind(q,"mouseup",k);d.bind(q,"mousemove",m);o.select()}}})})()}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}return r};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(y,e,z){var x;if(!y){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.leftMatch[v].exec(y))){var r=u[1];u.splice(1,1);if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");x=f.find[v](u,e,z);if(x!=null){y=y.replace(f.match[v],"");break}}}}if(!x){x=e.getElementsByTagName("*")}return{set:x,expr:y}};b.filter=function(C,B,F,u){var s=C,H=[],z=B,x,e,y=B&&B[0]&&b.isXML(B[0]);while(C&&B.length){for(var A in f.filter){if((x=f.leftMatch[A].exec(C))!=null&&x[2]){var r=f.filter[A],G,E,t=x[1];e=false;x.splice(1,1);if(t.substr(t.length-1)==="\\"){continue}if(z===H){H=[]}if(f.preFilter[A]){x=f.preFilter[A](x,z,F,H,u,y);if(!x){e=G=true}else{if(x===true){continue}}}if(x){for(var v=0;(E=z[v])!=null;v++){if(E){G=r(E,x,v,z);var D=u^!!G;if(F&&G!=null){if(D){e=true}else{z[v]=false}}else{if(D){H.push(E);e=true}}}}}if(G!==undefined){if(!F){z=H}C=C.replace(f.match[A],"");if(!e){return[]}break}}}if(C===s){if(e==null){b.error(C)}else{break}}s=C}return z};b.error=function(e){throw"Syntax error, unrecognized expression: "+e};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,r){var t=typeof r==="string",v=t&&!/\W/.test(r),y=t&&!v;if(v){r=r.toLowerCase()}for(var s=0,e=x.length,u;s<e;s++){if((u=x[s])){while((u=u.previousSibling)&&u.nodeType!==1){}x[s]=y||u&&u.nodeName.toLowerCase()===r?u||false:u===r}}if(y){b.filter(r,x,true)}},">":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s<e;s++){v=x[s];if(v){var t=v.parentNode;x[s]=t.nodeName.toLowerCase()===r?t:false}}}else{for(;s<e;s++){v=x[s];if(v){x[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,x,true)}}},"":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,x,y){t=" "+t[1].replace(/\\/g,"")+" ";if(y){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(x^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v<u;v++){if(t[v]===s){return false}}return true}else{b.error("Syntax error, unrecognized expression: "+e)}}}},CHILD:function(e,t){var x=t[1],r=e;switch(x){case"only":case"first":while((r=r.previousSibling)){if(r.nodeType===1){return false}}if(x==="first"){return true}r=e;case"last":while((r=r.nextSibling)){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],A=t[3];if(s===1&&A===0){return true}var v=t[0],z=e.parentNode;if(z&&(z.sizcache!==v||!e.nodeIndex)){var u=0;for(r=z.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}z.sizcache=v}var y=e.nodeIndex-A;if(s===0){return y===0}else{return(y%s===0&&y/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s<e;s++){r.push(u[s])}}else{for(;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){if(!r.compareDocumentPosition||!e.compareDocumentPosition){if(r==e){o=true}return r.compareDocumentPosition?-1:1}var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){o=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){if(!r.sourceIndex||!e.sourceIndex){if(r==e){o=true}return r.sourceIndex?-1:1}var s=r.sourceIndex-e.sourceIndex;if(s===0){o=true}return s}}else{if(document.createRange){c=function(t,r){if(!t.ownerDocument||!r.ownerDocument){if(t==r){o=true}return t.ownerDocument?-1:1}var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){o=true}return u}}}}b.getText=function(e){var r="",t;for(var s=0;e[s];s++){t=e[s];if(t.nodeType===3||t.nodeType===4){r+=t.nodeValue}else{if(t.nodeType!==8){r+=b.getText(t.childNodes)}}}return r};(function(){var r=document.createElement("div"),s="script"+(new Date()).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName.toLowerCase()===x){u=e;break}e=e[r]}A[t]=u}}}function q(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof x!=="string"){if(e===x){u=true;break}}else{if(b.filter(x,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x<r;x++){b(e,s[x],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j<arguments.length;j++){h.push(arguments[j])}h=e[g].apply(e,h);b.update(g);return h}});a.extend(b,{on:function(i,h,g){return a.dom.Event.add(b.id,i,h,g)},getXY:function(){return{x:parseInt(b.getStyle("left")),y:parseInt(b.getStyle("top"))}},getSize:function(){var g=e.get(b.id);return{w:parseInt(b.getStyle("width")||g.clientWidth),h:parseInt(b.getStyle("height")||g.clientHeight)}},moveTo:function(g,h){b.setStyles({left:g,top:h})},moveBy:function(g,i){var h=b.getXY();b.moveTo(h.x+g,h.y+i)},resizeTo:function(g,i){b.setStyles({width:g,height:i})},resizeBy:function(g,j){var i=b.getSize();b.resizeTo(i.w+g,i.h+j)},update:function(h){var g;if(a.isIE6&&d.blocker){h=h||"";if(h.indexOf("get")===0||h.indexOf("has")===0||h.indexOf("is")===0){return}if(h=="remove"){e.remove(b.blocker);return}if(!b.blocker){b.blocker=e.uniqueId();g=e.add(d.container||e.getRoot(),"iframe",{id:b.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});e.setStyle(g,"opacity",0)}else{g=e.get(b.blocker)}e.setStyles(g,{left:b.getStyle("left",1),top:b.getStyle("top",1),width:b.getStyle("width",1),height:b.getStyle("height",1),display:b.getStyle("display",1),zIndex:parseInt(b.getStyle("zIndex",1)||0)-1})}}})}})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';if(j.startContainer==k&&j.endContainer==k){k.body.innerHTML=i}else{j.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=i}else{j.insertNode(j.createContextualFragment(i))}}l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndBefore(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}if(h&&h.nodeName=="BODY"){return h.firstChild||h}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(q,r){var u=this,m=u.dom,g,j,i,n,h,o,p,l="\uFEFF",s;function f(v,x){var t=0;d(m.select(v),function(z,y){if(z==x){t=y}});return t}if(q==2){function k(){var v=u.getRng(true),t=m.getRoot(),x={};function y(B,G){var A=B[G?"startContainer":"endContainer"],F=B[G?"startOffset":"endOffset"],z=[],C,E,D=0;if(A.nodeType==3){if(r){for(C=A.previousSibling;C&&C.nodeType==3;C=C.previousSibling){F+=C.nodeValue.length}}z.push(F)}else{E=A.childNodes;if(F>=E.length&&E.length){D=1;F=Math.max(0,E.length-1)}z.push(u.dom.nodeIndex(E[F],r)+D)}for(;A&&A!=t;A=A.parentNode){z.push(u.dom.nodeIndex(A,r))}return z}x.start=y(v,true);if(!u.isCollapsed()){x.end=y(v)}return x}return k()}if(q){return{rng:u.getRng()}}g=u.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();s="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();g.collapse();g.pasteHTML('<span _mce_type="bookmark" id="'+i+'_start" style="'+s+'">'+l+"</span>");if(!n){j.collapse(false);j.pasteHTML('<span _mce_type="bookmark" id="'+i+'_end" style="'+s+'">'+l+"</span>")}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=u.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{_mce_type:"bookmark",id:i+"_end",style:s},l))}g.collapse(true);g.insertNode(m.create("span",{_mce_type:"bookmark",id:i+"_start",style:s},l))}u.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(r.tridentSel){r.tridentSel.destroy()}if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(u.length){x=u[t[v]]}}if(z){f.setStart(x,t[0])}else{f.setEnd(x,t[0])}}}g(true);g();r.setRng(f)}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(!a&&l.isBlock(t)&&!t.innerHTML){t.innerHTML='<br _mce_bogus="1" />'}return t}k("start");k("end");f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g);return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=g.win.document.createRange?g.win.document.createRange():g.win.document.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;h.removeAllRanges();h.addRange(i);g.selectedRange=h.getRangeAt(0)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var g=this,f=g.getRng(),h=g.getSel(),i;if(f.setStart){if(!f){return g.dom.getRoot()}i=f.commonAncestorContainer;if(!f.collapsed){if(f.startContainer==f.endContainer){if(f.startOffset-f.endOffset<2){if(f.startContainer.hasChildNodes()){i=f.startContainer.childNodes[f.startOffset]}}}if(c.isWebKit&&h.anchorNode&&h.anchorNode.nodeType==1){return h.anchorNode.childNodes[h.anchorOffset]}}if(i&&i.nodeType==3){return i.parentNode}return i}return f.item?f.item(0):f.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(_mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",valid_elements:"*[*]",extended_valid_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;i.schema=j.schema;if(j.entity_encoding=="named"&&!j.entities){j.entity_encoding="raw"}if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,z,y=["ol","ul"],u,t,q,k=/^(OL|UL)$/,A;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(z=0;z<y.length;z++){l=i.dom.select(y[z],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){A=m(t,"LI");if(!A){A=i.dom.create("li");A.innerHTML="&nbsp;";A.appendChild(t);q.insertBefore(A,q.firstChild)}else{A.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){if(!e.isOpera||opera.buildNumber()>=1767){f(i.dom.select("p table",l.node).reverse(),function(p){var o=i.dom.getParent(p.parentNode,"table,p");if(o.nodeName!="TABLE"){try{i.dom.split(o,p)}catch(m){}}})}})}},setEntities:function(o){var n=this,j,m,h={},k;if(n.entityLookup){return}j=o.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16)}n.entityLookup=h},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var y=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(y){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(r,q){var m,k=this,p,i,j,l;k._setup();q=q||{};q.format=q.format||"html";k.processObj=q;if(d){l=[];f(r.getElementsByTagName("option"),function(o){var h=k.dom.getAttrib(o,"selected");l.push(h?h:null)})}r=r.cloneNode(true);if(d){f(r.getElementsByTagName("option"),function(o,h){k.dom.setAttrib(o,"selected",l[h])})}j=r.ownerDocument.implementation;if(j.createHTMLDocument&&(e.isOpera&&opera.buildNumber()>=1767)){p=j.createHTMLDocument("");f(r.nodeName=="BODY"?r.childNodes:[r],function(h){p.body.appendChild(p.importNode(h,true))});if(r.nodeName!="BODY"){r=p.body.firstChild}else{r=p.body}i=k.dom.doc;k.dom.doc=p}k.key=""+(parseInt(k.key)+1);if(!q.no_events){q.node=r;k.onPreProcess.dispatch(k,q)}k.writer.reset();k._info=q;k._serializeNode(r,q.getInner);q.content=k.writer.getContent();if(i){k.dom.doc=i}if(!q.no_events){k.onPostProcess.dispatch(k,q)}k._postProcess(q);q.node=null;return e.trim(q.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,I){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,H,B,h,y,k,r,C,p,m,G,o;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("_mce_bogus"):D.getAttribute("_mce_bogus")){return}p=G=false;q=D.hasChildNodes();k=D.getAttribute("_mce_name")||D.nodeName.toLowerCase();o=D.getAttribute("_mce_type");if(o){if(!z._info.cleanup){p=true;return}else{G=1}}if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!G){if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||I){p=true;break}}if(d){if(A.fix_content_duplication){if(D._mce_serialized==z.key){return}D._mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(A.validate_children){if(z.elementName&&!z.schema.isValid(z.elementName,k)){p=true;break}z.elementName=k}r=z.findRule(k);if(!r){p=true;break}k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){H=r.requiredAttribs;for(F=H.length-1;F>=0;F--){if(this.dom.getAttrib(D,H[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){H=B[F];y=z._getAttrib(D,H);if(y!==null){x.writeAttribute(H.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){H=h.nodeName.toLowerCase();if(A.invalid_attrs.test(H)||!r.validAttribsRE.test(H)){continue}C=z.findAttribRule(r,H);y=z._getAttrib(D,C,H);if(y!==null){x.writeAttribute(H,y)}}}}if(o&&G){x.writeAttribute("_mce_type",o)}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("_mce_bogus"):u.getAttribute("_mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(A.validate_children&&z.elementName&&!z.schema.isValid(z.elementName,"#text")){return}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(/[\u007E-\uFFFF]/g,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,u){var v=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}u()}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(x){var t=q.create("script",{type:"text/javascript"});t.text=x;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()}});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});s.onload=p;s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}};(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","lastSibling",e))}};(function(){var a={};function b(f,e){var d;function c(g){return g.replace(/[A-Z]+/g,function(h){return c(f[h])})}for(d in f){if(f.hasOwnProperty(d)){f[d]=c(f[d])}}c(e).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]/g,function(l,g,j){var h,k={};j=j.split(/\|/);for(h=j.length-1;h>=0;h--){k[j[h]]=1}a[g]=k})}b({Z:"#|H|K|N|O|P",Y:"#|X|form|R|Q",X:"p|T|div|U|W|isindex|fieldset|table",W:"pre|hr|blockquote|address|center|noframes",U:"ul|ol|dl|menu|dir",ZC:"#|p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"#|X|S|Q",S:"R|P",ZA:"#|a|G|J|M|O|P",R:"#|a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe"},"script[]style[]object[#|param|X|form|a|H|K|N|O|Q]param[]p[S]a[Z]br[]span[S]bdo[S]applet[#|param|X|form|a|H|K|N|O|Q]h1[S]img[]map[X|form|Q|area]h2[S]iframe[#|X|form|a|H|K|N|O|Q]h3[S]tt[S]i[S]b[S]u[S]s[S]strike[S]big[S]small[S]font[S]basefont[]em[S]strong[S]dfn[S]code[S]q[S]samp[S]kbd[S]var[S]cite[S]abbr[S]acronym[S]sub[S]sup[S]input[]select[optgroup|option]optgroup[option]option[]textarea[]label[S]button[#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[S]ins[#|X|form|a|H|K|N|O|Q]h5[S]del[#|X|form|a|H|K|N|O|Q]h6[S]div[#|X|form|a|H|K|N|O|Q]ul[li]li[#|X|form|a|H|K|N|O|Q]ol[li]dl[dt|dd]dt[S]dd[#|X|form|a|H|K|N|O|Q]menu[li]dir[li]pre[ZA]hr[]blockquote[#|X|form|a|H|K|N|O|Q]address[S|p]center[#|X|form|a|H|K|N|O|Q]noframes[#|X|form|a|H|K|N|O|Q]isindex[]fieldset[#|legend|X|form|a|H|K|N|O|Q]legend[S]table[caption|col|colgroup|thead|tfoot|tbody|tr]caption[S]col[]colgroup[col]thead[tr]tr[th|td]th[#|X|form|a|H|K|N|O|Q]form[#|X|a|H|K|N|O|Q]noscript[#|X|form|a|H|K|N|O|Q]td[#|X|form|a|H|K|N|O|Q]tfoot[tr]tbody[tr]area[]base[]body[#|X|form|a|H|K|N|O|Q]");tinymce.dom.Schema=function(){var c=this,d=a;c.isValid=function(f,e){var g=d[f];return !!(g&&(!e||g[e]))}}})();(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(k==l?l:l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(k){var h=-1,i,j=k.keyCode;e(f.items,function(l,m){if(f.selectedValue==l.value){h=m}});if(j==38){i=f.items[h-1]}else{if(j==40){i=f.items[h+1]}else{if(j==13){i=f.selectedValue;f.selectedValue=null;f.settings.onselect(i);return b.cancel(k)}}}if(i){f.hideMenu();f.select(i.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},_mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("_mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(e){var d=b.settings;if(d&&d.language){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l<o.length;l++){if(o[l]==n){o.splice(l,1);break}}if(m.activeEditor==n){m._setActive(o[0])}n.destroy();m.onRemoveEditor.dispatch(m,n);return n},execCommand:function(r,p,o){var q=this,n=q.get(o),l;switch(r){case"mceFocus":n.focus();return true;case"mceAddEditor":case"mceAddControl":if(!q.get(o)){new j.Editor(o,q.settings).render()}return true;case"mceAddFrameControl":l=o.window;l.tinyMCE=tinyMCE;l.tinymce=j;j.DOM.doc=l.document;j.DOM.win=l;n=new j.Editor(o.element_id,o);n.render();if(j.isIE){function m(){n.destroy();l.detachEvent("onunload",m);l=l.tinyMCE=l.tinymce=null}l.attachEvent("onunload",m)}o.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(n){n.remove()}return true;case"mceToggleEditor":if(!n){q.execCommand("mceAddControl",0,o);return true}if(n.isHidden()){n.show()}else{n.hide()}return true}if(q.activeEditor){return q.activeEditor.execCommand(r,p,o)}return false},execInstanceCommand:function(p,o,n,m){var l=this.get(p);if(l){return l.execCommand(o,n,m)}return false},triggerSave:function(){g(this.editors,function(l){l.save()})},addI18n:function(n,q){var l,m=this.i18n;if(!j.is(n,"string")){g(n,function(r,p){g(r,function(t,s){g(t,function(v,u){if(s==="common"){m[p+"."+u]=v}else{m[p+"."+s+"."+u]=v}})})})}else{g(q,function(r,p){m[n+"."+p]=r})}},_setActive:function(l){this.selectedInstance=this.activeEditor=l}})})(tinymce);(function(m){var n=m.DOM,j=m.dom.Event,f=m.extend,k=m.util.Dispatcher,i=m.each,a=m.isGecko,b=m.isIE,e=m.isWebKit,d=m.is,h=m.ThemeManager,c=m.PluginManager,o=m.inArray,l=m.grep,g=m.explode;m.create("tinymce.Editor",{Editor:function(r,q){var p=this;p.id=p.editorId=r;p.execCommands={};p.queryStateCommands={};p.queryValueCommands={};p.isNotDirty=false;p.plugins={};i(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){p[s]=new k(p)});p.settings=q=f({id:r,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:m.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:m.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language){p.add(m.baseURL+"/langs/"+v.language+".js")}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+m.suffix+".js")}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,E=this,F=E.settings,B,y,A=E.getElement(),q,p,C,x,z,D;m.add(E);if(F.theme){F.theme=F.theme.replace(/-/,"");q=h.get(F.theme);E.theme=new q();if(E.theme.init&&F.init_theme){E.theme.init(E,h.urls[F.theme]||m.documentBaseURL.replace(/\/$/,""))}}i(g(F.plugins.replace(/\-/g,"")),function(G){var H=c.get(G),t=c.urls[G]||m.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(E,t);E.plugins[G]=s;if(s.init){s.init(E,t)}}});if(F.popup_css!==false){if(F.popup_css){F.popup_css=E.documentBaseURI.toAbsolute(F.popup_css)}else{F.popup_css=E.baseURI.toAbsolute("themes/"+F.theme+"/skins/"+F.skin+"/dialog.css")}}if(F.popup_css_add){F.popup_css+=","+E.documentBaseURI.toAbsolute(F.popup_css_add)}E.controlManager=new m.ControlManager(E);if(F.custom_undo_redo){E.onBeforeExecCommand.add(function(t,G,u,H,s){if(G!="Undo"&&G!="Redo"&&G!="mceRepaint"&&(!s||!s.skip_undo)){if(!E.undoManager.hasUndo()){E.undoManager.add()}}});E.onExecCommand.add(function(t,G,u,H,s){if(G!="Undo"&&G!="Redo"&&G!="mceRepaint"&&(!s||!s.skip_undo)){E.undoManager.add()}})}E.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){E.nodeChanged()}});if(a){function v(s,t){if(!t||!t.initial){E.execCommand("mceRepaint")}}E.onUndo.add(v);E.onRedo.add(v);E.onSetContent.add(v)}E.onBeforeRenderUI.dispatch(E,E.controlManager);if(F.render_ui){B=F.width||A.style.width||A.offsetWidth;y=F.height||A.style.height||A.offsetHeight;E.orgDisplay=A.style.display;D=/^[0-9\.]+(|px)$/i;if(D.test(""+B)){B=Math.max(parseInt(B)+(q.deltaWidth||0),100)}if(D.test(""+y)){y=Math.max(parseInt(y)+(q.deltaHeight||0),100)}q=E.theme.renderUI({targetNode:A,width:B,height:y,deltaWidth:F.delta_width,deltaHeight:F.delta_height});E.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:B,height:y});y=(q.iframeHeight||y)+(typeof(y)=="number"?(q.deltaHeight||0):"");if(y<100){y=100}E.iframeHTML=F.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(F.document_base_url!=m.documentBaseURL){E.iframeHTML+='<base href="'+E.documentBaseURI.getURI()+'" />'}E.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(m.relaxedDomain){E.iframeHTML+='<script type="text/javascript">document.domain = "'+m.relaxedDomain+'";<\/script>'}x=F.body_id||"tinymce";if(x.indexOf("=")!=-1){x=E.getParam("body_id","","hash");x=x[E.id]||x}z=F.body_class||"";if(z.indexOf("=")!=-1){z=E.getParam("body_class","","hash");z=z[E.id]||""}E.iframeHTML+='</head><body id="'+x+'" class="mceContentBody '+z+'"></body></html>';if(m.relaxedDomain){if(b||(m.isOpera&&parseFloat(opera.version())>=9.5)){C='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+E.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(m.isOpera){C='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}r=n.add(q.iframeContainer,"iframe",{id:E.id+"_ifr",src:C||'javascript:""',frameBorder:"0",style:{width:"100%",height:y}});E.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=E.orgDisplay;n.get(E.id).style.display="none";if(!b||!m.relaxedDomain){E.setupIframe()}A=r=q=null},setupIframe:function(){var z=this,A=z.settings,r=n.get(z.id),u=z.getDoc(),q,x;if(!b||!m.relaxedDomain){u.open();u.write(z.iframeHTML);u.close()}if(!b){try{if(!A.readonly){u.designMode="On"}}catch(v){}}if(b){x=z.getBody();n.hide(x);if(!A.readonly){x.contentEditable=true}n.show(x)}z.dom=new m.dom.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1,valid_styles:A.valid_styles});z.schema=new m.dom.Schema();z.serializer=new m.dom.Serializer(f(A,{valid_elements:A.verify_html===false?"*[*]":A.valid_elements,dom:z.dom,schema:z.schema}));z.selection=new m.dom.Selection(z.dom,z.getWin(),z.serializer);z.formatter=new m.Formatter(this);z.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b"}],italic:[{inline:"em"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"u"}],forecolor:{inline:"span",styles:{color:"%value"}},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"}},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){z.formatter.register(s,{block:s,remove:"all"})});z.formatter.register(z.settings.formats);z.undoManager=new m.UndoManager(z);z.undoManager.onAdd.add(function(t,s){if(!s.initial){return z.onChange.dispatch(z,s,t)}});z.undoManager.onUndo.add(function(t,s){return z.onUndo.dispatch(z,s,t)});z.undoManager.onRedo.add(function(t,s){return z.onRedo.dispatch(z,s,t)});z.forceBlocks=new m.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new m.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){i(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' _mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";i(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){j.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function p(s,t){i(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{_mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){p(s)}});z.onSetContent.add(z.selection.onSetContent.add(p));if(!A.readonly){try{u.designMode="Off";u.designMode="On"}catch(v){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){m.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=m.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);r=null},focus:function(s){var x,q=this,v=q.settings.content_editable,r,p,u=q.getDoc();if(!s){r=q.selection.getRng();if(r.item){p=r.item(0)}if(!v){q.getWin().focus()}if(p&&p.ownerDocument==u){r=u.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((x=m.activeEditor)!=null){x.onDeactivate.dispatch(x,q)}q.onActivate.dispatch(q,x)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=(b?q.getNode():q.getStart())||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(r,q,p){this.execCommands[r]={func:q,scope:p||this}},addQueryStateHandler:function(r,q,p){this.queryStateCommands[r]={func:q,scope:p||this}},addQueryValueHandler:function(r,q,p){this.queryValueCommands[r]={func:q,scope:p||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(m.GlobalCommands.execCommand(r,x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=0;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(q,r){var p=this;r=r||{};r.format=r.format||"html";r.set=true;r.content=q;if(!r.no_events){p.onBeforeSetContent.dispatch(p,r)}if(!m.isIE&&(q.length===0||/^\s+$/.test(q))){r.content=p.dom.setHTML(p.getBody(),'<br _mce_bogus="1" />');r.format="raw"}r.content=p.dom.setHTML(p.getBody(),m.trim(r.content));if(r.format!="raw"&&p.settings.cleanup){r.getInner=true;r.content=p.dom.setHTML(p.getBody(),p.serializer.serialize(p.getBody(),r))}if(!r.no_events){p.onSetContent.dispatch(p,r)}return r.content},getContent:function(r){var p=this,q;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){p.onBeforeGetContent.dispatch(p,r)}if(r.format!="raw"&&p.settings.cleanup){r.getInner=true;q=p.serializer.serialize(p.getBody(),r)}else{q=p.getBody().innerHTML}q=q.replace(/^\s*|\s*$/g,"");r.content=q;if(!r.no_events){p.onGetContent.dispatch(p,r)}return r.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var v=this,u,y=v.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function r(t,A){var s=t.type;if(v.removed){return}if(v.onEvent.dispatch(v,t,A)!==false){v[x[t.fakeType||t.type]].dispatch(v,t,A)}}i(x,function(t,s){switch(s){case"contextmenu":if(m.isOpera){v.dom.bind(v.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";r(A)}})}else{v.dom.bind(v.getBody(),s,r)}break;case"paste":v.dom.bind(v.getBody(),s,function(A){r(A)});break;case"submit":case"reset":v.dom.bind(v.getElement().form||n.getParent(v.id,"form"),s,r);break;default:v.dom.bind(y.content_editable?v.getBody():v.getDoc(),s,r)}});v.dom.bind(y.content_editable?v.getBody():(a?v.getDoc():v.getWin()),"focus",function(s){v.focus(true)});if(m.isGecko){v.dom.bind(v.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("_mce_src"))){t.src=v.documentBaseURI.toAbsolute(s)}})}if(a){function p(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}v.onBeforeExecCommand.add(p);v.onMouseDown.add(p)}if(m.isWebKit){v.onClick.add(function(s,t){t=t.target;if(t.nodeName=="IMG"||(t.nodeName=="A"&&v.dom.hasClass(t,"mceItemAnchor"))){v.selection.getSel().setBaseAndExtent(t,0,t,1)}})}v.onMouseUp.add(v.nodeChanged);v.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(m.isMac&&(A==91||A==93))||t.ctrlKey){v.nodeChanged()}});v.onReset.add(function(){v.setContent(v.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){v.addShortcut("ctrl+z",v.getLang("undo_desc"),"Undo");v.addShortcut("ctrl+y",v.getLang("redo_desc"),"Redo")}v.addShortcut("ctrl+b",v.getLang("bold_desc"),"Bold");v.addShortcut("ctrl+i",v.getLang("italic_desc"),"Italic");v.addShortcut("ctrl+u",v.getLang("underline_desc"),"Underline");for(u=1;u<=6;u++){v.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}v.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);v.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);v.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(v.shortcuts,function(A){if(m.isMac&&A.ctrl!=t.metaKey){return}else{if(!m.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}v.onKeyUp.add(function(s,t){var A=z(t);if(A){return j.cancel(t)}});v.onKeyPress.add(function(s,t){var A=z(t);if(A){return j.cancel(t)}});v.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return j.cancel(t)}})}if(m.isIE){v.dom.bind(v.getDoc(),"controlselect",function(A){var t=v.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){v.dom.unbind(t.node,t.ev,t.cb)}if(!v.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=v.dom.bind(A,ev,function(C){var B;C=C.target;if(B=v.dom.getStyle(C,"width")){v.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));v.dom.setStyle(C,"width","")}if(B=v.dom.getStyle(C,"height")){v.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));v.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=v.dom.bind(A,"resizestart",j.cancel,j)}t=v.resizeInfo={node:A,ev:ev,cb:s}});v.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(v.selection.getRng().item){s.dom.remove(v.selection.getRng().item(0));return j.cancel(t)}}})}if(m.isOpera){v.onClick.add(function(s,t){j.prevent(t)})}if(y.custom_undo_redo){function q(){v.undoManager.typing=0;v.undoManager.add()}v.dom.bind(v.getDoc(),"focusout",function(s){if(!v.removed&&v.undoManager.typing){q()}});v.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){q()}});v.onKeyDown.add(function(t,D){var s,A,C,E;if(b&&D.keyCode==46){s=v.selection.getRng();if(s.parentElement){C=s.parentElement();A=s.duplicate();A.moveToElementText(C);A.setEndPoint("EndToEnd",s);E=A.text.length;if(D.ctrlKey){s.moveEnd("word",1);s.select()}v.selection.getSel().clear();if(s.parentElement()==C){try{C.innerHTML=C.innerHTML}catch(B){}A.moveToElementText(C);A.collapse();A.move("character",E);A.select()}D.preventDefault();return}}if((D.keyCode>=33&&D.keyCode<=36)||(D.keyCode>=37&&D.keyCode<=40)||D.keyCode==13||D.keyCode==45){if(v.undoManager.typing){q()}return}if(!v.undoManager.typing){v.undoManager.add();v.undoManager.typing=1}});v.onMouseDown.add(function(){if(v.undoManager.typing){q()}})}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)},_fixNesting:function(q){var r=[],p;q=q.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(t,s,v){var u;if(s==="/"){if(!r.length){return""}if(v!==r[r.length-1].tag){for(p=r.length-1;p>=0;p--){if(r[p].tag===v){r[p].close=1;break}}return""}else{r.pop();if(r.length&&r[r.length-1].close){t=t+"</"+r[r.length-1].tag+">";r.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(v)){return t}if(/\/>$/.test(t)){return t}r.push({tag:v})}return t});for(p=r.length-1;p>=0;p--){q+="</"+r[p].tag+">"}return q}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var l=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,o;function q(y,x,v){var u;y=y.toLowerCase();if(u=j.exec[y]){u(y,x,v);return a}return b}function m(v){var u;v=v.toLowerCase();if(u=j.state[v]){return u(v)}return -1}function h(v){var u;v=v.toLowerCase();if(u=j.value[v]){return u(v)}return b}function t(u,v){v=v||"exec";d(u,function(y,x){d(x.toLowerCase().split(","),function(z){j[v][z]=y})})}c.extend(this,{execCommand:q,queryCommandState:m,queryCommandValue:h,addCommands:t});function f(x,v,u){if(v===e){v=b}if(u===e){u=null}return n.getDoc().execCommand(x,v,u)}function s(u){return n.formatter.match(u)}function r(u,v){n.formatter.toggle(u,v?{value:v}:e)}function i(u){o=p.getBookmark(u)}function g(){p.moveToBookmark(o)}t({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(y){var x=n.getDoc(),u;try{f(y)}catch(v){u=a}if(u||!x.queryCommandSupported(y)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(z){if(z){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(u){if(p.isCollapsed()){p.select(p.getNode())}f(u);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){var v=u.substring(7);d("left,center,right,full".split(","),function(x){if(v!=x){n.formatter.remove("align"+x)}});r("align"+v)},"InsertUnorderedList,InsertOrderedList":function(x){var u,v;f(x);u=l.getParent(p.getNode(),"ol,ul");if(u){v=u.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(v.nodeName)){i();l.split(v,u);g()}}},"Bold,Italic,Underline,Strikethrough":function(u){r(u)},"ForeColor,HiliteColor,FontName":function(x,v,u){r(x,u)},FontSize:function(y,x,v){var u,z;if(v>=1&&v<=7){z=c.explode(k.font_size_style_values);u=c.explode(k.font_size_classes);if(u){v=u[v-1]||v}else{v=z[v-1]||v}}r(y,v)},RemoveFormat:function(u){n.formatter.remove(u)},mceBlockQuote:function(u){r("blockquote")},FormatBlock:function(x,v,u){return r(u)},mceCleanup:function(){var u=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(u)},mceRemoveNode:function(y,x,v){var u=v||p.getNode();if(u!=n.getBody()){i();n.dom.remove(u,a);g()}},mceSelectNodeDepth:function(y,x,v){var u=0;l.getParent(p.getNode(),function(z){if(z.nodeType==1&&u++==v){p.select(z);return b}},n.getBody())},mceSelectNode:function(x,v,u){p.select(u)},mceInsertContent:function(x,v,u){p.setContent(u)},mceInsertRawHTML:function(x,v,u){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,u))},mceSetContent:function(x,v,u){n.setContent(u)},"Indent,Outdent":function(y){var v,u,x;v=k.indentation;u=/[a-z%]+$/i.exec(v);v=parseInt(v);if(!m("InsertUnorderedList")&&!m("InsertOrderedList")){d(p.getSelectedBlocks(),function(z){if(y=="outdent"){x=Math.max(0,parseInt(z.style.paddingLeft||0)-v);l.setStyle(z,"paddingLeft",x?x+u:"")}else{l.setStyle(z,"paddingLeft",(parseInt(z.style.paddingLeft||0)+v)+u)}})}else{f(y)}},mceRepaint:function(){var v;if(c.isGecko){try{i(a);if(p.getSel()){p.getSel().selectAllChildren(n.getBody())}p.collapse(a);g()}catch(u){}}},mceToggleFormat:function(x,v,u){n.formatter.toggle(u)},InsertHorizontalRule:function(){p.setContent("<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(x,v,u){p.setContent(u.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(y,x,v){var u=l.getParent(p.getNode(),"a");if(c.is(v,"string")){v={href:v}}if(!u){f("CreateLink",b,"javascript:mctmp(0);");d(l.select("a[href=javascript:mctmp(0);]"),function(z){l.setAttribs(z,v)})}else{if(v.href){l.setAttribs(u,v)}else{n.dom.remove(u,a)}}},selectAll:function(){var v=l.getRoot();var u=l.createRng();u.setStart(v,0);u.setEnd(v,v.childNodes.length);n.selection.setRng(u)}});t({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){return s("align"+u.substring(7))},"Bold,Italic,Underline,Strikethrough":function(u){return s(u)},mceBlockQuote:function(){return s("blockquote")},Outdent:function(){var u;if(k.inline_styles){if((u=l.getParent(p.getStart(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}if((u=l.getParent(p.getEnd(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}}return m("InsertUnorderedList")||m("InsertOrderedList")||(!k.inline_styles&&!!l.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(u){return l.getParent(p.getNode(),u=="insertunorderedlist"?"UL":"OL")}},"state");t({"FontSize,FontName":function(x){var v=0,u;if(u=l.getParent(p.getNode(),"span")){if(x=="fontsize"){v=u.style.fontSize}else{v=u.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return v}},"value");if(k.custom_undo_redo){t({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(e){var c,d=0,g=[];function f(){return b.trim(e.getContent({format:"raw",no_events:1}))}return c={typing:0,onAdd:new a(c),onUndo:new a(c),onRedo:new a(c),add:function(l){var h,j=e.settings,k;l=l||{};l.content=f();k=g[d];if(k&&k.content==l.content){if(d>0||g.length==1){return null}}if(j.custom_undo_redo_levels){if(g.length>j.custom_undo_redo_levels){for(h=0;h<g.length-1;h++){g[h]=g[h+1]}g.length--;d=g.length}}l.bookmark=e.selection.getBookmark(2,true);if(d<g.length-1){if(d==0){g=[]}else{g.length=d+1}}g.push(l);d=g.length-1;c.onAdd.dispatch(c,l);e.isNotDirty=0;return l},undo:function(){var j,h;if(c.typing){c.add();c.typing=0}if(d>0){j=g[--d];e.setContent(j.content,{format:"raw"});e.selection.moveToBookmark(j.bookmark);c.onUndo.dispatch(c,j)}return j},redo:function(){var h;if(d<g.length-1){h=g[++d];e.setContent(h.content,{format:"raw"});e.selection.moveToBookmark(h.bookmark);c.onRedo.dispatch(c,h)}return h},clear:function(){g=[];d=c.typing=0},hasUndo:function(){return d>0||c.typing},hasRedo:function(){return d<g.length-1}}}})(tinymce);(function(m){var k=m.dom.Event,c=m.isIE,a=m.isGecko,b=m.isOpera,j=m.each,i=m.extend,d=true,h=false;function l(p){var q,o,n;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(p.nodeName)){if(q){o=p.cloneNode(false);o.appendChild(q);q=o}else{q=n=p.cloneNode(false)}q.removeAttribute("id")}}while(p=p.parentNode);if(q){return{wrapper:q,inner:n}}}function g(o,p){var n=p.ownerDocument.createRange();n.setStart(o.endContainer,o.endOffset);n.setEndAfter(p);return n.cloneContents().textContent.length==0}function f(o){o=o.innerHTML;o=o.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");o=o.replace(/<[^>]+>/g,"");return o.replace(/[ \u00a0\t\r\n]+/g,"")==""}function e(p,r,n){var o,q;if(f(n)){o=r.getParent(n,"ul,ol");if(!r.getParent(o.parentNode,"ul,ol")){r.split(o,n);q=r.create("p",0,'<br _mce_bogus="1" />');r.replace(q,n);p.select(q,1)}return h}return d}m.create("tinymce.ForceBlocks",{ForceBlocks:function(o){var p=this,q=o.settings,r;p.editor=o;p.dom=o.dom;r=(q.forced_root_block||"p").toLowerCase();q.element=r.toUpperCase();o.onPreInit.add(p.setup,p);p.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+r+">","gi");p.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,r),"gi");p.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,r),"gi");p.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,r),"gi");p.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,r),"gi");function n(s,t){if(b){t.content=t.content.replace(p.reOpera,"</"+r+">")}t.content=t.content.replace(p.rePadd,"<"+r+"$1$2$3$4$5$6>\u00a0</"+r+">");if(!c&&!b&&t.set){t.content=t.content.replace(p.reNbsp2BR1,"<"+r+"$1$2><br /></"+r+">");t.content=t.content.replace(p.reNbsp2BR2,"<"+r+"$1$2><br /></"+r+">")}else{t.content=t.content.replace(p.reBR2Nbsp,"<"+r+"$1$2>\u00a0</"+r+">")}}o.onBeforeSetContent.add(n);o.onPostProcess.add(n);if(q.forced_root_block){o.onInit.add(p.forceRoots,p);o.onSetContent.add(p.forceRoots,p);o.onBeforeGetContent.add(p.forceRoots,p)}},setup:function(){var o=this,n=o.editor,q=n.settings,u=n.dom,p=n.selection;if(q.forced_root_block){n.onBeforeExecCommand.add(o.forceRoots,o);n.onKeyUp.add(o.forceRoots,o);n.onPreProcess.add(o.forceRoots,o)}if(q.force_br_newlines){if(c){n.onKeyPress.add(function(s,t){var v;if(t.keyCode==13&&p.getNode().nodeName!="LI"){p.setContent('<br id="__" /> ',{format:"raw"});v=u.get("__");v.removeAttribute("id");p.select(v);p.collapse();return k.cancel(t)}})}}if(q.force_p_newlines){if(!c){n.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!o.insertPara(t)){k.cancel(t)}})}else{m.addUnload(function(){o._previousFormats=0});n.onKeyPress.add(function(s,t){o._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&q.keep_styles){o._previousFormats=l(s.selection.getStart())}});n.onKeyUp.add(function(t,x){if(x.keyCode==13&&!x.shiftKey){var v=t.selection.getStart(),s=o._previousFormats;if(!v.hasChildNodes()){v=u.getParent(v,u.isBlock);if(v){v.innerHTML="";if(o._previousFormats){v.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{v.innerHTML="\uFEFF"}p.select(v,1);t.getDoc().execCommand("Delete",false,null)}}}})}if(a){n.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){o.backspaceDelete(t,t.keyCode==8)}})}}if(m.isWebKit){function r(t){var s=p.getRng(),v,z=u.create("div",null," "),y,x=u.getViewPort(t.getWin()).h;s.insertNode(v=u.create("br"));s.setStartAfter(v);s.setEndAfter(v);p.setRng(s);if(p.getSel().focusNode==v.previousSibling){p.select(u.insertAfter(u.doc.createTextNode("\u00a0"),v));p.collapse(d)}u.insertAfter(z,v);y=u.getPos(z).y;u.remove(z);if(y>x){t.getWin().scrollTo(0,y)}}n.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(q.force_br_newlines&&!u.getParent(p.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);k.cancel(t)}})}n.onPreProcess.add(function(s,t){j(u.select("p,h1,h2,h3,h4,h5,h6,div",t.node),function(v){if(f(v)){j(u.select("span,em,strong,b,i",t.node),function(x){if(!x.hasChildNodes()){x.appendChild(s.getDoc().createTextNode("\u00a0"));return h}})}})});if(c){if(q.element!="P"){n.onKeyPress.add(function(s,t){o.lastElm=p.getNode().nodeName});n.onKeyUp.add(function(t,v){var y,x=p.getNode(),s=t.getBody();if(s.childNodes.length===1&&x.nodeName=="P"){x=u.rename(x,q.element);p.select(x);p.collapse();t.nodeChanged()}else{if(v.keyCode==13&&!v.shiftKey&&o.lastElm!="P"){y=u.getParent(x,"p");if(y){u.rename(y,q.element);t.nodeChanged()}}}})}}},find:function(v,q,r){var p=this.editor,o=p.getDoc().createTreeWalker(v,4,null,h),u=-1;while(v=o.nextNode()){u++;if(q==0&&v==r){return u}if(q==1&&u==r){return v}}return -1},forceRoots:function(x,I){var z=this,x=z.editor,M=x.getBody(),J=x.getDoc(),P=x.selection,A=P.getSel(),B=P.getRng(),N=-2,v,G,o,p,K=-16777215;var L,q,O,F,C,u=M.childNodes,E,D,y;for(E=u.length-1;E>=0;E--){L=u[E];if(L.nodeType===1&&L.getAttribute("_mce_type")){q=null;continue}if(L.nodeType===3||(!z.dom.isBlock(L)&&L.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(L.nodeName))){if(!q){if(L.nodeType!=3||/[^\s]/g.test(L.nodeValue)){if(N==-2&&B){if(!c){if(B.startContainer.nodeType==1&&(D=B.startContainer.childNodes[B.startOffset])&&D.nodeType==1){y=D.getAttribute("id");D.setAttribute("id","__mce")}else{if(x.dom.getParent(B.startContainer,function(n){return n===M})){G=B.startOffset;o=B.endOffset;N=z.find(M,0,B.startContainer);v=z.find(M,0,B.endContainer)}}}else{if(B.item){p=J.body.createTextRange();p.moveToElementText(B.item(0));B=p}p=J.body.createTextRange();p.moveToElementText(M);p.collapse(1);O=p.move("character",K)*-1;p=B.duplicate();p.collapse(1);F=p.move("character",K)*-1;p=B.duplicate();p.collapse(0);C=(p.move("character",K)*-1)-F;N=F-O;v=C}}q=x.dom.create(x.settings.forced_root_block);L.parentNode.replaceChild(q,L);q.appendChild(L)}}else{if(q.hasChildNodes()){q.insertBefore(L,q.firstChild)}else{q.appendChild(L)}}}else{q=null}}if(N!=-2){if(!c){q=M.getElementsByTagName(x.settings.element)[0];B=J.createRange();if(N!=-1){B.setStart(z.find(M,1,N),G)}else{B.setStart(q,0)}if(v!=-1){B.setEnd(z.find(M,1,v),o)}else{B.setEnd(q,0)}if(A){A.removeAllRanges();A.addRange(B)}}else{try{B=A.createRange();B.moveToElementText(M);B.collapse(1);B.moveStart("character",N);B.moveEnd("character",v);B.select()}catch(H){}}}else{if(!c&&(D=x.dom.get("__mce"))){if(y){D.setAttribute("id",y)}else{D.removeAttribute("id")}B=J.createRange();B.setStartBefore(D);B.setEndBefore(D);P.setRng(B)}}},getParentBlock:function(p){var o=this.dom;return o.getParent(p,o.isBlock)},insertPara:function(S){var G=this,x=G.editor,O=x.dom,T=x.getDoc(),X=x.settings,H=x.selection.getSel(),I=H.getRangeAt(0),W=T.body;var L,M,J,Q,P,u,p,v,A,o,E,V,q,z,K,N=O.getViewPort(x.getWin()),D,F,C;L=T.createRange();L.setStart(H.anchorNode,H.anchorOffset);L.collapse(d);M=T.createRange();M.setStart(H.focusNode,H.focusOffset);M.collapse(d);J=L.compareBoundaryPoints(L.START_TO_END,M)<0;Q=J?H.anchorNode:H.focusNode;P=J?H.anchorOffset:H.focusOffset;u=J?H.focusNode:H.anchorNode;p=J?H.focusOffset:H.anchorOffset;if(Q===u&&/^(TD|TH)$/.test(Q.nodeName)){if(Q.firstChild.nodeName=="BR"){O.remove(Q.firstChild)}if(Q.childNodes.length==0){x.dom.add(Q,X.element,null,"<br />");V=x.dom.add(Q,X.element,null,"<br />")}else{K=Q.innerHTML;Q.innerHTML="";x.dom.add(Q,X.element,null,K);V=x.dom.add(Q,X.element,null,"<br />")}I=T.createRange();I.selectNodeContents(V);I.collapse(1);x.selection.setRng(I);return h}if(Q==W&&u==W&&W.firstChild&&x.dom.isBlock(W.firstChild)){Q=u=Q.firstChild;P=p=0;L=T.createRange();L.setStart(Q,0);M=T.createRange();M.setStart(u,0)}Q=Q.nodeName=="HTML"?T.body:Q;Q=Q.nodeName=="BODY"?Q.firstChild:Q;u=u.nodeName=="HTML"?T.body:u;u=u.nodeName=="BODY"?u.firstChild:u;v=G.getParentBlock(Q);A=G.getParentBlock(u);o=v?v.nodeName:X.element;if(K=G.dom.getParent(v,"li,pre")){if(K.nodeName=="LI"){return e(x.selection,G.dom,K)}return d}if(v&&(v.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(O.getStyle(v,"position",1)))){o=X.element;v=null}if(A&&(A.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(O.getStyle(v,"position",1)))){o=X.element;A=null}if(/(TD|TABLE|TH|CAPTION)/.test(o)||(v&&o=="DIV"&&/left|right/gi.test(O.getStyle(v,"float",1)))){o=X.element;v=A=null}E=(v&&v.nodeName==o)?v.cloneNode(0):x.dom.create(o);V=(A&&A.nodeName==o)?A.cloneNode(0):x.dom.create(o);V.removeAttribute("id");if(/^(H[1-6])$/.test(o)&&g(I,v)){V=x.dom.create(X.element)}K=q=Q;do{if(K==W||K.nodeType==9||G.dom.isBlock(K)||/(TD|TABLE|TH|CAPTION)/.test(K.nodeName)){break}q=K}while((K=K.previousSibling?K.previousSibling:K.parentNode));K=z=u;do{if(K==W||K.nodeType==9||G.dom.isBlock(K)||/(TD|TABLE|TH|CAPTION)/.test(K.nodeName)){break}z=K}while((K=K.nextSibling?K.nextSibling:K.parentNode));if(q.nodeName==o){L.setStart(q,0)}else{L.setStartBefore(q)}L.setEnd(Q,P);E.appendChild(L.cloneContents()||T.createTextNode(""));try{M.setEndAfter(z)}catch(R){}M.setStart(u,p);V.appendChild(M.cloneContents()||T.createTextNode(""));I=T.createRange();if(!q.previousSibling&&q.parentNode.nodeName==o){I.setStartBefore(q.parentNode)}else{if(L.startContainer.nodeName==o&&L.startOffset==0){I.setStartBefore(L.startContainer)}else{I.setStart(L.startContainer,L.startOffset)}}if(!z.nextSibling&&z.parentNode.nodeName==o){I.setEndAfter(z.parentNode)}else{I.setEnd(M.endContainer,M.endOffset)}I.deleteContents();if(b){x.getWin().scrollTo(0,N.y)}if(E.firstChild&&E.firstChild.nodeName==o){E.innerHTML=E.firstChild.innerHTML}if(V.firstChild&&V.firstChild.nodeName==o){V.innerHTML=V.firstChild.innerHTML}if(f(E)){E.innerHTML="<br />"}function U(y,s){var r=[],Z,Y,t;y.innerHTML="";if(X.keep_styles){Y=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(Y.nodeName)){Z=Y.cloneNode(h);O.setAttrib(Z,"id","");r.push(Z)}}while(Y=Y.parentNode)}if(r.length>0){for(t=r.length-1,Z=y;t>=0;t--){Z=Z.appendChild(r[t])}r[0].innerHTML=b?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=b?"&nbsp;":"<br />"}}if(f(V)){C=U(V,u)}if(b&&parseFloat(opera.version())<9.5){I.insertNode(E);I.insertNode(V)}else{I.insertNode(V);I.insertNode(E)}V.normalize();E.normalize();function B(r){return T.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,h).nextNode()||r}I=T.createRange();I.selectNodeContents(a?B(C||V):C||V);I.collapse(1);H.removeAllRanges();H.addRange(I);D=x.dom.getPos(V).y;F=V.clientHeight;if(D<N.y||D+F>N.y+N.h){x.getWin().scrollTo(0,D<N.y?D:D-N.h+25)}return h},backspaceDelete:function(v,C){var D=this,u=D.editor,z=u.getBody(),s=u.dom,q,x=u.selection,p=x.getRng(),y=p.startContainer,q,A,B,o;if(!C&&p.collapsed&&y.nodeType==1&&p.startOffset==y.childNodes.length){o=new m.dom.TreeWalker(y.lastChild,y);for(q=y.lastChild;q;q=o.prev()){if(q.nodeType==3){p.setStart(q,q.nodeValue.length);p.collapse(true);x.setRng(p);return}}}if(y&&u.dom.isBlock(y)&&!/^(TD|TH)$/.test(y.nodeName)&&C){if(y.childNodes.length==0||(y.childNodes.length==1&&y.firstChild.nodeName=="BR")){q=y;while((q=q.previousSibling)&&!u.dom.isBlock(q)){}if(q){if(y!=z.firstChild){A=u.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,h);while(B=A.nextNode()){q=B}p=u.getDoc().createRange();p.setStart(q,q.nodeValue?q.nodeValue.length:0);p.setEnd(q,q.nodeValue?q.nodeValue.length:0);x.setRng(p);u.dom.remove(y)}return k.cancel(v)}}}}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){if(p.cmd){i.execCommand(p.cmd,p.ui||false,p.value)}}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},resizeBy:function(f,g,h){h.resizeBy(f,g)},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){function b(){var d={},c={},e={};function f(j,i,h,g){if(typeof(i)=="string"){i=[i]}a.each(i,function(k){j[k.toLowerCase()]={func:h,scope:g}})}a.extend(this,{add:function(i,h,g){f(d,i,h,g)},addQueryStateHandler:function(i,h,g){f(c,i,h,g)},addQueryValueHandler:function(i,h,g){f(e,i,h,g)},execCommand:function(h,k,j,i,g){if(k=d[k.toLowerCase()]){if(k.func.call(h||k.scope,j,i,g)!==false){return true}}},queryCommandValue:function(){if(cmd=e[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=c[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})}a.GlobalCommands=new b()})(tinymce);(function(a){a.Formatter=function(T){var K={},M=a.each,c=T.dom,p=T.selection,s=a.dom.TreeWalker,I=new a.dom.RangeUtils(c),d=T.schema.isValid,E=c.isBlock,k=T.settings.forced_root_block,r=c.nodeIndex,D="\uFEFF",e=/^(src|href|style)$/,Q=false,A=true,o,N={apply:[],remove:[]};function y(U){return U instanceof Array}function l(V,U){return c.getParents(V,U,c.getRoot())}function b(U){return U.nodeType===1&&(U.face==="mceinline"||U.style.fontFamily==="mceinline")}function P(U){return U?K[U]:K}function j(U,V){if(U){if(typeof(U)!=="string"){M(U,function(X,W){j(W,X)})}else{V=V.length?V:[V];M(V,function(W){if(W.deep===o){W.deep=!W.selector}if(W.split===o){W.split=!W.selector||W.inline}if(W.remove===o&&W.selector&&!W.inline){W.remove="none"}if(W.selector&&W.inline){W.mixed=true;W.block_expand=true}if(typeof(W.classes)==="string"){W.classes=W.classes.split(/\s+/)}});K[U]=V}}}function R(W,ac,Y){var Z=P(W),ad=Z[0],ab,V,aa;function X(ag){var af=ag.startContainer,aj=ag.startOffset,ai,ah;if(af.nodeType==1||af.nodeValue===""){af=af.nodeType==1?af.childNodes[aj]:af;if(af){ai=new s(af,af.parentNode);for(ah=ai.current();ah;ah=ai.next()){if(ah.nodeType==3&&!f(ah)){ag.setStart(ah,0);break}}}}return ag}function U(ag,af){af=af||ad;if(ag){M(af.styles,function(ai,ah){c.setStyle(ag,ah,q(ai,ac))});M(af.attributes,function(ai,ah){c.setAttrib(ag,ah,q(ai,ac))});M(af.classes,function(ah){ah=q(ah,ac);if(!c.hasClass(ag,ah)){c.addClass(ag,ah)}})}}function ae(ag){var af=[],ai,ah;ai=ad.inline||ad.block;ah=c.create(ai);U(ah);I.walk(ag,function(aj){var ak;function al(am){var ap=am.nodeName.toLowerCase(),ao=am.parentNode.nodeName.toLowerCase(),an;if(g(ap,"br")){ak=0;if(ad.block){c.remove(am)}return}if(ad.wrapper&&v(am,W,ac)){ak=0;return}if(ad.block&&!ad.wrapper&&F(ap)){am=c.rename(am,ai);U(am);af.push(am);ak=0;return}if(ad.selector){M(Z,function(aq){if(c.is(am,aq.selector)&&!b(am)){U(am,aq);an=true}});if(!ad.inline||an){ak=0;return}}if(d(ai,ap)&&d(ao,ai)){if(!ak){ak=ah.cloneNode(Q);am.parentNode.insertBefore(ak,am);af.push(ak)}ak.appendChild(am)}else{ak=0;M(a.grep(am.childNodes),al);ak=0}}M(aj,al)});M(af,function(al){var aj;function am(ao){var an=0;M(ao.childNodes,function(ap){if(!f(ap)&&!G(ap)){an++}});return an}function ak(an){var ap,ao;M(an.childNodes,function(aq){if(aq.nodeType==1&&!G(aq)&&!b(aq)){ap=aq;return Q}});if(ap&&h(ap,ad)){ao=ap.cloneNode(Q);U(ao);c.replace(ao,an,A);c.remove(ap,1)}return ao||an}aj=am(al);if(aj===0){c.remove(al,1);return}if(ad.inline||ad.wrapper){if(!ad.exact&&aj===1){al=ak(al)}M(Z,function(an){M(c.select(an.inline,al),function(ao){S(an,ac,ao,an.exact?ao:null)})});if(v(al.parentNode,W,ac)){c.remove(al,1);al=0;return A}if(ad.merge_with_parents){c.getParent(al.parentNode,function(an){if(v(an,W,ac)){c.remove(al,1);al=0;return A}})}if(al){al=t(B(al),al);al=t(al,B(al,A))}}})}if(ad){if(Y){V=c.createRng();V.setStartBefore(Y);V.setEndAfter(Y);ae(n(V,Z))}else{if(!p.isCollapsed()||!ad.inline){ab=p.getBookmark();ae(n(p.getRng(A),Z));p.moveToBookmark(ab);p.setRng(X(p.getRng(A)));T.nodeChanged()}else{O("apply",W,ac)}}}}function z(W,ae,Y){var Z=P(W),ag=Z[0],ad,ac,V;function X(al){var ak,aj,ai;ak=a.grep(al.childNodes);for(aj=0,ai=Z.length;aj<ai;aj++){if(S(Z[aj],ae,al,al)){break}}if(ag.deep){for(aj=0,ai=ak.length;aj<ai;aj++){X(ak[aj])}}}function aa(ai){var aj;M(l(ai.parentNode).reverse(),function(ak){var al;if(!aj&&ak.id!="_start"&&ak.id!="_end"){al=v(ak,W,ae);if(al&&al.split!==false){aj=ak}}});return aj}function U(al,ai,an,aq){var ar,ap,ao,ak,am,aj;if(al){aj=al.parentNode;for(ar=ai.parentNode;ar&&ar!=aj;ar=ar.parentNode){ap=ar.cloneNode(Q);for(am=0;am<Z.length;am++){if(S(Z[am],ae,ap,ap)){ap=0;break}}if(ap){if(ao){ap.appendChild(ao)}if(!ak){ak=ap}ao=ap}}if(aq&&(!ag.mixed||!E(al))){ai=c.split(al,ai)}if(ao){an.parentNode.insertBefore(ao,an);ak.appendChild(an)}}return ai}function af(ai){return U(aa(ai),ai,ai,true)}function ab(ak){var aj=c.get(ak?"_start":"_end"),ai=aj[ak?"firstChild":"lastChild"];if(G(ai)){ai=ai[ak?"firstChild":"lastChild"]}c.remove(aj,true);return ai}function ah(ai){var aj,ak;ai=n(ai,Z,A);if(ag.split){aj=H(ai,A);ak=H(ai);if(aj!=ak){aj=L(aj,"span",{id:"_start",_mce_type:"bookmark"});ak=L(ak,"span",{id:"_end",_mce_type:"bookmark"});af(aj);af(ak);aj=ab(A);ak=ab()}else{aj=ak=af(aj)}ai.startContainer=aj.parentNode;ai.startOffset=r(aj);ai.endContainer=ak.parentNode;ai.endOffset=r(ak)+1}I.walk(ai,function(al){M(al,function(am){X(am)})})}if(Y){V=c.createRng();V.setStartBefore(Y);V.setEndAfter(Y);ah(V);return}if(!p.isCollapsed()||!ag.inline){ad=p.getBookmark();ah(p.getRng(A));p.moveToBookmark(ad);T.nodeChanged()}else{O("remove",W,ae)}}function C(U,W,V){if(i(U,W,V)){z(U,W,V)}else{R(U,W,V)}}function v(V,U,aa,Y){var W=P(U),ab,Z,X;function ac(ag,ai,aj){var af,ah,ad=ai[aj],ae;if(ad){if(ad.length===o){for(af in ad){if(ad.hasOwnProperty(af)){if(aj==="attributes"){ah=c.getAttrib(ag,af)}else{ah=J(ag,af)}if(Y&&!ah&&!ai.exact){return}if((!Y||ai.exact)&&!g(ah,q(ad[af],aa))){return}}}}else{for(ae=0;ae<ad.length;ae++){if(aj==="attributes"?c.getAttrib(ag,ad[ae]):J(ag,ad[ae])){return ai}}}}return ai}if(W&&V){for(Z=0;Z<W.length;Z++){ab=W[Z];if(h(V,ab)&&ac(V,ab,"attributes")&&ac(V,ab,"styles")){if(X=ab.classes){for(Z=0;Z<X.length;Z++){if(!c.hasClass(V,X[Z])){return}}}return ab}}}}function i(W,Z,Y){var V,X;function U(aa){aa=c.getParent(aa,function(ab){return !!v(ab,W,Z,true)});return v(aa,W,Z)}if(Y){return U(Y)}if(p.isCollapsed()){for(X=N.apply.length-1;X>=0;X--){if(N.apply[X].name==W){return true}}for(X=N.remove.length-1;X>=0;X--){if(N.remove[X].name==W){return false}}return U(p.getNode())}Y=p.getNode();if(U(Y)){return A}V=p.getStart();if(V!=Y){if(U(V)){return A}}return Q}function u(ab,aa){var Y,Z=[],X={},W,V,U;if(p.isCollapsed()){for(V=0;V<ab.length;V++){for(W=N.remove.length-1;W>=0;W--){U=ab[V];if(N.remove[W].name==U){X[U]=true;break}}}for(W=N.apply.length-1;W>=0;W--){for(V=0;V<ab.length;V++){U=ab[V];if(!X[U]&&N.apply[W].name==U){X[U]=true;Z.push(U)}}}}Y=p.getStart();c.getParent(Y,function(ae){var ad,ac;for(ad=0;ad<ab.length;ad++){ac=ab[ad];if(!X[ac]&&v(ae,ac,aa)){X[ac]=true;Z.push(ac)}}});return Z}function x(Y){var aa=P(Y),X,W,Z,V,U;if(aa){X=p.getStart();W=l(X);for(V=aa.length-1;V>=0;V--){U=aa[V].selector;if(!U){return A}for(Z=W.length-1;Z>=0;Z--){if(c.is(W[Z],U)){return A}}}}return Q}a.extend(this,{get:P,register:j,apply:R,remove:z,toggle:C,match:i,matchAll:u,matchNode:v,canApply:x});function h(U,V){if(g(U,V.inline)){return A}if(g(U,V.block)){return A}if(V.selector){return c.is(U,V.selector)}}function g(V,U){V=V||"";U=U||"";V=""+(V.nodeName||V);U=""+(U.nodeName||U);return V.toLowerCase()==U.toLowerCase()}function J(V,U){var W=c.getStyle(V,U);if(U=="color"||U=="backgroundColor"){W=c.toHex(W)}if(U=="fontWeight"&&W==700){W="bold"}return""+W}function q(U,V){if(typeof(U)!="string"){U=U(V)}else{if(V){U=U.replace(/%(\w+)/g,function(X,W){return V[W]||X})}}return U}function f(U){return U&&U.nodeType===3&&/^([\s\r\n]+|)$/.test(U.nodeValue)}function L(W,V,U){var X=c.create(V,U);W.parentNode.insertBefore(X,W);X.appendChild(W);return X}function n(U,ac,X){var W=U.startContainer,Z=U.startOffset,af=U.endContainer,aa=U.endOffset,ae,ab;function ad(ai,aj,ag,ah){var ak,al;ah=ah||c.getRoot();for(;;){ak=ai.parentNode;if(ak==ah||(!ac[0].block_expand&&E(ak))){return ai}for(ae=ak[aj];ae&&ae!=ai;ae=ae[ag]){if(ae.nodeType==1&&!G(ae)){return ai}if(ae.nodeType==3&&!f(ae)){return ai}}ai=ai.parentNode}return ai}if(W.nodeType==1&&W.hasChildNodes()){ab=W.childNodes.length-1;W=W.childNodes[Z>ab?ab:Z];if(W.nodeType==3){Z=0}}if(af.nodeType==1&&af.hasChildNodes()){ab=af.childNodes.length-1;af=af.childNodes[aa>ab?ab:aa-1];if(af.nodeType==3){aa=af.nodeValue.length}}if(G(W.parentNode)){W=W.parentNode}if(G(W)){W=W.nextSibling||W}if(G(af.parentNode)){af=af.parentNode}if(G(af)){af=af.previousSibling||af}if(ac[0].inline||ac[0].block_expand){W=ad(W,"firstChild","nextSibling");af=ad(af,"lastChild","previousSibling")}if(ac[0].selector&&ac[0].expand!==Q&&!ac[0].inline){function Y(ah,ag){var ai,aj,ak;if(ah.nodeType==3&&ah.nodeValue.length==0&&ah[ag]){ah=ah[ag]}ai=l(ah);for(aj=0;aj<ai.length;aj++){for(ak=0;ak<ac.length;ak++){if(c.is(ai[aj],ac[ak].selector)){return ai[aj]}}}return ah}W=Y(W,"previousSibling");af=Y(af,"nextSibling")}if(ac[0].block||ac[0].selector){function V(ah,ag,aj){var ai;if(!ac[0].wrapper){ai=c.getParent(ah,ac[0].block)}if(!ai){ai=c.getParent(ah.nodeType==3?ah.parentNode:ah,E)}if(ai&&ac[0].wrapper){ai=l(ai,"ul,ol").reverse()[0]||ai}if(!ai){ai=ah;while(ai[ag]&&!E(ai[ag])){ai=ai[ag];if(g(ai,"br")){break}}}return ai||ah}W=V(W,"previousSibling");af=V(af,"nextSibling");if(ac[0].block){if(!E(W)){W=ad(W,"firstChild","nextSibling")}if(!E(af)){af=ad(af,"lastChild","previousSibling")}}}if(W.nodeType==1){Z=r(W);W=W.parentNode}if(af.nodeType==1){aa=r(af)+1;af=af.parentNode}return{startContainer:W,startOffset:Z,endContainer:af,endOffset:aa}}function S(aa,Z,X,U){var W,V,Y;if(!h(X,aa)){return Q}if(aa.remove!="all"){M(aa.styles,function(ac,ab){ac=q(ac,Z);if(typeof(ab)==="number"){ab=ac;U=0}if(!U||g(J(U,ab),ac)){c.setStyle(X,ab,"")}Y=1});if(Y&&c.getAttrib(X,"style")==""){X.removeAttribute("style");X.removeAttribute("_mce_style")}M(aa.attributes,function(ad,ab){var ac;ad=q(ad,Z);if(typeof(ab)==="number"){ab=ad;U=0}if(!U||g(c.getAttrib(U,ab),ad)){if(ab=="class"){ad=c.getAttrib(X,ab);if(ad){ac="";M(ad.split(/\s+/),function(ae){if(/mce\w+/.test(ae)){ac+=(ac?" ":"")+ae}});if(ac){c.setAttrib(X,ab,ac);return}}}if(ab=="class"){X.removeAttribute("className")}if(e.test(ab)){X.removeAttribute("_mce_"+ab)}X.removeAttribute(ab)}});M(aa.classes,function(ab){ab=q(ab,Z);if(!U||c.hasClass(U,ab)){c.removeClass(X,ab)}});V=c.getAttribs(X);for(W=0;W<V.length;W++){if(V[W].nodeName.indexOf("_")!==0){return Q}}}if(aa.remove!="none"){m(X,aa);return A}}function m(W,X){var U=W.parentNode,V;if(X.block){if(!k){function Y(aa,Z,ab){aa=B(aa,Z,ab);return !aa||(aa.nodeName=="BR"||E(aa))}if(E(W)&&!E(U)){if(!Y(W,Q)&&!Y(W.firstChild,A,1)){W.insertBefore(c.create("br"),W.firstChild)}if(!Y(W,A)&&!Y(W.lastChild,Q,1)){W.appendChild(c.create("br"))}}}else{if(U==c.getRoot()){if(!X.list_block||!g(W,X.list_block)){M(a.grep(W.childNodes),function(Z){if(d(k,Z.nodeName.toLowerCase())){if(!V){V=L(Z,k)}else{V.appendChild(Z)}}else{V=0}})}}}}if(X.selector&&X.inline&&!g(X.inline,W)){return}c.remove(W,1)}function B(V,U,W){if(V){U=U?"nextSibling":"previousSibling";for(V=W?V:V[U];V;V=V[U]){if(V.nodeType==1||!f(V)){return V}}}}function G(U){return U&&U.nodeType==1&&U.getAttribute("_mce_type")=="bookmark"}function t(Y,X){var U,W,V;function aa(ad,ac){if(ad.nodeName!=ac.nodeName){return Q}function ab(af){var ag={};M(c.getAttribs(af),function(ah){var ai=ah.nodeName.toLowerCase();if(ai.indexOf("_")!==0&&ai!=="style"){ag[ai]=c.getAttrib(af,ai)}});return ag}function ae(ai,ah){var ag,af;for(af in ai){if(ai.hasOwnProperty(af)){ag=ah[af];if(ag===o){return Q}if(ai[af]!=ag){return Q}delete ah[af]}}for(af in ah){if(ah.hasOwnProperty(af)){return Q}}return A}if(!ae(ab(ad),ab(ac))){return Q}if(!ae(c.parseStyle(c.getAttrib(ad,"style")),c.parseStyle(c.getAttrib(ac,"style")))){return Q}return A}if(Y&&X){function Z(ac,ab){for(W=ac;W;W=W[ab]){if(W.nodeType==3&&!f(W)){return ac}if(W.nodeType==1&&!G(W)){return W}}return ac}Y=Z(Y,"previousSibling");X=Z(X,"nextSibling");if(aa(Y,X)){for(W=Y.nextSibling;W&&W!=X;){V=W;W=W.nextSibling;Y.appendChild(V)}c.remove(X);M(a.grep(X.childNodes),function(ab){Y.appendChild(ab)});return Y}}return X}function F(U){return/^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(U)}function H(V,Y){var U,X,W;U=V[Y?"startContainer":"endContainer"];X=V[Y?"startOffset":"endOffset"];if(U.nodeType==1){W=U.childNodes.length-1;if(!Y&&X){X--}U=U.childNodes[X>W?W:X]}return U}function O(Z,V,Y){var W,U=N[Z],aa=N[Z=="apply"?"remove":"apply"];function ab(){return N.apply.length||N.remove.length}function X(){N.apply=[];N.remove=[]}function ac(ad){M(N.apply.reverse(),function(ae){R(ae.name,ae.vars,ad)});M(N.remove.reverse(),function(ae){z(ae.name,ae.vars,ad)});c.remove(ad,1);X()}for(W=U.length-1;W>=0;W--){if(U[W].name==V){return}}U.push({name:V,vars:Y});for(W=aa.length-1;W>=0;W--){if(aa[W].name==V){aa.splice(W,1)}}if(ab()){T.getDoc().execCommand("FontName",false,"mceinline");N.lastRng=p.getRng();M(c.select("font,span"),function(ae){var ad;if(b(ae)){ad=p.getBookmark();ac(ae);p.moveToBookmark(ad);T.nodeChanged()}});if(!N.isListening&&ab()){N.isListening=true;M("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(ad){T[ad].addToTop(function(ae,af){if(ab()&&!a.dom.RangeUtils.compareRanges(N.lastRng,p.getRng())){M(c.select("font,span"),function(ah){var ai,ag;if(b(ah)){ai=ah.firstChild;if(ai){ac(ah);ag=c.createRng();ag.setStart(ai,ai.nodeValue.length);ag.setEnd(ai,ai.nodeValue.length);p.setRng(ag);ae.nodeChanged()}else{c.remove(ah)}}});if(af.type=="keyup"||af.type=="mouseup"){X()}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){g.replace(g.create("span",{style:i}),j,1)}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}});
\ No newline at end of file
+(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"3",minorVersion:"5b2",releaseDate:"2012-03-15",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m<f.length;m++){if(r=f[m].href){if(/^https?:\/\/[^\/]+$/.test(r)){r+="/"}k=r?r.match(/.*\//)[0]:""}}function h(i){if(i.src&&/tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(i.src)){if(/_(src|dev)\.js/g.test(i.src)){s.suffix="_src"}if((j=i.src.indexOf("?"))!=-1){s.query=i.src.substring(j+1)}s.baseURL=i.src.substring(0,i.src.lastIndexOf("/"));if(k&&s.baseURL.indexOf("://")==-1&&s.baseURL.indexOf("/")!==0){s.baseURL=k+s.baseURL}return s.baseURL}return null}f=q.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}l=q.getElementsByTagName("head")[0];if(l){f=l.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}}return},is:function(g,f){if(!f){return g!==e}if(f=="array"&&(g.hasOwnProperty&&g instanceof Array)){return true}return typeof(g)==f},makeMap:function(f,j,h){var g;f=f||[];j=j||",";if(typeof(f)=="string"){f=f.split(j)}h=h||{};g=f.length;while(g--){h[f[g]]={}}return h},each:function(i,f,h){var j,g;if(!i){return 0}h=h||i;if(i.length!==e){for(j=0,g=i.length;j<g;j++){if(f.call(h,i[j],j,i)===false){return 0}}}else{for(j in i){if(i.hasOwnProperty(j)){if(f.call(h,i[j],j,i)===false){return 0}}}}return 1},map:function(g,h){var i=[];b.each(g,function(f){i.push(h(f))});return i},grep:function(g,h){var i=[];b.each(g,function(f){if(!h||h(f)){i.push(f)}});return i},inArray:function(g,h){var j,f;if(g){for(j=0,f=g.length;j<f;j++){if(g[j]===h){return j}}}return -1},extend:function(k,j){var h,g,f=arguments;for(h=1,g=f.length;h<g;h++){j=f[h];b.each(j,function(i,l){if(i!==e){k[l]=i}})}return k},trim:function(f){return(f?""+f:"").replace(a,"")},create:function(o,f,j){var n=this,g,i,k,l,h,m=0;o=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(o);k=o[3].match(/(^|\.)(\w+)$/i)[2];i=n.createNS(o[3].replace(/\.\w+$/,""),j);if(i[k]){return}if(o[2]=="static"){i[k]=f;if(this.onCreate){this.onCreate(o[2],o[3],i[k])}return}if(!f[k]){f[k]=function(){};m=1}i[k]=f[k];n.extend(i[k].prototype,f);if(o[5]){g=n.resolve(o[5]).prototype;l=o[5].match(/\.(\w+)$/i)[1];h=i[k];if(m){i[k]=function(){return g[l].apply(this,arguments)}}else{i[k]=function(){this.parent=g[l];return h.apply(this,arguments)}}i[k].prototype[k]=i[k];n.each(g,function(p,q){i[k].prototype[q]=g[q]});n.each(f,function(p,q){if(g[q]){i[k].prototype[q]=function(){this.parent=g[q];return p.apply(this,arguments)}}else{if(q!=k){i[k].prototype[q]=p}}})}n.each(f["static"],function(p,q){i[k][q]=p});if(this.onCreate){this.onCreate(o[2],o[3],i[k].prototype)}},walk:function(i,h,j,g){g=g||this;if(i){if(j){i=i[j]}b.each(i,function(k,f){if(h.call(g,k,f,j)===false){return false}b.walk(k,h,j,g)})}},createNS:function(j,h){var g,f;h=h||d;j=j.split(".");for(g=0;g<j.length;g++){f=j[g];if(!h[f]){h[f]={}}h=h[f]}return h},resolve:function(j,h){var g,f;h=h||d;j=j.split(".");for(g=0,f=j.length;g<f;g++){h=h[j[g]];if(!h){break}}return h},addUnload:function(j,i){var h=this;j={func:j,scope:i||this};if(!h.unloads){function g(){var f=h.unloads,l,m;if(f){for(m in f){l=f[m];if(l&&l.func){l.func.call(l.scope,1)}}if(d.detachEvent){d.detachEvent("onbeforeunload",k);d.detachEvent("onunload",g)}else{if(d.removeEventListener){d.removeEventListener("unload",g,false)}}h.unloads=l=f=w=g=0;if(d.CollectGarbage){CollectGarbage()}}}function k(){var l=document;if(l.readyState=="interactive"){function f(){l.detachEvent("onstop",f);if(g){g()}l=0}if(l){l.attachEvent("onstop",f)}d.setTimeout(function(){if(l){l.detachEvent("onstop",f)}},0)}}if(d.attachEvent){d.attachEvent("onunload",g);d.attachEvent("onbeforeunload",k)}else{if(d.addEventListener){d.addEventListener("unload",g,false)}}h.unloads=[j]}else{h.unloads.push(j)}return j},removeUnload:function(i){var g=this.unloads,h=null;b.each(g,function(j,f){if(j&&j.func==i){g.splice(f,1);h=i;return false}});return h},explode:function(f,g){return f?b.map(f.split(g||","),b.trim):f},_addVer:function(g){var f;if(!this.query){return g}f=(g.indexOf("?")==-1?"?":"&")+this.query;if(g.indexOf("#")==-1){return g+f}return g.replace("#",f+"#")},_replace:function(h,f,g){if(c){return g.replace(h,function(){var l=f,j=arguments,k;for(k=0;k<j.length-2;k++){if(j[k]===e){l=l.replace(new RegExp("\\$"+k,"g"),"")}else{l=l.replace(new RegExp("\\$"+k,"g"),j[k])}}return l})}return g.replace(h,f)}};b._init();d.tinymce=d.tinyMCE=b})(window);tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d.length>0?d:[g.scope]);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i<o.length;i++){v+=(i>0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){if(o.hasOwnProperty(i)){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey}}})(tinymce);(function(n){var l=n.VK,m=l.BACKSPACE,j=l.DELETE;function p(r,t,s){try{r.getDoc().execCommand(t,false,s)}catch(q){}}function d(q){var s=q.dom,r=q.selection;q.onKeyDown.add(function(u,z){var t,A,x,y,v;if(z.isDefaultPrevented()){return}v=z.keyCode==j;if((v||z.keyCode==m)&&!l.modifierPressed(z)){z.preventDefault();t=r.getRng();A=s.getParent(t.startContainer,s.isBlock);if(v){A=s.getNext(A,s.isBlock)}if(A){x=A.firstChild;while(x&&x.nodeType==3&&x.nodeValue.length==0){x=x.nextSibling}if(x&&x.nodeName==="SPAN"){y=x.cloneNode(false)}}u.getDoc().execCommand(v?"ForwardDelete":"Delete",false,null);A=s.getParent(t.startContainer,s.isBlock);n.each(s.select("span.Apple-style-span,font.Apple-style-span",A),function(B){var C=r.getBookmark();if(y){s.replace(y.cloneNode(false),B,true)}else{s.remove(B,true)}r.moveToBookmark(C)})}})}function e(q){function r(u){var t=q.dom.create("body");var v=u.cloneContents();t.appendChild(v);return q.selection.serializer.serialize(t,{format:"html"})}function s(t){var v=r(t);var x=q.dom.createRng();x.selectNode(q.getBody());var u=r(x);return v===u}q.onKeyDown.addToTop(function(u,x){var v=x.keyCode;if(v==j||v==m){var t=u.selection.getRng(true);if(!t.collapsed&&s(t)){u.setContent("",{format:"raw"});u.nodeChanged();x.preventDefault()}}})}function c(q){q.dom.bind(q.getDoc(),"focusin",function(){q.selection.setRng(q.selection.getRng())})}function g(q){q.onKeyDown.add(function(r,u){if(u.keyCode===m){if(r.selection.isCollapsed()&&r.selection.getRng(true).startOffset===0){var t=r.selection.getNode();var s=t.previousSibling;if(s&&s.nodeName&&s.nodeName.toLowerCase()==="hr"){r.dom.remove(s);n.dom.Event.cancel(u)}}}})}function i(q){if(!Range.prototype.getClientRects){q.onMouseDown.add(function(s,t){if(t.target.nodeName==="HTML"){var r=s.getBody();r.blur();setTimeout(function(){r.focus()},0)}})}}function h(q){q.onClick.add(function(r,s){s=s.target;if(/^(IMG|HR)$/.test(s.nodeName)){r.selection.getSel().setBaseAndExtent(s,0,s,1)}if(s.nodeName=="A"&&r.dom.hasClass(s,"mceItemAnchor")){r.selection.select(s)}r.nodeChanged()})}function b(q){var s=q.selection,v=q.dom;function t(){var x=v.getAttribs(s.getStart().cloneNode(false));return function(){var y=s.getStart();if(y!==q.getBody()){v.setAttrib(y,"style",null);n.each(x,function(z){y.setAttributeNode(z.cloneNode(true))})}}}function r(){return !s.isCollapsed()&&s.getStart()!=s.getEnd()}function u(x,y){y.preventDefault();return false}q.onKeyPress.add(function(x,z){var y;if((z.keyCode==8||z.keyCode==46)&&r()){y=t();x.getDoc().execCommand("delete",false,null);y();z.preventDefault();return false}});v.bind(q.getDoc(),"cut",function(y){var x;if(r()){x=t();q.onKeyUp.addToTop(u);setTimeout(function(){x();q.onKeyUp.remove(u)},0)}})}function o(q){var s,r;q.dom.bind(q.getDoc(),"selectionchange",function(){if(r){clearTimeout(r);r=0}r=window.setTimeout(function(){var t=q.selection.getRng();if(!s||!n.dom.RangeUtils.compareRanges(t,s)){q.nodeChanged();s=t}},50)})}function a(q){document.body.setAttribute("role","application")}function f(q){q.onKeyDown.add(function(r,t){if(t.keyCode===m){if(r.selection.isCollapsed()&&r.selection.getRng(true).startOffset===0){var s=r.selection.getNode().previousSibling;if(s&&s.nodeName&&s.nodeName.toLowerCase()==="table"){return n.dom.Event.cancel(t)}}}})}function k(r){var q=r.getDoc().documentMode;if(q&&q>7){return}p(r,"RespectVisibilityInDesign",true);r.dom.addClass(r.getBody(),"mceHideBrInPre");r.parser.addNodeFilter("pre",function(s,u){var v=s.length,y,t,z,x;while(v--){y=s[v].getAll("br");t=y.length;while(t--){z=y[t];x=z.prev;if(x&&x.type===3&&x.value.charAt(x.value-1)!="\n"){x.value+="\n"}else{z.parent.insert(new n.html.Node("#text",3),z,true).value="\n"}}}});r.serializer.addNodeFilter("pre",function(s,u){var v=s.length,y,t,z,x;while(v--){y=s[v].getAll("br");t=y.length;while(t--){z=y[t];x=z.prev;if(x&&x.type==3){x.value=x.value.replace(/\r?\n$/,"")}}}})}n.create("tinymce.util.Quirks",{Quirks:function(q){f(q);if(n.isWebKit){d(q);e(q);c(q);h(q);if(n.isIDevice){o(q)}}if(n.isIE){g(q);e(q);a(q);k(q)}if(n.isGecko){g(q);i(q);b(q)}}})})(tinymce);(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;"};d={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n<m.length;n+=2){o=String.fromCharCode(parseInt(m[n],p));if(!g[o]){l="&"+m[n+1]+";";q[o]=l;q[l]=o}}return q}}a=e("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);j.html=j.html||{};j.html.Entities={encodeRaw:function(m,l){return m.replace(l?k:b,function(n){return g[n]||n})},encodeAllRaw:function(l){return(""+l).replace(f,function(m){return g[m]||m})},encodeNumeric:function(m,l){return m.replace(l?k:b,function(n){if(n.length>1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g<j.length;g++){a[j[g]]="\uFEFF"+g;a["\uFEFF"+g]=j[g]}function c(n,q,p,i){function o(r){r=parseInt(r).toString(16);return r.length>1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/\uFEFF[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:\uFEFF]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u<s;u++){t=x[u];v=p[t];if(v!==e&&v.length>0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(f){var a={},e=f.makeMap,g=f.each;function d(j,i){return j.split(i||",")}function h(m,l){var j,k={};function i(n){return n.replace(/[A-Z]+/g,function(o){return i(m[o])})}for(j in m){if(m.hasOwnProperty(j)){m[j]=i(m[j])}}i(l).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(q,o,n,p){n=d(n,"|");k[o]={attributes:e(n),attributesOrder:n,children:e(p,"|",{"#comment":{}})}});return k}function b(){var i=a.html5;if(!i){i=a.html5=h({A:"id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title",B:"#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video",C:"#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video"},"html[A|manifest][body|head]head[A][base|command|link|meta|noscript|script|style|title]title[A][#]base[A|href|target][]link[A|href|rel|media|type|sizes][]meta[A|http-equiv|name|content|charset][]style[A|type|media|scoped][#]script[A|charset|type|src|defer|async][#]noscript[A][C]body[A][C]section[A][C]nav[A][C]article[A][C]aside[A][C]h1[A][B]h2[A][B]h3[A][B]h4[A][B]h5[A][B]h6[A][B]hgroup[A][h1|h2|h3|h4|h5|h6]header[A][C]footer[A][C]address[A][C]p[A][B]br[A][]pre[A][B]dialog[A][dd|dt]blockquote[A|cite][C]ol[A|start|reversed][li]ul[A][li]li[A|value][C]dl[A][dd|dt]dt[A][B]dd[A][C]a[A|href|target|ping|rel|media|type][C]em[A][B]strong[A][B]small[A][B]cite[A][B]q[A|cite][B]dfn[A][B]abbr[A][B]code[A][B]var[A][B]samp[A][B]kbd[A][B]sub[A][B]sup[A][B]i[A][B]b[A][B]mark[A][B]progress[A|value|max][B]meter[A|value|min|max|low|high|optimum][B]time[A|datetime][B]ruby[A][B|rt|rp]rt[A][B]rp[A][B]bdo[A][B]span[A][B]ins[A|cite|datetime][B]del[A|cite|datetime][B]figure[A][C|legend]img[A|alt|src|height|width|usemap|ismap][]iframe[A|name|src|height|width|sandbox|seamless][]embed[A|src|height|width|type][]object[A|data|type|height|width|usemap|name|form|classid][param]param[A|name|value][]details[A|open][C|legend]command[A|type|label|icon|disabled|checked|radiogroup][]menu[A|type|label][C|li]legend[A][C|B]div[A][C]source[A|src|type|media][]audio[A|src|autobuffer|autoplay|loop|controls][source]video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]hr[A][]form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]fieldset[A|disabled|form|name][C|legend]label[A|form|for][B]input[A|type|accept|alt|autocomplete|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value][]button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]datalist[A][B|option]optgroup[A|disabled|label][option]option[A|disabled|selected|label|value][]textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]keygen[A|autofocus|challenge|disabled|form|keytype|name][]output[A|for|form|name][B]canvas[A|width|height][]map[A|name][B|C]area[A|shape|coords|href|alt|target|media|rel|ping|type][]mathml[A][]svg[A][]table[A|summary][caption|colgroup|thead|tfoot|tbody|tr]caption[A][C]colgroup[A|span][col]col[A|span][]thead[A][tr]tfoot[A][tr]tbody[A][tr]tr[A][th|td]th[A|headers|rowspan|colspan|scope][B]td[A|headers|rowspan|colspan][C]")}return i}function c(){var i=a.html4;if(!i){i=a.html4=h({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]")}return i}f.html.Schema=function(A){var u=this,s={},k={},j=[],D,y;var o,q,z,r,v,n,p={};function m(F,E,H){var G=A[F];if(!G){G=a[F];if(!G){G=e(E," ",e(E.toUpperCase()," "));G=f.extend(G,H);a[F]=G}}else{G=e(G,",",e(G.toUpperCase()," "))}return G}A=A||{};y=A.schema=="html5"?b():c();if(A.verify_html===false){A.valid_elements="*[*]"}if(A.valid_styles){D={};g(A.valid_styles,function(F,E){D[E]=f.explode(F)})}o=m("whitespace_elements","pre script style textarea");q=m("self_closing_elements","colgroup dd dt li options p td tfoot th thead tr");z=m("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source");r=m("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls");n=m("non_empty_elements","td th iframe video audio object",z);v=m("block_elements","h1 h2 h3 h4 h5 h6 hr p div address pre form table tbody thead tfoot th tr td li ol ul caption blockquote center dl dt dd dir fieldset noscript menu isindex samp header footer article section hgroup aside nav");function i(E){return new RegExp("^"+E.replace(/([?+*])/g,".$1")+"$")}function C(L){var K,G,Z,V,aa,F,I,U,X,Q,Y,ac,O,J,W,E,S,H,ab,ad,P,T,N=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,R=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,M=/[*?+]/;if(L){L=d(L);if(s["@"]){S=s["@"].attributes;H=s["@"].attributesOrder}for(K=0,G=L.length;K<G;K++){F=N.exec(L[K]);if(F){W=F[1];Q=F[2];E=F[3];X=F[4];O={};J=[];I={attributes:O,attributesOrder:J};if(W==="#"){I.paddEmpty=true}if(W==="-"){I.removeEmpty=true}if(S){for(ad in S){O[ad]=S[ad]}J.push.apply(J,H)}if(X){X=d(X,"|");for(Z=0,V=X.length;Z<V;Z++){F=R.exec(X[Z]);if(F){U={};ac=F[1];Y=F[2].replace(/::/g,":");W=F[3];T=F[4];if(ac==="!"){I.attributesRequired=I.attributesRequired||[];I.attributesRequired.push(Y);U.required=true}if(ac==="-"){delete O[Y];J.splice(f.inArray(J,Y),1);continue}if(W){if(W==="="){I.attributesDefault=I.attributesDefault||[];I.attributesDefault.push({name:Y,value:T});U.defaultValue=T}if(W===":"){I.attributesForced=I.attributesForced||[];I.attributesForced.push({name:Y,value:T});U.forcedValue=T}if(W==="<"){U.validValues=e(T,"?")}}if(M.test(Y)){I.attributePatterns=I.attributePatterns||[];U.pattern=i(Y);I.attributePatterns.push(U)}else{if(!O[Y]){J.push(Y)}O[Y]=U}}}}if(!S&&Q=="@"){S=O;H=J}if(E){I.outputName=Q;s[E]=I}if(M.test(Q)){I.pattern=i(Q);j.push(I)}else{s[Q]=I}}}}}function t(E){s={};j=[];C(E);g(y,function(G,F){k[F]=G.children})}function l(F){var E=/^(~)?(.+)$/;if(F){g(d(F),function(J){var H=E.exec(J),I=H[1]==="~",K=I?"span":"div",G=H[2];k[G]=k[K];p[G]=K;if(!I){v[G]={}}g(k,function(L,M){if(L[K]){L[G]=L[K]}})})}}function x(F){var E=/^([+\-]?)(\w+)\[([^\]]+)\]$/;if(F){g(d(F),function(J){var I=E.exec(J),G,H;if(I){H=I[1];if(H){G=k[I[2]]}else{G=k[I[2]]={"#comment":{}}}G=k[I[2]];g(d(I[3],"|"),function(K){if(H==="-"){delete G[K]}else{G[K]={}}})}})}}function B(E){var G=s[E],F;if(G){return G}F=j.length;while(F--){G=j[F];if(G.pattern.test(E)){return G}}}if(!A.valid_elements){g(y,function(F,E){s[E]={attributes:F.attributes,attributesOrder:F.attributesOrder};k[E]=F.children});if(A.schema!="html5"){g(d("strong/b,em/i"),function(E){E=d(E,"/");s[E[1]].outputName=E[0]})}s.img.attributesDefault=[{name:"alt",value:""}];g(d("ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i"),function(E){if(s[E]){s[E].removeEmpty=true}});g(d("p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption"),function(E){s[E].paddEmpty=true})}else{t(A.valid_elements)}l(A.custom_elements);x(A.valid_children);C(A.extended_valid_elements);x("+ol[ul|ol],+ul[ul|ol]");if(A.invalid_elements){f.each(f.explode(A.invalid_elements),function(E){if(s[E]){delete s[E]}})}if(!B("span")){C("span[!data-mce-type|*]")}u.children=k;u.styles=D;u.getBoolAttrs=function(){return r};u.getBlockElements=function(){return v};u.getShortEndedElements=function(){return z};u.getSelfClosingElements=function(){return q};u.getNonEmptyElements=function(){return n};u.getWhiteSpaceElements=function(){return o};u.isValidChild=function(E,G){var F=k[E];return !!(F&&F[G])};u.getElementRule=B;u.getCustomElements=function(){return p};u.addValidElements=C;u.setValidElements=t;u.addCustomElements=l;u.addValidChildren=x}})(tinymce);(function(a){a.html.SaxParser=function(c,e){var b=this,d=function(){};c=c||{};b.schema=e=e||new a.html.Schema();if(c.fix_self_closing!==false){c.fix_self_closing=true}a.each("comment cdata text start end pi doctype".split(" "),function(f){if(f){b[f]=c[f]||d}});b.parse=function(D){var n=this,g,F=0,H,A,z=[],M,P,B,q,y,r,L,G,N,u,m,k,s,Q,o,O,E,R,K,f,I,l,C,J,h,v=0,j=a.html.Entities.decode,x,p;function t(S){var U,T;U=z.length;while(U--){if(z[U].name===S){break}}if(U>=0){for(T=z.length-1;T>=U;T--){S=z[T];if(S.valid){n.end(S.name)}}z.length=U}}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([A-Za-z0-9-:]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g");C=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;J={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};L=e.getShortEndedElements();I=e.getSelfClosingElements();G=e.getBoolAttrs();u=c.validate;r=c.remove_internals;x=c.fix_self_closing;p=a.isIE;o=/^:/;while(g=l.exec(D)){if(F<g.index){n.text(j(D.substr(F,g.index-F)))}if(H=g[6]){H=H.toLowerCase();if(p&&o.test(H)){H=H.substr(1)}t(H)}else{if(H=g[7]){H=H.toLowerCase();if(p&&o.test(H)){H=H.substr(1)}N=H in L;if(x&&I[H]&&z.length>0&&z[z.length-1].name===H){t(H)}if(!u||(m=e.getElementRule(H))){k=true;if(u){O=m.attributes;E=m.attributePatterns}if(Q=g[8]){y=Q.indexOf("data-mce-type")!==-1;if(y&&r){k=false}M=[];M.map={};Q.replace(C,function(T,S,X,W,V){var Y,U;S=S.toLowerCase();X=S in G?S:j(X||W||V||"");if(u&&!y&&S.indexOf("data-")!==0){Y=O[S];if(!Y&&E){U=E.length;while(U--){Y=E[U];if(Y.pattern.test(S)){break}}if(U===-1){Y=null}}if(!Y){return}if(Y.validValues&&!(X in Y.validValues)){return}}M.map[S]=X;M.push({name:S,value:X})})}else{M=[];M.map={}}if(u&&!y){R=m.attributesRequired;K=m.attributesDefault;f=m.attributesForced;if(f){P=f.length;while(P--){s=f[P];q=s.name;h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}if(K){P=K.length;while(P--){s=K[P];q=s.name;if(!(q in M.map)){h=s.value;if(h==="{$uid}"){h="mce_"+v++}M.map[q]=h;M.push({name:q,value:h})}}}if(R){P=R.length;while(P--){if(R[P] in M.map){break}}if(P===-1){k=false}}if(M.map["data-mce-bogus"]){k=false}}if(k){n.start(H,M,N)}}else{k=false}if(A=J[H]){A.lastIndex=F=g.index+g[0].length;if(g=A.exec(D)){if(k){B=D.substr(F,g.index-F)}F=g.index+g[0].length}else{B=D.substr(F);F=D.length}if(k&&B.length>0){n.text(B,true)}if(k){n.end(H)}l.lastIndex=F;continue}if(!N){if(!Q||Q.indexOf("/")!=Q.length-1){z.push({name:H,valid:k})}else{if(k){n.end(H)}}}}else{if(H=g[1]){n.comment(H)}else{if(H=g[2]){n.cdata(H)}else{if(H=g[3]){n.doctype(H)}else{if(H=g[4]){n.pi(H,g[5])}}}}}}F=g.index+g[0].length}if(F<D.length){n.text(j(D.substr(F)))}for(P=z.length-1;P>=0;P--){H=z[P];if(H.valid){n.end(H.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h<f;h++){j=m[h];if(j.name!=="id"){k[k.length]={name:j.name,value:j.value};k.map[j.name]=j.value}}n.attributes=k}n.value=g.value;n.shortEnded=g.shortEnded;return n},wrap:function(g){var f=this;f.parent.insert(g,f);g.append(f);return f},unwrap:function(){var f=this,h,g;for(h=f.firstChild;h;){g=h.next;f.insert(h,f,true);h=g}f.remove()},remove:function(){var f=this,h=f.parent,g=f.next,i=f.prev;if(h){if(h.firstChild===f){h.firstChild=g;if(g){g.prev=null}}else{i.next=g}if(h.lastChild===f){h.lastChild=i;if(i){i.next=null}}else{g.prev=i}f.parent=f.next=f.prev=null}return f},append:function(h){var f=this,g;if(h.parent){h.remove()}g=f.lastChild;if(g){g.next=h;h.prev=g;f.lastChild=h}else{f.lastChild=f.firstChild=h}h.parent=f;return h},insert:function(h,f,i){var g;if(h.parent){h.remove()}g=f.parent||this;if(i){if(f===g.firstChild){g.firstChild=h}else{f.prev.next=h}h.prev=f.prev;h.next=f;f.prev=h}else{if(f===g.lastChild){g.lastChild=h}else{f.next.prev=h}h.next=f.next;h.prev=f;f.next=h}h.parent=g;return h},getAll:function(g){var f=this,h,i=[];for(h=f.firstChild;h;h=a(h,f)){if(h.name===g){i.push(h)}}return i},empty:function(){var g=this,f,h,j;if(g.firstChild){f=[];for(j=g.firstChild;j;j=a(j,g)){f.push(j)}h=f.length;while(h--){j=f[h];j.parent=j.firstChild=j.lastChild=j.next=j.prev=null}}g.firstChild=g.lastChild=null;return g},isEmpty:function(k){var f=this,j=f.firstChild,h,g;if(j){do{if(j.type===1){if(j.attributes.map["data-mce-bogus"]){continue}if(k[j.name]){return false}h=j.attributes.length;while(h--){g=j.attributes[h].name;if(g==="name"||g.indexOf("data-")===0){return false}}}if(j.type===8){return false}if((j.type===3&&!c.test(j.value))){return false}}while(j=a(j,f))}return true},walk:function(f){return a(this,null,f)}});d.extend(b,{create:function(g,f){var i,h;i=new b(g,e[g]||1);if(f){for(h in f){i.attr(h,f[h])}}return i}});d.html.Node=b})(tinymce);(function(b){var a=b.html.Node;b.html.DomParser=function(g,h){var f=this,e={},d=[],i={},c={};g=g||{};g.validate="validate" in g?g.validate:true;g.root_name=g.root_name||"body";f.schema=h=h||new b.html.Schema();function j(m){var o,p,x,v,z,n,q,l,t,u,k,s,y,r;s=b.makeMap("tr,td,th,tbody,thead,tfoot,table");k=h.getNonEmptyElements();for(o=0;o<m.length;o++){p=m[o];if(!p.parent){continue}v=[p];for(x=p.parent;x&&!h.isValidChild(x.name,p.name)&&!s[x.name];x=x.parent){v.push(x)}if(x&&v.length>1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t<v.length-1;t++){if(h.isValidChild(n.name,v[t].name)){q=f.filterNode(v[t].clone());n.append(q)}else{q=n}for(l=v[t].firstChild;l&&l!=v[t+1];){r=l.next;q.append(l);l=r}n=q}if(!z.isEmpty(k)){x.insert(z,v[0],true);x.insert(p,z)}else{x.insert(p,v[0],true)}x=v[0];if(x.isEmpty(k)||x.firstChild===x.lastChild&&x.firstChild.name==="br"){x.empty().remove()}}else{if(p.parent){if(p.name==="li"){y=p.prev;if(y&&(y.name==="ul"||y.name==="ul")){y.append(p);continue}y=p.next;if(y&&(y.name==="ul"||y.name==="ul")){y.insert(p,y.firstChild,true);continue}p.wrap(f.filterNode(new a("ul",1)));continue}if(h.isValidChild(p.parent.name,"div")&&h.isValidChild("div",p.name)){p.wrap(f.filterNode(new a("div",1)))}else{if(p.name==="style"||p.name==="script"){p.empty().remove()}else{p.unwrap()}}}}}}f.filterNode=function(m){var l,k,n;if(k in e){n=i[k];if(n){n.push(m)}else{i[k]=[m]}}l=d.length;while(l--){k=d[l].name;if(k in m.attributes.map){n=c[k];if(n){n.push(m)}else{c[k]=[m]}}}return m};f.addNodeFilter=function(k,l){b.each(b.explode(k),function(m){var n=e[m];if(!n){e[m]=n=[]}n.push(l)})};f.addAttributeFilter=function(k,l){b.each(b.explode(k),function(m){var n;for(n=0;n<d.length;n++){if(d[n].name===m){d[n].callbacks.push(l);return}}d.push({name:m,callbacks:[l]})})};f.parse=function(v,m){var n,H,A,z,C,B,x,r,E,L,y,o,D,K=[],J,t,k,s,p,u,q;m=m||{};i={};c={};o=b.extend(b.makeMap("script,style,head,html,body,title,meta,param"),h.getBlockElements());u=h.getNonEmptyElements();p=h.children;y=g.validate;q="forced_root_block" in m?m.forced_root_block:g.forced_root_block;s=h.getWhiteSpaceElements();D=/^[ \t\r\n]+/;t=/[ \t\r\n]+$/;k=/[ \t\r\n]+/g;function F(){var M=H.firstChild,l,N;while(M){l=M.next;if(M.type==3||(M.type==1&&M.name!=="p"&&!o[M.name]&&!M.attr("data-mce-type"))){if(!N){N=I(q,1);H.insert(N,M);N.append(M)}else{N.append(M)}}else{N=null}M=l}}function I(l,M){var N=new a(l,M),O;if(l in e){O=i[l];if(O){O.push(N)}else{i[l]=[N]}}return N}function G(N){var O,l,M;for(O=N.prev;O&&O.type===3;){l=O.value.replace(t,"");if(l.length>0){O.value=l;O=O.prev}else{M=O.prev;O.remove();O=M}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(N,l){var M;if(!J){N=N.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){N=N.replace(D,"")}}if(N.length!==0){M=I("#text",3);M.raw=!!l;A.append(M).value=N}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,M){A.append(I(l,7)).value=M;G(A)},doctype:function(M){var l;l=A.append(I("#doctype",10));l.value=M;G(A)},start:function(l,U,N){var S,P,O,M,Q,V,T,R;O=y?h.getElementRule(l):{};if(O){S=I(O.outputName||l,1);S.attributes=U;S.shortEnded=N;A.append(S);R=p[A.name];if(R&&p[S.name]&&!R[S.name]){K.push(S)}P=d.length;while(P--){Q=d[P].name;if(Q in U.map){E=c[Q];if(E){E.push(S)}else{c[Q]=[S]}}}if(o[l]){G(S)}if(!N){A=S}if(!J&&s[l]){J=true}}},end:function(l){var Q,N,P,M,O;N=y?h.getElementRule(l):{};if(N){if(o[l]){if(!J){for(Q=A.firstChild;Q&&Q.type===3;){P=Q.value.replace(D,"");if(P.length>0){Q.value=P;Q=Q.next}else{M=Q.next;Q.remove();Q=M}}for(Q=A.lastChild;Q&&Q.type===3;){P=Q.value.replace(t,"");if(P.length>0){Q.value=P;Q=Q.prev}else{M=Q.prev;Q.remove();Q=M}}}Q=A.prev;if(Q&&Q.type===3){P=Q.value.replace(D,"");if(P.length>0){Q.value=P}else{Q.remove()}}}if(J&&s[l]){J=false}if(N.removeEmpty||N.paddEmpty){if(A.isEmpty(u)){if(N.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){O=A.parent;A.empty().remove();A=O;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&K.length){if(!m.context){j(K)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(L in i){E=e[L];z=i[L];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(C=0,B=E.length;C<B;C++){E[C](z,L,m)}}for(C=0,B=d.length;C<B;C++){E=d[C];if(E.name in c){z=c[E.name];x=z.length;while(x--){if(!z[x].parent){z.splice(x,1)}}for(x=0,r=E.callbacks.length;x<r;x++){E.callbacks[x](z,E.name,m)}}}}return H};if(g.remove_trailing_brs){f.addNodeFilter("br",function(n,m){var r,q=n.length,o,u=h.getBlockElements(),k=h.getNonEmptyElements(),s,p,t;u.body=1;for(r=0;r<q;r++){o=n[r];s=o.parent;if(u[o.parent.name]&&o===s.lastChild){p=o.prev;while(p){t=p.name;if(t!=="span"||p.attr("data-mce-type")!=="bookmark"){if(t!=="br"){break}if(t==="br"){o=null;break}}p=p.prev}if(o){o.remove();if(s.isEmpty(k)){elementRule=h.getElementRule(s.name);if(elementRule){if(elementRule.removeEmpty){s.remove()}else{if(elementRule.paddEmpty){s.empty().append(new b.html.Node("#text",3)).value="\u00a0"}}}}}}}})}}})(tinymce);tinymce.html.Writer=function(e){var c=[],a,b,d,f,g;e=e||{};a=e.indent;b=tinymce.makeMap(e.indent_before||"");d=tinymce.makeMap(e.indent_after||"");f=tinymce.html.Entities.getEncodeFunc(e.entity_encoding||"raw",e.entities);g=e.element_format=="html";return{start:function(m,k,p){var n,j,h,o;if(a&&b[m]&&c.length>0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n<j;n++){h=k[n];c.push(" ",h.name,'="',f(h.value,true),'"')}}if(!p||g){c[c.length]=">"}else{c[c.length]=" />"}if(p&&a&&d[m]&&c.length>0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("</",h,">");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("<![CDATA[",h,"]]>")},comment:function(h){c.push("<!--",h,"-->")},pi:function(h,i){if(i){c.push("<?",h," ",i,"?>")}else{c.push("<?",h,"?>")}if(a){c.push("\n")}},doctype:function(h){c.push("<!DOCTYPE",h,">",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n<m;n++){r=q.attributesOrder[n];if(r in s.map){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}for(n=0,m=s.length;n<m;n++){r=s[n].name;if(!(r in u.map)){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}s=u}e.start(k.name,s,o);if(!o){if((k=k.firstChild)){do{f(k)}while(k=k.next)}e.end(j)}}else{t(k)}}if(h.type==1&&!c.inner){f(h)}else{g[11](h)}return e.getContent()}}})(tinymce);tinymce.dom={};(function(b,h){var g=!!document.addEventListener;function c(k,j,l,i){if(k.addEventListener){k.addEventListener(j,l,i||false)}else{if(k.attachEvent){k.attachEvent("on"+j,l)}}}function e(k,j,l,i){if(k.removeEventListener){k.removeEventListener(j,l,i||false)}else{if(k.detachEvent){k.detachEvent("on"+j,l)}}}function a(n,l){var i,k=l||{};function j(){return false}function m(){return true}for(i in n){if(i!=="layerX"&&i!=="layerY"){k[i]=n[i]}}if(!k.target){k.target=k.srcElement||document}k.preventDefault=function(){k.isDefaultPrevented=m;if(n){if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}}};k.stopPropagation=function(){k.isPropagationStopped=m;if(n){if(n.stopPropagation){n.stopPropagation()}else{n.cancelBubble=true}}};k.stopImmediatePropagation=function(){k.isImmediatePropagationStopped=m;k.stopPropagation()};if(!k.isDefaultPrevented){k.isDefaultPrevented=j;k.isPropagationStopped=j;k.isImmediatePropagationStopped=j}return k}function d(m,n,l){var k=m.document,j={type:"ready"};function i(){if(!l.domLoaded){l.domLoaded=true;n(j)}}if(g){c(m,"DOMContentLoaded",i)}else{c(k,"readystatechange",function(){if(k.readyState==="complete"){e(k,"readystatechange",arguments.callee);i()}});if(k.documentElement.doScroll&&m===m.top){(function(){try{k.documentElement.doScroll("left")}catch(o){setTimeout(arguments.callee,0);return}i()})()}}c(m,"load",i)}function f(k){var q=this,p={},i,o,n,m,l;m="onmouseenter" in document.documentElement;n="onfocusin" in document.documentElement;l={mouseenter:"mouseover",mouseleave:"mouseout"};i=1;q.domLoaded=false;q.events=p;function j(t,x){var s,u,r,v;s=p[x][t.type];if(s){for(u=0,r=s.length;u<r;u++){v=s[u];if(v&&v.func.call(v.scope,t)===false){t.preventDefault()}if(t.isImmediatePropagationStopped()){return}}}}q.bind=function(x,A,D,E){var s,t,u,r,B,z,C,v=window;function y(F){j(a(F||v.event),s)}if(!x||x.nodeType===3||x.nodeType===8){return}if(!x[h]){s=i++;x[h]=s;p[s]={}}else{s=x[h];if(!p[s]){p[s]={}}}E=E||x;A=A.split(" ");u=A.length;while(u--){r=A[u];z=y;B=C=false;if(r==="DOMContentLoaded"){r="ready"}if((q.domLoaded||x.readyState=="complete")&&r==="ready"){q.domLoaded=true;D.call(E,a({type:r}));continue}if(!m){B=l[r];if(B){z=function(F){var H,G;H=F.currentTarget;G=F.relatedTarget;if(G&&H.contains){G=H.contains(G)}else{while(G&&G!==H){G=G.parentNode}}if(!G){F=a(F||v.event);F.type=F.type==="mouseout"?"mouseleave":"mouseenter";F.target=H;j(F,s)}}}}if(!n&&(r==="focusin"||r==="focusout")){C=true;B=r==="focusin"?"focus":"blur";z=function(F){F=a(F||v.event);F.type=F.type==="focus"?"focusin":"focusout";j(F,s)}}t=p[s][r];if(!t){p[s][r]=t=[{func:D,scope:E}];t.fakeName=B;t.capture=C;t.nativeHandler=z;if(!g){t.proxyHandler=k(s)}if(r==="ready"){d(x,z,q)}else{c(x,B||r,g?z:t.proxyHandler,C)}}else{t.push({func:D,scope:E})}}x=t=0;return D};q.unbind=function(x,z,A){var s,u,v,B,r,t;if(!x||x.nodeType===3||x.nodeType===8){return q}s=x[h];if(s){t=p[s];if(z){z=z.split(" ");v=z.length;while(v--){r=z[v];u=t[r];if(u){if(A){B=u.length;while(B--){if(u[B].func===A){u.splice(B,1)}}}if(!A||u.length===0){delete t[r];e(x,u.fakeName||r,g?u.nativeHandler:u.proxyHandler,u.capture)}}}}else{for(r in t){u=t[r];e(x,u.fakeName||r,g?u.nativeHandler:u.proxyHandler,u.capture)}t={}}for(r in t){return q}delete p[s];try{delete x[h]}catch(y){x[h]=null}}return q};q.fire=function(u,s,r){var v,t;if(!u||u.nodeType===3||u.nodeType===8){return q}t=a(null,r);t.type=s;do{v=u[h];if(v){j(t,v)}u=u.parentNode||u.ownerDocument||u.defaultView||u.parentWindow}while(u&&!t.isPropagationStopped());return q};q.clean=function(u){var s,r,t=q.unbind;if(!u||u.nodeType===3||u.nodeType===8){return q}if(u[h]){t(u)}if(!u.getElementsByTagName){u=u.document}if(u&&u.getElementsByTagName){t(u);r=u.getElementsByTagName("*");s=r.length;while(s--){u=r[s];if(u[h]){t(u)}}}return q};q.callNativeHandler=function(s,r){if(p){p[s][r.type].nativeHandler(r)}};q.destory=function(){p={}};q.add=function(v,s,u,t){if(typeof(v)==="string"){v=document.getElementById(v)}if(v&&v instanceof Array){var r=v;while(r--){q.add(v[r],s,u,t)}return}if(s==="init"){s="ready"}return q.bind(v,s instanceof Array?s.join(" "):s,u,t)};q.remove=function(u,s,t){if(typeof(u)==="string"){u=document.getElementById(u)}if(u instanceof Array){var r=u;while(r--){q.remove(u[r],s,t,scope)}return q}return q.unbind(u,s instanceof Array?s.join(" "):s,t)};q.clear=function(r){if(typeof(r)==="string"){r=document.getElementById(r)}return q.clean(r)};q.cancel=function(r){if(r){q.prevent(r);q.stop(r)}return false};q.prevent=function(r){r.preventDefault();return false};q.stop=function(r){r.stopPropagation();return false}}b.EventUtils=f;b.Event=new f(function(i){return function(j){tinymce.dom.Event.callNativeHandler(i,j)}});b.Event.bind(window,"ready",function(){});b=0})(tinymce.dom,"data-mce-expando");(function(e){var g=e.each,d=e.is,f=e.isWebKit,b=e.isIE,h=e.html.Entities,c=/^([a-z0-9],?)+$/i,a=/^[ \t\r\n]*$/;e.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(o,l){var k=this,i,j,n;k.doc=o;k.win=window;k.files={};k.cssFlicker=false;k.counter=0;k.stdMode=!e.isIE||o.documentMode>=8;k.boxModel=!e.isIE||o.compatMode=="CSS1Compat"||k.stdMode;k.hasOuterHTML="outerHTML" in o.createElement("a");k.settings=l=e.extend({keep_values:false,hex_colors:1},l);k.schema=l.schema;k.styles=new e.html.Styles({url_converter:l.url_converter,url_converter_scope:l.url_converter_scope},l.schema);if(e.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(m){k.cssFlicker=true}}k.fixDoc(o);k.events=l.ownEvents?new e.dom.EventUtils(l.proxy):e.dom.Event;e.addUnload(k.destroy,k);n=l.schema?l.schema.getBlockElements():{};k.isBlock=function(q){var p=q.nodeType;if(p){return !!(p===1&&n[q.nodeName])}return !!n[q]}},fixDoc:function(k){var j=this.settings,i;if(b&&j.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(l){k.createElement(l)});for(i in j.schema.getCustomElements()){k.createElement(i)}}},clone:function(k,i){var j=this,m,l;if(!b||k.nodeType!==1||i){return k.cloneNode(i)}l=j.doc;if(!i){m=l.createElement(k.nodeName);g(j.getAttribs(k),function(n){j.setAttrib(m,n.nodeName,j.getAttrib(k,n.nodeName))});return m}return m.firstChild},getRoot:function(){var i=this,j=i.settings;return(j&&i.get(j.root_element))||i.doc.body},getViewPort:function(j){var k,i;j=!j?this.win:j;k=j.document;i=this.boxModel?k.documentElement:k.body;return{x:j.pageXOffset||i.scrollLeft,y:j.pageYOffset||i.scrollTop,w:j.innerWidth||i.clientWidth,h:j.innerHeight||i.clientHeight}},getRect:function(l){var k,i=this,j;l=i.get(l);k=i.getPos(l);j=i.getSize(l);return{x:k.x,y:k.y,w:j.w,h:j.h}},getSize:function(l){var j=this,i,k;l=j.get(l);i=j.getStyle(l,"width");k=j.getStyle(l,"height");if(i.indexOf("px")===-1){i=0}if(k.indexOf("px")===-1){k=0}return{w:parseInt(i)||l.offsetWidth||l.clientWidth,h:parseInt(k)||l.offsetHeight||l.clientHeight}},getParent:function(k,j,i){return this.getParents(k,j,i,false)},getParents:function(s,m,k,q){var j=this,i,l=j.settings,p=[];s=j.get(s);q=q===undefined;if(l.strict_root){k=k||j.getRoot()}if(d(m,"string")){i=m;if(m==="*"){m=function(o){return o.nodeType==1}}else{m=function(o){return j.is(o,i)}}}while(s){if(s==k||!s.nodeType||s.nodeType===9){break}if(!m||m(s)){if(q){p.push(s)}else{return s}}s=s.parentNode}return q?p:null},get:function(i){var j;if(i&&this.doc&&typeof(i)=="string"){j=i;i=this.doc.getElementById(i);if(i&&i.id!==j){return this.doc.getElementsByName(j)[1]}}return i},getNext:function(j,i){return this._findSib(j,i,"nextSibling")},getPrev:function(j,i){return this._findSib(j,i,"previousSibling")},select:function(k,j){var i=this;return e.dom.Sizzle(k,i.get(j)||i.get(i.settings.root_element)||i.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(c.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return e.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(l,o,i,k,m){var j=this;return this.run(l,function(r){var q,n;q=d(o,"string")?j.doc.createElement(o):o;j.setAttribs(q,i);if(k){if(k.nodeType){q.appendChild(k)}else{j.setHTML(q,k)}}return !m?r.appendChild(q):q})},create:function(k,i,j){return this.add(this.doc.createElement(k),k,i,j,1)},createHTML:function(q,i,m){var p="",l=this,j;p+="<"+q;for(j in i){if(i.hasOwnProperty(j)){p+=" "+j+'="'+l.encode(i[j])+'"'}}if(typeof(m)!="undefined"){return p+">"+m+"</"+q+">"}return p+" />"},remove:function(i,j){return this.run(i,function(l){var m,k=l.parentNode;if(!k){return null}if(j){while(m=l.firstChild){if(!e.isIE||m.nodeType!==3||m.nodeValue){k.insertBefore(m,l)}else{l.removeChild(m)}}}return k.removeChild(l)})},setStyle:function(l,i,j){var k=this;return k.run(l,function(o){var n,m;n=o.style;i=i.replace(/-(\D)/g,function(q,p){return p.toUpperCase()});if(k.pixelStyles.test(i)&&(e.is(j,"number")||/^[\-0-9\.]+$/.test(j))){j+="px"}switch(i){case"opacity":if(b){n.filter=j===""?"":"alpha(opacity="+(j*100)+")";if(!l.currentStyle||!l.currentStyle.hasLayout){n.display="inline-block"}}n[i]=n["-moz-opacity"]=n["-khtml-opacity"]=j||"";break;case"float":b?n.styleFloat=j:n.cssFloat=j;break;default:n[i]=j||""}if(k.settings.update_styles){k.setAttrib(o,"data-mce-style")}})},getStyle:function(l,i,k){l=this.get(l);if(!l){return}if(this.doc.defaultView&&k){i=i.replace(/[A-Z]/g,function(m){return"-"+m});try{return this.doc.defaultView.getComputedStyle(l,null).getPropertyValue(i)}catch(j){return null}}i=i.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(i=="float"){i=b?"styleFloat":"cssFloat"}if(l.currentStyle&&k){return l.currentStyle[i]}return l.style?l.style[i]:undefined},setStyles:function(l,m){var j=this,k=j.settings,i;i=k.update_styles;k.update_styles=0;g(m,function(o,p){j.setStyle(l,p,o)});k.update_styles=i;if(k.update_styles){j.setAttrib(l,k.cssText)}},removeAllAttribs:function(i){return this.run(i,function(l){var k,j=l.attributes;for(k=j.length-1;k>=0;k--){l.removeAttributeNode(j.item(k))}})},setAttrib:function(k,l,i){var j=this;if(!k||!l){return}if(j.settings.strict){l=l.toLowerCase()}return this.run(k,function(p){var o=j.settings;var m=p.getAttribute(l);if(i!==null){switch(l){case"style":if(!d(i,"string")){g(i,function(q,r){j.setStyle(p,r,q)});return}if(o.keep_values){if(i&&!j._isRes(i)){p.setAttribute("data-mce-style",i,2)}else{p.removeAttribute("data-mce-style",2)}}p.style.cssText=i;break;case"class":p.className=i||"";break;case"src":case"href":if(o.keep_values){if(o.url_converter){i=o.url_converter.call(o.url_converter_scope||j,i,l,p)}j.setAttrib(p,"data-mce-"+l,i,2)}break;case"shape":p.setAttribute("data-mce-style",i);break}}if(d(i)&&i!==null&&i.length!==0){p.setAttribute(l,""+i,2)}else{p.removeAttribute(l,2)}if(tinyMCE.activeEditor&&m!=i){var n=tinyMCE.activeEditor;n.onSetAttrib.dispatch(n,p,l,i)}})},setAttribs:function(j,k){var i=this;return this.run(j,function(l){g(k,function(m,o){i.setAttrib(l,o,m)})})},getAttrib:function(m,o,k){var i,j=this,l;m=j.get(m);if(!m||m.nodeType!==1){return k===l?false:k}if(!d(k)){k=""}if(/^(src|href|style|coords|shape)$/.test(o)){i=m.getAttribute("data-mce-"+o);if(i){return i}}if(b&&j.props[o]){i=m[j.props[o]];i=i&&i.nodeValue?i.nodeValue:i}if(!i){i=m.getAttribute(o,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(o)){if(m[j.props[o]]===true&&i===""){return o}return i?o:""}if(m.nodeName==="FORM"&&m.getAttributeNode(o)){return m.getAttributeNode(o).nodeValue}if(o==="style"){i=i||m.style.cssText;if(i){i=j.serializeStyle(j.parseStyle(i),m.nodeName);if(j.settings.keep_values&&!j._isRes(i)){m.setAttribute("data-mce-style",i)}}}if(f&&o==="class"&&i){i=i.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(o){case"rowspan":case"colspan":if(i===1){i=""}break;case"size":if(i==="+0"||i===20||i===0){i=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(i===0){i=""}break;case"hspace":if(i===-1){i=""}break;case"maxlength":case"tabindex":if(i===32768||i===2147483647||i==="32768"){i=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(i===65535){return o}return k;case"shape":i=i.toLowerCase();break;default:if(o.indexOf("on")===0&&i){i=e._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+i)}}}return(i!==l&&i!==null&&i!=="")?""+i:k},getPos:function(q,l){var j=this,i=0,p=0,m,o=j.doc,k;q=j.get(q);l=l||o.body;if(q){if(q.getBoundingClientRect){q=q.getBoundingClientRect();m=j.boxModel?o.documentElement:o.body;i=q.left+(o.documentElement.scrollLeft||o.body.scrollLeft)-m.clientTop;p=q.top+(o.documentElement.scrollTop||o.body.scrollTop)-m.clientLeft;return{x:i,y:p}}k=q;while(k&&k!=l&&k.nodeType){i+=k.offsetLeft||0;p+=k.offsetTop||0;k=k.offsetParent}k=q.parentNode;while(k&&k!=l&&k.nodeType){i-=k.scrollLeft||0;p-=k.scrollTop||0;k=k.parentNode}}return{x:i,y:p}},parseStyle:function(i){return this.styles.parse(i)},serializeStyle:function(j,i){return this.styles.serialize(j,i)},loadCSS:function(i){var k=this,l=k.doc,j;if(!i){i=""}j=k.select("head")[0];g(i.split(","),function(m){var n;if(k.files[m]){return}k.files[m]=true;n=k.create("link",{rel:"stylesheet",href:e._addVer(m)});if(b&&l.documentMode&&l.recalc){n.onload=function(){if(l.recalc){l.recalc()}n.onload=null}}j.appendChild(n)})},addClass:function(i,j){return this.run(i,function(k){var l;if(!j){return 0}if(this.hasClass(k,j)){return k.className}l=this.removeClass(k,j);return k.className=(l!=""?(l+" "):"")+j})},removeClass:function(k,l){var i=this,j;return i.run(k,function(n){var m;if(i.hasClass(n,l)){if(!j){j=new RegExp("(^|\\s+)"+l+"(\\s+|$)","g")}m=n.className.replace(j," ");m=e.trim(m!=" "?m:"");n.className=m;if(!m){n.removeAttribute("class");n.removeAttribute("className")}return m}return n.className})},hasClass:function(j,i){j=this.get(j);if(!j||!i){return false}return(" "+j.className+" ").indexOf(" "+i+" ")!==-1},show:function(i){return this.setStyle(i,"display","block")},hide:function(i){return this.setStyle(i,"display","none")},isHidden:function(i){i=this.get(i);return !i||i.style.display=="none"||this.getStyle(i,"display")=="none"},uniqueId:function(i){return(!i?"mce_":i)+(this.counter++)},setHTML:function(k,j){var i=this;return i.run(k,function(m){if(b){while(m.firstChild){m.removeChild(m.firstChild)}try{m.innerHTML="<br />"+j;m.removeChild(m.firstChild)}catch(l){m=i.create("div");m.innerHTML="<br />"+j;g(m.childNodes,function(o,n){if(n){m.appendChild(o)}})}}else{m.innerHTML=j}return j})},getOuterHTML:function(k){var j,i=this;k=i.get(k);if(!k){return null}if(k.nodeType===1&&i.hasOuterHTML){return k.outerHTML}j=(k.ownerDocument||i.doc).createElement("body");j.appendChild(k.cloneNode(true));return j.innerHTML},setOuterHTML:function(l,j,m){var i=this;function k(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){i.insertAfter(s.cloneNode(true),p);s=s.previousSibling}i.remove(p)}return this.run(l,function(o){o=i.get(o);if(o.nodeType==1){m=m||o.ownerDocument||i.doc;if(b){try{if(b&&o.nodeType==1){o.outerHTML=j}else{k(o,j,m)}}catch(n){k(o,j,m)}}else{k(o,j,m)}}})},decode:h.decode,encode:h.encodeAllRaw,insertAfter:function(i,j){j=this.get(j);return this.run(i,function(l){var k,m;k=j.parentNode;m=j.nextSibling;if(m){k.insertBefore(l,m)}else{k.appendChild(l)}return l})},replace:function(m,l,i){var j=this;if(d(l,"array")){m=m.cloneNode(true)}return j.run(l,function(k){if(i){g(e.grep(k.childNodes),function(n){m.appendChild(n)})}return k.parentNode.replaceChild(m,k)})},rename:function(l,i){var k=this,j;if(l.nodeName!=i.toUpperCase()){j=k.create(i);g(k.getAttribs(l),function(m){k.setAttrib(j,m.nodeName,k.getAttrib(l,m.nodeName))});k.replace(j,l,1)}return j||l},findCommonAncestor:function(k,i){var l=k,j;while(l){j=i;while(j&&l!=j){j=j.parentNode}if(l==j){break}l=l.parentNode}if(!l&&k.ownerDocument){return k.ownerDocument.documentElement}return l},toHex:function(i){var k=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(i);function j(l){l=parseInt(l).toString(16);return l.length>1?l:"0"+l}if(k){i="#"+j(k[1])+j(k[2])+j(k[3]);return i}return i},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(i){g(i.imports,function(s){q(s)});g(i.cssRules||i.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){g(s.selectorText.split(","),function(r){r=r.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(r)||!/\.[\w\-]+$/.test(r)){return}l=r;r=e._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",r);if(p&&!(r=p(r,l))){return}if(!o[r]){j.push({"class":r});o[r]=1}})}break;case 3:q(s.styleSheet);break}})}try{g(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(l,k,j){var i=this,m;if(i.doc&&typeof(l)==="string"){l=i.get(l)}if(!l){return false}j=j||this;if(!l.nodeType&&(l.length||l.length===0)){m=[];g(l,function(o,n){if(o){if(typeof(o)=="string"){o=i.doc.getElementById(o)}m.push(k.call(j,o,n))}});return m}return k.call(j,l)},getAttribs:function(j){var i;j=this.get(j);if(!j){return[]}if(b){i=[];if(j.nodeName=="OBJECT"){return j.attributes}if(j.nodeName==="OPTION"&&this.getAttrib(j,"selected")){i.push({specified:1,nodeName:"selected"})}j.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(k){i.push({specified:1,nodeName:k})});return i}return j.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p=0;m=m.firstChild;if(m){j=new e.dom.TreeWalker(m,m.parentNode);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){if(l==="br"){p++;continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!a.test(m.nodeValue))){return false}}while(m=j.next())}return p<=1},destroy:function(j){var i=this;i.win=i.doc=i.root=i.events=i.frag=null;if(!j){e.removeUnload(i.destroy)}},createRng:function(){var i=this.doc;return i.createRange?i.createRange():new e.dom.Range(this)},nodeIndex:function(m,n){var i=0,k,l,j;if(m){for(k=m.nodeType,m=m.previousSibling,l=m;m;m=m.previousSibling){j=m.nodeType;if(n&&j==3){if(j==k||!m.nodeValue.length){continue}}i++;k=j}}return i},split:function(m,l,p){var q=this,i=q.createRng(),n,k,o;function j(v){var t,s=v.childNodes,u=v.nodeType;function x(A){var z=A.previousSibling&&A.previousSibling.nodeName=="SPAN";var y=A.nextSibling&&A.nextSibling.nodeName=="SPAN";return z&&y}if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=s.length-1;t>=0;t--){j(s[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){var r=e.trim(v.nodeValue).length;if(!q.isBlock(v.parentNode)||r>0||r==0&&x(v)){return}}else{if(u==1){s=v.childNodes;if(s.length==1&&s[0]&&s[0].nodeType==1&&s[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(s[0],v)}if(s.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}q.remove(v)}return v}if(m&&l){i.setStart(m.parentNode,q.nodeIndex(m));i.setEnd(l.parentNode,q.nodeIndex(l));n=i.extractContents();i=q.createRng();i.setStart(l.parentNode,q.nodeIndex(l)+1);i.setEnd(m.parentNode,q.nodeIndex(m)+1);k=i.extractContents();o=m.parentNode;o.insertBefore(j(n),m);if(p){o.replaceChild(p,l)}else{o.insertBefore(l,m)}o.insertBefore(j(k),m);q.remove(m);return p||l}},bind:function(l,i,k,j){return this.events.add(l,i,k,j||this)},unbind:function(k,i,j){return this.events.remove(k,i,j)},fire:function(k,j,i){return this.events.fire(k,j,i)},_findSib:function(l,i,j){var k=this,m=i;if(l){if(d(m,"string")){m=function(n){return k.is(n,i)}}for(l=l[j];l;l=l[j]){if(m(l)){return l}}}return null},_isRes:function(i){return/^(top|left|bottom|right|width|height)/i.test(i)||/;\s*(top|left|bottom|right|width|height)/i.test(i)}});e.DOM=new e.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var O=this,e=c.doc,T=0,F=1,j=2,E=true,S=false,V="startOffset",h="startContainer",Q="endContainer",A="endOffset",k=tinymce.extend,n=c.nodeIndex;k(O,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:E,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:J,setEndBefore:K,setEndAfter:u,collapse:B,selectNode:y,selectNodeContents:G,compareBoundaryPoints:v,deleteContents:p,extractContents:I,cloneContents:d,insertNode:D,surroundContents:N,cloneRange:L});function x(){return e.createDocumentFragment()}function q(W,t){C(E,W,t)}function s(W,t){C(S,W,t)}function g(t){q(t.parentNode,n(t))}function J(t){q(t.parentNode,n(t)+1)}function K(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function B(t){if(t){O[Q]=O[h];O[A]=O[V]}else{O[h]=O[Q];O[V]=O[A]}O.collapsed=E}function y(t){g(t);u(t)}function G(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Z,t){var ac=O[h],X=O[V],ab=O[Q],W=O[A],aa=t.startContainer,ae=t.startOffset,Y=t.endContainer,ad=t.endOffset;if(Z===0){return H(ac,X,aa,ae)}if(Z===1){return H(ab,W,aa,ae)}if(Z===2){return H(ab,W,Y,ad)}if(Z===3){return H(ac,X,Y,ad)}}function p(){l(j)}function I(){return l(T)}function d(){return l(F)}function D(Z){var W=this[h],t=this[V],Y,X;if((W.nodeType===3||W.nodeType===4)&&W.nodeValue){if(!t){W.parentNode.insertBefore(Z,W)}else{if(t>=W.nodeValue.length){c.insertAfter(Z,W)}else{Y=W.splitText(t);W.parentNode.insertBefore(Z,Y)}}}else{if(W.childNodes.length>0){X=W.childNodes[t]}if(X){W.insertBefore(Z,X)}else{W.appendChild(Z)}}}function N(W){var t=O.extractContents();O.insertNode(W);W.appendChild(t);O.selectNode(W)}function L(){return k(new b(c),{startContainer:O[h],startOffset:O[V],endContainer:O[Q],endOffset:O[A],collapsed:O.collapsed,commonAncestorContainer:O.commonAncestorContainer})}function P(t,W){var X;if(t.nodeType==3){return t}if(W<0){return t}X=t.firstChild;while(X&&W>0){--W;X=X.nextSibling}if(X){return X}return t}function m(){return(O[h]==O[Q]&&O[V]==O[A])}function H(Y,aa,W,Z){var ab,X,t,ac,ae,ad;if(Y==W){if(aa==Z){return 0}if(aa<Z){return -1}return 1}ab=W;while(ab&&ab.parentNode!=Y){ab=ab.parentNode}if(ab){X=0;t=Y.firstChild;while(t!=ab&&X<aa){X++;t=t.nextSibling}if(aa<=X){return -1}return 1}ab=Y;while(ab&&ab.parentNode!=W){ab=ab.parentNode}if(ab){X=0;t=W.firstChild;while(t!=ab&&X<Z){X++;t=t.nextSibling}if(X<Z){return -1}return 1}ac=c.findCommonAncestor(Y,W);ae=Y;while(ae&&ae.parentNode!=ac){ae=ae.parentNode}if(!ae){ae=ac}ad=W;while(ad&&ad.parentNode!=ac){ad=ad.parentNode}if(!ad){ad=ac}if(ae==ad){return 0}t=ac.firstChild;while(t){if(t==ae){return -1}if(t==ad){return 1}t=t.nextSibling}}function C(W,Z,Y){var t,X;if(W){O[h]=Z;O[V]=Y}else{O[Q]=Z;O[A]=Y}t=O[Q];while(t.parentNode){t=t.parentNode}X=O[h];while(X.parentNode){X=X.parentNode}if(X==t){if(H(O[h],O[V],O[Q],O[A])>0){O.collapse(W)}}else{O.collapse(W)}O.collapsed=m();O.commonAncestorContainer=c.findCommonAncestor(O[h],O[Q])}function l(ac){var ab,Y=0,ae=0,W,aa,X,Z,t,ad;if(O[h]==O[Q]){return f(ac)}for(ab=O[Q],W=ab.parentNode;W;ab=W,W=W.parentNode){if(W==O[h]){return r(ab,ac)}++Y}for(ab=O[h],W=ab.parentNode;W;ab=W,W=W.parentNode){if(W==O[Q]){return U(ab,ac)}++ae}aa=ae-Y;X=O[h];while(aa>0){X=X.parentNode;aa--}Z=O[Q];while(aa<0){Z=Z.parentNode;aa++}for(t=X.parentNode,ad=Z.parentNode;t!=ad;t=t.parentNode,ad=ad.parentNode){X=t;Z=ad}return o(X,Z,ac)}function f(ab){var ad,ae,t,X,Y,ac,Z,W,aa;if(ab!=j){ad=x()}if(O[V]==O[A]){return ad}if(O[h].nodeType==3){ae=O[h].nodeValue;t=ae.substring(O[V],O[A]);if(ab!=F){X=O[h];W=O[V];aa=O[A]-O[V];if(W===0&&aa>=X.nodeValue.length-1){X.parentNode.removeChild(X)}else{X.deleteData(W,aa)}O.collapse(E)}if(ab==j){return}if(t.length>0){ad.appendChild(e.createTextNode(t))}return ad}X=P(O[h],O[V]);Y=O[A]-O[V];while(X&&Y>0){ac=X.nextSibling;Z=z(X,ab);if(ad){ad.appendChild(Z)}--Y;X=ac}if(ab!=F){O.collapse(E)}return ad}function r(ac,Z){var ab,aa,W,t,Y,X;if(Z!=j){ab=x()}aa=i(ac,Z);if(ab){ab.appendChild(aa)}W=n(ac);t=W-O[V];if(t<=0){if(Z!=F){O.setEndBefore(ac);O.collapse(S)}return ab}aa=ac.previousSibling;while(t>0){Y=aa.previousSibling;X=z(aa,Z);if(ab){ab.insertBefore(X,ab.firstChild)}--t;aa=Y}if(Z!=F){O.setEndBefore(ac);O.collapse(S)}return ab}function U(aa,Z){var ac,W,ab,t,Y,X;if(Z!=j){ac=x()}ab=R(aa,Z);if(ac){ac.appendChild(ab)}W=n(aa);++W;t=O[A]-W;ab=aa.nextSibling;while(ab&&t>0){Y=ab.nextSibling;X=z(ab,Z);if(ac){ac.appendChild(X)}--t;ab=Y}if(Z!=F){O.setStartAfter(aa);O.collapse(E)}return ac}function o(aa,t,ad){var X,af,Z,ab,ac,W,ae,Y;if(ad!=j){af=x()}X=R(aa,ad);if(af){af.appendChild(X)}Z=aa.parentNode;ab=n(aa);ac=n(t);++ab;W=ac-ab;ae=aa.nextSibling;while(W>0){Y=ae.nextSibling;X=z(ae,ad);if(af){af.appendChild(X)}ae=Y;--W}X=i(t,ad);if(af){af.appendChild(X)}if(ad!=F){O.setStartAfter(aa);O.collapse(E)}return af}function i(ab,ac){var X=P(O[Q],O[A]-1),ad,aa,Z,t,W,Y=X!=O[Q];if(X==ab){return M(X,Y,S,ac)}ad=X.parentNode;aa=M(ad,S,S,ac);while(ad){while(X){Z=X.previousSibling;t=M(X,Y,S,ac);if(ac!=j){aa.insertBefore(t,aa.firstChild)}Y=E;X=Z}if(ad==ab){return aa}X=ad.previousSibling;ad=ad.parentNode;W=M(ad,S,S,ac);if(ac!=j){W.appendChild(aa)}aa=W}}function R(ab,ac){var Y=P(O[h],O[V]),Z=Y!=O[h],ad,aa,X,t,W;if(Y==ab){return M(Y,Z,E,ac)}ad=Y.parentNode;aa=M(ad,S,E,ac);while(ad){while(Y){X=Y.nextSibling;t=M(Y,Z,E,ac);if(ac!=j){aa.appendChild(t)}Z=E;Y=X}if(ad==ab){return aa}Y=ad.nextSibling;ad=ad.parentNode;W=M(ad,S,E,ac);if(ac!=j){W.appendChild(aa)}aa=W}}function M(t,Z,ac,ad){var Y,X,aa,W,ab;if(Z){return z(t,ad)}if(t.nodeType==3){Y=t.nodeValue;if(ac){W=O[V];X=Y.substring(W);aa=Y.substring(0,W)}else{W=O[A];X=Y.substring(0,W);aa=Y.substring(W)}if(ad!=F){t.nodeValue=aa}if(ad==j){return}ab=c.clone(t,S);ab.nodeValue=X;return ab}if(ad==j){return}return c.clone(t,S)}function z(W,t){if(t!=j){return t==F?c.clone(W,E):W}W.parentNode.removeChild(W)}}a.Range=b})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",1)==0||s!=k.parentElement()){break}o++}}else{k.collapse(true);o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",-1)==0||s!=k.parentElement()){break}o++}}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var u,t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,s,q,r=d.dom.doc,m=r.body;function j(z){var u,y,t,x,v;t=h.create("a");u=z?k:s;y=z?p:q;x=n.duplicate();if(u==r||u==r.documentElement){u=m;y=0}if(u.nodeType==3){u.parentNode.insertBefore(t,u);x.moveToElementText(t);x.moveStart("character",y);h.remove(t);n.setEndPoint(z?"StartToStart":"EndToEnd",x)}else{v=u.childNodes;if(v.length){if(y>=v.length){h.insertAfter(t,v[v.length-1])}else{u.insertBefore(t,v[y])}x.moveToElementText(t)}else{if(u.canHaveHTML){u.innerHTML="<span>\uFEFF</span>";t=u.firstChild;x.moveToElementText(t);x.collapse(f)}}n.setEndPoint(z?"StartToStart":"EndToEnd",x);h.remove(t)}}k=i.startContainer;p=i.startOffset;s=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==s&&k.nodeType==1){if(!k.hasChildNodes()){k.innerHTML="<span>\uFEFF</span><span>\uFEFF</span>";n.moveToElementText(k.lastChild);n.select();h.doc.selection.clear();k.innerHTML="";return}if(p==q-1){try{l=m.createControlRange();l.addElement(k.childNodes[p]);l.select();return}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}return r};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(y,e,z){var x;if(!y){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.leftMatch[v].exec(y))){var r=u[1];u.splice(1,1);if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");x=f.find[v](u,e,z);if(x!=null){y=y.replace(f.match[v],"");break}}}}if(!x){x=e.getElementsByTagName("*")}return{set:x,expr:y}};b.filter=function(C,B,F,u){var s=C,H=[],z=B,x,e,y=B&&B[0]&&b.isXML(B[0]);while(C&&B.length){for(var A in f.filter){if((x=f.leftMatch[A].exec(C))!=null&&x[2]){var r=f.filter[A],G,E,t=x[1];e=false;x.splice(1,1);if(t.substr(t.length-1)==="\\"){continue}if(z===H){H=[]}if(f.preFilter[A]){x=f.preFilter[A](x,z,F,H,u,y);if(!x){e=G=true}else{if(x===true){continue}}}if(x){for(var v=0;(E=z[v])!=null;v++){if(E){G=r(E,x,v,z);var D=u^!!G;if(F&&G!=null){if(D){e=true}else{z[v]=false}}else{if(D){H.push(E);e=true}}}}}if(G!==undefined){if(!F){z=H}C=C.replace(f.match[A],"");if(!e){return[]}break}}}if(C===s){if(e==null){b.error(C)}else{break}}s=C}return z};b.error=function(e){throw"Syntax error, unrecognized expression: "+e};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,r){var t=typeof r==="string",v=t&&!/\W/.test(r),y=t&&!v;if(v){r=r.toLowerCase()}for(var s=0,e=x.length,u;s<e;s++){if((u=x[s])){while((u=u.previousSibling)&&u.nodeType!==1){}x[s]=y||u&&u.nodeName.toLowerCase()===r?u||false:u===r}}if(y){b.filter(r,x,true)}},">":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s<e;s++){v=x[s];if(v){var t=v.parentNode;x[s]=t.nodeName.toLowerCase()===r?t:false}}}else{for(;s<e;s++){v=x[s];if(v){x[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,x,true)}}},"":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,x,y){t=" "+t[1].replace(/\\/g,"")+" ";if(y){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(x^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v<u;v++){if(t[v]===s){return false}}return true}else{b.error("Syntax error, unrecognized expression: "+e)}}}},CHILD:function(e,t){var x=t[1],r=e;switch(x){case"only":case"first":while((r=r.previousSibling)){if(r.nodeType===1){return false}}if(x==="first"){return true}r=e;case"last":while((r=r.nextSibling)){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],A=t[3];if(s===1&&A===0){return true}var v=t[0],z=e.parentNode;if(z&&(z.sizcache!==v||!e.nodeIndex)){var u=0;for(r=z.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}z.sizcache=v}var y=e.nodeIndex-A;if(s===0){return y===0}else{return(y%s===0&&y/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s<e;s++){r.push(u[s])}}else{for(;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){if(!r.compareDocumentPosition||!e.compareDocumentPosition){if(r==e){o=true}return r.compareDocumentPosition?-1:1}var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){o=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){if(!r.sourceIndex||!e.sourceIndex){if(r==e){o=true}return r.sourceIndex?-1:1}var s=r.sourceIndex-e.sourceIndex;if(s===0){o=true}return s}}else{if(document.createRange){c=function(t,r){if(!t.ownerDocument||!r.ownerDocument){if(t==r){o=true}return t.ownerDocument?-1:1}var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){o=true}return u}}}}b.getText=function(e){var r="",t;for(var s=0;e[s];s++){t=e[s];if(t.nodeType===3||t.nodeType===4){r+=t.nodeValue}else{if(t.nodeType!==8){r+=b.getText(t.childNodes)}}}return r};(function(){var r=document.createElement("div"),s="script"+(new Date()).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName.toLowerCase()===x){u=e;break}e=e[r]}A[t]=u}}}function q(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof x!=="string"){if(e===x){u=true;break}}else{if(b.filter(x,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x<r;x++){b(e,s[x],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j<arguments.length;j++){h.push(arguments[j])}h=e[g].apply(e,h);b.update(g);return h}});a.extend(b,{on:function(i,h,g){return a.dom.Event.add(b.id,i,h,g)},getXY:function(){return{x:parseInt(b.getStyle("left")),y:parseInt(b.getStyle("top"))}},getSize:function(){var g=e.get(b.id);return{w:parseInt(b.getStyle("width")||g.clientWidth),h:parseInt(b.getStyle("height")||g.clientHeight)}},moveTo:function(g,h){b.setStyles({left:g,top:h})},moveBy:function(g,i){var h=b.getXY();b.moveTo(h.x+g,h.y+i)},resizeTo:function(g,i){b.setStyles({width:g,height:i})},resizeBy:function(g,j){var i=b.getSize();b.resizeTo(i.w+g,i.h+j)},update:function(h){var g;if(a.isIE6&&d.blocker){h=h||"";if(h.indexOf("get")===0||h.indexOf("has")===0||h.indexOf("is")===0){return}if(h=="remove"){e.remove(b.blocker);return}if(!b.blocker){b.blocker=e.uniqueId();g=e.add(d.container||e.getRoot(),"iframe",{id:b.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});e.setStyle(g,"opacity",0)}else{g=e.get(b.blocker)}e.setStyles(g,{left:b.getStyle("left",1),top:b.getStyle("top",1),width:b.getStyle("width",1),height:b.getStyle("height",1),display:b.getStyle("display",1),zIndex:parseInt(b.getStyle("zIndex",1)||0)-1})}}})}})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}if(c.isIE&&i.boxModel){this._fixIESelection()}c.addUnload(f.destroy,f)},setCursorLocation:function(h,i){var f=this;var g=f.dom.createRng();g.setStart(h,i);g.setEnd(h,i);f.setRng(g);f.collapse(false)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";g.forced_root_block="";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML="<br>"+(h.item?h.item(0).outerHTML:h.htmlText);l.removeChild(l.firstChild)}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(g,i){var n=this,f=n.getRng(),j,k=n.win.document,m,l;i=i||{format:"html"};i.set=true;g=i.content=g;if(!i.no_events){n.onBeforeSetContent.dispatch(n,i)}g=i.content;if(f.insertNode){g+='<span id="__caret">_</span>';if(f.startContainer==k&&f.endContainer==k){k.body.innerHTML=g}else{f.deleteContents();if(k.body.childNodes.length==0){k.body.innerHTML=g}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(g))}else{m=k.createDocumentFragment();l=k.createElement("div");m.appendChild(l);l.outerHTML=g;f.insertNode(m)}}}j=n.dom.get("__caret");f=k.createRange();f.setStartBefore(j);f.setEndBefore(j);n.setRng(f);n.dom.remove("__caret");try{n.setRng(f)}catch(h){}}else{if(f.item){k.execCommand("Delete",false,null);f=n.getRng()}if(/^\s+/.test(g)){f.pasteHTML('<span id="__mce_tmp">_</span>'+g);n.dom.remove("__mce_tmp")}else{f.pasteHTML(g)}}if(!i.no_events){n.onSetContent.dispatch(n,i)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}if(v.tridentSel){return v.tridentSel.getBookmark(r)}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML('<span data-mce-type="bookmark" id="'+i+'_start" style="'+u+'">'+l+"</span>");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML('<span data-mce-type="bookmark" id="'+i+'_end" style="'+u+'">'+l+"</span>")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}if(g.startContainer.nodeType==9){return}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(r.tridentSel){return r.tridentSel.moveToBookmark(n)}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'<br data-mce-bogus="1" />':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.rangeCount>0?h.getRangeAt(0):null}}else{if(i.cloneRange){try{g.tridentSel.addRange(i);return}catch(f){}}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(o,g){var m=this,j=m.dom,l,k,h,i=[];l=j.getParent(o||m.getStart(),j.isBlock);k=j.getParent(g||m.getEnd(),j.isBlock);if(l){i.push(l)}if(l&&k&&l!=k){h=l;var f=new c.dom.TreeWalker(l,j.getRoot());while((h=f.next())&&h!=k){if(j.isBlock(h)){i.push(h)}}}if(k&&l!=k){i.push(k)}return i},normalize:function(){var g=this,f,i;if(c.isIE){return}function h(p){var k,o,n,m=g.dom,j=m.getRoot(),l;k=f[(p?"start":"end")+"Container"];o=f[(p?"start":"end")+"Offset"];if(k.nodeType===9){k=k.body;o=0}if(k===j){if(k.hasChildNodes()){k=k.childNodes[Math.min(!p&&o>0?o-1:o,k.childNodes.length-1)];o=0;if(k.hasChildNodes()){l=k;n=new c.dom.TreeWalker(k,j);do{if(l.nodeType===3){o=p?0:l.nodeValue.length-1;k=l;i=true;break}if(/^(BR|IMG)$/.test(l.nodeName)){o=m.nodeIndex(l);k=l.parentNode;if(l.nodeName=="IMG"&&!p){o++}i=true;break}}while(l=(p?n.next():n.prev()))}}}if(i){f["set"+(p?"Start":"End")](k,o)}}f=g.getRng();h(true);if(!f.collapsed){h()}if(i){g.setRng(f)}},destroy:function(g){var f=this;f.win=null;if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addAttributeFilter("data-mce-expando",function(j,l,k){var m=j.length;while(m--){j[m].attr(l,null)}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// <![CDATA[\n"+j(o)+"\n// ]]>"}}else{if(o.length>0){n.firstChild.value="<!--\n"+j(o)+"\n-->"}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF|\u200B/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&d<h.nodeValue.length){i=f(h,d);h=i.previousSibling;if(g>d){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d<h.nodeValue.length){h=f(h,d);d=0}if(i.nodeType==3&&g>0&&g<i.nodeValue.length){i=f(i,g).previousSibling;g=i.nodeValue.length}}return{startContainer:h,startOffset:d,endContainer:i,endOffset:g}}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return false}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){if(typeof h.settings.style=="function"){h.settings.style=h.settings.style()}c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a role="button" id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" aria-labelledby="'+this.id+'_voice" title="'+a.encode(e.title)+'">';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+='<img class="mceIcon" src="'+e.image+'" alt="'+a.encode(e.title)+'" />'+c}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")}d+='<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="'+this.id+'_voice">'+e.title+"</span>";d+="</a>";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox";g.marked={}},select:function(h){var g=this,j,i;g.marked={};if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var h=this,i,j,g;h.marked={};if(f!=h.selectedIndex){i=c.get(h.id+"_text");g=c.get(h.id+"_voiceDesc");j=h.items[f];if(j){h.selectedValue=j.value;h.selectedIndex=f;c.setHTML(i,c.encode(j.title));c.setHTML(g,h.settings.title+" - "+j.title);c.removeClass(i,"mceTitle");c.setAttrib(h.id,"aria-valuenow",j.title)}else{c.setHTML(i,c.encode(h.settings.title));c.setHTML(g,c.encode(h.settings.title));c.addClass(i,"mceTitle");h.selectedValue=h.selectedIndex=null;c.setAttrib(h.id,"aria-valuenow",h.settings.title)}i=0}},mark:function(f){this.marked[f]=true},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<span role="listbox" aria-haspopup="true" aria-labelledby="'+f.id+'_voiceDesc" aria-describedby="'+f.id+'_voiceDesc"><table role="presentation" tabindex="0" id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("span",{id:f.id+"_voiceDesc","class":"voiceLabel",style:"display:none;"},f.settings.title);i+=c.createHTML("a",{id:f.id+"_text",tabindex:-1,href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},'<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>')+"</td>";i+="</tr></tbody></table></span>";return i},showMenu:function(){var g=this,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;e(g.items,function(j){if(f.items[j.id]){f.items[j.id].setSelected(0)}});e(g.items,function(j){if(f.items[j.id]&&g.marked[j.value]){f.items[j.id].setSelected(1)}if(j.value===g.selectedValue){f.items[j.id].setSelected(1)}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.role="option";h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(d.isWebKit&&(k.keyCode==37||k.keyCode==39)){return b.prevent(k)}if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return false});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('<div id="'+f.id+'" role="group" aria-labelledby="'+f.id+'_voice">');i.push("<span role='application'>");i.push('<span id="'+f.id+'_voice" class="mceVoiceLabel" style="display:none;">'+d.encode(g.name)+"</span>");j(e,function(h){i.push(h.renderHTML())});i.push("</span>");i.push("</div>");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e<l.length;e++){k=l[e];d=l[e-1];g=l[e+1];if(e===0){j="mceToolbarStart";if(k.Button){j+=" mceToolbarStartButton"}else{if(k.SplitButton){j+=" mceToolbarStartSplitButton"}else{if(k.ListBox){j+=" mceToolbarStartListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,"<!-- IE -->"))}}if(c.stdMode){f+='<td style="position: relative">'+k.renderHTML()+"</td>"}else{f+="<td>"+k.renderHTML()+"</td>"}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,"<!-- IE -->"))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},"<tbody><tr>"+f+"</tr></tbody>")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(v){var u=this,o,n=j.ScriptLoader,r,l=[],q;function p(t){var s=t.id;if(!s){s=t.name;if(s&&!k.get(s)){s=t.name}else{s=k.uniqueId()}t.setAttribute("id",s)}return s}function m(y,z,t){var x=y[z];if(!x){return}if(j.is(x,"string")){t=x.replace(/\.\w+$/,"");t=t?j.resolve(t):0;x=j.resolve(x)}return x.apply(t||this,Array.prototype.slice.call(arguments,2))}v=d({theme:"simple",language:"en"},v);u.settings=v;i.bind(window,"ready",function(){var s,x;m(v,"onpageload");switch(v.mode){case"exact":s=v.elements||"";if(s.length>0){g(e(s),function(y){if(k.get(y)){q=new j.Editor(y,v);l.push(q);q.render(1)}else{g(document.forms,function(z){g(z.elements,function(A){if(A.name===y){y="mce_editor_"+c++;k.setAttrib(A,"id",y);q=new j.Editor(y,v);l.push(q);q.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(z,y){return y.constructor===RegExp?y.test(z.className):k.hasClass(z,y)}g(k.select("textarea"),function(y){if(v.editor_deselector&&t(y,v.editor_deselector)){return}if(!v.editor_selector||t(y,v.editor_selector)){q=new j.Editor(p(y),v);l.push(q);q.render(1)}});break;default:if(v.types){g(v.types,function(y){g(k.select(y.selector),function(A){var z=new j.Editor(p(A),j.extend({},v,y));l.push(z);z.render(1)})})}else{if(v.selector){g(k.select(v.selector),function(z){var y=new j.Editor(p(z),v);l.push(y);y.render(1)})}}}if(v.oninit){s=x=0;g(l,function(y){x++;if(!y.initialized){y.onInit.add(function(){s++;if(s==x){m(v,"oninit")}})}else{s++}if(s==x){m(v,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l<o.length;l++){if(o[l]==n){o.splice(l,1);break}}if(m.activeEditor==n){m._setActive(o[0])}n.destroy();m.onRemoveEditor.dispatch(m,n);return n},execCommand:function(r,p,o){var q=this,n=q.get(o),l;switch(r){case"mceFocus":n.focus();return true;case"mceAddEditor":case"mceAddControl":if(!q.get(o)){new j.Editor(o,q.settings).render()}return true;case"mceAddFrameControl":l=o.window;l.tinyMCE=tinyMCE;l.tinymce=j;j.DOM.doc=l.document;j.DOM.win=l;n=new j.Editor(o.element_id,o);n.render();if(j.isIE){function m(){n.destroy();l.detachEvent("onunload",m);l=l.tinyMCE=l.tinymce=null}l.attachEvent("onunload",m)}o.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(n){n.remove()}return true;case"mceToggleEditor":if(!n){q.execCommand("mceAddControl",0,o);return true}if(n.isHidden()){n.show()}else{n.hide()}return true}if(q.activeEditor){return q.activeEditor.execCommand(r,p,o)}return false},execInstanceCommand:function(p,o,n,m){var l=this.get(p);if(l){return l.execCommand(o,n,m)}return false},triggerSave:function(){g(this.editors,function(l){l.save()})},addI18n:function(n,q){var l,m=this.i18n;if(!j.is(n,"string")){g(n,function(r,p){g(r,function(t,s){g(t,function(v,u){if(s==="common"){m[p+"."+u]=v}else{m[p+"."+s+"."+u]=v}})})})}else{g(q,function(r,p){m[n+"."+p]=r})}},_setActive:function(l){this.selectedInstance=this.activeEditor=l}})})(tinymce);(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher,i=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit,d=n.is,h=n.ThemeManager,c=n.PluginManager,p=n.inArray,m=n.grep,g=n.explode,j=n.VK;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.isNotDirty=false;q.plugins={};i(["onPreInit","onBeforeRenderUI","onPostRender","onLoad","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState","onSetAttrib"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:n.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside",validate:true,entity_encoding:"named",url_converter:q.convertURL,url_converter_scope:q,ie7_compat:true},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=n.baseURI;q.contentCSS=[];q.execCallback("setup",q)},render:function(u){var v=this,x=v.settings,y=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(window,"ready",function(){v.render()});return}tinyMCE.settings=x;if(!v.getElement()){return}if(n.isIDevice&&!n.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&x.hidden_input&&o.getParent(y,"form")){o.insertAfter(o.create("input",{type:"hidden",name:y}),y)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(x.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(x.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(x.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(x.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){n.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(x.language&&x.language_load!==false){q.add(n.baseURL+"/langs/"+x.language+".js")}if(x.theme&&x.theme.charAt(0)!="-"&&!h.urls[x.theme]){h.load(x.theme,"themes/"+x.theme+"/editor_template"+n.suffix+".js")}i(g(x.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(A){var z={prefix:"plugins/",resource:A,suffix:"/editor_plugin"+n.suffix+".js"};var A=c.createUrl(z,A);c.load(A.resource,A)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+n.suffix+".js"})}}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,I=this,J=I.settings,F,B,E=I.getElement(),r,q,G,z,D,H,A,x=[];n.add(I);J.aria_label=J.aria_label||o.getAttrib(E,"aria-label",I.getLang("aria.rich_text_area"));if(J.theme){J.theme=J.theme.replace(/-/,"");r=h.get(J.theme);I.theme=new r();if(I.theme.init&&J.init_theme){I.theme.init(I,h.urls[J.theme]||n.documentBaseURL.replace(/\/$/,""))}}function C(K){var L=c.get(K),t=c.urls[K]||n.documentBaseURL.replace(/\/$/,""),s;if(L&&n.inArray(x,K)===-1){i(c.dependencies(K),function(u){C(u)});s=new L(I,t);I.plugins[K]=s;if(s.init){s.init(I,t);x.push(K)}}}i(g(J.plugins.replace(/\-/g,"")),C);if(J.popup_css!==false){if(J.popup_css){J.popup_css=I.documentBaseURI.toAbsolute(J.popup_css)}else{J.popup_css=I.baseURI.toAbsolute("themes/"+J.theme+"/skins/"+J.skin+"/dialog.css")}}if(J.popup_css_add){J.popup_css+=","+I.documentBaseURI.toAbsolute(J.popup_css_add)}I.controlManager=new n.ControlManager(I);if(J.custom_undo_redo){I.onBeforeExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.beforeChange()}});I.onExecCommand.add(function(t,K,u,L,s){if(K!="Undo"&&K!="Redo"&&K!="mceRepaint"&&(!s||!s.skip_undo)){I.undoManager.add()}})}I.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){I.nodeChanged()}});if(a){function y(s,t){if(!t||!t.initial){I.execCommand("mceRepaint")}}I.onUndo.add(y);I.onRedo.add(y);I.onSetContent.add(y)}I.onBeforeRenderUI.dispatch(I,I.controlManager);if(J.render_ui){F=J.width||E.style.width||E.offsetWidth;B=J.height||E.style.height||E.offsetHeight;I.orgDisplay=E.style.display;H=/^[0-9\.]+(|px)$/i;if(H.test(""+F)){F=Math.max(parseInt(F)+(r.deltaWidth||0),100)}if(H.test(""+B)){B=Math.max(parseInt(B)+(r.deltaHeight||0),100)}r=I.theme.renderUI({targetNode:E,width:F,height:B,deltaWidth:J.delta_width,deltaHeight:J.delta_height});I.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:F,height:B});if(J.content_css){n.each(g(J.content_css),function(s){I.contentCSS.push(I.documentBaseURI.toAbsolute(s))})}B=(r.iframeHeight||B)+(typeof(B)=="number"?(r.deltaHeight||0):"");if(B<100){B=100}I.iframeHTML=J.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(J.document_base_url!=n.documentBaseURL){I.iframeHTML+='<base href="'+I.documentBaseURI.getURI()+'" />'}if(J.ie7_compat){I.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" />'}else{I.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=edge" />'}I.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';for(A=0;A<I.contentCSS.length;A++){I.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+I.contentCSS[A]+'" />'}I.contentCSS=[];z=J.body_id||"tinymce";if(z.indexOf("=")!=-1){z=I.getParam("body_id","","hash");z=z[I.id]||z}D=J.body_class||"";if(D.indexOf("=")!=-1){D=I.getParam("body_class","","hash");D=D[I.id]||""}I.iframeHTML+='</head><body id="'+z+'" class="mceContentBody '+D+'" onload="window.parent.tinyMCE.get(\''+I.id+"').onLoad.dispatch();\"><br></body></html>";if(n.relaxedDomain&&(b||(n.isOpera&&parseFloat(opera.version())<11))){G='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+I.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}v=o.add(r.iframeContainer,"iframe",{id:I.id+"_ifr",src:G||'javascript:""',frameBorder:"0",allowTransparency:"true",title:J.aria_label,style:{width:"100%",height:B,display:"block"}});I.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=I.orgDisplay;o.get(I.id).style.display="none";o.setAttrib(I.id,"aria-hidden",true);if(!n.relaxedDomain||!G){I.setupIframe()}E=v=r=null},setupIframe:function(){var r=this,x=r.settings,y=o.get(r.id),z=r.getDoc(),v,q;if(!b||!n.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(n.relaxedDomain){z.domain=n.relaxedDomain}}q=r.getBody();q.disabled=true;if(!x.readonly){q.contentEditable=true}q.disabled=false;r.schema=new n.html.Schema(x);r.dom=new n.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new n.html.DomParser(x,r.schema);if(!r.settings.allow_html_in_named_anchor){r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}})}r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,C,E=r.dom,D,B;while(A--){C=s[A];D=C.attr(t);B="data-mce-"+t;if(!C.attributes.map[B]){if(t==="style"){C.attr(B,E.serializeStyle(E.parseStyle(D),C.name))}else{C.attr(B,r.convertURL(D,t,C.name))}}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length,B;while(A--){B=s[A];B.attr("type","mce-"+(B.attr("type")||"text/javascript"))}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new n.html.Node("br",1)).shortEnded=true}}});r.serializer=new n.dom.Serializer(x,r.dom,r.schema);r.selection=new n.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new n.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"},defaultBlock:"div"},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"},defaultBlock:"div"},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"},defaultBlock:"div"},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"},defaultBlock:"div"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:true,deep:true,onmatch:function(s){return true},onformat:function(A,s,t){i(t,function(C,B){r.dom.setAttrib(A,B,C)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new n.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new n.ForceBlocks(r);r.enterKey=new n.EnterKey(r);r.editorCommands=new n.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);r.quirks=new n.util.Quirks(this);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return"<!--mce:protected "+escape(B)+"-->"})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(x.preformatted){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){k.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u))}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=n.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}y=null},focus:function(v){var z,r=this,u=r.selection,y=r.settings.content_editable,s,q,x=r.getDoc();if(!v){s=u.getRng();if(s.item){q=s.item(0)}r._refreshContentEditable();if(!y){r.getWin().focus()}if(n.isGecko){r.getBody().focus()}if(q&&q.ownerDocument==x){s=x.body.createControlRange();s.addElement(q);s.select()}}if(n.activeEditor!=r){if((z=n.activeEditor)!=null){z.onDeactivate.dispatch(z,r)}r.onActivate.dispatch(r,z)}n._setActive(r)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=n.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return n.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(x,s,q){var t=n.trim,r=d(this.settings[x])?this.settings[x]:s,u;if(q==="hash"){u={};if(d(r,"string")){i(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(y){y=y.split("=");if(y.length>1){u[t(y[0])]=t(y[1])}else{u[t(y[0])]=t(y)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getStart()||q.getBody();if(q.initialized){u=u||{};v=b&&v.ownerDocument!=q.getDoc()?q.getBody():v;u.parents=[];q.dom.getParent(v,function(s){if(s.nodeName=="BODY"){return true}u.parents.push(s)});q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(q,s,r){this.execCommands[q]={func:s,scope:r||this}},addQueryStateHandler:function(q,s,r){this.queryStateCommands[q]={func:s,scope:r||this}},addQueryValueHandler:function(q,s,r){this.queryValueCommands[q]={func:s,scope:r||this}},addShortcut:function(s,v,q,u){var r=this,x;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){x=q;q=function(){r.execCommand(x,false,null)}}if(d(q,"object")){x=q;q=function(){r.execCommand(x[0],x[1],x[2])}}i(g(s),function(t){var y={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(z){switch(z){case"alt":case"ctrl":case"shift":y[z]=true;break;default:y.charCode=z.charCodeAt(0);y.keyCode=z.toUpperCase().charCodeAt(0)}});r.shortcuts[(y.ctrl?"ctrl":"")+","+(y.alt?"alt":"")+","+(y.shift?"shift":"")+","+y.keyCode]=y});return true},execCommand:function(y,x,A,q){var u=this,v=0,z,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(y)&&(!q||!q.skip_focus)){u.focus()}q=f({},q);u.onBeforeExecCommand.dispatch(u,y,x,A,q);if(q.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(z=u.execCommands[y]){r=z.func.call(z.scope,x,A);if(r!==true){u.onExecCommand.dispatch(u,y,x,A,q);return r}}i(u.plugins,function(s){if(s.execCommand&&s.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}if(u.editorCommands.execCommand(y,x,A)){u.onExecCommand.dispatch(u,y,x,A,q);return true}u.getDoc().execCommand(y,x,A);u.onExecCommand.dispatch(u,y,x,A,q)},queryCommandState:function(v){var r=this,x,u;if(r._isHidden()){return}if(x=r.queryStateCommands[v]){u=x.func.call(x.scope);if(u!==true){return u}}x=r.editorCommands.queryCommandState(v);if(x!==-1){return x}try{return this.getDoc().queryCommandState(v)}catch(q){}},queryCommandValue:function(x){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[x]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(x);if(d(v)){return v}try{return this.getDoc().queryCommandValue(x)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=false;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){i(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(v,t){var s=this,r,q=s.getBody(),u;t=t||{};t.format=t.format||"html";t.set=true;t.content=v;if(!t.no_events){s.onBeforeSetContent.dispatch(s,t)}v=t.content;if(!n.isIE&&(v.length===0||/^\s+$/.test(v))){u=s.settings.forced_root_block;if(u){v="<"+u+'><br data-mce-bogus="1"></'+u+">"}else{v='<br data-mce-bogus="1">'}q.innerHTML=v;s.selection.select(q,true);s.selection.collapse(true);return}if(t.format!=="raw"){v=new n.html.Serializer({},s.schema).serialize(s.parser.parse(v))}t.content=n.trim(v);s.dom.setHTML(q,t.content);if(!t.no_events){s.onSetContent.dispatch(s,t)}s.selection.normalize();return t.content},getContent:function(r){var q=this,s;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){q.onBeforeGetContent.dispatch(q,r)}if(r.format=="raw"){s=q.getBody().innerHTML}else{s=q.serializer.serialize(q.getBody(),r)}r.content=n.trim(s);if(!r.no_events){q.onGetContent.dispatch(q,r)}return r.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,y,x){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,x,true,y)}if(!v.convert_urls||(x&&x.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}i(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();if(!q.removed){q.removed=1;q.hide();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement);k.unbind(r);q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];n.remove(q);o.remove(r)}},destroy:function(r){var q=this;if(q.destroyed){return}if(a){k.unbind(q.getDoc());k.unbind(q.getWin());k.unbind(q.getBody())}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy()}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var B=this,u,C=B.settings,r=B.dom,y={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function q(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[y[t.fakeType||t.type]].dispatch(B,t,D)}}i(y,function(t,s){switch(s){case"contextmenu":r.bind(B.getDoc(),s,q);break;case"paste":r.bind(B.getBody(),s,function(D){q(D)});break;case"submit":case"reset":r.bind(B.getElement().form||o.getParent(B.id,"form"),s,q);break;default:r.bind(C.content_editable?B.getBody():B.getDoc(),s,q)}});r.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(n.isGecko){r.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function v(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){E._refreshContentEditable();try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(v);B.onMouseDown.add(v)}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(n.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onKeyDown.add(function(t,D){if(D.keyCode!=j.BACKSPACE){return}var s=t.selection.getRng();if(!s.collapsed){return}var F=s.startContainer;var E=s.startOffset;while(F&&F.nodeType&&F.nodeType!=1&&F.parentNode){F=F.parentNode}if(F&&F.parentNode&&F.parentNode.tagName==="BLOCKQUOTE"&&F.parentNode.firstChild==F&&E==0){t.formatter.toggle("blockquote",null,F.parentNode);s.setStart(F,0);s.setEnd(F,0);t.selection.setRng(s);t.selection.collapse(false)}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(u=1;u<=6;u++){B.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}B.addShortcut("ctrl+7","",["FormatBlock",false,"p"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"div"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"address"]);function x(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(n.isMac&&D.ctrl!=t.metaKey){return}else{if(!n.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=x(t);if(D){return k.cancel(t)}});B.onKeyPress.add(function(s,t){var D=x(t);if(D){return k.cancel(t)}});B.onKeyDown.add(function(s,t){var D=x(t);if(D){D.func.call(D.scope);return k.cancel(t)}})}if(n.isIE){r.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){r.unbind(t.node,t.ev,t.cb)}if(!r.hasClass(D,"mceItemNoResize")){ev="resizeend";s=r.bind(D,ev,function(F){var E;F=F.target;if(E=r.getStyle(F,"width")){r.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));r.setStyle(F,"width","")}if(E=r.getStyle(F,"height")){r.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));r.setStyle(F,"height","")}})}else{ev="resizestart";s=r.bind(D,"resizestart",k.cancel,k)}t=B.resizeInfo={node:D,ev:ev,cb:s}})}if(n.isOpera){B.onClick.add(function(s,t){k.prevent(t)})}if(C.custom_undo_redo){function A(){B.undoManager.typing=false;B.undoManager.add()}var z=n.isGecko?"blur":"focusout";r.bind(B.getDoc(),z,function(s){if(!B.removed&&B.undoManager.typing){A()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){A()});B.onKeyUp.add(function(s,D){var t=D.keyCode;if((t>=33&&t<=36)||(t>=37&&t<=40)||t==13||t==45||D.ctrlKey){A()}});B.onKeyDown.add(function(s,E){var D=E.keyCode,t;if(D==8){t=B.getDoc().selection;if(t&&t.createRange&&t.createRange().item){B.undoManager.beforeChange();s.dom.remove(t.createRange().item(0));A();return k.cancel(E)}}if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45){if(n.isIE&&D==13){B.undoManager.beforeChange()}if(B.undoManager.typing){A()}return}if((D<16||D>20)&&D!=224&&D!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}});B.onMouseDown.add(function(){if(B.undoManager.typing){A()}})}},_refreshContentEditable:function(){var r=this,q,s;if(r._isHidden()){q=r.getBody();s=q.parentNode;s.removeChild(q);s.appendChild(q);q.focus()}},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return b}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return b}function u(v,x){x=x||"exec";d(v,function(z,y){d(y.toLowerCase().split(","),function(A){j[x][A]=z})})}c.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===e){x=b}if(v===e){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:e)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);d("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=c.explode(k.font_size_style_values);v=c.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return b}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new c.html.Serializer({},n.schema);v='<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=n.selection.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.y<L.y)||(C.x>L.x+L.w||C.x<L.x)){H=c.isIE?n.getDoc().documentElement:n.getBody();H.scrollLeft=C.x;H.scrollTop=C.y-L.h+25}x=m.createRng();A=D.previousSibling;if(A&&A.nodeType==3){x.setStart(A,A.nodeValue.length)}else{x.setStartBefore(D);x.setEndBefore(D)}m.remove(D);p.setRng(x);p.onSetContent.dispatch(p,G);n.addVisual()},mceInsertRawHTML:function(y,x,v){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,function(){return v}))},mceSetContent:function(y,x,v){n.setContent(v)},"Indent,Outdent":function(z){var x,v,y;x=k.indentation;v=/[a-z%]+$/i.exec(x);x=parseInt(x);if(!l("InsertUnorderedList")&&!l("InsertOrderedList")){if(!k.forced_root_block&&!m.getParent(p.getNode(),m.isBlock)){q.apply("div")}d(p.getSelectedBlocks(),function(A){if(z=="outdent"){y=Math.max(0,parseInt(A.style.paddingLeft||0)-x);m.setStyle(A,"paddingLeft",y?y+v:"")}else{m.setStyle(A,"paddingLeft",(parseInt(A.style.paddingLeft||0)+x)+v)}})}else{f(z)}},mceRepaint:function(){var x;if(c.isGecko){try{i(a);if(p.getSel()){p.getSel().selectAllChildren(n.getBody())}p.collapse(a);g()}catch(v){}}},mceToggleFormat:function(y,x,v){q.toggle(v)},InsertHorizontalRule:function(){n.execCommand("mceInsertContent",false,"<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();v.setStart(x,0);v.setEnd(x,x.childNodes.length);n.selection.setRng(v)}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[p.getNode()]:p.getSelectedBlocks();var y=c.map(v,function(A){return !!q.matchNode(A,x)});return c.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(v){return m.getParent(p.getNode(),v=="insertunorderedlist"?"UL":"OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");if(k.custom_undo_redo){u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g,""))}return d={typing:false,onAdd:new a(d),onUndo:new a(d),onRedo:new a(d),beforeChange:function(){c=f.selection.getBookmark(2,true)},add:function(m){var j,k=f.settings,l;m=m||{};m.content=g();l=h[e];if(l&&l.content==m.content){return null}if(h[e]){h[e].beforeBookmark=c}if(k.custom_undo_redo_levels){if(h.length>k.custom_undo_redo_levels){for(j=0;j<h.length-1;j++){h[j]=h[j+1]}h.length--;e=h.length}}m.bookmark=f.selection.getBookmark(2,true);if(e<h.length-1){h.length=e+1}h.push(m);e=h.length-1;d.onAdd.dispatch(d,m);f.isNotDirty=0;return m},undo:function(){var k,j;if(d.typing){d.add();d.typing=false}if(e>0){k=h[--e];f.setContent(k.content,{format:"raw"});f.selection.moveToBookmark(k.beforeBookmark);d.onUndo.dispatch(d,k)}return k},redo:function(){var i;if(e<h.length-1){i=h[++e];f.setContent(i.content,{format:"raw"});f.selection.moveToBookmark(i.bookmark);d.onRedo.dispatch(d,i)}return i},clear:function(){h=[];e=0;d.typing=false},hasUndo:function(){return e>0||this.typing},hasRedo:function(){return e<h.length-1&&!this.typing}}}})(tinymce);tinymce.ForceBlocks=function(c){var b=c.settings,e=c.dom,a=c.selection,d=c.schema.getBlockElements();if(b.forced_root_block){function f(){var j=a.getStart(),h=c.getBody(),g,k,o,q,p,i,l,m=-16777215;if(!j||j.nodeType!==1||!b.forced_root_block){return}while(j!=h){if(d[j.nodeName]){return}j=j.parentNode}g=a.getRng();if(g.setStart){k=g.startContainer;o=g.startOffset;q=g.endContainer;p=g.endOffset}else{if(g.item){j=g.item(0);g=c.getDoc().body.createTextRange();g.moveToElementText(j)}tmpRng=g.duplicate();tmpRng.collapse(true);o=tmpRng.move("character",m)*-1;if(!tmpRng.collapsed){tmpRng=g.duplicate();tmpRng.collapse(false);p=(tmpRng.move("character",m)*-1)-o}}for(j=h.firstChild;j;j){if(j.nodeType===3||(j.nodeType==1&&!d[j.nodeName])){if(!i){i=e.create(b.forced_root_block);j.parentNode.insertBefore(i,j)}l=j;j=j.nextSibling;i.appendChild(l)}else{i=null;j=j.nextSibling}}if(g.setStart){g.setStart(k,o);g.setEnd(q,p);a.setRng(g)}else{try{g=c.getDoc().body.createTextRange();g.moveToElementText(h);g.collapse(true);g.moveStart("character",o);if(p>0){g.moveEnd("character",p)}g.select()}catch(n){}}c.nodeChanged()}c.onKeyUp.add(f);c.onClick.add(f)}};(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){if(p.cmd){i.execCommand(p.cmd,p.ui||false,p.value)}}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(f,n,h){var l=this,j=l.editor,i,k,m;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,scope:n.scope,control_manager:l},n);f=l.prefix+f;function g(o){return o.settings.use_accessible_selects&&!c.isGecko}if(j.settings.use_native_selects||g(j)){k=new c.ui.NativeListBox(f,n)}else{m=h||l._cls.listbox||c.ui.ListBox;k=new m(f,n,j)}l.controls[f]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){j.bookmark=j.selection.getBookmark(1)});a.add(o,"focus",function(){j.selection.moveToBookmark(j.bookmark);j.bookmark=null})})}if(k.hideMenu){j.onMouseDown.add(k.hideMenu,k)}return l.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i,g);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i,g)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i,g));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n,j);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h,g.editor);if(g.get(k)){return null}return g.add(i)},createToolbarGroup:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||this._cls.toolbarGroup||c.ui.ToolbarGroup;i=new f(k,h,g.editor);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},resizeBy:function(f,g,h){h.resizeBy(f,g)},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.Formatter=function(W){var N={},Q=a.each,c=W.dom,q=W.selection,t=a.dom.TreeWalker,L=new a.dom.RangeUtils(c),d=W.schema.isValidChild,G=c.isBlock,l=W.settings.forced_root_block,s=c.nodeIndex,F=a.isGecko?"\u200B":"\uFEFF",e=/^(src|href|style)$/,T=false,C=true,p;function x(Y){var X=Y.getAttribute("data-mce-contenteditable");if(X&&X!=="inherit"){return X}return Y.contentEditable!=="inherit"?Y.contentEditable:null}function A(X){return X instanceof Array}function m(Y,X){return c.getParents(Y,X,c.getRoot())}function b(X){return X.nodeType===1&&X.id==="_mce_caret"}function S(X){return X?N[X]:N}function k(X,Y){if(X){if(typeof(X)!=="string"){Q(X,function(aa,Z){k(Z,aa)})}else{Y=Y.length?Y:[Y];Q(Y,function(Z){if(Z.deep===p){Z.deep=!Z.selector}if(Z.split===p){Z.split=!Z.selector||Z.inline}if(Z.remove===p&&Z.selector&&!Z.inline){Z.remove="none"}if(Z.selector&&Z.inline){Z.mixed=true;Z.block_expand=true}if(typeof(Z.classes)==="string"){Z.classes=Z.classes.split(/\s+/)}});N[X]=Y}}}var i=function(Y){var X;W.dom.getParent(Y,function(Z){X=W.dom.getStyle(Z,"text-decoration");return X&&X!=="none"});return X};var J=function(X){var Y;if(X.nodeType===1&&X.parentNode&&X.parentNode.nodeType===1){Y=i(X.parentNode);if(W.dom.getStyle(X,"color")&&Y){W.dom.setStyle(X,"text-decoration",Y)}else{if(W.dom.getStyle(X,"textdecoration")===Y){W.dom.setStyle(X,"text-decoration",null)}}}};function U(aa,ah,ac){var ad=S(aa),ai=ad[0],ag,Y,af,ae=q.isCollapsed();function X(am,al){al=al||ai;if(am){if(al.onformat){al.onformat(am,al,ah,ac)}Q(al.styles,function(ao,an){c.setStyle(am,an,r(ao,ah))});Q(al.attributes,function(ao,an){c.setAttrib(am,an,r(ao,ah))});Q(al.classes,function(an){an=r(an,ah);if(!c.hasClass(am,an)){c.addClass(am,an)}})}}function ab(){function an(au,ar){var at=new t(ar);for(ac=at.current();ac;ac=at.prev()){if(ac.childNodes.length>1||ac==au){return ac}}}var am=W.selection.getRng();var aq=am.startContainer;var al=am.endContainer;if(aq!=al&&am.endOffset==0){var ap=an(aq,al);var ao=ap.nodeType==3?ap.length:ap.childNodes.length;am.setEnd(ap,ao)}return am}function Z(ao,au,ar,aq,am){var al=[],an=-1,at,aw=-1,ap=-1,av;Q(ao.childNodes,function(ay,ax){if(ay.nodeName==="UL"||ay.nodeName==="OL"){an=ax;at=ay;return false}});Q(ao.childNodes,function(ay,ax){if(ay.nodeName==="SPAN"&&c.getAttrib(ay,"data-mce-type")=="bookmark"){if(ay.id==au.id+"_start"){aw=ax}else{if(ay.id==au.id+"_end"){ap=ax}}}});if(an<=0||(aw<an&&ap>an)){Q(a.grep(ao.childNodes),am);return 0}else{av=c.clone(ar,T);Q(a.grep(ao.childNodes),function(ay,ax){if((aw<an&&ax<an)||(aw>an&&ax>an)){al.push(ay);ay.parentNode.removeChild(ay)}});if(aw<an){ao.insertBefore(av,at)}else{if(aw>an){ao.insertBefore(av,at.nextSibling)}}aq.push(av);Q(al,function(ax){av.appendChild(ax)});return av}}function aj(am,ao,ar){var al=[],aq,an,ap=true;aq=ai.inline||ai.block;an=c.create(aq);X(an);L.walk(am,function(at){var au;function av(aw){var aB,az,ax,ay,aA;aA=ap;aB=aw.nodeName.toLowerCase();az=aw.parentNode.nodeName.toLowerCase();if(aw.nodeType===1&&x(aw)){aA=ap;ap=x(aw)==="true";ay=true}if(g(aB,"br")){au=0;if(ai.block){c.remove(aw)}return}if(ai.wrapper&&y(aw,aa,ah)){au=0;return}if(ap&&!ay&&ai.block&&!ai.wrapper&&H(aB)){aw=c.rename(aw,aq);X(aw);al.push(aw);au=0;return}if(ai.selector){Q(ad,function(aC){if("collapsed" in aC&&aC.collapsed!==ae){return}if(c.is(aw,aC.selector)&&!b(aw)){X(aw,aC);ax=true}});if(!ai.inline||ax){au=0;return}}if(ap&&!ay&&d(aq,aB)&&d(az,aq)&&!(!ar&&aw.nodeType===3&&aw.nodeValue.length===1&&aw.nodeValue.charCodeAt(0)===65279)&&!b(aw)){if(!au){au=c.clone(an,T);aw.parentNode.insertBefore(au,aw);al.push(au)}au.appendChild(aw)}else{if(aB=="li"&&ao){au=Z(aw,ao,an,al,av)}else{au=0;Q(a.grep(aw.childNodes),av);if(ay){ap=aA}au=0}}}Q(at,av)});if(ai.wrap_links===false){Q(al,function(at){function au(ay){var ax,aw,av;if(ay.nodeName==="A"){aw=c.clone(an,T);al.push(aw);av=a.grep(ay.childNodes);for(ax=0;ax<av.length;ax++){aw.appendChild(av[ax])}ay.appendChild(aw)}Q(a.grep(ay.childNodes),au)}au(at)})}Q(al,function(av){var at;function aw(ay){var ax=0;Q(ay.childNodes,function(az){if(!f(az)&&!I(az)){ax++}});return ax}function au(ax){var az,ay;Q(ax.childNodes,function(aA){if(aA.nodeType==1&&!I(aA)&&!b(aA)){az=aA;return T}});if(az&&h(az,ai)){ay=c.clone(az,T);X(ay);c.replace(ay,ax,C);c.remove(az,1)}return ay||ax}at=aw(av);if((al.length>1||!G(av))&&at===0){c.remove(av,1);return}if(ai.inline||ai.wrapper){if(!ai.exact&&at===1){av=au(av)}Q(ad,function(ax){Q(c.select(ax.inline,av),function(az){var ay;if(ax.wrap_links===false){ay=az.parentNode;do{if(ay.nodeName==="A"){return}}while(ay=ay.parentNode)}V(ax,ah,az,ax.exact?az:null)})});if(y(av.parentNode,aa,ah)){c.remove(av,1);av=0;return C}if(ai.merge_with_parents){c.getParent(av.parentNode,function(ax){if(y(ax,aa,ah)){c.remove(av,1);av=0;return C}})}if(av&&ai.merge_siblings!==false){av=u(D(av),av);av=u(av,D(av,C))}}})}if(ai){if(ac){if(ac.nodeType){Y=c.createRng();Y.setStartBefore(ac);Y.setEndAfter(ac);aj(o(Y,ad),null,true)}else{aj(ac,null,true)}}else{if(!ae||!ai.inline||c.select("td.mceSelected,th.mceSelected").length){var ak=W.selection.getNode();if(!l&&ad[0].defaultBlock&&!c.getParent(ak,c.isBlock)){U(ad[0].defaultBlock)}W.selection.setRng(ab());ag=q.getBookmark();aj(o(q.getRng(C),ad),ag);if(ai.styles&&(ai.styles.color||ai.styles.textDecoration)){a.walk(ak,J,"childNodes");J(ak)}q.moveToBookmark(ag);O(q.getRng(C));W.nodeChanged()}else{R("apply",aa,ah)}}}}function B(Z,ai,ab){var ac=S(Z),ak=ac[0],ag,af,Y,ah=true;function aa(aq){var ap,ao,an,am,at,ar;if(aq.nodeType===1&&x(aq)){at=ah;ah=x(aq)==="true";ar=true}ap=a.grep(aq.childNodes);if(ah&&!ar){for(ao=0,an=ac.length;ao<an;ao++){if(V(ac[ao],ai,aq,aq)){break}}}if(ak.deep){if(ap.length){for(ao=0,an=ap.length;ao<an;ao++){aa(ap[ao])}if(ar){ah=at}}}}function ad(am){var an;Q(m(am.parentNode).reverse(),function(ao){var ap;if(!an&&ao.id!="_start"&&ao.id!="_end"){ap=y(ao,Z,ai);if(ap&&ap.split!==false){an=ao}}});return an}function X(ap,am,ar,av){var aw,au,at,ao,aq,an;if(ap){an=ap.parentNode;for(aw=am.parentNode;aw&&aw!=an;aw=aw.parentNode){au=c.clone(aw,T);for(aq=0;aq<ac.length;aq++){if(V(ac[aq],ai,au,au)){au=0;break}}if(au){if(at){au.appendChild(at)}if(!ao){ao=au}at=au}}if(av&&(!ak.mixed||!G(ap))){am=c.split(ap,am)}if(at){ar.parentNode.insertBefore(at,ar);ao.appendChild(ar)}}return am}function aj(am){return X(ad(am),am,am,true)}function ae(ao){var an=c.get(ao?"_start":"_end"),am=an[ao?"firstChild":"lastChild"];if(I(am)){am=am[ao?"firstChild":"lastChild"]}c.remove(an,true);return am}function al(am){var an,ao;am=o(am,ac,C);if(ak.split){an=K(am,C);ao=K(am);if(an!=ao){an=P(an,"span",{id:"_start","data-mce-type":"bookmark"});ao=P(ao,"span",{id:"_end","data-mce-type":"bookmark"});aj(an);aj(ao);an=ae(C);ao=ae()}else{an=ao=aj(an)}am.startContainer=an.parentNode;am.startOffset=s(an);am.endContainer=ao.parentNode;am.endOffset=s(ao)+1}L.walk(am,function(ap){Q(ap,function(aq){aa(aq);if(aq.nodeType===1&&W.dom.getStyle(aq,"text-decoration")==="underline"&&aq.parentNode&&i(aq.parentNode)==="underline"){V({deep:false,exact:true,inline:"span",styles:{textDecoration:"underline"}},null,aq)}})})}if(ab){if(ab.nodeType){Y=c.createRng();Y.setStartBefore(ab);Y.setEndAfter(ab);al(Y)}else{al(ab)}return}if(!q.isCollapsed()||!ak.inline||c.select("td.mceSelected,th.mceSelected").length){ag=q.getBookmark();al(q.getRng(C));q.moveToBookmark(ag);if(ak.inline&&j(Z,ai,q.getStart())){O(q.getRng(true))}W.nodeChanged()}else{R("remove",Z,ai)}}function E(Y,aa,Z){var X=S(Y);if(j(Y,aa,Z)&&(!("toggle" in X[0])||X[0]["toggle"])){B(Y,aa,Z)}else{U(Y,aa,Z)}}function y(Y,X,ad,ab){var Z=S(X),ae,ac,aa;function af(aj,al,am){var ai,ak,ag=al[am],ah;if(al.onmatch){return al.onmatch(aj,al,am)}if(ag){if(ag.length===p){for(ai in ag){if(ag.hasOwnProperty(ai)){if(am==="attributes"){ak=c.getAttrib(aj,ai)}else{ak=M(aj,ai)}if(ab&&!ak&&!al.exact){return}if((!ab||al.exact)&&!g(ak,r(ag[ai],ad))){return}}}}else{for(ah=0;ah<ag.length;ah++){if(am==="attributes"?c.getAttrib(aj,ag[ah]):M(aj,ag[ah])){return al}}}}return al}if(Z&&Y){for(ac=0;ac<Z.length;ac++){ae=Z[ac];if(h(Y,ae)&&af(Y,ae,"attributes")&&af(Y,ae,"styles")){if(aa=ae.classes){for(ac=0;ac<aa.length;ac++){if(!c.hasClass(Y,aa[ac])){return}}}return ae}}}}function j(Z,ab,aa){var Y;function X(ac){ac=c.getParent(ac,function(ad){return !!y(ad,Z,ab,true)});return y(ac,Z,ab)}if(aa){return X(aa)}aa=q.getNode();if(X(aa)){return C}Y=q.getStart();if(Y!=aa){if(X(Y)){return C}}return T}function v(ae,ad){var ab,ac=[],aa={},Z,Y,X;ab=q.getStart();c.getParent(ab,function(ah){var ag,af;for(ag=0;ag<ae.length;ag++){af=ae[ag];if(!aa[af]&&y(ah,af,ad)){aa[af]=true;ac.push(af)}}});return ac}function z(ab){var ad=S(ab),aa,Z,ac,Y,X;if(ad){aa=q.getStart();Z=m(aa);for(Y=ad.length-1;Y>=0;Y--){X=ad[Y].selector;if(!X){return C}for(ac=Z.length-1;ac>=0;ac--){if(c.is(Z[ac],X)){return C}}}}return T}a.extend(this,{get:S,register:k,apply:U,remove:B,toggle:E,match:j,matchAll:v,matchNode:y,canApply:z});function h(X,Y){if(g(X,Y.inline)){return C}if(g(X,Y.block)){return C}if(Y.selector){return c.is(X,Y.selector)}}function g(Y,X){Y=Y||"";X=X||"";Y=""+(Y.nodeName||Y);X=""+(X.nodeName||X);return Y.toLowerCase()==X.toLowerCase()}function M(Y,X){var Z=c.getStyle(Y,X);if(X=="color"||X=="backgroundColor"){Z=c.toHex(Z)}if(X=="fontWeight"&&Z==700){Z="bold"}return""+Z}function r(X,Y){if(typeof(X)!="string"){X=X(Y)}else{if(Y){X=X.replace(/%(\w+)/g,function(aa,Z){return Y[Z]||aa})}}return X}function f(X){return X&&X.nodeType===3&&/^([\t \r\n]+|)$/.test(X.nodeValue)}function P(Z,Y,X){var aa=c.create(Y,X);Z.parentNode.insertBefore(aa,Z);aa.appendChild(Z);return aa}function o(X,ai,aa){var al,aj,ad,Z=X.startContainer,ae=X.startOffset,an=X.endContainer,ag=X.endOffset,al,aj,ad,ah;function ak(au){var ao,ar,at,aq,ap;ao=ar=au?Z:an;ap=au?"previousSibling":"nextSibling";root=c.getRoot();if(ao.nodeType==3&&!f(ao)){if(au?ae>0:ag<ao.nodeValue.length){return ao}}for(;;){if(!ai[0].block_expand&&G(ar)){return ar}for(aq=ar[ap];aq;aq=aq[ap]){if(!I(aq)&&!f(aq)){return ar}}if(ar.parentNode==root){ao=ar;break}ar=ar.parentNode}return ao}function ac(ao,ap){if(ap===p){ap=ao.nodeType===3?ao.length:ao.childNodes.length}while(ao&&ao.hasChildNodes()){ao=ao.childNodes[ap];if(ao){ap=ao.nodeType===3?ao.length:ao.childNodes.length}}return{node:ao,offset:ap}}if(Z.nodeType==1&&Z.hasChildNodes()){aj=Z.childNodes.length-1;Z=Z.childNodes[ae>aj?aj:ae];if(Z.nodeType==3){ae=0}}if(an.nodeType==1&&an.hasChildNodes()){aj=an.childNodes.length-1;an=an.childNodes[ag>aj?aj:ag-1];if(an.nodeType==3){ag=an.nodeValue.length}}function am(ap){var ao=ap;while(ao){if(ao.nodeType===1&&x(ao)){return x(ao)==="false"?ao:ap}ao=ao.parentNode}return ap}Z=am(Z);an=am(an);if(I(Z.parentNode)||I(Z)){Z=I(Z)?Z:Z.parentNode;Z=Z.nextSibling||Z;if(Z.nodeType==3){ae=0}}if(I(an.parentNode)||I(an)){an=I(an)?an:an.parentNode;an=an.previousSibling||an;if(an.nodeType==3){ag=an.length}}if(ai[0].inline){if(X.collapsed){function af(ap,au,aw){var at,aq,av,ao;function ar(ay,aA){var aB,ax,az=ay.nodeValue;if(typeof(aA)=="undefined"){aA=aw?az.length:0}if(aw){aB=az.lastIndexOf(" ",aA);ax=az.lastIndexOf("\u00a0",aA);aB=aB>ax?aB:ax;if(aB!==-1&&!aa){aB++}}else{aB=az.indexOf(" ",aA);ax=az.indexOf("\u00a0",aA);aB=aB!==-1&&(ax===-1||aB<ax)?aB:ax}return aB}if(ap.nodeType===3){av=ar(ap,au);if(av!==-1){return{container:ap,offset:av}}ao=ap}at=new t(ap,c.getParent(ap,G)||W.getBody());while(aq=at[aw?"prev":"next"]()){if(aq.nodeType===3){ao=aq;av=ar(aq);if(av!==-1){return{container:aq,offset:av}}}else{if(G(aq)){break}}}if(ao){if(aw){au=0}else{au=ao.length}return{container:ao,offset:au}}}ah=af(Z,ae,true);if(ah){Z=ah.container;ae=ah.offset}ah=af(an,ag);if(ah){an=ah.container;ag=ah.offset}}ad=ac(an,ag);if(ad.node){while(ad.node&&ad.offset===0&&ad.node.previousSibling){ad=ac(ad.node.previousSibling)}if(ad.node&&ad.offset>0&&ad.node.nodeType===3&&ad.node.nodeValue.charAt(ad.offset-1)===" "){if(ad.offset>1){an=ad.node;an.splitText(ad.offset-1)}else{if(ad.node.previousSibling){}}}}}if(ai[0].inline||ai[0].block_expand){if(!ai[0].inline||(Z.nodeType!=3||ae===0)){Z=ak(true)}if(!ai[0].inline||(an.nodeType!=3||ag===an.nodeValue.length)){an=ak()}}if(ai[0].selector&&ai[0].expand!==T&&!ai[0].inline){function ab(ap,ao){var aq,ar,au,at;if(ap.nodeType==3&&ap.nodeValue.length==0&&ap[ao]){ap=ap[ao]}aq=m(ap);for(ar=0;ar<aq.length;ar++){for(au=0;au<ai.length;au++){at=ai[au];if("collapsed" in at&&at.collapsed!==X.collapsed){continue}if(c.is(aq[ar],at.selector)){return aq[ar]}}}return ap}Z=ab(Z,"previousSibling");an=ab(an,"nextSibling")}if(ai[0].block||ai[0].selector){function Y(ap,ao,ar){var aq;if(!ai[0].wrapper){aq=c.getParent(ap,ai[0].block)}if(!aq){aq=c.getParent(ap.nodeType==3?ap.parentNode:ap,G)}if(aq&&ai[0].wrapper){aq=m(aq,"ul,ol").reverse()[0]||aq}if(!aq){aq=ap;while(aq[ao]&&!G(aq[ao])){aq=aq[ao];if(g(aq,"br")){break}}}return aq||ap}Z=Y(Z,"previousSibling");an=Y(an,"nextSibling");if(ai[0].block){if(!G(Z)){Z=ak(true)}if(!G(an)){an=ak()}}}if(Z.nodeType==1){ae=s(Z);Z=Z.parentNode}if(an.nodeType==1){ag=s(an)+1;an=an.parentNode}return{startContainer:Z,startOffset:ae,endContainer:an,endOffset:ag}}function V(ad,ac,aa,X){var Z,Y,ab;if(!h(aa,ad)){return T}if(ad.remove!="all"){Q(ad.styles,function(af,ae){af=r(af,ac);if(typeof(ae)==="number"){ae=af;X=0}if(!X||g(M(X,ae),af)){c.setStyle(aa,ae,"")}ab=1});if(ab&&c.getAttrib(aa,"style")==""){aa.removeAttribute("style");aa.removeAttribute("data-mce-style")}Q(ad.attributes,function(ag,ae){var af;ag=r(ag,ac);if(typeof(ae)==="number"){ae=ag;X=0}if(!X||g(c.getAttrib(X,ae),ag)){if(ae=="class"){ag=c.getAttrib(aa,ae);if(ag){af="";Q(ag.split(/\s+/),function(ah){if(/mce\w+/.test(ah)){af+=(af?" ":"")+ah}});if(af){c.setAttrib(aa,ae,af);return}}}if(ae=="class"){aa.removeAttribute("className")}if(e.test(ae)){aa.removeAttribute("data-mce-"+ae)}aa.removeAttribute(ae)}});Q(ad.classes,function(ae){ae=r(ae,ac);if(!X||c.hasClass(X,ae)){c.removeClass(aa,ae)}});Y=c.getAttribs(aa);for(Z=0;Z<Y.length;Z++){if(Y[Z].nodeName.indexOf("_")!==0){return T}}}if(ad.remove!="none"){n(aa,ad);return C}}function n(Z,aa){var X=Z.parentNode,Y;if(aa.block){if(!l){function ab(ad,ac,ae){ad=D(ad,ac,ae);return !ad||(ad.nodeName=="BR"||G(ad))}if(G(Z)&&!G(X)){if(!ab(Z,T)&&!ab(Z.firstChild,C,1)){Z.insertBefore(c.create("br"),Z.firstChild)}if(!ab(Z,C)&&!ab(Z.lastChild,T,1)){Z.appendChild(c.create("br"))}}}else{if(X==c.getRoot()){if(!aa.list_block||!g(Z,aa.list_block)){Q(a.grep(Z.childNodes),function(ac){if(d(l,ac.nodeName.toLowerCase())){if(!Y){Y=P(ac,l)}else{Y.appendChild(ac)}}else{Y=0}})}}}}if(aa.selector&&aa.inline&&!g(aa.inline,Z)){return}c.remove(Z,1)}function D(Y,X,Z){if(Y){X=X?"nextSibling":"previousSibling";for(Y=Z?Y:Y[X];Y;Y=Y[X]){if(Y.nodeType==1||!f(Y)){return Y}}}}function I(X){return X&&X.nodeType==1&&X.getAttribute("data-mce-type")=="bookmark"}function u(ab,aa){var X,Z,Y;function ad(ag,af){if(ag.nodeName!=af.nodeName){return T}function ae(ai){var aj={};Q(c.getAttribs(ai),function(ak){var al=ak.nodeName.toLowerCase();if(al.indexOf("_")!==0&&al!=="style"){aj[al]=c.getAttrib(ai,al)}});return aj}function ah(al,ak){var aj,ai;for(ai in al){if(al.hasOwnProperty(ai)){aj=ak[ai];if(aj===p){return T}if(al[ai]!=aj){return T}delete ak[ai]}}for(ai in ak){if(ak.hasOwnProperty(ai)){return T}}return C}if(!ah(ae(ag),ae(af))){return T}if(!ah(c.parseStyle(c.getAttrib(ag,"style")),c.parseStyle(c.getAttrib(af,"style")))){return T}return C}if(ab&&aa){function ac(af,ae){for(Z=af;Z;Z=Z[ae]){if(Z.nodeType==3&&Z.nodeValue.length!==0){return af}if(Z.nodeType==1&&!I(Z)){return Z}}return af}ab=ac(ab,"previousSibling");aa=ac(aa,"nextSibling");if(ad(ab,aa)){for(Z=ab.nextSibling;Z&&Z!=aa;){Y=Z;Z=Z.nextSibling;ab.appendChild(Y)}c.remove(aa);Q(a.grep(aa.childNodes),function(ae){ab.appendChild(ae)});return ab}}return aa}function H(X){return/^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(X)}function K(Y,ac){var X,ab,Z,aa;X=Y[ac?"startContainer":"endContainer"];ab=Y[ac?"startOffset":"endOffset"];if(X.nodeType==1){Z=X.childNodes.length-1;if(!ac&&ab){ab--}X=X.childNodes[ab>Z?Z:ab]}if(X.nodeType===3&&ac&&ab>=X.nodeValue.length){X=new t(X,W.getBody()).next()||X}if(X.nodeType===3&&!ac&&ab==0){X=new t(X,W.getBody()).prev()||X}return X}function R(ag,X,ae){var ah="_mce_caret",Y=W.settings.caret_debug;function Z(ak){var aj=c.create("span",{id:ah,"data-mce-bogus":true,style:Y?"color:red":""});if(ak){aj.appendChild(W.getDoc().createTextNode(F))}return aj}function af(ak,aj){while(ak){if((ak.nodeType===3&&ak.nodeValue!==F)||ak.childNodes.length>1){return false}if(aj&&ak.nodeType===1){aj.push(ak)}ak=ak.firstChild}return true}function ac(aj){while(aj){if(aj.id===ah){return aj}aj=aj.parentNode}}function ab(aj){var ak;if(aj){ak=new t(aj,aj);for(aj=ak.current();aj;aj=ak.next()){if(aj.nodeType===3){return aj}}}}function aa(al,ak){var am,aj;if(!al){al=ac(q.getStart());if(!al){while(al=c.get(ah)){aa(al,false)}}}else{aj=q.getRng(true);if(af(al)){if(ak!==false){aj.setStartBefore(al);aj.setEndBefore(al)}c.remove(al)}else{am=ab(al);if(am.nodeValue.charAt(0)===F){am=am.deleteData(0,1)}c.remove(al,1)}q.setRng(aj)}}function ad(){var al,aj,ap,ao,am,ak,an;al=q.getRng(true);ao=al.startOffset;ak=al.startContainer;an=ak.nodeValue;aj=ac(q.getStart());if(aj){ap=ab(aj)}if(an&&ao>0&&ao<an.length&&/\w/.test(an.charAt(ao))&&/\w/.test(an.charAt(ao-1))){am=q.getBookmark();al.collapse(true);al=o(al,S(X));al=L.split(al);U(X,ae,al);q.moveToBookmark(am)}else{if(!aj||ap.nodeValue!==F){aj=Z(true);ap=aj.firstChild;al.insertNode(aj);ao=1;U(X,ae,aj)}else{U(X,ae,aj)}q.setCursorLocation(ap,ao)}}function ai(){var aj=q.getRng(true),ak,am,ap,ao,al,at,ar=[],an,aq;ak=aj.startContainer;am=aj.startOffset;al=ak;if(ak.nodeType==3){if(am!=ak.nodeValue.length||ak.nodeValue===F){ao=true}al=al.parentNode}while(al){if(y(al,X,ae)){at=al;break}if(al.nextSibling){ao=true}ar.push(al);al=al.parentNode}if(!at){return}if(ao){ap=q.getBookmark();aj.collapse(true);aj=o(aj,S(X),true);aj=L.split(aj);B(X,ae,aj);q.moveToBookmark(ap)}else{aq=Z();al=aq;for(an=ar.length-1;an>=0;an--){al.appendChild(c.clone(ar[an],false));al=al.firstChild}al.appendChild(c.doc.createTextNode(F));al=al.firstChild;c.insertAfter(aq,at);q.setCursorLocation(al,1)}}if(!self._hasCaretEvents){W.onBeforeGetContent.addToTop(function(){var aj=[],ak;if(af(ac(q.getStart()),aj)){ak=aj.length;while(ak--){c.setAttrib(aj[ak],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(aj){W[aj].addToTop(function(){aa()})});W.onKeyDown.addToTop(function(aj,al){var ak=al.keyCode;if(ak==8||ak==37||ak==39){aa(ac(q.getStart()))}});self._hasCaretEvents=true}if(ag=="apply"){ad()}else{ai()}}function O(Y){var X=Y.startContainer,ad=Y.startOffset,ac,ab,Z,aa;if(X.nodeType==3&&ad>=X.nodeValue.length){X=X.parentNode;ad=s(X)+1}if(X.nodeType==1){Z=X.childNodes;X=Z[Math.min(ad,Z.length-1)];ac=new t(X,c.getParent(X,c.isBlock));if(ad>Z.length-1){ac.next()}for(ab=ac.current();ab;ab=ac.next()){if(ab.nodeType==3&&!f(ab)){aa=c.create("a",null,F);ab.parentNode.insertBefore(aa,ab);Y.setStart(ab,0);q.setRng(Y);c.remove(aa);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_legacy_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}});(function(b){var a=b.dom.TreeWalker;b.EnterKey=function(e){var h=e.dom,d=e.selection,c=e.settings,g=e.undoManager;function f(x){var t=d.getRng(true),A,v,s,n,m,i,k,r,C,u;function z(E){return E&&h.isBlock(E)&&!/^(TD|TH|CAPTION)$/.test(E.nodeName)&&!/^(fixed|absolute)/i.test(E.style.position)}function l(F){var J,H,E,K,I,G=F;E=h.createRng();if(F.hasChildNodes()){J=new a(F,F);while(H=J.current()){if(H.nodeType==3){E.setStart(H,0);E.setEnd(H,0);break}if(/^(BR|IMG)$/.test(H.nodeName)){E.setStartBefore(H);E.setEndBefore(H);break}G=H;H=J.next()}if(!H){E.setStart(G,0);E.setEnd(G,0)}}else{if(F.nodeName=="BR"){E.setStartAfter(F);E.setEndAfter(F)}else{E.setStart(F,0);E.setEnd(F,0)}}d.setRng(E);I=h.getViewPort(e.getWin());K=h.getPos(F).y;if(K<I.y||K+25>I.y+I.h){e.getWin().scrollTo(0,K<I.y?K:K-I.h+25)}}function p(F){var G=v,I,H,E;I=F?h.create(F):n.cloneNode(false);E=I;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(G.nodeName)){H=G.cloneNode(false);h.setAttrib(H,"id","");if(I.hasChildNodes()){H.appendChild(I.firstChild);I.appendChild(H)}else{E=H;I.appendChild(H)}}}while(G=G.parentNode);if(!b.isIE){E.innerHTML="<br>"}return I}function o(G){var F,E;if(v.nodeType==3&&(G?s>0:s<v.nodeValue.length)){return false}F=new a(v,n);while(E=(G?F.prev():F.next())){if(E.nodeType===1){if(E.getAttribute("data-mce-bogus")){continue}name=E.nodeName.toLowerCase();if(name==="IMG"){return false}}else{if(E.nodeType===3&&!/^[ \t\r\n]*$/.test(E.nodeValue)){return false}}}return true}function j(E,J){var K,I,F,H,G;I=h.getParent(E,h.isBlock);if(u&&!x.shiftKey&&(!I||!z(I))){I=I||h.getRoot();if(!I.hasChildNodes()){K=h.create(u);I.appendChild(K);t.setStart(K,0);t.setEnd(K,0);return K}H=E;while(H.parentNode!=I){H=H.parentNode}while(H&&!h.isBlock(H)){F=H;H=H.previousSibling}if(F){K=h.create(u);F.parentNode.insertBefore(K,F);H=F;while(H&&!h.isBlock(H)){G=H.nextSibling;K.appendChild(H);H=G}t.setStart(E,J);t.setEnd(E,J)}}return E}function B(){function E(G){var F=k[G?"firstChild":"lastChild"];while(F){if(F.nodeType==1){break}F=F[G?"nextSibling":"previousSibling"]}return F===n}m=u?p(u):h.create("BR");if(E(true)&&E()){h.replace(m,k)}else{if(E(true)){k.parentNode.insertBefore(m,k)}else{if(E()){h.insertAfter(m,k)}else{A=t.cloneRange();A.setStartAfter(n);A.setEndAfter(k);i=A.extractContents();h.insertAfter(i,k);h.insertAfter(m,k)}}}h.remove(n);l(m);g.add()}function y(){var F=new a(v,n),E;while(E=F.current()){if(E.nodeName=="BR"){return true}E=F.next()}}function D(){var G,F,E;if(v&&v.nodeType==3&&s>=v.nodeValue.length){if(!b.isIE&&!y()){G=h.create("br");t.insertNode(G);t.setStartAfter(G);t.setEndAfter(G);F=true}}G=h.create("br");t.insertNode(G);E=h.doc.documentMode;if(b.isIE&&r=="PRE"&&(!E||E<8)){G.parentNode.insertBefore(h.doc.createTextNode("\r"),G)}if(!F){t.setStartAfter(G);t.setEndAfter(G)}else{t.setStartBefore(G);t.setEndBefore(G)}d.setRng(t);g.add()}function q(E){do{if(E.nodeType===3){E.nodeValue=E.nodeValue.replace(/^[\r\n]+/,"")}E=E.firstChild}while(E)}if(!t.collapsed){e.execCommand("Delete");return}if(x.isDefaultPrevented()){return}v=t.startContainer;s=t.startOffset;u=c.forced_root_block;u=u?u.toUpperCase():"";if(v.nodeType==1&&v.hasChildNodes()){v=v.childNodes[Math.min(s,v.childNodes.length-1)]||v;s=0}g.beforeChange();v=j(v,s);n=h.getParent(v,h.isBlock);k=n?h.getParent(n.parentNode,h.isBlock):null;r=n?n.nodeName.toUpperCase():"";C=k?k.nodeName.toUpperCase():"";if(r=="LI"&&h.isEmpty(n)){if(/^(UL|OL|LI)$/.test(k.parentNode.nodeName)){return false}B();return}if(r=="PRE"&&c.br_in_pre!==false){if(!x.shiftKey){D();return}}else{if((!u&&!x.shiftKey&&r!="LI")||(u&&x.shiftKey)){D();return}}u=u||"P";if(o()){if(/^(H[1-6]|PRE)$/.test(r)&&C!="HGROUP"){m=p(u)}else{m=p()}if(c.end_container_on_empty_block&&z(k)&&h.isEmpty(n)){m=h.split(k,n)}else{h.insertAfter(m,n)}}else{if(o(true)){m=n.parentNode.insertBefore(p(),n)}else{A=t.cloneRange();A.setEndAfter(n);i=A.extractContents();q(i);m=i.firstChild;h.insertAfter(i,n)}}h.setAttrib(m,"id","");l(m);g.add()}e.onKeyDown.add(function(j,i){if(i.keyCode==13){if(f(i)!==false){i.preventDefault()}}})}})(tinymce);
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 3ef3acb..4d9ffc0
@@ -2,4 +2,4 @@
 // Uncomment and change this document.domain value if you are loading the script cross subdomains
 // document.domain = 'moxiecode.com';
 
-var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
\ No newline at end of file
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 9db8d18..42f01a5
@@ -1,13 +1,13 @@
 (function(win) {\r
        var whiteSpaceRe = /^\s*|\s*$/g,\r
-               undefined;\r
+               undefined, isRegExpBroken = 'B'.replace(/A(.)|B/, '$1') === '$1';\r
 \r
        var tinymce = {\r
                majorVersion : '3',\r
 \r
-               minorVersion : '3.7',\r
+               minorVersion : '5b2',\r
 \r
-               releaseDate : '2010-06-10',\r
+               releaseDate : '2012-03-15',\r
 \r
                _init : function() {\r
                        var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;\r
 \r
                        t.isIE6 = t.isIE && /MSIE [56]/.test(ua);\r
 \r
+                       t.isIE7 = t.isIE && /MSIE [7]/.test(ua);\r
+\r
+                       t.isIE8 = t.isIE && /MSIE [8]/.test(ua);\r
+\r
+                       t.isIE9 = t.isIE && /MSIE [9]/.test(ua);\r
+\r
                        t.isGecko = !t.isWebKit && /Gecko/.test(ua);\r
 \r
                        t.isMac = ua.indexOf('Mac') != -1;\r
@@ -27,6 +33,8 @@
                        t.isAir = /adobeair/i.test(ua);\r
 \r
                        t.isIDevice = /(iPad|iPhone)/.test(ua);\r
+                       \r
+                       t.isIOS5 = t.isIDevice && ua.match(/AppleWebKit\/(\d*)/)[1]>=534;\r
 \r
                        // TinyMCE .NET webcontrol might be setting the values for TinyMCE\r
                        if (win.tinyMCEPreInit) {\r
@@ -52,7 +60,7 @@
                        }\r
 \r
                        function getBase(n) {\r
-                               if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) {\r
+                               if (n.src && /tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)) {\r
                                        if (/_(src|dev)\.js/g.test(n.src))\r
                                                t.suffix = '_src';\r
 \r
                        return typeof(o) == t;\r
                },\r
 \r
+               makeMap : function(items, delim, map) {\r
+                       var i;\r
+\r
+                       items = items || [];\r
+                       delim = delim || ',';\r
+\r
+                       if (typeof(items) == "string")\r
+                               items = items.split(delim);\r
+\r
+                       map = map || {};\r
+\r
+                       i = items.length;\r
+                       while (i--)\r
+                               map[items[i]] = {};\r
+\r
+                       return map;\r
+               },\r
+\r
                each : function(o, cb, s) {\r
                        var n, l;\r
 \r
                        return (s ? '' + s : '').replace(whiteSpaceRe, '');\r
                },\r
 \r
-               create : function(s, p) {\r
+               create : function(s, p, root) {\r
                        var t = this, sp, ns, cn, scn, c, de = 0;\r
 \r
                        // Parse : <prefix> <class>:<super class>\r
                        cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name\r
 \r
                        // Create namespace for new class\r
-                       ns = t.createNS(s[3].replace(/\.\w+$/, ''));\r
+                       ns = t.createNS(s[3].replace(/\.\w+$/, ''), root);\r
 \r
                        // Class already exists\r
                        if (ns[cn])\r
                                return u + v;\r
 \r
                        return u.replace('#', v + '#');\r
+               },\r
+\r
+               // Fix function for IE 9 where regexps isn't working correctly\r
+               // Todo: remove me once MS fixes the bug\r
+               _replace : function(find, replace, str) {\r
+                       // On IE9 we have to fake $x replacement\r
+                       if (isRegExpBroken) {\r
+                               return str.replace(find, function() {\r
+                                       var val = replace, args = arguments, i;\r
+\r
+                                       for (i = 0; i < args.length - 2; i++) {\r
+                                               if (args[i] === undefined) {\r
+                                                       val = val.replace(new RegExp('\\$' + i, 'g'), '');\r
+                                               } else {\r
+                                                       val = val.replace(new RegExp('\\$' + i, 'g'), args[i]);\r
+                                               }\r
+                                       }\r
+\r
+                                       return val;\r
+                               });\r
+                       }\r
+\r
+                       return str.replace(find, replace);\r
                }\r
 \r
                };\r
 \r
        // Expose tinymce namespace to the global namespace (window)\r
        win.tinymce = win.tinyMCE = tinymce;\r
-})(window);\r
+\r
+       // Describe the different namespaces\r
+\r
+       })(window);\r
+\r
 \r
 \r
 tinymce.create('tinymce.util.Dispatcher', {\r
@@ -482,7 +535,7 @@ tinymce.create('tinymce.util.Dispatcher', {
                // And this is also more efficient\r
                for (i = 0; i<li.length; i++) {\r
                        c = li[i];\r
-                       s = c.cb.apply(c.scope, a);\r
+                       s = c.cb.apply(c.scope, a.length > 0 ? a : [c.scope]);\r
 \r
                        if (s === false)\r
                                break;\r
@@ -498,7 +551,7 @@ tinymce.create('tinymce.util.Dispatcher', {
 \r
        tinymce.create('tinymce.util.URI', {\r
                URI : function(u, s) {\r
-                       var t = this, o, a, b;\r
+                       var t = this, o, a, b, base_url;\r
 \r
                        // Trim whitespace\r
                        u = tinymce.trim(u);\r
@@ -506,8 +559,9 @@ tinymce.create('tinymce.util.Dispatcher', {
                        // Default settings\r
                        s = t.settings = s || {};\r
 \r
-                       // Strange app protocol or local anchor\r
-                       if (/^(mailto|tel|news|javascript|about|data):/i.test(u) || /^\s*#/.test(u)) {\r
+                       // Strange app protocol that isn't http/https or local anchor\r
+                       // For example: mailto,skype,tel etc.\r
+                       if (/^([\w\-]+):([^\/]{2})/i.test(u) || /^\s*#/.test(u)) {\r
                                t.source = u;\r
                                return;\r
                        }\r
@@ -517,12 +571,14 @@ tinymce.create('tinymce.util.Dispatcher', {
                                u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;\r
 \r
                        // Relative path http:// or protocol relative //path\r
-                       if (!/^\w*:?\/\//.test(u))\r
-                               u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);\r
+                       if (!/^[\w-]*:?\/\//.test(u)) {\r
+                               base_url = s.base_uri ? s.base_uri.path : new tinymce.util.URI(location.href).directory;\r
+                               u = ((s.base_uri && s.base_uri.protocol) || 'http') + '://mce_host' + t.toAbsPath(base_url, u);\r
+                       }\r
 \r
                        // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)\r
                        u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something\r
-                       u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);\r
+                       u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);\r
                        each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) {\r
                                var s = u[i];\r
 \r
@@ -805,9 +861,11 @@ tinymce.create('tinymce.util.Dispatcher', {
        });\r
 })();\r
 \r
-tinymce.create('static tinymce.util.JSON', {\r
-       serialize : function(o) {\r
-               var i, v, s = tinymce.util.JSON.serialize, t;\r
+(function() {\r
+       function serialize(o, quote) {\r
+               var i, v, t;\r
+\r
+               quote = quote || '"';\r
 \r
                if (o == null)\r
                        return 'null';\r
@@ -817,7 +875,11 @@ tinymce.create('static tinymce.util.JSON', {
                if (t == 'string') {\r
                        v = '\bb\tt\nn\ff\rr\""\'\'\\\\';\r
 \r
-                       return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {\r
+                       return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function(a, b) {\r
+                               // Make sure single quotes never get encoded inside double quotes for JSON compatibility\r
+                               if (quote === '"' && a === "'")\r
+                                       return a;\r
+\r
                                i = v.indexOf(b);\r
 \r
                                if (i + 1)\r
@@ -826,37 +888,44 @@ tinymce.create('static tinymce.util.JSON', {
                                a = b.charCodeAt().toString(16);\r
 \r
                                return '\\u' + '0000'.substring(a.length) + a;\r
-                       }) + '"';\r
+                       }) + quote;\r
                }\r
 \r
                if (t == 'object') {\r
                        if (o.hasOwnProperty && o instanceof Array) {\r
                                        for (i=0, v = '['; i<o.length; i++)\r
-                                               v += (i > 0 ? ',' : '') + s(o[i]);\r
+                                               v += (i > 0 ? ',' : '') + serialize(o[i], quote);\r
 \r
                                        return v + ']';\r
                                }\r
 \r
                                v = '{';\r
 \r
-                               for (i in o)\r
-                                       v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';\r
+                               for (i in o) {\r
+                                       if (o.hasOwnProperty(i)) {\r
+                                               v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : '';\r
+                                       }\r
+                               }\r
 \r
                                return v + '}';\r
                }\r
 \r
                return '' + o;\r
-       },\r
+       };\r
 \r
-       parse : function(s) {\r
-               try {\r
-                       return eval('(' + s + ')');\r
-               } catch (ex) {\r
-                       // Ignore\r
+       tinymce.util.JSON = {\r
+               serialize: serialize,\r
+\r
+               parse: function(s) {\r
+                       try {\r
+                               return eval('(' + s + ')');\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
                }\r
-       }\r
 \r
-       });\r
+               };\r
+})();\r
 \r
 tinymce.create('static tinymce.util.XHR', {\r
        send : function(o) {\r
@@ -948,7 +1017,8 @@ tinymce.create('static tinymce.util.XHR', {
                        };\r
 \r
                        o.error = function(ty, x) {\r
-                               ecb.call(o.error_scope || o.scope, ty, x);\r
+                               if (ecb)\r
+                                       ecb.call(o.error_scope || o.scope, ty, x);\r
                        };\r
 \r
                        o.data = JSON.serialize({\r
@@ -970,5862 +1040,8219 @@ tinymce.create('static tinymce.util.XHR', {
                }\r
        });\r
 }());\r
+(function(tinymce){\r
+       tinymce.VK = {\r
+               BACKSPACE: 8,\r
+               DELETE: 46,\r
+               DOWN: 40,\r
+               ENTER: 13,\r
+               LEFT: 37,\r
+               RIGHT: 39,\r
+               SPACEBAR: 32,\r
+               TAB: 9,\r
+               UP: 38,\r
+\r
+               modifierPressed: function (e) {\r
+                       return e.shiftKey || e.ctrlKey || e.altKey;\r
+               }\r
+       }\r
+})(tinymce);\r
+\r
 (function(tinymce) {\r
-       // Shorten names\r
-       var each = tinymce.each,\r
-               is = tinymce.is,\r
-               isWebKit = tinymce.isWebKit,\r
-               isIE = tinymce.isIE,\r
-               blockRe = /^(H[1-6R]|P|DIV|ADDRESS|PRE|FORM|T(ABLE|BODY|HEAD|FOOT|H|R|D)|LI|OL|UL|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|MENU|ISINDEX|SAMP)$/,\r
-               boolAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),\r
-               mceAttribs = makeMap('src,href,style,coords,shape'),\r
-               encodedChars = {'&' : '&amp;', '"' : '&quot;', '<' : '&lt;', '>' : '&gt;'},\r
-               encodeCharsRe = /[<>&\"]/g,\r
-               simpleSelectorRe = /^([a-z0-9],?)+$/i,\r
-               tagRegExp = /<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)(\s*\/?)>/g,\r
-               attrRegExp = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;\r
+       var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE;\r
 \r
-       function makeMap(str) {\r
-               var map = {}, i;\r
+       function setEditorCommandState(editor, cmd, state) {\r
+               try {\r
+                       editor.getDoc().execCommand(cmd, false, state);\r
+               } catch (ex) {\r
+                       // Ignore\r
+               }\r
+       }\r
 \r
-               str = str.split(',');\r
-               for (i = str.length; i >= 0; i--)\r
-                       map[str[i]] = 1;\r
+       function cleanupStylesWhenDeleting(ed) {\r
+               var dom = ed.dom, selection = ed.selection;\r
 \r
-               return map;\r
-       };\r
+               ed.onKeyDown.add(function(ed, e) {\r
+                       var rng, blockElm, node, clonedSpan, isDelete;\r
 \r
-       tinymce.create('tinymce.dom.DOMUtils', {\r
-               doc : null,\r
-               root : null,\r
-               files : null,\r
-               pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,\r
-               props : {\r
-                       "for" : "htmlFor",\r
-                       "class" : "className",\r
-                       className : "className",\r
-                       checked : "checked",\r
-                       disabled : "disabled",\r
-                       maxlength : "maxLength",\r
-                       readonly : "readOnly",\r
-                       selected : "selected",\r
-                       value : "value",\r
-                       id : "id",\r
-                       name : "name",\r
-                       type : "type"\r
-               },\r
+                       if (e.isDefaultPrevented()) {\r
+                               return;\r
+                       }\r
 \r
-               DOMUtils : function(d, s) {\r
-                       var t = this, globalStyle;\r
+                       isDelete = e.keyCode == DELETE;\r
+                       if ((isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {\r
+                               e.preventDefault();\r
+                               rng = selection.getRng();\r
 \r
-                       t.doc = d;\r
-                       t.win = window;\r
-                       t.files = {};\r
-                       t.cssFlicker = false;\r
-                       t.counter = 0;\r
-                       t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat"; \r
-                       t.stdMode = d.documentMode === 8;\r
+                               // Find root block\r
+                               blockElm = dom.getParent(rng.startContainer, dom.isBlock);\r
 \r
-                       t.settings = s = tinymce.extend({\r
-                               keep_values : false,\r
-                               hex_colors : 1,\r
-                               process_html : 1\r
-                       }, s);\r
+                               // On delete clone the root span of the next block element\r
+                               if (isDelete)\r
+                                       blockElm = dom.getNext(blockElm, dom.isBlock);\r
 \r
-                       // Fix IE6SP2 flicker and check it failed for pre SP2\r
-                       if (tinymce.isIE6) {\r
-                               try {\r
-                                       d.execCommand('BackgroundImageCache', false, true);\r
-                               } catch (e) {\r
-                                       t.cssFlicker = true;\r
+                               // Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace\r
+                               if (blockElm) {\r
+                                       node = blockElm.firstChild;\r
+\r
+                                       // Ignore empty text nodes\r
+                                       while (node && node.nodeType == 3 && node.nodeValue.length == 0)\r
+                                               node = node.nextSibling;\r
+\r
+                                       if (node && node.nodeName === 'SPAN') {\r
+                                               clonedSpan = node.cloneNode(false);\r
+                                       }\r
                                }\r
-                       }\r
 \r
-                       // Build styles list\r
-                       if (s.valid_styles) {\r
-                               t._styles = {};\r
+                               // Do the backspace/delete action\r
+                               ed.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);\r
+\r
+                               // Find all odd apple-style-spans\r
+                               blockElm = dom.getParent(rng.startContainer, dom.isBlock);\r
+                               tinymce.each(dom.select('span.Apple-style-span,font.Apple-style-span', blockElm), function(span) {\r
+                                       var bm = selection.getBookmark();\r
 \r
-                               // Convert styles into a rule list\r
-                               each(s.valid_styles, function(value, key) {\r
-                                       t._styles[key] = tinymce.explode(value);\r
+                                       if (clonedSpan) {\r
+                                               dom.replace(clonedSpan.cloneNode(false), span, true);\r
+                                       } else {\r
+                                               dom.remove(span, true);\r
+                                       }\r
+\r
+                                       // Restore the selection\r
+                                       selection.moveToBookmark(bm);\r
                                });\r
                        }\r
+               });\r
+       };\r
 \r
-                       tinymce.addUnload(t.destroy, t);\r
-               },\r
+       function emptyEditorWhenDeleting(ed) {\r
+               function serializeRng(rng) {\r
+                       var body = ed.dom.create("body");\r
+                       var contents = rng.cloneContents();\r
+                       body.appendChild(contents);\r
+                       return ed.selection.serializer.serialize(body, {format: 'html'});\r
+               }\r
 \r
-               getRoot : function() {\r
-                       var t = this, s = t.settings;\r
+               function allContentsSelected(rng) {\r
+                       var selection = serializeRng(rng);\r
 \r
-                       return (s && t.get(s.root_element)) || t.doc.body;\r
-               },\r
+                       var allRng = ed.dom.createRng();\r
+                       allRng.selectNode(ed.getBody());\r
 \r
-               getViewPort : function(w) {\r
-                       var d, b;\r
+                       var allSelection = serializeRng(allRng);\r
+                       return selection === allSelection;\r
+               }\r
 \r
-                       w = !w ? this.win : w;\r
-                       d = w.document;\r
-                       b = this.boxModel ? d.documentElement : d.body;\r
+               ed.onKeyDown.addToTop(function(ed, e) {\r
+                       var keyCode = e.keyCode;\r
+                       if (keyCode == DELETE || keyCode == BACKSPACE) {\r
+                               var rng = ed.selection.getRng(true);\r
+                               if (!rng.collapsed && allContentsSelected(rng)) {\r
+                                       ed.setContent('', {format : 'raw'});\r
+                                       ed.nodeChanged();\r
+                                       e.preventDefault();\r
+                               }\r
+                       }\r
+               });\r
+       };\r
 \r
-                       // Returns viewport size excluding scrollbars\r
-                       return {\r
-                               x : w.pageXOffset || b.scrollLeft,\r
-                               y : w.pageYOffset || b.scrollTop,\r
-                               w : w.innerWidth || b.clientWidth,\r
-                               h : w.innerHeight || b.clientHeight\r
-                       };\r
-               },\r
+       function inputMethodFocus(ed) {\r
+               ed.dom.bind(ed.getDoc(), 'focusin', function() {\r
+                       ed.selection.setRng(ed.selection.getRng());\r
+               });\r
+       };\r
 \r
-               getRect : function(e) {\r
-                       var p, t = this, sr;\r
+       function removeHrOnBackspace(ed) {\r
+               ed.onKeyDown.add(function(ed, e) {\r
+                       if (e.keyCode === BACKSPACE) {\r
+                               if (ed.selection.isCollapsed() && ed.selection.getRng(true).startOffset === 0) {\r
+                                       var node = ed.selection.getNode();\r
+                                       var previousSibling = node.previousSibling;\r
+                                       if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") {\r
+                                               ed.dom.remove(previousSibling);\r
+                                               tinymce.dom.Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       }\r
+               })\r
+       }\r
 \r
-                       e = t.get(e);\r
-                       p = t.getPos(e);\r
-                       sr = t.getSize(e);\r
+       function focusBody(ed) {\r
+               // Fix for a focus bug in FF 3.x where the body element\r
+               // wouldn't get proper focus if the user clicked on the HTML element\r
+               if (!Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\r
+                       ed.onMouseDown.add(function(ed, e) {\r
+                               if (e.target.nodeName === "HTML") {\r
+                                       var body = ed.getBody();\r
+\r
+                                       // Blur the body it's focused but not correctly focused\r
+                                       body.blur();\r
+\r
+                                       // Refocus the body after a little while\r
+                                       setTimeout(function() {\r
+                                               body.focus();\r
+                                       }, 0);\r
+                               }\r
+                       });\r
+               }\r
+       };\r
 \r
-                       return {\r
-                               x : p.x,\r
-                               y : p.y,\r
-                               w : sr.w,\r
-                               h : sr.h\r
-                       };\r
-               },\r
+       function selectControlElements(ed) {\r
+               ed.onClick.add(function(ed, e) {\r
+                       e = e.target;\r
 \r
-               getSize : function(e) {\r
-                       var t = this, w, h;\r
+                       // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250\r
+                       // WebKit can't even do simple things like selecting an image\r
+                       // Needs tobe the setBaseAndExtend or it will fail to select floated images\r
+                       if (/^(IMG|HR)$/.test(e.nodeName))\r
+                               ed.selection.getSel().setBaseAndExtent(e, 0, e, 1);\r
 \r
-                       e = t.get(e);\r
-                       w = t.getStyle(e, 'width');\r
-                       h = t.getStyle(e, 'height');\r
+                       if (e.nodeName == 'A' && ed.dom.hasClass(e, 'mceItemAnchor'))\r
+                               ed.selection.select(e);\r
 \r
-                       // Non pixel value, then force offset/clientWidth\r
-                       if (w.indexOf('px') === -1)\r
-                               w = 0;\r
+                       ed.nodeChanged();\r
+               });\r
+       };\r
 \r
-                       // Non pixel value, then force offset/clientWidth\r
-                       if (h.indexOf('px') === -1)\r
-                               h = 0;\r
+       function removeStylesWhenDeletingAccrossBlockElements(ed) {\r
+               var selection = ed.selection, dom = ed.dom;\r
 \r
-                       return {\r
-                               w : parseInt(w) || e.offsetWidth || e.clientWidth,\r
-                               h : parseInt(h) || e.offsetHeight || e.clientHeight\r
-                       };\r
-               },\r
+               function getAttributeApplyFunction() {\r
+                       var template = dom.getAttribs(selection.getStart().cloneNode(false));\r
 \r
-               getParent : function(n, f, r) {\r
-                       return this.getParents(n, f, r, false);\r
-               },\r
+                       return function() {\r
+                               var target = selection.getStart();\r
 \r
-               getParents : function(n, f, r, c) {\r
-                       var t = this, na, se = t.settings, o = [];\r
+                               if (target !== ed.getBody()) {\r
+                                       dom.setAttrib(target, "style", null);\r
 \r
-                       n = t.get(n);\r
-                       c = c === undefined;\r
+                               tinymce.each(template, function(attr) {\r
+                                       target.setAttributeNode(attr.cloneNode(true));\r
+                               });\r
+                               }\r
+                       };\r
+               }\r
 \r
-                       if (se.strict_root)\r
-                               r = r || t.getRoot();\r
+               function isSelectionAcrossElements() {\r
+                       return !selection.isCollapsed() && selection.getStart() != selection.getEnd();\r
+               }\r
 \r
-                       // Wrap node name as func\r
-                       if (is(f, 'string')) {\r
-                               na = f;\r
+               function blockEvent(ed, e) {\r
+                       e.preventDefault();\r
+                       return false;\r
+               }\r
 \r
-                               if (f === '*') {\r
-                                       f = function(n) {return n.nodeType == 1;};\r
-                               } else {\r
-                                       f = function(n) {\r
-                                               return t.is(n, na);\r
-                                       };\r
-                               }\r
+               ed.onKeyPress.add(function(ed, e) {\r
+                       var applyAttributes;\r
+\r
+                       if ((e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {\r
+                               applyAttributes = getAttributeApplyFunction();\r
+                               ed.getDoc().execCommand('delete', false, null);\r
+                               applyAttributes();\r
+                               e.preventDefault();\r
+                               return false;\r
                        }\r
+               });\r
 \r
-                       while (n) {\r
-                               if (n == r || !n.nodeType || n.nodeType === 9)\r
-                                       break;\r
+               dom.bind(ed.getDoc(), 'cut', function(e) {\r
+                       var applyAttributes;\r
 \r
-                               if (!f || f(n)) {\r
-                                       if (c)\r
-                                               o.push(n);\r
-                                       else\r
-                                               return n;\r
-                               }\r
+                       if (isSelectionAcrossElements()) {\r
+                               applyAttributes = getAttributeApplyFunction();\r
+                               ed.onKeyUp.addToTop(blockEvent);\r
 \r
-                               n = n.parentNode;\r
+                               setTimeout(function() {\r
+                                       applyAttributes();\r
+                                       ed.onKeyUp.remove(blockEvent);\r
+                               }, 0);\r
                        }\r
+               });\r
+       }\r
+       \r
+       /*\r
+       function removeStylesOnPTagsInheritedFromHeadingTag(ed) {\r
+               ed.onKeyDown.add(function(ed, event) {\r
+                       function checkInHeadingTag(ed) {\r
+                               var currentNode = ed.selection.getNode();\r
+                               var headingTags = 'h1,h2,h3,h4,h5,h6';\r
+                               return ed.dom.is(currentNode, headingTags) || ed.dom.getParent(currentNode, headingTags) !== null;\r
+                       }\r
+\r
+                       if (event.keyCode === VK.ENTER && !VK.modifierPressed(event) && checkInHeadingTag(ed)) {\r
+                               setTimeout(function() {\r
+                                       var currentNode = ed.selection.getNode();\r
+                                       if (ed.dom.is(currentNode, 'p')) {\r
+                                               ed.dom.setAttrib(currentNode, 'style', null);\r
+                                               // While tiny's content is correct after this method call, the content shown is not representative of it and needs to be 'repainted'\r
+                                               ed.execCommand('mceCleanup');\r
+                                       }\r
+                               }, 0);\r
+                       }\r
+               });\r
+       }\r
+       */\r
 \r
-                       return c ? o : null;\r
-               },\r
-\r
-               get : function(e) {\r
-                       var n;\r
-\r
-                       if (e && this.doc && typeof(e) == 'string') {\r
-                               n = e;\r
-                               e = this.doc.getElementById(e);\r
+       function selectionChangeNodeChanged(ed) {\r
+               var lastRng, selectionTimer;\r
 \r
-                               // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick\r
-                               if (e && e.id !== n)\r
-                                       return this.doc.getElementsByName(n)[1];\r
+               ed.dom.bind(ed.getDoc(), 'selectionchange', function() {\r
+                       if (selectionTimer) {\r
+                               clearTimeout(selectionTimer);\r
+                               selectionTimer = 0;\r
                        }\r
 \r
-                       return e;\r
-               },\r
+                       selectionTimer = window.setTimeout(function() {\r
+                               var rng = ed.selection.getRng();\r
 \r
-               getNext : function(node, selector) {\r
-                       return this._findSib(node, selector, 'nextSibling');\r
-               },\r
+                               // Compare the ranges to see if it was a real change or not\r
+                               if (!lastRng || !tinymce.dom.RangeUtils.compareRanges(rng, lastRng)) {\r
+                                       ed.nodeChanged();\r
+                                       lastRng = rng;\r
+                               }\r
+                       }, 50);\r
+               });\r
+       }\r
 \r
-               getPrev : function(node, selector) {\r
-                       return this._findSib(node, selector, 'previousSibling');\r
-               },\r
+       function ensureBodyHasRoleApplication(ed) {\r
+               document.body.setAttribute("role", "application");\r
+       }\r
+       \r
+       function disableBackspaceIntoATable(ed) {\r
+               ed.onKeyDown.add(function(ed, e) {\r
+                       if (e.keyCode === BACKSPACE) {\r
+                               if (ed.selection.isCollapsed() && ed.selection.getRng(true).startOffset === 0) {\r
+                                       var previousSibling = ed.selection.getNode().previousSibling;\r
+                                       if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {\r
+                                               return tinymce.dom.Event.cancel(e);\r
+                                       }\r
+                               }\r
+                       }\r
+               })\r
+       }\r
 \r
+       function addNewLinesBeforeBrInPre(editor) {\r
+               var documentMode = editor.getDoc().documentMode;\r
 \r
-               select : function(pa, s) {\r
-                       var t = this;\r
+               // IE8+ rendering mode does the right thing with BR in PRE\r
+               if (documentMode && documentMode > 7) {\r
+                       return;\r
+               }\r
 \r
-                       return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);\r
-               },\r
-\r
-               is : function(n, selector) {\r
-                       var i;\r
-\r
-                       // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance\r
-                       if (n.length === undefined) {\r
-                               // Simple all selector\r
-                               if (selector === '*')\r
-                                       return n.nodeType == 1;\r
-\r
-                               // Simple selector just elements\r
-                               if (simpleSelectorRe.test(selector)) {\r
-                                       selector = selector.toLowerCase().split(/,/);\r
-                                       n = n.nodeName.toLowerCase();\r
+                // Enable display: none in area and add a specific class that hides all BR elements in PRE to\r
+                // avoid the caret from getting stuck at the BR elements while pressing the right arrow key\r
+               setEditorCommandState(editor, 'RespectVisibilityInDesign', true);\r
+               editor.dom.addClass(editor.getBody(), 'mceHideBrInPre');\r
+\r
+               // Adds a \n before all BR elements in PRE to get them visual\r
+               editor.parser.addNodeFilter('pre', function(nodes, name) {\r
+                       var i = nodes.length, brNodes, j, brElm, sibling;\r
+\r
+                       while (i--) {\r
+                               brNodes = nodes[i].getAll('br');\r
+                               j = brNodes.length;\r
+                               while (j--) {\r
+                                       brElm = brNodes[j];\r
+\r
+                                       // Add \n before BR in PRE elements on older IE:s so the new lines get rendered\r
+                                       sibling = brElm.prev;\r
+                                       if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') {\r
+                                               sibling.value += '\n';\r
+                                       } else {\r
+                                               brElm.parent.insert(new tinymce.html.Node('#text', 3), brElm, true).value = '\n';\r
+                                       }\r
+                               }\r
+                       }\r
+               });\r
 \r
-                                       for (i = selector.length - 1; i >= 0; i--) {\r
-                                               if (selector[i] == n)\r
-                                                       return true;\r
+               // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible\r
+               editor.serializer.addNodeFilter('pre', function(nodes, name) {\r
+                       var i = nodes.length, brNodes, j, brElm, sibling;\r
+\r
+                       while (i--) {\r
+                               brNodes = nodes[i].getAll('br');\r
+                               j = brNodes.length;\r
+                               while (j--) {\r
+                                       brElm = brNodes[j];\r
+                                       sibling = brElm.prev;\r
+                                       if (sibling && sibling.type == 3) {\r
+                                               sibling.value = sibling.value.replace(/\r?\n$/, '');\r
                                        }\r
+                               }\r
+                       }\r
+               });\r
+       }\r
 \r
-                                       return false;\r
+       tinymce.create('tinymce.util.Quirks', {\r
+               Quirks: function(ed) {\r
+                       // All browsers\r
+                       disableBackspaceIntoATable(ed);\r
+\r
+                       // WebKit\r
+                       if (tinymce.isWebKit) {\r
+                               cleanupStylesWhenDeleting(ed);\r
+                               emptyEditorWhenDeleting(ed);\r
+                               inputMethodFocus(ed);\r
+                               selectControlElements(ed);\r
+\r
+                               // iOS\r
+                               if (tinymce.isIDevice) {\r
+                                       selectionChangeNodeChanged(ed);\r
                                }\r
                        }\r
 \r
-                       return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;\r
-               },\r
+                       // IE\r
+                       if (tinymce.isIE) {\r
+                               removeHrOnBackspace(ed);\r
+                               emptyEditorWhenDeleting(ed);\r
+                               ensureBodyHasRoleApplication(ed);\r
+                               //removeStylesOnPTagsInheritedFromHeadingTag(ed)\r
+                               addNewLinesBeforeBrInPre(ed);\r
+                       }\r
 \r
+                       // Gecko\r
+                       if (tinymce.isGecko) {\r
+                               removeHrOnBackspace(ed);\r
+                               focusBody(ed);\r
+                               removeStylesWhenDeletingAccrossBlockElements(ed);\r
+                       }\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-               add : function(p, n, a, h, c) {\r
-                       var t = this;\r
+(function(tinymce) {\r
+       var namedEntities, baseEntities, reverseEntities,\r
+               attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,\r
+               textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,\r
+               rawCharsRegExp = /[<>&\"\']/g,\r
+               entityRegExp = /&(#x|#)?([\w]+);/g,\r
+               asciiMap = {\r
+                               128 : "\u20AC", 130 : "\u201A", 131 : "\u0192", 132 : "\u201E", 133 : "\u2026", 134 : "\u2020",\r
+                               135 : "\u2021", 136 : "\u02C6", 137 : "\u2030", 138 : "\u0160", 139 : "\u2039", 140 : "\u0152",\r
+                               142 : "\u017D", 145 : "\u2018", 146 : "\u2019", 147 : "\u201C", 148 : "\u201D", 149 : "\u2022",\r
+                               150 : "\u2013", 151 : "\u2014", 152 : "\u02DC", 153 : "\u2122", 154 : "\u0161", 155 : "\u203A",\r
+                               156 : "\u0153", 158 : "\u017E", 159 : "\u0178"\r
+               };\r
 \r
-                       return this.run(p, function(p) {\r
-                               var e, k;\r
+       // Raw entities\r
+       baseEntities = {\r
+               '\"' : '&quot;', // Needs to be escaped since the YUI compressor would otherwise break the code\r
+               "'" : '&#39;',\r
+               '<' : '&lt;',\r
+               '>' : '&gt;',\r
+               '&' : '&amp;'\r
+       };\r
 \r
-                               e = is(n, 'string') ? t.doc.createElement(n) : n;\r
-                               t.setAttribs(e, a);\r
+       // Reverse lookup table for raw entities\r
+       reverseEntities = {\r
+               '&lt;' : '<',\r
+               '&gt;' : '>',\r
+               '&amp;' : '&',\r
+               '&quot;' : '"',\r
+               '&apos;' : "'"\r
+       };\r
 \r
-                               if (h) {\r
-                                       if (h.nodeType)\r
-                                               e.appendChild(h);\r
-                                       else\r
-                                               t.setHTML(e, h);\r
-                               }\r
+       // Decodes text by using the browser\r
+       function nativeDecode(text) {\r
+               var elm;\r
 \r
-                               return !c ? p.appendChild(e) : e;\r
-                       });\r
-               },\r
+               elm = document.createElement("div");\r
+               elm.innerHTML = text;\r
 \r
-               create : function(n, a, h) {\r
-                       return this.add(this.doc.createElement(n), n, a, h, 1);\r
-               },\r
+               return elm.textContent || elm.innerText || text;\r
+       };\r
 \r
-               createHTML : function(n, a, h) {\r
-                       var o = '', t = this, k;\r
+       // Build a two way lookup table for the entities\r
+       function buildEntitiesLookup(items, radix) {\r
+               var i, chr, entity, lookup = {};\r
 \r
-                       o += '<' + n;\r
+               if (items) {\r
+                       items = items.split(',');\r
+                       radix = radix || 10;\r
 \r
-                       for (k in a) {\r
-                               if (a.hasOwnProperty(k))\r
-                                       o += ' ' + k + '="' + t.encode(a[k]) + '"';\r
+                       // Build entities lookup table\r
+                       for (i = 0; i < items.length; i += 2) {\r
+                               chr = String.fromCharCode(parseInt(items[i], radix));\r
+\r
+                               // Only add non base entities\r
+                               if (!baseEntities[chr]) {\r
+                                       entity = '&' + items[i + 1] + ';';\r
+                                       lookup[chr] = entity;\r
+                                       lookup[entity] = chr;\r
+                               }\r
                        }\r
 \r
-                       if (tinymce.is(h))\r
-                               return o + '>' + h + '</' + n + '>';\r
+                       return lookup;\r
+               }\r
+       };\r
 \r
-                       return o + ' />';\r
+       // Unpack entities lookup where the numbers are in radix 32 to reduce the size\r
+       namedEntities = buildEntitiesLookup(\r
+               '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +\r
+               '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +\r
+               '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +\r
+               '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +\r
+               '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +\r
+               '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +\r
+               '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +\r
+               '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +\r
+               '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +\r
+               '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +\r
+               'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +\r
+               'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +\r
+               't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +\r
+               'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +\r
+               'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +\r
+               '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +\r
+               '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +\r
+               '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +\r
+               '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +\r
+               '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +\r
+               'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +\r
+               'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +\r
+               'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +\r
+               '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +\r
+               '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro'\r
+       , 32);\r
+\r
+       tinymce.html = tinymce.html || {};\r
+\r
+       tinymce.html.Entities = {\r
+               encodeRaw : function(text, attr) {\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || chr;\r
+                       });\r
                },\r
 \r
-               remove : function(node, keep_children) {\r
-                       return this.run(node, function(node) {\r
-                               var parent, child;\r
+               encodeAllRaw : function(text) {\r
+                       return ('' + text).replace(rawCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || chr;\r
+                       });\r
+               },\r
 \r
-                               parent = node.parentNode;\r
+               encodeNumeric : function(text, attr) {\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               // Multi byte sequence convert it to a single entity\r
+                               if (chr.length > 1)\r
+                                       return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';\r
 \r
-                               if (!parent)\r
-                                       return null;\r
+                               return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';\r
+                       });\r
+               },\r
 \r
-                               if (keep_children) {\r
-                                       while (child = node.firstChild) {\r
-                                               // IE 8 will crash if you don't remove completely empty text nodes\r
-                                               if (!tinymce.isIE || child.nodeType !== 3 || child.nodeValue)\r
-                                                       parent.insertBefore(child, node);\r
-                                               else\r
-                                                       node.removeChild(child);\r
-                                       }\r
-                               }\r
+               encodeNamed : function(text, attr, entities) {\r
+                       entities = entities || namedEntities;\r
 \r
-                               return parent.removeChild(node);\r
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || entities[chr] || chr;\r
                        });\r
                },\r
 \r
-               setStyle : function(n, na, v) {\r
-                       var t = this;\r
-\r
-                       return t.run(n, function(e) {\r
-                               var s, i;\r
+               getEncodeFunc : function(name, entities) {\r
+                       var Entities = tinymce.html.Entities;\r
 \r
-                               s = e.style;\r
+                       entities = buildEntitiesLookup(entities) || namedEntities;\r
 \r
-                               // Camelcase it, if needed\r
-                               na = na.replace(/-(\D)/g, function(a, b){\r
-                                       return b.toUpperCase();\r
+                       function encodeNamedAndNumeric(text, attr) {\r
+                               return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                                       return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr;\r
                                });\r
+                       };\r
 \r
-                               // Default px suffix on these\r
-                               if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))\r
-                                       v += 'px';\r
+                       function encodeCustomNamed(text, attr) {\r
+                               return Entities.encodeNamed(text, attr, entities);\r
+                       };\r
 \r
-                               switch (na) {\r
-                                       case 'opacity':\r
-                                               // IE specific opacity\r
-                                               if (isIE) {\r
-                                                       s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";\r
+                       // Replace + with , to be compatible with previous TinyMCE versions\r
+                       name = tinymce.makeMap(name.replace(/\+/g, ','));\r
 \r
-                                                       if (!n.currentStyle || !n.currentStyle.hasLayout)\r
-                                                               s.display = 'inline-block';\r
-                                               }\r
+                       // Named and numeric encoder\r
+                       if (name.named && name.numeric)\r
+                               return encodeNamedAndNumeric;\r
 \r
-                                               // Fix for older browsers\r
-                                               s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';\r
-                                               break;\r
+                       // Named encoder\r
+                       if (name.named) {\r
+                               // Custom names\r
+                               if (entities)\r
+                                       return encodeCustomNamed;\r
 \r
-                                       case 'float':\r
-                                               isIE ? s.styleFloat = v : s.cssFloat = v;\r
-                                               break;\r
-                                       \r
-                                       default:\r
-                                               s[na] = v || '';\r
-                               }\r
+                               return Entities.encodeNamed;\r
+                       }\r
 \r
-                               // Force update of the style data\r
-                               if (t.settings.update_styles)\r
-                                       t.setAttrib(e, '_mce_style');\r
-                       });\r
-               },\r
+                       // Numeric\r
+                       if (name.numeric)\r
+                               return Entities.encodeNumeric;\r
 \r
-               getStyle : function(n, na, c) {\r
-                       n = this.get(n);\r
+                       // Raw encoder\r
+                       return Entities.encodeRaw;\r
+               },\r
 \r
-                       if (!n)\r
-                               return false;\r
+               decode : function(text) {\r
+                       return text.replace(entityRegExp, function(all, numeric, value) {\r
+                               if (numeric) {\r
+                                       value = parseInt(value, numeric.length === 2 ? 16 : 10);\r
 \r
-                       // Gecko\r
-                       if (this.doc.defaultView && c) {\r
-                               // Remove camelcase\r
-                               na = na.replace(/[A-Z]/g, function(a){\r
-                                       return '-' + a;\r
-                               });\r
+                                       // Support upper UTF\r
+                                       if (value > 0xFFFF) {\r
+                                               value -= 0x10000;\r
 \r
-                               try {\r
-                                       return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);\r
-                               } catch (ex) {\r
-                                       // Old safari might fail\r
-                                       return null;\r
+                                               return String.fromCharCode(0xD800 + (value >> 10), 0xDC00 + (value & 0x3FF));\r
+                                       } else\r
+                                               return asciiMap[value] || String.fromCharCode(value);\r
                                }\r
-                       }\r
 \r
-                       // Camelcase it, if needed\r
-                       na = na.replace(/-(\D)/g, function(a, b){\r
-                               return b.toUpperCase();\r
+                               return reverseEntities[all] || namedEntities[all] || nativeDecode(all);\r
                        });\r
+               }\r
+       };\r
+})(tinymce);\r
 \r
-                       if (na == 'float')\r
-                               na = isIE ? 'styleFloat' : 'cssFloat';\r
+tinymce.html.Styles = function(settings, schema) {\r
+       var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,\r
+               urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,\r
+               styleRegExp = /\s*([^:]+):\s*([^;]+);?/g,\r
+               trimRightRegExp = /\s+$/,\r
+               urlColorRegExp = /rgb/,\r
+               undef, i, encodingLookup = {}, encodingItems;\r
 \r
-                       // IE & Opera\r
-                       if (n.currentStyle && c)\r
-                               return n.currentStyle[na];\r
+       settings = settings || {};\r
 \r
-                       return n.style[na];\r
-               },\r
+       encodingItems = '\\" \\\' \\; \\: ; : \uFEFF'.split(' ');\r
+       for (i = 0; i < encodingItems.length; i++) {\r
+               encodingLookup[encodingItems[i]] = '\uFEFF' + i;\r
+               encodingLookup['\uFEFF' + i] = encodingItems[i];\r
+       }\r
 \r
-               setStyles : function(e, o) {\r
-                       var t = this, s = t.settings, ol;\r
+       function toHex(match, r, g, b) {\r
+               function hex(val) {\r
+                       val = parseInt(val).toString(16);\r
 \r
-                       ol = s.update_styles;\r
-                       s.update_styles = 0;\r
+                       return val.length > 1 ? val : '0' + val; // 0 -> 00\r
+               };\r
 \r
-                       each(o, function(v, n) {\r
-                               t.setStyle(e, n, v);\r
-                       });\r
+               return '#' + hex(r) + hex(g) + hex(b);\r
+       };\r
 \r
-                       // Update style info\r
-                       s.update_styles = ol;\r
-                       if (s.update_styles)\r
-                               t.setAttrib(e, s.cssText);\r
+       return {\r
+               toHex : function(color) {\r
+                       return color.replace(rgbRegExp, toHex);\r
                },\r
 \r
-               setAttrib : function(e, n, v) {\r
-                       var t = this;\r
+               parse : function(css) {\r
+                       var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope || this;\r
 \r
-                       // Whats the point\r
-                       if (!e || !n)\r
-                               return;\r
+                       function compress(prefix, suffix) {\r
+                               var top, right, bottom, left;\r
 \r
-                       // Strict XML mode\r
-                       if (t.settings.strict)\r
-                               n = n.toLowerCase();\r
+                               // Get values and check it it needs compressing\r
+                               top = styles[prefix + '-top' + suffix];\r
+                               if (!top)\r
+                                       return;\r
 \r
-                       return this.run(e, function(e) {\r
-                               var s = t.settings;\r
+                               right = styles[prefix + '-right' + suffix];\r
+                               if (top != right)\r
+                                       return;\r
 \r
-                               switch (n) {\r
-                                       case "style":\r
-                                               if (!is(v, 'string')) {\r
-                                                       each(v, function(v, n) {\r
-                                                               t.setStyle(e, n, v);\r
-                                                       });\r
+                               bottom = styles[prefix + '-bottom' + suffix];\r
+                               if (right != bottom)\r
+                                       return;\r
 \r
-                                                       return;\r
-                                               }\r
+                               left = styles[prefix + '-left' + suffix];\r
+                               if (bottom != left)\r
+                                       return;\r
 \r
-                                               // No mce_style for elements with these since they might get resized by the user\r
-                                               if (s.keep_values) {\r
-                                                       if (v && !t._isRes(v))\r
-                                                               e.setAttribute('_mce_style', v, 2);\r
-                                                       else\r
-                                                               e.removeAttribute('_mce_style', 2);\r
-                                               }\r
+                               // Compress\r
+                               styles[prefix + suffix] = left;\r
+                               delete styles[prefix + '-top' + suffix];\r
+                               delete styles[prefix + '-right' + suffix];\r
+                               delete styles[prefix + '-bottom' + suffix];\r
+                               delete styles[prefix + '-left' + suffix];\r
+                       };\r
 \r
-                                               e.style.cssText = v;\r
-                                               break;\r
+                       function canCompress(key) {\r
+                               var value = styles[key], i;\r
 \r
-                                       case "class":\r
-                                               e.className = v || ''; // Fix IE null bug\r
-                                               break;\r
+                               if (!value || value.indexOf(' ') < 0)\r
+                                       return;\r
 \r
-                                       case "src":\r
-                                       case "href":\r
-                                               if (s.keep_values) {\r
-                                                       if (s.url_converter)\r
-                                                               v = s.url_converter.call(s.url_converter_scope || t, v, n, e);\r
+                               value = value.split(' ');\r
+                               i = value.length;\r
+                               while (i--) {\r
+                                       if (value[i] !== value[0])\r
+                                               return false;\r
+                               }\r
 \r
-                                                       t.setAttrib(e, '_mce_' + n, v, 2);\r
-                                               }\r
+                               styles[key] = value[0];\r
 \r
-                                               break;\r
-                                       \r
-                                       case "shape":\r
-                                               e.setAttribute('_mce_style', v);\r
-                                               break;\r
-                               }\r
+                               return true;\r
+                       };\r
 \r
-                               if (is(v) && v !== null && v.length !== 0)\r
-                                       e.setAttribute(n, '' + v, 2);\r
-                               else\r
-                                       e.removeAttribute(n, 2);\r
-                       });\r
-               },\r
+                       function compress2(target, a, b, c) {\r
+                               if (!canCompress(a))\r
+                                       return;\r
 \r
-               setAttribs : function(e, o) {\r
-                       var t = this;\r
+                               if (!canCompress(b))\r
+                                       return;\r
 \r
-                       return this.run(e, function(e) {\r
-                               each(o, function(v, n) {\r
-                                       t.setAttrib(e, n, v);\r
-                               });\r
-                       });\r
-               },\r
+                               if (!canCompress(c))\r
+                                       return;\r
 \r
-               getAttrib : function(e, n, dv) {\r
-                       var v, t = this;\r
+                               // Compress\r
+                               styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];\r
+                               delete styles[a];\r
+                               delete styles[b];\r
+                               delete styles[c];\r
+                       };\r
 \r
-                       e = t.get(e);\r
+                       // Encodes the specified string by replacing all \" \' ; : with _<num>\r
+                       function encode(str) {\r
+                               isEncoded = true;\r
 \r
-                       if (!e || e.nodeType !== 1)\r
-                               return false;\r
+                               return encodingLookup[str];\r
+                       };\r
 \r
-                       if (!is(dv))\r
-                               dv = '';\r
+                       // Decodes the specified string by replacing all _<num> with it's original value \" \' etc\r
+                       // It will also decode the \" \' if keep_slashes is set to fale or omitted\r
+                       function decode(str, keep_slashes) {\r
+                               if (isEncoded) {\r
+                                       str = str.replace(/\uFEFF[0-9]/g, function(str) {\r
+                                               return encodingLookup[str];\r
+                                       });\r
+                               }\r
 \r
-                       // Try the mce variant for these\r
-                       if (/^(src|href|style|coords|shape)$/.test(n)) {\r
-                               v = e.getAttribute("_mce_" + n);\r
+                               if (!keep_slashes)\r
+                                       str = str.replace(/\\([\'\";:])/g, "$1");\r
 \r
-                               if (v)\r
-                                       return v;\r
+                               return str;\r
                        }\r
 \r
-                       if (isIE && t.props[n]) {\r
-                               v = e[t.props[n]];\r
-                               v = v && v.nodeValue ? v.nodeValue : v;\r
-                       }\r
+                       if (css) {\r
+                               // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing\r
+                               css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) {\r
+                                       return str.replace(/[;:]/g, encode);\r
+                               });\r
 \r
-                       if (!v)\r
-                               v = e.getAttribute(n, 2);\r
+                               // Parse styles\r
+                               while (matches = styleRegExp.exec(css)) {\r
+                                       name = matches[1].replace(trimRightRegExp, '').toLowerCase();\r
+                                       value = matches[2].replace(trimRightRegExp, '');\r
 \r
-                       // Check boolean attribs\r
-                       if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {\r
-                               if (e[t.props[n]] === true && v === '')\r
-                                       return n;\r
+                                       if (name && value.length > 0) {\r
+                                               // Opera will produce 700 instead of bold in their style values\r
+                                               if (name === 'font-weight' && value === '700')\r
+                                                       value = 'bold';\r
+                                               else if (name === 'color' || name === 'background-color') // Lowercase colors like RED\r
+                                                       value = value.toLowerCase();            \r
 \r
-                               return v ? n : '';\r
-                       }\r
+                                               // Convert RGB colors to HEX\r
+                                               value = value.replace(rgbRegExp, toHex);\r
 \r
-                       // Inner input elements will override attributes on form elements\r
-                       if (e.nodeName === "FORM" && e.getAttributeNode(n))\r
-                               return e.getAttributeNode(n).nodeValue;\r
+                                               // Convert URLs and force them into url('value') format\r
+                                               value = value.replace(urlOrStrRegExp, function(match, url, url2, url3, str, str2) {\r
+                                                       str = str || str2;\r
 \r
-                       if (n === 'style') {\r
-                               v = v || e.style.cssText;\r
+                                                       if (str) {\r
+                                                               str = decode(str);\r
 \r
-                               if (v) {\r
-                                       v = t.serializeStyle(t.parseStyle(v), e.nodeName);\r
+                                                               // Force strings into single quote format\r
+                                                               return "'" + str.replace(/\'/g, "\\'") + "'";\r
+                                                       }\r
 \r
-                                       if (t.settings.keep_values && !t._isRes(v))\r
-                                               e.setAttribute('_mce_style', v);\r
+                                                       url = decode(url || url2 || url3);\r
+\r
+                                                       // Convert the URL to relative/absolute depending on config\r
+                                                       if (urlConverter)\r
+                                                               url = urlConverter.call(urlConverterScope, url, 'style');\r
+\r
+                                                       // Output new URL format\r
+                                                       return "url('" + url.replace(/\'/g, "\\'") + "')";\r
+                                               });\r
+\r
+                                               styles[name] = isEncoded ? decode(value, true) : value;\r
+                                       }\r
+\r
+                                       styleRegExp.lastIndex = matches.index + matches[0].length;\r
                                }\r
+\r
+                               // Compress the styles to reduce it's size for example IE will expand styles\r
+                               compress("border", "");\r
+                               compress("border", "-width");\r
+                               compress("border", "-color");\r
+                               compress("border", "-style");\r
+                               compress("padding", "");\r
+                               compress("margin", "");\r
+                               compress2('border', 'border-width', 'border-style', 'border-color');\r
+\r
+                               // Remove pointless border, IE produces these\r
+                               if (styles.border === 'medium none')\r
+                                       delete styles.border;\r
                        }\r
 \r
-                       // Remove Apple and WebKit stuff\r
-                       if (isWebKit && n === "class" && v)\r
-                               v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');\r
+                       return styles;\r
+               },\r
 \r
-                       // Handle IE issues\r
-                       if (isIE) {\r
-                               switch (n) {\r
-                                       case 'rowspan':\r
-                                       case 'colspan':\r
-                                               // IE returns 1 as default value\r
-                                               if (v === 1)\r
-                                                       v = '';\r
+               serialize : function(styles, element_name) {\r
+                       var css = '', name, value;\r
 \r
-                                               break;\r
+                       function serializeStyles(name) {\r
+                               var styleList, i, l, value;\r
 \r
-                                       case 'size':\r
-                                               // IE returns +0 as default value for size\r
-                                               if (v === '+0' || v === 20 || v === 0)\r
-                                                       v = '';\r
+                               styleList = schema.styles[name];\r
+                               if (styleList) {\r
+                                       for (i = 0, l = styleList.length; i < l; i++) {\r
+                                               name = styleList[i];\r
+                                               value = styles[name];\r
 \r
-                                               break;\r
+                                               if (value !== undef && value.length > 0)\r
+                                                       css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                                       }\r
+                               }\r
+                       };\r
 \r
-                                       case 'width':\r
-                                       case 'height':\r
-                                       case 'vspace':\r
-                                       case 'checked':\r
-                                       case 'disabled':\r
-                                       case 'readonly':\r
-                                               if (v === 0)\r
-                                                       v = '';\r
+                       // Serialize styles according to schema\r
+                       if (element_name && schema && schema.styles) {\r
+                               // Serialize global styles and element specific styles\r
+                               serializeStyles('*');\r
+                               serializeStyles(element_name);\r
+                       } else {\r
+                               // Output the styles in the order they are inside the object\r
+                               for (name in styles) {\r
+                                       value = styles[name];\r
 \r
-                                               break;\r
+                                       if (value !== undef && value.length > 0)\r
+                                               css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                               }\r
+                       }\r
 \r
-                                       case 'hspace':\r
-                                               // IE returns -1 as default value\r
-                                               if (v === -1)\r
-                                                       v = '';\r
+                       return css;\r
+               }\r
+       };\r
+};\r
 \r
-                                               break;\r
+(function(tinymce) {\r
+       var mapCache = {}, makeMap = tinymce.makeMap, each = tinymce.each;\r
 \r
-                                       case 'maxlength':\r
-                                       case 'tabindex':\r
-                                               // IE returns default value\r
-                                               if (v === 32768 || v === 2147483647 || v === '32768')\r
-                                                       v = '';\r
+       function split(str, delim) {\r
+               return str.split(delim || ',');\r
+       };\r
 \r
-                                               break;\r
+       function unpack(lookup, data) {\r
+               var key, elements = {};\r
 \r
-                                       case 'multiple':\r
-                                       case 'compact':\r
-                                       case 'noshade':\r
-                                       case 'nowrap':\r
-                                               if (v === 65535)\r
-                                                       return n;\r
+               function replace(value) {\r
+                       return value.replace(/[A-Z]+/g, function(key) {\r
+                               return replace(lookup[key]);\r
+                       });\r
+               };\r
 \r
-                                               return dv;\r
+               // Unpack lookup\r
+               for (key in lookup) {\r
+                       if (lookup.hasOwnProperty(key))\r
+                               lookup[key] = replace(lookup[key]);\r
+               }\r
 \r
-                                       case 'shape':\r
-                                               v = v.toLowerCase();\r
-                                               break;\r
+               // Unpack and parse data into object map\r
+               replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g, function(str, name, attributes, children) {\r
+                       attributes = split(attributes, '|');\r
 \r
-                                       default:\r
-                                               // IE has odd anonymous function for event attributes\r
-                                               if (n.indexOf('on') === 0 && v)\r
-                                                       v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1');\r
-                               }\r
+                       elements[name] = {\r
+                               attributes : makeMap(attributes),\r
+                               attributesOrder : attributes,\r
+                               children : makeMap(children, '|', {'#comment' : {}})\r
                        }\r
+               });\r
 \r
-                       return (v !== undefined && v !== null && v !== '') ? '' + v : dv;\r
-               },\r
+               return elements;\r
+       };\r
 \r
-               getPos : function(n, ro) {\r
-                       var t = this, x = 0, y = 0, e, d = t.doc, r;\r
+       function getHTML5() {\r
+               var html5 = mapCache.html5;\r
+\r
+               if (!html5) {\r
+                       html5 = mapCache.html5 = unpack({\r
+                                       A : 'id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title',\r
+                                       B : '#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video',\r
+                                       C : '#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video'\r
+                               }, 'html[A|manifest][body|head]' +\r
+                                       'head[A][base|command|link|meta|noscript|script|style|title]' +\r
+                                       'title[A][#]' +\r
+                                       'base[A|href|target][]' +\r
+                                       'link[A|href|rel|media|type|sizes][]' +\r
+                                       'meta[A|http-equiv|name|content|charset][]' +\r
+                                       'style[A|type|media|scoped][#]' +\r
+                                       'script[A|charset|type|src|defer|async][#]' +\r
+                                       'noscript[A][C]' +\r
+                                       'body[A][C]' +\r
+                                       'section[A][C]' +\r
+                                       'nav[A][C]' +\r
+                                       'article[A][C]' +\r
+                                       'aside[A][C]' +\r
+                                       'h1[A][B]' +\r
+                                       'h2[A][B]' +\r
+                                       'h3[A][B]' +\r
+                                       'h4[A][B]' +\r
+                                       'h5[A][B]' +\r
+                                       'h6[A][B]' +\r
+                                       'hgroup[A][h1|h2|h3|h4|h5|h6]' +\r
+                                       'header[A][C]' +\r
+                                       'footer[A][C]' +\r
+                                       'address[A][C]' +\r
+                                       'p[A][B]' +\r
+                                       'br[A][]' +\r
+                                       'pre[A][B]' +\r
+                                       'dialog[A][dd|dt]' +\r
+                                       'blockquote[A|cite][C]' +\r
+                                       'ol[A|start|reversed][li]' +\r
+                                       'ul[A][li]' +\r
+                                       'li[A|value][C]' +\r
+                                       'dl[A][dd|dt]' +\r
+                                       'dt[A][B]' +\r
+                                       'dd[A][C]' +\r
+                                       'a[A|href|target|ping|rel|media|type][C]' +\r
+                                       'em[A][B]' +\r
+                                       'strong[A][B]' +\r
+                                       'small[A][B]' +\r
+                                       'cite[A][B]' +\r
+                                       'q[A|cite][B]' +\r
+                                       'dfn[A][B]' +\r
+                                       'abbr[A][B]' +\r
+                                       'code[A][B]' +\r
+                                       'var[A][B]' +\r
+                                       'samp[A][B]' +\r
+                                       'kbd[A][B]' +\r
+                                       'sub[A][B]' +\r
+                                       'sup[A][B]' +\r
+                                       'i[A][B]' +\r
+                                       'b[A][B]' +\r
+                                       'mark[A][B]' +\r
+                                       'progress[A|value|max][B]' +\r
+                                       'meter[A|value|min|max|low|high|optimum][B]' +\r
+                                       'time[A|datetime][B]' +\r
+                                       'ruby[A][B|rt|rp]' +\r
+                                       'rt[A][B]' +\r
+                                       'rp[A][B]' +\r
+                                       'bdo[A][B]' +\r
+                                       'span[A][B]' +\r
+                                       'ins[A|cite|datetime][B]' +\r
+                                       'del[A|cite|datetime][B]' +\r
+                                       'figure[A][C|legend]' +\r
+                                       'img[A|alt|src|height|width|usemap|ismap][]' +\r
+                                       'iframe[A|name|src|height|width|sandbox|seamless][]' +\r
+                                       'embed[A|src|height|width|type][]' +\r
+                                       'object[A|data|type|height|width|usemap|name|form|classid][param]' +\r
+                                       'param[A|name|value][]' +\r
+                                       'details[A|open][C|legend]' +\r
+                                       'command[A|type|label|icon|disabled|checked|radiogroup][]' +\r
+                                       'menu[A|type|label][C|li]' +\r
+                                       'legend[A][C|B]' +\r
+                                       'div[A][C]' +\r
+                                       'source[A|src|type|media][]' +\r
+                                       'audio[A|src|autobuffer|autoplay|loop|controls][source]' +\r
+                                       'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]' +\r
+                                       'hr[A][]' +\r
+                                       'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +\r
+                                       'fieldset[A|disabled|form|name][C|legend]' +\r
+                                       'label[A|form|for][B]' +\r
+                                       'input[A|type|accept|alt|autocomplete|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value][]' +\r
+                                       'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +\r
+                                       'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +\r
+                                       'datalist[A][B|option]' +\r
+                                       'optgroup[A|disabled|label][option]' +\r
+                                       'option[A|disabled|selected|label|value][]' +\r
+                                       'textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]' +\r
+                                       'keygen[A|autofocus|challenge|disabled|form|keytype|name][]' +\r
+                                       'output[A|for|form|name][B]' +\r
+                                       'canvas[A|width|height][]' +\r
+                                       'map[A|name][B|C]' +\r
+                                       'area[A|shape|coords|href|alt|target|media|rel|ping|type][]' +\r
+                                       'mathml[A][]' +\r
+                                       'svg[A][]' +\r
+                                       'table[A|summary][caption|colgroup|thead|tfoot|tbody|tr]' +\r
+                                       'caption[A][C]' +\r
+                                       'colgroup[A|span][col]' +\r
+                                       'col[A|span][]' +\r
+                                       'thead[A][tr]' +\r
+                                       'tfoot[A][tr]' +\r
+                                       'tbody[A][tr]' +\r
+                                       'tr[A][th|td]' +\r
+                                       'th[A|headers|rowspan|colspan|scope][B]' +\r
+                                       'td[A|headers|rowspan|colspan][C]'\r
+                       );\r
+               }\r
 \r
-                       n = t.get(n);\r
-                       ro = ro || d.body;\r
+               return html5;\r
+       };\r
 \r
-                       if (n) {\r
-                               // Use getBoundingClientRect on IE, Opera has it but it's not perfect\r
-                               if (isIE && !t.stdMode) {\r
-                                       n = n.getBoundingClientRect();\r
-                                       e = t.boxModel ? d.documentElement : d.body;\r
-                                       x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border\r
-                                       x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x;\r
-                                       n.top += t.win.self != t.win.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset\r
+       function getHTML4() {\r
+               var html4 = mapCache.html4;\r
+\r
+               if (!html4) {\r
+                       // This is the XHTML 1.0 transitional elements with it's attributes and children packed to reduce it's size\r
+                       html4 = mapCache.html4 = unpack({\r
+                               Z : 'H|K|N|O|P',\r
+                               Y : 'X|form|R|Q',\r
+                               ZG : 'E|span|width|align|char|charoff|valign',\r
+                               X : 'p|T|div|U|W|isindex|fieldset|table',\r
+                               ZF : 'E|align|char|charoff|valign',\r
+                               W : 'pre|hr|blockquote|address|center|noframes',\r
+                               ZE : 'abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height',\r
+                               ZD : '[E][S]',\r
+                               U : 'ul|ol|dl|menu|dir',\r
+                               ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q',\r
+                               T : 'h1|h2|h3|h4|h5|h6',\r
+                               ZB : 'X|S|Q',\r
+                               S : 'R|P',\r
+                               ZA : 'a|G|J|M|O|P',\r
+                               R : 'a|H|K|N|O',\r
+                               Q : 'noscript|P',\r
+                               P : 'ins|del|script',\r
+                               O : 'input|select|textarea|label|button',\r
+                               N : 'M|L',\r
+                               M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym',\r
+                               L : 'sub|sup',\r
+                               K : 'J|I',\r
+                               J : 'tt|i|b|u|s|strike',\r
+                               I : 'big|small|font|basefont',\r
+                               H : 'G|F',\r
+                               G : 'br|span|bdo',\r
+                               F : 'object|applet|img|map|iframe',\r
+                               E : 'A|B|C',\r
+                               D : 'accesskey|tabindex|onfocus|onblur',\r
+                               C : 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',\r
+                               B : 'lang|xml:lang|dir',\r
+                               A : 'id|class|style|title'\r
+                       }, 'script[id|charset|type|language|src|defer|xml:space][]' + \r
+                               'style[B|id|type|media|title|xml:space][]' + \r
+                               'object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]' + \r
+                               'param[id|name|value|valuetype|type][]' + \r
+                               'p[E|align][#|S]' + \r
+                               'a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]' + \r
+                               'br[A|clear][]' + \r
+                               'span[E][#|S]' + \r
+                               'bdo[A|C|B][#|S]' + \r
+                               'applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]' + \r
+                               'h1[E|align][#|S]' + \r
+                               'img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]' + \r
+                               'map[B|C|A|name][X|form|Q|area]' + \r
+                               'h2[E|align][#|S]' + \r
+                               'iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]' + \r
+                               'h3[E|align][#|S]' + \r
+                               'tt[E][#|S]' + \r
+                               'i[E][#|S]' + \r
+                               'b[E][#|S]' + \r
+                               'u[E][#|S]' + \r
+                               's[E][#|S]' + \r
+                               'strike[E][#|S]' + \r
+                               'big[E][#|S]' + \r
+                               'small[E][#|S]' + \r
+                               'font[A|B|size|color|face][#|S]' + \r
+                               'basefont[id|size|color|face][]' + \r
+                               'em[E][#|S]' + \r
+                               'strong[E][#|S]' + \r
+                               'dfn[E][#|S]' + \r
+                               'code[E][#|S]' + \r
+                               'q[E|cite][#|S]' + \r
+                               'samp[E][#|S]' + \r
+                               'kbd[E][#|S]' + \r
+                               'var[E][#|S]' + \r
+                               'cite[E][#|S]' + \r
+                               'abbr[E][#|S]' + \r
+                               'acronym[E][#|S]' + \r
+                               'sub[E][#|S]' + \r
+                               'sup[E][#|S]' + \r
+                               'input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]' + \r
+                               'select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]' + \r
+                               'optgroup[E|disabled|label][option]' + \r
+                               'option[E|selected|disabled|label|value][]' + \r
+                               'textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]' + \r
+                               'label[E|for|accesskey|onfocus|onblur][#|S]' + \r
+                               'button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' + \r
+                               'h4[E|align][#|S]' + \r
+                               'ins[E|cite|datetime][#|Y]' + \r
+                               'h5[E|align][#|S]' + \r
+                               'del[E|cite|datetime][#|Y]' + \r
+                               'h6[E|align][#|S]' + \r
+                               'div[E|align][#|Y]' + \r
+                               'ul[E|type|compact][li]' + \r
+                               'li[E|type|value][#|Y]' + \r
+                               'ol[E|type|compact|start][li]' + \r
+                               'dl[E|compact][dt|dd]' + \r
+                               'dt[E][#|S]' + \r
+                               'dd[E][#|Y]' + \r
+                               'menu[E|compact][li]' + \r
+                               'dir[E|compact][li]' + \r
+                               'pre[E|width|xml:space][#|ZA]' + \r
+                               'hr[E|align|noshade|size|width][]' + \r
+                               'blockquote[E|cite][#|Y]' + \r
+                               'address[E][#|S|p]' + \r
+                               'center[E][#|Y]' + \r
+                               'noframes[E][#|Y]' + \r
+                               'isindex[A|B|prompt][]' + \r
+                               'fieldset[E][#|legend|Y]' + \r
+                               'legend[E|accesskey|align][#|S]' + \r
+                               'table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]' + \r
+                               'caption[E|align][#|S]' + \r
+                               'col[ZG][]' + \r
+                               'colgroup[ZG][col]' + \r
+                               'thead[ZF][tr]' + \r
+                               'tr[ZF|bgcolor][th|td]' + \r
+                               'th[E|ZE][#|Y]' + \r
+                               'form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]' + \r
+                               'noscript[E][#|Y]' + \r
+                               'td[E|ZE][#|Y]' + \r
+                               'tfoot[ZF][tr]' + \r
+                               'tbody[ZF][tr]' + \r
+                               'area[E|D|shape|coords|href|nohref|alt|target][]' + \r
+                               'base[id|href|target][]' + \r
+                               'body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]'\r
+                       );\r
+               }\r
 \r
-                                       return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};\r
-                               }\r
+               return html4;\r
+       };\r
 \r
-                               r = n;\r
-                               while (r && r != ro && r.nodeType) {\r
-                                       x += r.offsetLeft || 0;\r
-                                       y += r.offsetTop || 0;\r
-                                       r = r.offsetParent;\r
-                               }\r
+       tinymce.html.Schema = function(settings) {\r
+               var self = this, elements = {}, children = {}, patternElements = [], validStyles, schemaItems;\r
+               var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, blockElementsMap, nonEmptyElementsMap, customElementsMap = {};\r
 \r
-                               r = n.parentNode;\r
-                               while (r && r != ro && r.nodeType) {\r
-                                       x -= r.scrollLeft || 0;\r
-                                       y -= r.scrollTop || 0;\r
-                                       r = r.parentNode;\r
+               // Creates an lookup table map object for the specified option or the default value\r
+               function createLookupTable(option, default_value, extend) {\r
+                       var value = settings[option];\r
+\r
+                       if (!value) {\r
+                               // Get cached default map or make it if needed\r
+                               value = mapCache[option];\r
+\r
+                               if (!value) {\r
+                                       value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' '));\r
+                                       value = tinymce.extend(value, extend);\r
+\r
+                                       mapCache[option] = value;\r
                                }\r
+                       } else {\r
+                               // Create custom map\r
+                               value = makeMap(value, ',', makeMap(value.toUpperCase(), ' '));\r
                        }\r
 \r
-                       return {x : x, y : y};\r
-               },\r
+                       return value;\r
+               };\r
 \r
-               parseStyle : function(st) {\r
-                       var t = this, s = t.settings, o = {};\r
+               settings = settings || {};\r
+               schemaItems = settings.schema == "html5" ? getHTML5() : getHTML4();\r
 \r
-                       if (!st)\r
-                               return o;\r
+               // Allow all elements and attributes if verify_html is set to false\r
+               if (settings.verify_html === false)\r
+                       settings.valid_elements = '*[*]';\r
 \r
-                       function compress(p, s, ot) {\r
-                               var t, r, b, l;\r
+               // Build styles list\r
+               if (settings.valid_styles) {\r
+                       validStyles = {};\r
 \r
-                               // Get values and check it it needs compressing\r
-                               t = o[p + '-top' + s];\r
-                               if (!t)\r
-                                       return;\r
+                       // Convert styles into a rule list\r
+                       each(settings.valid_styles, function(value, key) {\r
+                               validStyles[key] = tinymce.explode(value);\r
+                       });\r
+               }\r
 \r
-                               r = o[p + '-right' + s];\r
-                               if (t != r)\r
-                                       return;\r
+               // Setup map objects\r
+               whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script style textarea');\r
+               selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li options p td tfoot th thead tr');\r
+               shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source');\r
+               boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');\r
+               nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap);\r
+               blockElementsMap = createLookupTable('block_elements', 'h1 h2 h3 h4 h5 h6 hr p div address pre form table tbody thead tfoot ' + \r
+                                               'th tr td li ol ul caption blockquote center dl dt dd dir fieldset ' + \r
+                                               'noscript menu isindex samp header footer article section hgroup aside nav');\r
+\r
+               // Converts a wildcard expression string to a regexp for example *a will become /.*a/.\r
+               function patternToRegExp(str) {\r
+                       return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');\r
+               };\r
 \r
-                               b = o[p + '-bottom' + s];\r
-                               if (r != b)\r
-                                       return;\r
+               // Parses the specified valid_elements string and adds to the current rules\r
+               // This function is a bit hard to read since it's heavily optimized for speed\r
+               function addValidElements(valid_elements) {\r
+                       var ei, el, ai, al, yl, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder,\r
+                               prefix, outputName, globalAttributes, globalAttributesOrder, transElement, key, childKey, value,\r
+                               elementRuleRegExp = /^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,\r
+                               attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,\r
+                               hasPatternsRegExp = /[*?+]/;\r
+\r
+                       if (valid_elements) {\r
+                               // Split valid elements into an array with rules\r
+                               valid_elements = split(valid_elements);\r
+\r
+                               if (elements['@']) {\r
+                                       globalAttributes = elements['@'].attributes;\r
+                                       globalAttributesOrder = elements['@'].attributesOrder;\r
+                               }\r
 \r
-                               l = o[p + '-left' + s];\r
-                               if (b != l)\r
-                                       return;\r
+                               // Loop all rules\r
+                               for (ei = 0, el = valid_elements.length; ei < el; ei++) {\r
+                                       // Parse element rule\r
+                                       matches = elementRuleRegExp.exec(valid_elements[ei]);\r
+                                       if (matches) {\r
+                                               // Setup local names for matches\r
+                                               prefix = matches[1];\r
+                                               elementName = matches[2];\r
+                                               outputName = matches[3];\r
+                                               attrData = matches[4];\r
+\r
+                                               // Create new attributes and attributesOrder\r
+                                               attributes = {};\r
+                                               attributesOrder = [];\r
+\r
+                                               // Create the new element\r
+                                               element = {\r
+                                                       attributes : attributes,\r
+                                                       attributesOrder : attributesOrder\r
+                                               };\r
 \r
-                               // Compress\r
-                               o[ot] = l;\r
-                               delete o[p + '-top' + s];\r
-                               delete o[p + '-right' + s];\r
-                               delete o[p + '-bottom' + s];\r
-                               delete o[p + '-left' + s];\r
-                       };\r
+                                               // Padd empty elements prefix\r
+                                               if (prefix === '#')\r
+                                                       element.paddEmpty = true;\r
 \r
-                       function compress2(ta, a, b, c) {\r
-                               var t;\r
+                                               // Remove empty elements prefix\r
+                                               if (prefix === '-')\r
+                                                       element.removeEmpty = true;\r
 \r
-                               t = o[a];\r
-                               if (!t)\r
-                                       return;\r
+                                               // Copy attributes from global rule into current rule\r
+                                               if (globalAttributes) {\r
+                                                       for (key in globalAttributes)\r
+                                                               attributes[key] = globalAttributes[key];\r
 \r
-                               t = o[b];\r
-                               if (!t)\r
-                                       return;\r
+                                                       attributesOrder.push.apply(attributesOrder, globalAttributesOrder);\r
+                                               }\r
 \r
-                               t = o[c];\r
-                               if (!t)\r
-                                       return;\r
+                                               // Attributes defined\r
+                                               if (attrData) {\r
+                                                       attrData = split(attrData, '|');\r
+                                                       for (ai = 0, al = attrData.length; ai < al; ai++) {\r
+                                                               matches = attrRuleRegExp.exec(attrData[ai]);\r
+                                                               if (matches) {\r
+                                                                       attr = {};\r
+                                                                       attrType = matches[1];\r
+                                                                       attrName = matches[2].replace(/::/g, ':');\r
+                                                                       prefix = matches[3];\r
+                                                                       value = matches[4];\r
+\r
+                                                                       // Required\r
+                                                                       if (attrType === '!') {\r
+                                                                               element.attributesRequired = element.attributesRequired || [];\r
+                                                                               element.attributesRequired.push(attrName);\r
+                                                                               attr.required = true;\r
+                                                                       }\r
 \r
-                               // Compress\r
-                               o[ta] = o[a] + ' ' + o[b] + ' ' + o[c];\r
-                               delete o[a];\r
-                               delete o[b];\r
-                               delete o[c];\r
-                       };\r
+                                                                       // Denied from global\r
+                                                                       if (attrType === '-') {\r
+                                                                               delete attributes[attrName];\r
+                                                                               attributesOrder.splice(tinymce.inArray(attributesOrder, attrName), 1);\r
+                                                                               continue;\r
+                                                                       }\r
 \r
-                       st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities\r
+                                                                       // Default value\r
+                                                                       if (prefix) {\r
+                                                                               // Default value\r
+                                                                               if (prefix === '=') {\r
+                                                                                       element.attributesDefault = element.attributesDefault || [];\r
+                                                                                       element.attributesDefault.push({name: attrName, value: value});\r
+                                                                                       attr.defaultValue = value;\r
+                                                                               }\r
 \r
-                       each(st.split(';'), function(v) {\r
-                               var sv, ur = [];\r
+                                                                               // Forced value\r
+                                                                               if (prefix === ':') {\r
+                                                                                       element.attributesForced = element.attributesForced || [];\r
+                                                                                       element.attributesForced.push({name: attrName, value: value});\r
+                                                                                       attr.forcedValue = value;\r
+                                                                               }\r
 \r
-                               if (v) {\r
-                                       v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities\r
-                                       v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';});\r
-                                       v = v.split(':');\r
-                                       sv = tinymce.trim(v[1]);\r
-                                       sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];});\r
-\r
-                                       sv = sv.replace(/rgb\([^\)]+\)/g, function(v) {\r
-                                               return t.toHex(v);\r
-                                       });\r
+                                                                               // Required values\r
+                                                                               if (prefix === '<')\r
+                                                                                       attr.validValues = makeMap(value, '?');\r
+                                                                       }\r
 \r
-                                       if (s.url_converter) {\r
-                                               sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) {\r
-                                                       return 'url(' + s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null) + ')';\r
-                                               });\r
-                                       }\r
+                                                                       // Check for attribute patterns\r
+                                                                       if (hasPatternsRegExp.test(attrName)) {\r
+                                                                               element.attributePatterns = element.attributePatterns || [];\r
+                                                                               attr.pattern = patternToRegExp(attrName);\r
+                                                                               element.attributePatterns.push(attr);\r
+                                                                       } else {\r
+                                                                               // Add attribute to order list if it doesn't already exist\r
+                                                                               if (!attributes[attrName])\r
+                                                                                       attributesOrder.push(attrName);\r
 \r
-                                       o[tinymce.trim(v[0]).toLowerCase()] = sv;\r
-                               }\r
-                       });\r
+                                                                               attributes[attrName] = attr;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
 \r
-                       compress("border", "", "border");\r
-                       compress("border", "-width", "border-width");\r
-                       compress("border", "-color", "border-color");\r
-                       compress("border", "-style", "border-style");\r
-                       compress("padding", "", "padding");\r
-                       compress("margin", "", "margin");\r
-                       compress2('border', 'border-width', 'border-style', 'border-color');\r
+                                               // Global rule, store away these for later usage\r
+                                               if (!globalAttributes && elementName == '@') {\r
+                                                       globalAttributes = attributes;\r
+                                                       globalAttributesOrder = attributesOrder;\r
+                                               }\r
 \r
-                       if (isIE) {\r
-                               // Remove pointless border\r
-                               if (o.border == 'medium none')\r
-                                       o.border = '';\r
+                                               // Handle substitute elements such as b/strong\r
+                                               if (outputName) {\r
+                                                       element.outputName = elementName;\r
+                                                       elements[outputName] = element;\r
+                                               }\r
+\r
+                                               // Add pattern or exact element\r
+                                               if (hasPatternsRegExp.test(elementName)) {\r
+                                                       element.pattern = patternToRegExp(elementName);\r
+                                                       patternElements.push(element);\r
+                                               } else\r
+                                                       elements[elementName] = element;\r
+                                       }\r
+                               }\r
                        }\r
+               };\r
 \r
-                       return o;\r
-               },\r
+               function setValidElements(valid_elements) {\r
+                       elements = {};\r
+                       patternElements = [];\r
 \r
-               serializeStyle : function(o, name) {\r
-                       var t = this, s = '';\r
+                       addValidElements(valid_elements);\r
 \r
-                       function add(v, k) {\r
-                               if (k && v) {\r
-                                       // Remove browser specific styles like -moz- or -webkit-\r
-                                       if (k.indexOf('-') === 0)\r
-                                               return;\r
+                       each(schemaItems, function(element, name) {\r
+                               children[name] = element.children;\r
+                       });\r
+               };\r
 \r
-                                       switch (k) {\r
-                                               case 'font-weight':\r
-                                                       // Opera will output bold as 700\r
-                                                       if (v == 700)\r
-                                                               v = 'bold';\r
+               // Adds custom non HTML elements to the schema\r
+               function addCustomElements(custom_elements) {\r
+                       var customElementRegExp = /^(~)?(.+)$/;\r
 \r
-                                                       break;\r
+                       if (custom_elements) {\r
+                               each(split(custom_elements), function(rule) {\r
+                                       var matches = customElementRegExp.exec(rule),\r
+                                               inline = matches[1] === '~',\r
+                                               cloneName = inline ? 'span' : 'div',\r
+                                               name = matches[2];\r
 \r
-                                               case 'color':\r
-                                               case 'background-color':\r
-                                                       v = v.toLowerCase();\r
-                                                       break;\r
-                                       }\r
+                                       children[name] = children[cloneName];\r
+                                       customElementsMap[name] = cloneName;\r
 \r
-                                       s += (s ? ' ' : '') + k + ': ' + v + ';';\r
-                               }\r
-                       };\r
+                                       // If it's not marked as inline then add it to valid block elements\r
+                                       if (!inline)\r
+                                               blockElementsMap[name] = {};\r
 \r
-                       // Validate style output\r
-                       if (name && t._styles) {\r
-                               each(t._styles['*'], function(name) {\r
-                                       add(o[name], name);\r
+                                       // Add custom elements at span/div positions\r
+                                       each(children, function(element, child) {\r
+                                               if (element[cloneName])\r
+                                                       element[name] = element[cloneName];\r
+                                       });\r
                                });\r
+                       }\r
+               };\r
+\r
+               // Adds valid children to the schema object\r
+               function addValidChildren(valid_children) {\r
+                       var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;\r
+\r
+                       if (valid_children) {\r
+                               each(split(valid_children), function(rule) {\r
+                                       var matches = childRuleRegExp.exec(rule), parent, prefix;\r
+\r
+                                       if (matches) {\r
+                                               prefix = matches[1];\r
+\r
+                                               // Add/remove items from default\r
+                                               if (prefix)\r
+                                                       parent = children[matches[2]];\r
+                                               else\r
+                                                       parent = children[matches[2]] = {'#comment' : {}};\r
+\r
+                                               parent = children[matches[2]];\r
 \r
-                               each(t._styles[name.toLowerCase()], function(name) {\r
-                                       add(o[name], name);\r
+                                               each(split(matches[3], '|'), function(child) {\r
+                                                       if (prefix === '-')\r
+                                                               delete parent[child];\r
+                                                       else\r
+                                                               parent[child] = {};\r
+                                               });\r
+                                       }\r
                                });\r
-                       } else\r
-                               each(o, add);\r
+                       }\r
+               };\r
 \r
-                       return s;\r
-               },\r
+               function getElementRule(name) {\r
+                       var element = elements[name], i;\r
 \r
-               loadCSS : function(u) {\r
-                       var t = this, d = t.doc, head;\r
+                       // Exact match found\r
+                       if (element)\r
+                               return element;\r
 \r
-                       if (!u)\r
-                               u = '';\r
+                       // No exact match then try the patterns\r
+                       i = patternElements.length;\r
+                       while (i--) {\r
+                               element = patternElements[i];\r
 \r
-                       head = t.select('head')[0];\r
+                               if (element.pattern.test(name))\r
+                                       return element;\r
+                       }\r
+               };\r
 \r
-                       each(u.split(','), function(u) {\r
-                               var link;\r
+               if (!settings.valid_elements) {\r
+                       // No valid elements defined then clone the elements from the schema spec\r
+                       each(schemaItems, function(element, name) {\r
+                               elements[name] = {\r
+                                       attributes : element.attributes,\r
+                                       attributesOrder : element.attributesOrder\r
+                               };\r
 \r
-                               if (t.files[u])\r
-                                       return;\r
+                               children[name] = element.children;\r
+                       });\r
 \r
-                               t.files[u] = true;\r
-                               link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});\r
+                       // Switch these on HTML4\r
+                       if (settings.schema != "html5") {\r
+                               each(split('strong/b,em/i'), function(item) {\r
+                                       item = split(item, '/');\r
+                                       elements[item[1]].outputName = item[0];\r
+                               });\r
+                       }\r
 \r
-                               // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug\r
-                               // This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading\r
-                               // It's ugly but it seems to work fine.\r
-                               if (isIE && d.documentMode) {\r
-                                       link.onload = function() {\r
-                                               d.recalc();\r
-                                               link.onload = null;\r
-                                       };\r
+                       // Add default alt attribute for images\r
+                       elements.img.attributesDefault = [{name: 'alt', value: ''}];\r
+\r
+                       // Remove these if they are empty by default\r
+                       each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i'), function(name) {\r
+                               if (elements[name]) {\r
+                                       elements[name].removeEmpty = true;\r
                                }\r
+                       });\r
 \r
-                               head.appendChild(link);\r
+                       // Padd these by default\r
+                       each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption'), function(name) {\r
+                               elements[name].paddEmpty = true;\r
                        });\r
-               },\r
+               } else\r
+                       setValidElements(settings.valid_elements);\r
 \r
-               addClass : function(e, c) {\r
-                       return this.run(e, function(e) {\r
-                               var o;\r
+               addCustomElements(settings.custom_elements);\r
+               addValidChildren(settings.valid_children);\r
+               addValidElements(settings.extended_valid_elements);\r
 \r
-                               if (!c)\r
-                                       return 0;\r
+               // Todo: Remove this when we fix list handling to be valid\r
+               addValidChildren('+ol[ul|ol],+ul[ul|ol]');\r
 \r
-                               if (this.hasClass(e, c))\r
-                                       return e.className;\r
+               // Delete invalid elements\r
+               if (settings.invalid_elements) {\r
+                       tinymce.each(tinymce.explode(settings.invalid_elements), function(item) {\r
+                               if (elements[item])\r
+                                       delete elements[item];\r
+                       });\r
+               }\r
 \r
-                               o = this.removeClass(e, c);\r
+               // If the user didn't allow span only allow internal spans\r
+               if (!getElementRule('span'))\r
+                       addValidElements('span[!data-mce-type|*]');\r
 \r
-                               return e.className = (o != '' ? (o + ' ') : '') + c;\r
-                       });\r
-               },\r
+               self.children = children;\r
 \r
-               removeClass : function(e, c) {\r
-                       var t = this, re;\r
+               self.styles = validStyles;\r
 \r
-                       return t.run(e, function(e) {\r
-                               var v;\r
+               self.getBoolAttrs = function() {\r
+                       return boolAttrMap;\r
+               };\r
 \r
-                               if (t.hasClass(e, c)) {\r
-                                       if (!re)\r
-                                               re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");\r
+               self.getBlockElements = function() {\r
+                       return blockElementsMap;\r
+               };\r
 \r
-                                       v = e.className.replace(re, ' ');\r
-                                       v = tinymce.trim(v != ' ' ? v : '');\r
+               self.getShortEndedElements = function() {\r
+                       return shortEndedElementsMap;\r
+               };\r
 \r
-                                       e.className = v;\r
+               self.getSelfClosingElements = function() {\r
+                       return selfClosingElementsMap;\r
+               };\r
 \r
-                                       // Empty class attr\r
-                                       if (!v) {\r
-                                               e.removeAttribute('class');\r
-                                               e.removeAttribute('className');\r
-                                       }\r
+               self.getNonEmptyElements = function() {\r
+                       return nonEmptyElementsMap;\r
+               };\r
 \r
-                                       return v;\r
-                               }\r
+               self.getWhiteSpaceElements = function() {\r
+                       return whiteSpaceElementsMap;\r
+               };\r
 \r
-                               return e.className;\r
-                       });\r
-               },\r
+               self.isValidChild = function(name, child) {\r
+                       var parent = children[name];\r
 \r
-               hasClass : function(n, c) {\r
-                       n = this.get(n);\r
+                       return !!(parent && parent[child]);\r
+               };\r
 \r
-                       if (!n || !c)\r
-                               return false;\r
+               self.getElementRule = getElementRule;\r
 \r
-                       return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;\r
-               },\r
+               self.getCustomElements = function() {\r
+                       return customElementsMap;\r
+               };\r
 \r
-               show : function(e) {\r
-                       return this.setStyle(e, 'display', 'block');\r
-               },\r
+               self.addValidElements = addValidElements;\r
 \r
-               hide : function(e) {\r
-                       return this.setStyle(e, 'display', 'none');\r
-               },\r
+               self.setValidElements = setValidElements;\r
 \r
-               isHidden : function(e) {\r
-                       e = this.get(e);\r
+               self.addCustomElements = addCustomElements;\r
 \r
-                       return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';\r
-               },\r
+               self.addValidChildren = addValidChildren;\r
+       };\r
+})(tinymce);\r
 \r
-               uniqueId : function(p) {\r
-                       return (!p ? 'mce_' : p) + (this.counter++);\r
-               },\r
+(function(tinymce) {\r
+       tinymce.html.SaxParser = function(settings, schema) {\r
+               var self = this, noop = function() {};\r
 \r
-               setHTML : function(e, h) {\r
-                       var t = this;\r
+               settings = settings || {};\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
 \r
-                       return this.run(e, function(e) {\r
-                               var x, i, nl, n, p, x;\r
+               if (settings.fix_self_closing !== false)\r
+                       settings.fix_self_closing = true;\r
 \r
-                               h = t.processHTML(h);\r
+               // Add handler functions from settings and setup default handlers\r
+               tinymce.each('comment cdata text start end pi doctype'.split(' '), function(name) {\r
+                       if (name)\r
+                               self[name] = settings[name] || noop;\r
+               });\r
 \r
-                               if (isIE) {\r
-                                       function set() {\r
-                                               // Remove all child nodes\r
-                                               while (e.firstChild)\r
-                                                       e.firstChild.removeNode();\r
+               self.parse = function(html) {\r
+                       var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name, isInternalElement, removeInternalElements,\r
+                               shortEndedElements, fillAttrsMap, isShortEnded, validate, elementRule, isValidElement, attr, attribsValue, invalidPrefixRegExp,\r
+                               validAttributesMap, validAttributePatterns, attributesRequired, attributesDefault, attributesForced, selfClosing,\r
+                               tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0, decode = tinymce.html.Entities.decode, fixSelfClosing, isIE;\r
 \r
-                                               try {\r
-                                                       // IE will remove comments from the beginning\r
-                                                       // unless you padd the contents with something\r
-                                                       e.innerHTML = '<br />' + h;\r
-                                                       e.removeChild(e.firstChild);\r
-                                               } catch (ex) {\r
-                                                       // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p\r
-                                                       // This seems to fix this problem\r
-\r
-                                                       // Create new div with HTML contents and a BR infront to keep comments\r
-                                                       x = t.create('div');\r
-                                                       x.innerHTML = '<br />' + h;\r
-\r
-                                                       // Add all children from div to target\r
-                                                       each (x.childNodes, function(n, i) {\r
-                                                               // Skip br element\r
-                                                               if (i)\r
-                                                                       e.appendChild(n);\r
-                                                       });\r
-                                               }\r
-                                       };\r
+                       function processEndTag(name) {\r
+                               var pos, i;\r
 \r
-                                       // IE has a serious bug when it comes to paragraphs it can produce an invalid\r
-                                       // DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted\r
-                                       // It seems to be that IE doesn't like a root block element placed inside another root block element\r
-                                       if (t.settings.fix_ie_paragraphs)\r
-                                               h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 _mce_keep="true">&nbsp;</p>');\r
+                               // Find position of parent of the same type\r
+                               pos = stack.length;\r
+                               while (pos--) {\r
+                                       if (stack[pos].name === name)\r
+                                               break;                                          \r
+                               }\r
 \r
-                                       set();\r
+                               // Found parent\r
+                               if (pos >= 0) {\r
+                                       // Close all the open elements\r
+                                       for (i = stack.length - 1; i >= pos; i--) {\r
+                                               name = stack[i];\r
 \r
-                                       if (t.settings.fix_ie_paragraphs) {\r
-                                               // Check for odd paragraphs this is a sign of a broken DOM\r
-                                               nl = e.getElementsByTagName("p");\r
-                                               for (i = nl.length - 1, x = 0; i >= 0; i--) {\r
-                                                       n = nl[i];\r
+                                               if (name.valid)\r
+                                                       self.end(name.name);\r
+                                       }\r
 \r
-                                                       if (!n.hasChildNodes()) {\r
-                                                               if (!n._mce_keep) {\r
-                                                                       x = 1; // Is broken\r
-                                                                       break;\r
-                                                               }\r
+                                       // Remove the open elements from the stack\r
+                                       stack.length = pos;\r
+                               }\r
+                       };\r
 \r
-                                                               n.removeAttribute('_mce_keep');\r
-                                                       }\r
-                                               }\r
-                                       }\r
+                       // Precompile RegExps and map objects\r
+                       tokenRegExp = new RegExp('<(?:' +\r
+                               '(?:!--([\\w\\W]*?)-->)|' + // Comment\r
+                               '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA\r
+                               '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE\r
+                               '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI\r
+                               '(?:\\/([^>]+)>)|' + // End element\r
+                               '(?:([A-Za-z0-9\-\:]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element\r
+                       ')', 'g');\r
+\r
+                       attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;\r
+                       specialElements = {\r
+                               'script' : /<\/script[^>]*>/gi,\r
+                               'style' : /<\/style[^>]*>/gi,\r
+                               'noscript' : /<\/noscript[^>]*>/gi\r
+                       };\r
 \r
-                                       // Time to fix the madness IE left us\r
-                                       if (x) {\r
-                                               // So if we replace the p elements with divs and mark them and then replace them back to paragraphs\r
-                                               // after we use innerHTML we can fix the DOM tree\r
-                                               h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 _mce_tmp="1">');\r
-                                               h = h.replace(/<\/p>/gi, '</div>');\r
+                       // Setup lookup tables for empty elements and boolean attributes\r
+                       shortEndedElements = schema.getShortEndedElements();\r
+                       selfClosing = schema.getSelfClosingElements();\r
+                       fillAttrsMap = schema.getBoolAttrs();\r
+                       validate = settings.validate;\r
+                       removeInternalElements = settings.remove_internals;\r
+                       fixSelfClosing = settings.fix_self_closing;\r
+                       isIE = tinymce.isIE;\r
+                       invalidPrefixRegExp = /^:/;\r
+\r
+                       while (matches = tokenRegExp.exec(html)) {\r
+                               // Text\r
+                               if (index < matches.index)\r
+                                       self.text(decode(html.substr(index, matches.index - index)));\r
+\r
+                               if (value = matches[6]) { // End element\r
+                                       value = value.toLowerCase();\r
+\r
+                                       // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements\r
+                                       if (isIE && invalidPrefixRegExp.test(value))\r
+                                               value = value.substr(1);\r
+\r
+                                       processEndTag(value);\r
+                               } else if (value = matches[7]) { // Start element\r
+                                       value = value.toLowerCase();\r
+\r
+                                       // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements\r
+                                       if (isIE && invalidPrefixRegExp.test(value))\r
+                                               value = value.substr(1);\r
+\r
+                                       isShortEnded = value in shortEndedElements;\r
+\r
+                                       // Is self closing tag for example an <li> after an open <li>\r
+                                       if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value)\r
+                                               processEndTag(value);\r
+\r
+                                       // Validate element\r
+                                       if (!validate || (elementRule = schema.getElementRule(value))) {\r
+                                               isValidElement = true;\r
+\r
+                                               // Grab attributes map and patters when validation is enabled\r
+                                               if (validate) {\r
+                                                       validAttributesMap = elementRule.attributes;\r
+                                                       validAttributePatterns = elementRule.attributePatterns;\r
+                                               }\r
 \r
-                                               // Set the new HTML with DIVs\r
-                                               set();\r
+                                               // Parse attributes\r
+                                               if (attribsValue = matches[8]) {\r
+                                                       isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element\r
 \r
-                                               // Replace all DIV elements with the _mce_tmp attibute back to paragraphs\r
-                                               // This is needed since IE has a annoying bug see above for details\r
-                                               // This is a slow process but it has to be done. :(\r
-                                               if (t.settings.fix_ie_paragraphs) {\r
-                                                       nl = e.getElementsByTagName("DIV");\r
-                                                       for (i = nl.length - 1; i >= 0; i--) {\r
-                                                               n = nl[i];\r
+                                                       // If the element has internal attributes then remove it if we are told to do so\r
+                                                       if (isInternalElement && removeInternalElements)\r
+                                                               isValidElement = false;\r
 \r
-                                                               // Is it a temp div\r
-                                                               if (n._mce_tmp) {\r
-                                                                       // Create new paragraph\r
-                                                                       p = t.doc.createElement('p');\r
+                                                       attrList = [];\r
+                                                       attrList.map = {};\r
 \r
-                                                                       // Copy all attributes\r
-                                                                       n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {\r
-                                                                               var v;\r
+                                                       attribsValue.replace(attrRegExp, function(match, name, value, val2, val3) {\r
+                                                               var attrRule, i;\r
 \r
-                                                                               if (b !== '_mce_tmp') {\r
-                                                                                       v = n.getAttribute(b);\r
+                                                               name = name.toLowerCase();\r
+                                                               value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute\r
 \r
-                                                                                       if (!v && b === 'class')\r
-                                                                                               v = n.className;\r
+                                                               // Validate name and value\r
+                                                               if (validate && !isInternalElement && name.indexOf('data-') !== 0) {\r
+                                                                       attrRule = validAttributesMap[name];\r
 \r
-                                                                                       p.setAttribute(b, v);\r
+                                                                       // Find rule by pattern matching\r
+                                                                       if (!attrRule && validAttributePatterns) {\r
+                                                                               i = validAttributePatterns.length;\r
+                                                                               while (i--) {\r
+                                                                                       attrRule = validAttributePatterns[i];\r
+                                                                                       if (attrRule.pattern.test(name))\r
+                                                                                               break;\r
                                                                                }\r
-                                                                       });\r
 \r
-                                                                       // Append all children to new paragraph\r
-                                                                       for (x = 0; x<n.childNodes.length; x++)\r
-                                                                               p.appendChild(n.childNodes[x].cloneNode(true));\r
+                                                                               // No rule matched\r
+                                                                               if (i === -1)\r
+                                                                                       attrRule = null;\r
+                                                                       }\r
+\r
+                                                                       // No attribute rule found\r
+                                                                       if (!attrRule)\r
+                                                                               return;\r
 \r
-                                                                       // Replace div with new paragraph\r
-                                                                       n.swapNode(p);\r
+                                                                       // Validate value\r
+                                                                       if (attrRule.validValues && !(value in attrRule.validValues))\r
+                                                                               return;\r
                                                                }\r
-                                                       }\r
+\r
+                                                               // Add attribute to list and map\r
+                                                               attrList.map[name] = value;\r
+                                                               attrList.push({\r
+                                                                       name: name,\r
+                                                                       value: value\r
+                                                               });\r
+                                                       });\r
+                                               } else {\r
+                                                       attrList = [];\r
+                                                       attrList.map = {};\r
                                                }\r
-                                       }\r
-                               } else\r
-                                       e.innerHTML = h;\r
 \r
-                               return h;\r
-                       });\r
-               },\r
+                                               // Process attributes if validation is enabled\r
+                                               if (validate && !isInternalElement) {\r
+                                                       attributesRequired = elementRule.attributesRequired;\r
+                                                       attributesDefault = elementRule.attributesDefault;\r
+                                                       attributesForced = elementRule.attributesForced;\r
+\r
+                                                       // Handle forced attributes\r
+                                                       if (attributesForced) {\r
+                                                               i = attributesForced.length;\r
+                                                               while (i--) {\r
+                                                                       attr = attributesForced[i];\r
+                                                                       name = attr.name;\r
+                                                                       attrValue = attr.value;\r
+\r
+                                                                       if (attrValue === '{$uid}')\r
+                                                                               attrValue = 'mce_' + idCount++;\r
+\r
+                                                                       attrList.map[name] = attrValue;\r
+                                                                       attrList.push({name: name, value: attrValue});\r
+                                                               }\r
+                                                       }\r
 \r
-               processHTML : function(h) {\r
-                       var t = this, s = t.settings, codeBlocks = [];\r
+                                                       // Handle default attributes\r
+                                                       if (attributesDefault) {\r
+                                                               i = attributesDefault.length;\r
+                                                               while (i--) {\r
+                                                                       attr = attributesDefault[i];\r
+                                                                       name = attr.name;\r
 \r
-                       if (!s.process_html)\r
-                               return h;\r
+                                                                       if (!(name in attrList.map)) {\r
+                                                                               attrValue = attr.value;\r
 \r
-                       if (isIE) {\r
-                               h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos\r
-                               h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct\r
-                       }\r
+                                                                               if (attrValue === '{$uid}')\r
+                                                                                       attrValue = 'mce_' + idCount++;\r
+\r
+                                                                               attrList.map[name] = attrValue;\r
+                                                                               attrList.push({name: name, value: attrValue});\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
 \r
-                       // Fix some issues\r
-                       h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open\r
+                                                       // Handle required attributes\r
+                                                       if (attributesRequired) {\r
+                                                               i = attributesRequired.length;\r
+                                                               while (i--) {\r
+                                                                       if (attributesRequired[i] in attrList.map)\r
+                                                                               break;\r
+                                                               }\r
 \r
-                       // Store away src and href in _mce_src and mce_href since browsers mess them up\r
-                       if (s.keep_values) {\r
-                               // Wrap scripts and styles in comments for serialization purposes\r
-                               if (/<script|noscript|style/i.test(h)) {\r
-                                       function trim(s) {\r
-                                               // Remove prefix and suffix code for element\r
-                                               s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n');\r
-                                               s = s.replace(/^[\r\n]*|[\r\n]*$/g, '');\r
-                                               s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, '');\r
-                                               s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');\r
+                                                               // None of the required attributes where found\r
+                                                               if (i === -1)\r
+                                                                       isValidElement = false;\r
+                                                       }\r
 \r
-                                               return s;\r
-                                       };\r
+                                                       // Invalidate element if it's marked as bogus\r
+                                                       if (attrList.map['data-mce-bogus'])\r
+                                                               isValidElement = false;\r
+                                               }\r
 \r
-                                       // Wrap the script contents in CDATA and keep them from executing\r
-                                       h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi, function(v, attribs, text) {\r
-                                               // Force type attribute\r
-                                               if (!attribs)\r
-                                                       attribs = ' type="text/javascript"';\r
+                                               if (isValidElement)\r
+                                                       self.start(value, attrList, isShortEnded);\r
+                                       } else\r
+                                               isValidElement = false;\r
 \r
-                                               // Convert the src attribute of the scripts\r
-                                               attribs = attribs.replace(/src=\"([^\"]+)\"?/i, function(a, url) {\r
-                                                       if (s.url_converter)\r
-                                                               url = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(url), 'src', 'script'));\r
+                                       // Treat script, noscript and style a bit different since they may include code that looks like elements\r
+                                       if (endRegExp = specialElements[value]) {\r
+                                               endRegExp.lastIndex = index = matches.index + matches[0].length;\r
 \r
-                                                       return '_mce_src="' + url + '"';\r
-                                               });\r
+                                               if (matches = endRegExp.exec(html)) {\r
+                                                       if (isValidElement)\r
+                                                               text = html.substr(index, matches.index - index);\r
 \r
-                                               // Wrap text contents\r
-                                               if (tinymce.trim(text)) {\r
-                                                       codeBlocks.push(trim(text));\r
-                                                       text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n// -->';\r
+                                                       index = matches.index + matches[0].length;\r
+                                               } else {\r
+                                                       text = html.substr(index);\r
+                                                       index = html.length;\r
                                                }\r
 \r
-                                               return '<mce:script' + attribs + '>' + text + '</mce:script>';\r
-                                       });\r
+                                               if (isValidElement && text.length > 0)\r
+                                                       self.text(text, true);\r
 \r
-                                       // Wrap style elements\r
-                                       h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) {\r
-                                               // Wrap text contents\r
-                                               if (text) {\r
-                                                       codeBlocks.push(trim(text));\r
-                                                       text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n-->';\r
-                                               }\r
+                                               if (isValidElement)\r
+                                                       self.end(value);\r
 \r
-                                               return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' _mce_bogus="1">' + text + '</style>';\r
-                                       });\r
+                                               tokenRegExp.lastIndex = index;\r
+                                               continue;\r
+                                       }\r
 \r
-                                       // Wrap noscript elements\r
-                                       h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {\r
-                                               return '<mce:noscript' + attribs + '><!--' + t.encode(text).replace(/--/g, '&#45;&#45;') + '--></mce:noscript>';\r
-                                       });\r
+                                       // Push value on to stack\r
+                                       if (!isShortEnded) {\r
+                                               if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1)\r
+                                                       stack.push({name: value, valid: isValidElement});\r
+                                               else if (isValidElement)\r
+                                                       self.end(value);\r
+                                       }\r
+                               } else if (value = matches[1]) { // Comment\r
+                                       self.comment(value);\r
+                               } else if (value = matches[2]) { // CDATA\r
+                                       self.cdata(value);\r
+                               } else if (value = matches[3]) { // DOCTYPE\r
+                                       self.doctype(value);\r
+                               } else if (value = matches[4]) { // PI\r
+                                       self.pi(value, matches[5]);\r
                                }\r
 \r
-                               h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');\r
-\r
-                               // This function processes the attributes in the HTML string to force boolean\r
-                               // attributes to the attr="attr" format and convert style, src and href to _mce_ versions\r
-                               function processTags(html) {\r
-                                       return html.replace(tagRegExp, function(match, elm_name, attrs, end) {\r
-                                               return '<' + elm_name + attrs.replace(attrRegExp, function(match, name, value, val2, val3) {\r
-                                                       var mceValue;\r
+                               index = matches.index + matches[0].length;\r
+                       }\r
 \r
-                                                       name = name.toLowerCase();\r
-                                                       value = value || val2 || val3 || "";\r
+                       // Text\r
+                       if (index < html.length)\r
+                               self.text(decode(html.substr(index)));\r
 \r
-                                                       // Treat boolean attributes\r
-                                                       if (boolAttrs[name]) {\r
-                                                               // false or 0 is treated as a missing attribute\r
-                                                               if (value === 'false' || value === '0')\r
-                                                                       return;\r
+                       // Close any open elements\r
+                       for (i = stack.length - 1; i >= 0; i--) {\r
+                               value = stack[i];\r
 \r
-                                                               return name + '="' + name + '"';\r
-                                                       }\r
+                               if (value.valid)\r
+                                       self.end(value.name);\r
+                       }\r
+               };\r
+       }\r
+})(tinymce);\r
 \r
-                                                       // Is attribute one that needs special treatment\r
-                                                       if (mceAttribs[name] && attrs.indexOf('_mce_' + name) == -1) {\r
-                                                               mceValue = t.decode(value);\r
+(function(tinymce) {\r
+       var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = {\r
+               '#text' : 3,\r
+               '#comment' : 8,\r
+               '#cdata' : 4,\r
+               '#pi' : 7,\r
+               '#doctype' : 10,\r
+               '#document-fragment' : 11\r
+       };\r
 \r
-                                                               // Convert URLs to relative/absolute ones\r
-                                                               if (s.url_converter && (name == "src" || name == "href"))\r
-                                                                       mceValue = s.url_converter.call(s.url_converter_scope || t, mceValue, name, elm_name);\r
+       // Walks the tree left/right\r
+       function walk(node, root_node, prev) {\r
+               var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';\r
 \r
-                                                               // Process styles lowercases them and compresses them\r
-                                                               if (name == 'style')\r
-                                                                       mceValue = t.serializeStyle(t.parseStyle(mceValue), name);\r
+               // Walk into nodes if it has a start\r
+               if (node[startName])\r
+                       return node[startName];\r
 \r
-                                                               return name + '="' + value + '"' + ' _mce_' + name + '="' + t.encode(mceValue) + '"';\r
-                                                       }\r
+               // Return the sibling if it has one\r
+               if (node !== root_node) {\r
+                       sibling = node[siblingName];\r
 \r
-                                                       return match;\r
-                                               }) + end + '>';\r
-                                       });\r
-                               };\r
+                       if (sibling)\r
+                               return sibling;\r
 \r
-                               h = processTags(h);\r
+                       // Walk up the parents to look for siblings\r
+                       for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) {\r
+                               sibling = parent[siblingName];\r
 \r
-                               // Restore script blocks\r
-                               h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) {\r
-                                       return codeBlocks[idx];\r
-                               });\r
+                               if (sibling)\r
+                                       return sibling;\r
                        }\r
+               }\r
+       };\r
 \r
-                       return h;\r
-               },\r
-\r
-               getOuterHTML : function(e) {\r
-                       var d;\r
+       function Node(name, type) {\r
+               this.name = name;\r
+               this.type = type;\r
 \r
-                       e = this.get(e);\r
+               if (type === 1) {\r
+                       this.attributes = [];\r
+                       this.attributes.map = {};\r
+               }\r
+       }\r
 \r
-                       if (!e)\r
-                               return null;\r
+       tinymce.extend(Node.prototype, {\r
+               replace : function(node) {\r
+                       var self = this;\r
 \r
-                       if (e.outerHTML !== undefined)\r
-                               return e.outerHTML;\r
+                       if (node.parent)\r
+                               node.remove();\r
 \r
-                       d = (e.ownerDocument || this.doc).createElement("body");\r
-                       d.appendChild(e.cloneNode(true));\r
+                       self.insert(node, self);\r
+                       self.remove();\r
 \r
-                       return d.innerHTML;\r
+                       return self;\r
                },\r
 \r
-               setOuterHTML : function(e, h, d) {\r
-                       var t = this;\r
-\r
-                       function setHTML(e, h, d) {\r
-                               var n, tp;\r
+               attr : function(name, value) {\r
+                       var self = this, attrs, i, undef;\r
 \r
-                               tp = d.createElement("body");\r
-                               tp.innerHTML = h;\r
+                       if (typeof name !== "string") {\r
+                               for (i in name)\r
+                                       self.attr(i, name[i]);\r
 \r
-                               n = tp.lastChild;\r
-                               while (n) {\r
-                                       t.insertAfter(n.cloneNode(true), e);\r
-                                       n = n.previousSibling;\r
-                               }\r
+                               return self;\r
+                       }\r
 \r
-                               t.remove(e);\r
-                       };\r
+                       if (attrs = self.attributes) {\r
+                               if (value !== undef) {\r
+                                       // Remove attribute\r
+                                       if (value === null) {\r
+                                               if (name in attrs.map) {\r
+                                                       delete attrs.map[name];\r
 \r
-                       return this.run(e, function(e) {\r
-                               e = t.get(e);\r
+                                                       i = attrs.length;\r
+                                                       while (i--) {\r
+                                                               if (attrs[i].name === name) {\r
+                                                                       attrs = attrs.splice(i, 1);\r
+                                                                       return self;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
 \r
-                               // Only set HTML on elements\r
-                               if (e.nodeType == 1) {\r
-                                       d = d || e.ownerDocument || t.doc;\r
+                                               return self;\r
+                                       }\r
 \r
-                                       if (isIE) {\r
-                                               try {\r
-                                                       // Try outerHTML for IE it sometimes produces an unknown runtime error\r
-                                                       if (isIE && e.nodeType == 1)\r
-                                                               e.outerHTML = h;\r
-                                                       else\r
-                                                               setHTML(e, h, d);\r
-                                               } catch (ex) {\r
-                                                       // Fix for unknown runtime error\r
-                                                       setHTML(e, h, d);\r
+                                       // Set attribute\r
+                                       if (name in attrs.map) {\r
+                                               // Set attribute\r
+                                               i = attrs.length;\r
+                                               while (i--) {\r
+                                                       if (attrs[i].name === name) {\r
+                                                               attrs[i].value = value;\r
+                                                               break;\r
+                                                       }\r
                                                }\r
                                        } else\r
-                                               setHTML(e, h, d);\r
+                                               attrs.push({name: name, value: value});\r
+\r
+                                       attrs.map[name] = value;\r
+\r
+                                       return self;\r
+                               } else {\r
+                                       return attrs.map[name];\r
                                }\r
-                       });\r
+                       }\r
                },\r
 \r
-               decode : function(s) {\r
-                       var e, n, v;\r
+               clone : function() {\r
+                       var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;\r
 \r
-                       // Look for entities to decode\r
-                       if (/&[\w#]+;/.test(s)) {\r
-                               // Decode the entities using a div element not super efficient but less code\r
-                               e = this.doc.createElement("div");\r
-                               e.innerHTML = s;\r
-                               n = e.firstChild;\r
-                               v = '';\r
+                       // Clone element attributes\r
+                       if (selfAttrs = self.attributes) {\r
+                               cloneAttrs = [];\r
+                               cloneAttrs.map = {};\r
 \r
-                               if (n) {\r
-                                       do {\r
-                                               v += n.nodeValue;\r
-                                       } while (n = n.nextSibling);\r
+                               for (i = 0, l = selfAttrs.length; i < l; i++) {\r
+                                       selfAttr = selfAttrs[i];\r
+\r
+                                       // Clone everything except id\r
+                                       if (selfAttr.name !== 'id') {\r
+                                               cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value};\r
+                                               cloneAttrs.map[selfAttr.name] = selfAttr.value;\r
+                                       }\r
                                }\r
 \r
-                               return v || s;\r
+                               clone.attributes = cloneAttrs;\r
                        }\r
 \r
-                       return s;\r
-               },\r
+                       clone.value = self.value;\r
+                       clone.shortEnded = self.shortEnded;\r
 \r
-               encode : function(str) {\r
-                       return ('' + str).replace(encodeCharsRe, function(chr) {\r
-                               return encodedChars[chr];\r
-                       });\r
+                       return clone;\r
                },\r
 \r
-               insertAfter : function(node, reference_node) {\r
-                       reference_node = this.get(reference_node);\r
-\r
-                       return this.run(node, function(node) {\r
-                               var parent, nextSibling;\r
-\r
-                               parent = reference_node.parentNode;\r
-                               nextSibling = reference_node.nextSibling;\r
+               wrap : function(wrapper) {\r
+                       var self = this;\r
 \r
-                               if (nextSibling)\r
-                                       parent.insertBefore(node, nextSibling);\r
-                               else\r
-                                       parent.appendChild(node);\r
+                       self.parent.insert(wrapper, self);\r
+                       wrapper.append(self);\r
 \r
-                               return node;\r
-                       });\r
+                       return self;\r
                },\r
 \r
-               isBlock : function(n) {\r
-                       if (n.nodeType && n.nodeType !== 1)\r
-                               return false;\r
+               unwrap : function() {\r
+                       var self = this, node, next;\r
 \r
-                       n = n.nodeName || n;\r
+                       for (node = self.firstChild; node; ) {\r
+                               next = node.next;\r
+                               self.insert(node, self, true);\r
+                               node = next;\r
+                       }\r
 \r
-                       return blockRe.test(n);\r
+                       self.remove();\r
                },\r
 \r
-               replace : function(n, o, k) {\r
-                       var t = this;\r
+               remove : function() {\r
+                       var self = this, parent = self.parent, next = self.next, prev = self.prev;\r
 \r
-                       if (is(o, 'array'))\r
-                               n = n.cloneNode(true);\r
+                       if (parent) {\r
+                               if (parent.firstChild === self) {\r
+                                       parent.firstChild = next;\r
 \r
-                       return t.run(o, function(o) {\r
-                               if (k) {\r
-                                       each(tinymce.grep(o.childNodes), function(c) {\r
-                                               n.appendChild(c);\r
-                                       });\r
+                                       if (next)\r
+                                               next.prev = null;\r
+                               } else {\r
+                                       prev.next = next;\r
                                }\r
 \r
-                               return o.parentNode.replaceChild(n, o);\r
-                       });\r
+                               if (parent.lastChild === self) {\r
+                                       parent.lastChild = prev;\r
+\r
+                                       if (prev)\r
+                                               prev.next = null;\r
+                               } else {\r
+                                       next.prev = prev;\r
+                               }\r
+\r
+                               self.parent = self.next = self.prev = null;\r
+                       }\r
+\r
+                       return self;\r
                },\r
 \r
-               rename : function(elm, name) {\r
-                       var t = this, newElm;\r
+               append : function(node) {\r
+                       var self = this, last;\r
 \r
-                       if (elm.nodeName != name.toUpperCase()) {\r
-                               // Rename block element\r
-                               newElm = t.create(name);\r
+                       if (node.parent)\r
+                               node.remove();\r
 \r
-                               // Copy attribs to new block\r
-                               each(t.getAttribs(elm), function(attr_node) {\r
-                                       t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));\r
-                               });\r
+                       last = self.lastChild;\r
+                       if (last) {\r
+                               last.next = node;\r
+                               node.prev = last;\r
+                               self.lastChild = node;\r
+                       } else\r
+                               self.lastChild = self.firstChild = node;\r
 \r
-                               // Replace block\r
-                               t.replace(newElm, elm, 1);\r
-                       }\r
+                       node.parent = self;\r
 \r
-                       return newElm || elm;\r
+                       return node;\r
                },\r
 \r
-               findCommonAncestor : function(a, b) {\r
-                       var ps = a, pe;\r
+               insert : function(node, ref_node, before) {\r
+                       var parent;\r
 \r
-                       while (ps) {\r
-                               pe = b;\r
+                       if (node.parent)\r
+                               node.remove();\r
 \r
-                               while (pe && ps != pe)\r
-                                       pe = pe.parentNode;\r
+                       parent = ref_node.parent || this;\r
 \r
-                               if (ps == pe)\r
-                                       break;\r
+                       if (before) {\r
+                               if (ref_node === parent.firstChild)\r
+                                       parent.firstChild = node;\r
+                               else\r
+                                       ref_node.prev.next = node;\r
 \r
-                               ps = ps.parentNode;\r
+                               node.prev = ref_node.prev;\r
+                               node.next = ref_node;\r
+                               ref_node.prev = node;\r
+                       } else {\r
+                               if (ref_node === parent.lastChild)\r
+                                       parent.lastChild = node;\r
+                               else\r
+                                       ref_node.next.prev = node;\r
+\r
+                               node.next = ref_node.next;\r
+                               node.prev = ref_node;\r
+                               ref_node.next = node;\r
                        }\r
 \r
-                       if (!ps && a.ownerDocument)\r
-                               return a.ownerDocument.documentElement;\r
+                       node.parent = parent;\r
 \r
-                       return ps;\r
+                       return node;\r
                },\r
 \r
-               toHex : function(s) {\r
-                       var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);\r
+               getAll : function(name) {\r
+                       var self = this, node, collection = [];\r
 \r
-                       function hex(s) {\r
-                               s = parseInt(s).toString(16);\r
+                       for (node = self.firstChild; node; node = walk(node, self)) {\r
+                               if (node.name === name)\r
+                                       collection.push(node);\r
+                       }\r
 \r
-                               return s.length > 1 ? s : '0' + s; // 0 -> 00\r
-                       };\r
+                       return collection;\r
+               },\r
 \r
-                       if (c) {\r
-                               s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);\r
+               empty : function() {\r
+                       var self = this, nodes, i, node;\r
 \r
-                               return s;\r
+                       // Remove all children\r
+                       if (self.firstChild) {\r
+                               nodes = [];\r
+\r
+                               // Collect the children\r
+                               for (node = self.firstChild; node; node = walk(node, self))\r
+                                       nodes.push(node);\r
+\r
+                               // Remove the children\r
+                               i = nodes.length;\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;\r
+                               }\r
                        }\r
 \r
-                       return s;\r
-               },\r
+                       self.firstChild = self.lastChild = null;\r
 \r
-               getClasses : function() {\r
-                       var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;\r
+                       return self;\r
+               },\r
 \r
-                       if (t.classes)\r
-                               return t.classes;\r
+               isEmpty : function(elements) {\r
+                       var self = this, node = self.firstChild, i, name;\r
 \r
-                       function addClasses(s) {\r
-                               // IE style imports\r
-                               each(s.imports, function(r) {\r
-                                       addClasses(r);\r
-                               });\r
-\r
-                               each(s.cssRules || s.rules, function(r) {\r
-                                       // Real type or fake it on IE\r
-                                       switch (r.type || 1) {\r
-                                               // Rule\r
-                                               case 1:\r
-                                                       if (r.selectorText) {\r
-                                                               each(r.selectorText.split(','), function(v) {\r
-                                                                       v = v.replace(/^\s*|\s*$|^\s\./g, "");\r
-\r
-                                                                       // Is internal or it doesn't contain a class\r
-                                                                       if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))\r
-                                                                               return;\r
-\r
-                                                                       // Remove everything but class name\r
-                                                                       ov = v;\r
-                                                                       v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1');\r
-\r
-                                                                       // Filter classes\r
-                                                                       if (f && !(v = f(v, ov)))\r
-                                                                               return;\r
+                       if (node) {\r
+                               do {\r
+                                       if (node.type === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (node.attributes.map['data-mce-bogus'])\r
+                                                       continue;\r
 \r
-                                                                       if (!lo[v]) {\r
-                                                                               cl.push({'class' : v});\r
-                                                                               lo[v] = 1;\r
-                                                                       }\r
-                                                               });\r
-                                                       }\r
-                                                       break;\r
+                                               // Keep empty elements like <img />\r
+                                               if (elements[node.name])\r
+                                                       return false;\r
 \r
-                                               // Import\r
-                                               case 3:\r
-                                                       addClasses(r.styleSheet);\r
-                                                       break;\r
+                                               // Keep elements with data attributes or name attribute like <a name="1"></a>\r
+                                               i = node.attributes.length;\r
+                                               while (i--) {\r
+                                                       name = node.attributes[i].name;\r
+                                                       if (name === "name" || name.indexOf('data-') === 0)\r
+                                                               return false;\r
+                                               }\r
                                        }\r
-                               });\r
-                       };\r
 \r
-                       try {\r
-                               each(t.doc.styleSheets, addClasses);\r
-                       } catch (ex) {\r
-                               // Ignore\r
+                                       // Keep comments\r
+                                       if (node.type === 8)\r
+                                               return false;\r
+                                       \r
+                                       // Keep non whitespace text nodes\r
+                                       if ((node.type === 3 && !whiteSpaceRegExp.test(node.value)))\r
+                                               return false;\r
+                               } while (node = walk(node, self));\r
                        }\r
 \r
-                       if (cl.length > 0)\r
-                               t.classes = cl;\r
-\r
-                       return cl;\r
+                       return true;\r
                },\r
 \r
-               run : function(e, f, s) {\r
-                       var t = this, o;\r
+               walk : function(prev) {\r
+                       return walk(this, null, prev);\r
+               }\r
+       });\r
 \r
-                       if (t.doc && typeof(e) === 'string')\r
-                               e = t.get(e);\r
+       tinymce.extend(Node, {\r
+               create : function(name, attrs) {\r
+                       var node, attrName;\r
 \r
-                       if (!e)\r
-                               return false;\r
+                       // Create node\r
+                       node = new Node(name, typeLookup[name] || 1);\r
 \r
-                       s = s || this;\r
-                       if (!e.nodeType && (e.length || e.length === 0)) {\r
-                               o = [];\r
+                       // Add attributes if needed\r
+                       if (attrs) {\r
+                               for (attrName in attrs)\r
+                                       node.attr(attrName, attrs[attrName]);\r
+                       }\r
 \r
-                               each(e, function(e, i) {\r
-                                       if (e) {\r
-                                               if (typeof(e) == 'string')\r
-                                                       e = t.doc.getElementById(e);\r
+                       return node;\r
+               }\r
+       });\r
 \r
-                                               o.push(f.call(s, e, i));\r
-                                       }\r
-                               });\r
+       tinymce.html.Node = Node;\r
+})(tinymce);\r
 \r
-                               return o;\r
-                       }\r
+(function(tinymce) {\r
+       var Node = tinymce.html.Node;\r
 \r
-                       return f.call(s, e);\r
-               },\r
+       tinymce.html.DomParser = function(settings, schema) {\r
+               var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};\r
 \r
-               getAttribs : function(n) {\r
-                       var o;\r
+               settings = settings || {};\r
+               settings.validate = "validate" in settings ? settings.validate : true;\r
+               settings.root_name = settings.root_name || 'body';\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
 \r
-                       n = this.get(n);\r
+               function fixInvalidChildren(nodes) {\r
+                       var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,\r
+                               childClone, nonEmptyElements, nonSplitableElements, sibling, nextNode;\r
 \r
-                       if (!n)\r
-                               return [];\r
+                       nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');\r
+                       nonEmptyElements = schema.getNonEmptyElements();\r
 \r
-                       if (isIE) {\r
-                               o = [];\r
+                       for (ni = 0; ni < nodes.length; ni++) {\r
+                               node = nodes[ni];\r
 \r
-                               // Object will throw exception in IE\r
-                               if (n.nodeName == 'OBJECT')\r
-                                       return n.attributes;\r
+                               // Already removed\r
+                               if (!node.parent)\r
+                                       continue;\r
 \r
-                               // IE doesn't keep the selected attribute if you clone option elements\r
-                               if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))\r
-                                       o.push({specified : 1, nodeName : 'selected'});\r
+                               // Get list of all parent nodes until we find a valid parent to stick the child into\r
+                               parents = [node];\r
+                               for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent)\r
+                                       parents.push(parent);\r
 \r
-                               // It's crazy that this is faster in IE but it's because it returns all attributes all the time\r
-                               n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {\r
-                                       o.push({specified : 1, nodeName : a});\r
-                               });\r
+                               // Found a suitable parent\r
+                               if (parent && parents.length > 1) {\r
+                                       // Reverse the array since it makes looping easier\r
+                                       parents.reverse();\r
 \r
-                               return o;\r
-                       }\r
+                                       // Clone the related parent and insert that after the moved node\r
+                                       newParent = currentNode = self.filterNode(parents[0].clone());\r
 \r
-                       return n.attributes;\r
-               },\r
+                                       // Start cloning and moving children on the left side of the target node\r
+                                       for (i = 0; i < parents.length - 1; i++) {\r
+                                               if (schema.isValidChild(currentNode.name, parents[i].name)) {\r
+                                                       tempNode = self.filterNode(parents[i].clone());\r
+                                                       currentNode.append(tempNode);\r
+                                               } else\r
+                                                       tempNode = currentNode;\r
 \r
-               destroy : function(s) {\r
-                       var t = this;\r
+                                               for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1]; ) {\r
+                                                       nextNode = childNode.next;\r
+                                                       tempNode.append(childNode);\r
+                                                       childNode = nextNode;\r
+                                               }\r
 \r
-                       if (t.events)\r
-                               t.events.destroy();\r
+                                               currentNode = tempNode;\r
+                                       }\r
 \r
-                       t.win = t.doc = t.root = t.events = null;\r
+                                       if (!newParent.isEmpty(nonEmptyElements)) {\r
+                                               parent.insert(newParent, parents[0], true);\r
+                                               parent.insert(node, newParent);\r
+                                       } else {\r
+                                               parent.insert(node, parents[0], true);\r
+                                       }\r
 \r
-                       // Manual destroy then remove unload handler\r
-                       if (!s)\r
-                               tinymce.removeUnload(t.destroy);\r
-               },\r
+                                       // Check if the element is empty by looking through it's contents and special treatment for <p><br /></p>\r
+                                       parent = parents[0];\r
+                                       if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') {\r
+                                               parent.empty().remove();\r
+                                       }\r
+                               } else if (node.parent) {\r
+                                       // If it's an LI try to find a UL/OL for it or wrap it\r
+                                       if (node.name === 'li') {\r
+                                               sibling = node.prev;\r
+                                               if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\r
+                                                       sibling.append(node);\r
+                                                       continue;\r
+                                               }\r
 \r
-               createRng : function() {\r
-                       var d = this.doc;\r
+                                               sibling = node.next;\r
+                                               if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\r
+                                                       sibling.insert(node, sibling.firstChild, true);\r
+                                                       continue;\r
+                                               }\r
 \r
-                       return d.createRange ? d.createRange() : new tinymce.dom.Range(this);\r
-               },\r
+                                               node.wrap(self.filterNode(new Node('ul', 1)));\r
+                                               continue;\r
+                                       }\r
 \r
-               nodeIndex : function(node, normalized) {\r
-                       var idx = 0, lastNodeType, lastNode, nodeType;\r
+                                       // Try wrapping the element in a DIV\r
+                                       if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {\r
+                                               node.wrap(self.filterNode(new Node('div', 1)));\r
+                                       } else {\r
+                                               // We failed wrapping it, then remove or unwrap it\r
+                                               if (node.name === 'style' || node.name === 'script')\r
+                                                       node.empty().remove();\r
+                                               else\r
+                                                       node.unwrap();\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
 \r
-                       if (node) {\r
-                               for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {\r
-                                       nodeType = node.nodeType;\r
+               self.filterNode = function(node) {\r
+                       var i, name, list;\r
 \r
-                                       // Normalize text nodes\r
-                                       if (normalized && nodeType == 3) {\r
-                                               if (nodeType == lastNodeType || !node.nodeValue.length)\r
-                                                       continue;\r
-                                       }\r
+                       // Run element filters\r
+                       if (name in nodeFilters) {\r
+                               list = matchedNodes[name];\r
 \r
-                                       idx++;\r
-                                       lastNodeType = nodeType;\r
+                               if (list)\r
+                                       list.push(node);\r
+                               else\r
+                                       matchedNodes[name] = [node];\r
+                       }\r
+\r
+                       // Run attribute filters\r
+                       i = attributeFilters.length;\r
+                       while (i--) {\r
+                               name = attributeFilters[i].name;\r
+\r
+                               if (name in node.attributes.map) {\r
+                                       list = matchedAttributes[name];\r
+\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedAttributes[name] = [node];\r
                                }\r
                        }\r
 \r
-                       return idx;\r
-               },\r
+                       return node;\r
+               };\r
 \r
-               split : function(pe, e, re) {\r
-                       var t = this, r = t.createRng(), bef, aft, pa;\r
+               self.addNodeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var list = nodeFilters[name];\r
 \r
-                       // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sense\r
-                       // but we don't want that in our code since it serves no purpose for the end user\r
-                       // For example if this is chopped:\r
-                       //   <p>text 1<span><b>CHOP</b></span>text 2</p>\r
-                       // would produce:\r
-                       //   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>\r
-                       // this function will then trim of empty edges and produce:\r
-                       //   <p>text 1</p><b>CHOP</b><p>text 2</p>\r
-                       function trim(node) {\r
-                               var i, children = node.childNodes;\r
+                               if (!list)\r
+                                       nodeFilters[name] = list = [];\r
 \r
-                               if (node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark')\r
-                                       return;\r
+                               list.push(callback);\r
+                       });\r
+               };\r
 \r
-                               for (i = children.length - 1; i >= 0; i--)\r
-                                       trim(children[i]);\r
+               self.addAttributeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var i;\r
 \r
-                               if (node.nodeType != 9) {\r
-                                       // Keep non whitespace text nodes\r
-                                       if (node.nodeType == 3 && node.nodeValue.length > 0)\r
+                               for (i = 0; i < attributeFilters.length; i++) {\r
+                                       if (attributeFilters[i].name === name) {\r
+                                               attributeFilters[i].callbacks.push(callback);\r
                                                return;\r
+                                       }\r
+                               }\r
 \r
-                                       if (node.nodeType == 1) {\r
-                                               // If the only child is a bookmark then move it up\r
-                                               children = node.childNodes;\r
-                                               if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('_mce_type') == 'bookmark')\r
-                                                       node.parentNode.insertBefore(children[0], node);\r
+                               attributeFilters.push({name: name, callbacks: [callback]});\r
+                       });\r
+               };\r
 \r
-                                               // Keep non empty elements or img, hr etc\r
-                                               if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))\r
-                                                       return;\r
+               self.parse = function(html, args) {\r
+                       var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate,\r
+                               blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement,\r
+                               endWhiteSpaceRegExp, allWhiteSpaceRegExp, whiteSpaceElements, children, nonEmptyElements, rootBlockName;\r
+\r
+                       args = args || {};\r
+                       matchedNodes = {};\r
+                       matchedAttributes = {};\r
+                       blockElements = tinymce.extend(tinymce.makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());\r
+                       nonEmptyElements = schema.getNonEmptyElements();\r
+                       children = schema.children;\r
+                       validate = settings.validate;\r
+                       rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block;\r
+\r
+                       whiteSpaceElements = schema.getWhiteSpaceElements();\r
+                       startWhiteSpaceRegExp = /^[ \t\r\n]+/;\r
+                       endWhiteSpaceRegExp = /[ \t\r\n]+$/;\r
+                       allWhiteSpaceRegExp = /[ \t\r\n]+/g;\r
+\r
+                       function addRootBlocks() {\r
+                               var node = rootNode.firstChild, next, rootBlockNode;\r
+\r
+                               while (node) {\r
+                                       next = node.next;\r
+\r
+                                       if (node.type == 3 || (node.type == 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type'))) {\r
+                                               if (!rootBlockNode) {\r
+                                                       // Create a new root block element\r
+                                                       rootBlockNode = createNode(rootBlockName, 1);\r
+                                                       rootNode.insert(rootBlockNode, node);\r
+                                                       rootBlockNode.append(node);\r
+                                               } else\r
+                                                       rootBlockNode.append(node);\r
+                                       } else {\r
+                                               rootBlockNode = null;\r
                                        }\r
 \r
-                                       t.remove(node);\r
+                                       node = next;\r
+                               };\r
+                       };\r
+\r
+                       function createNode(name, type) {\r
+                               var node = new Node(name, type), list;\r
+\r
+                               if (name in nodeFilters) {\r
+                                       list = matchedNodes[name];\r
+\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedNodes[name] = [node];\r
                                }\r
 \r
                                return node;\r
                        };\r
 \r
-                       if (pe && e) {\r
-                               // Get before chunk\r
-                               r.setStart(pe.parentNode, t.nodeIndex(pe));\r
-                               r.setEnd(e.parentNode, t.nodeIndex(e));\r
-                               bef = r.extractContents();\r
-\r
-                               // Get after chunk\r
-                               r = t.createRng();\r
-                               r.setStart(e.parentNode, t.nodeIndex(e) + 1);\r
-                               r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);\r
-                               aft = r.extractContents();\r
+                       function removeWhitespaceBefore(node) {\r
+                               var textNode, textVal, sibling;\r
 \r
-                               // Insert before chunk\r
-                               pa = pe.parentNode;\r
-                               pa.insertBefore(trim(bef), pe);\r
+                               for (textNode = node.prev; textNode && textNode.type === 3; ) {\r
+                                       textVal = textNode.value.replace(endWhiteSpaceRegExp, '');\r
 \r
-                               // Insert middle chunk\r
-                               if (re)\r
-                                       pa.replaceChild(re, e);\r
-                               else\r
-                                       pa.insertBefore(e, pe);\r
+                                       if (textVal.length > 0) {\r
+                                               textNode.value = textVal;\r
+                                               textNode = textNode.prev;\r
+                                       } else {\r
+                                               sibling = textNode.prev;\r
+                                               textNode.remove();\r
+                                               textNode = sibling;\r
+                                       }\r
+                               }\r
+                       };\r
 \r
-                               // Insert after chunk\r
-                               pa.insertBefore(trim(aft), pe);\r
-                               t.remove(pe);\r
+                       parser = new tinymce.html.SaxParser({\r
+                               validate : validate,\r
+                               fix_self_closing : !validate, // Let the DOM parser handle <li> in <li> or <p> in <p> for better results\r
 \r
-                               return re || e;\r
-                       }\r
-               },\r
+                               cdata: function(text) {\r
+                                       node.append(createNode('#cdata', 4)).value = text;\r
+                               },\r
 \r
-               bind : function(target, name, func, scope) {\r
-                       var t = this;\r
+                               text: function(text, raw) {\r
+                                       var textNode;\r
 \r
-                       if (!t.events)\r
-                               t.events = new tinymce.dom.EventUtils();\r
+                                       // Trim all redundant whitespace on non white space elements\r
+                                       if (!isInWhiteSpacePreservedElement) {\r
+                                               text = text.replace(allWhiteSpaceRegExp, ' ');\r
 \r
-                       return t.events.add(target, name, func, scope || this);\r
-               },\r
+                                               if (node.lastChild && blockElements[node.lastChild.name])\r
+                                                       text = text.replace(startWhiteSpaceRegExp, '');\r
+                                       }\r
 \r
-               unbind : function(target, name, func) {\r
-                       var t = this;\r
+                                       // Do we need to create the node\r
+                                       if (text.length !== 0) {\r
+                                               textNode = createNode('#text', 3);\r
+                                               textNode.raw = !!raw;\r
+                                               node.append(textNode).value = text;\r
+                                       }\r
+                               },\r
 \r
-                       if (!t.events)\r
-                               t.events = new tinymce.dom.EventUtils();\r
+                               comment: function(text) {\r
+                                       node.append(createNode('#comment', 8)).value = text;\r
+                               },\r
 \r
-                       return t.events.remove(target, name, func);\r
-               },\r
+                               pi: function(name, text) {\r
+                                       node.append(createNode(name, 7)).value = text;\r
+                                       removeWhitespaceBefore(node);\r
+                               },\r
 \r
+                               doctype: function(text) {\r
+                                       var newNode;\r
+               \r
+                                       newNode = node.append(createNode('#doctype', 10));\r
+                                       newNode.value = text;\r
+                                       removeWhitespaceBefore(node);\r
+                               },\r
 \r
-               _findSib : function(node, selector, name) {\r
-                       var t = this, f = selector;\r
+                               start: function(name, attrs, empty) {\r
+                                       var newNode, attrFiltersLen, elementRule, textNode, attrName, text, sibling, parent;\r
 \r
-                       if (node) {\r
-                               // If expression make a function of it using is\r
-                               if (is(f, 'string')) {\r
-                                       f = function(node) {\r
-                                               return t.is(node, selector);\r
-                                       };\r
-                               }\r
+                                       elementRule = validate ? schema.getElementRule(name) : {};\r
+                                       if (elementRule) {\r
+                                               newNode = createNode(elementRule.outputName || name, 1);\r
+                                               newNode.attributes = attrs;\r
+                                               newNode.shortEnded = empty;\r
 \r
-                               // Loop all siblings\r
-                               for (node = node[name]; node; node = node[name]) {\r
-                                       if (f(node))\r
-                                               return node;\r
-                               }\r
-                       }\r
+                                               node.append(newNode);\r
 \r
-                       return null;\r
-               },\r
+                                               // Check if node is valid child of the parent node is the child is\r
+                                               // unknown we don't collect it since it's probably a custom element\r
+                                               parent = children[node.name];\r
+                                               if (parent && children[newNode.name] && !parent[newNode.name])\r
+                                                       invalidChildren.push(newNode);\r
 \r
-               _isRes : function(c) {\r
-                       // Is live resizble element\r
-                       return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);\r
-               }\r
+                                               attrFiltersLen = attributeFilters.length;\r
+                                               while (attrFiltersLen--) {\r
+                                                       attrName = attributeFilters[attrFiltersLen].name;\r
 \r
-               /*\r
-               walk : function(n, f, s) {\r
-                       var d = this.doc, w;\r
+                                                       if (attrName in attrs.map) {\r
+                                                               list = matchedAttributes[attrName];\r
 \r
-                       if (d.createTreeWalker) {\r
-                               w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);\r
-\r
-                               while ((n = w.nextNode()) != null)\r
-                                       f.call(s || this, n);\r
-                       } else\r
-                               tinymce.walk(n, f, 'childNodes', s);\r
-               }\r
-               */\r
+                                                               if (list)\r
+                                                                       list.push(newNode);\r
+                                                               else\r
+                                                                       matchedAttributes[attrName] = [newNode];\r
+                                                       }\r
+                                               }\r
 \r
-               /*\r
-               toRGB : function(s) {\r
-                       var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);\r
+                                               // Trim whitespace before block\r
+                                               if (blockElements[name])\r
+                                                       removeWhitespaceBefore(newNode);\r
 \r
-                       if (c) {\r
-                               // #FFF -> #FFFFFF\r
-                               if (!is(c[3]))\r
-                                       c[3] = c[2] = c[1];\r
+                                               // Change current node if the element wasn't empty i.e not <br /> or <img />\r
+                                               if (!empty)\r
+                                                       node = newNode;\r
 \r
-                               return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";\r
-                       }\r
+                                               // Check if we are inside a whitespace preserved element\r
+                                               if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\r
+                                                       isInWhiteSpacePreservedElement = true;\r
+                                               }\r
+                                       }\r
+                               },\r
 \r
-                       return s;\r
-               }\r
-               */\r
-       });\r
+                               end: function(name) {\r
+                                       var textNode, elementRule, text, sibling, tempNode;\r
 \r
-       tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});\r
-})(tinymce);\r
+                                       elementRule = validate ? schema.getElementRule(name) : {};\r
+                                       if (elementRule) {\r
+                                               if (blockElements[name]) {\r
+                                                       if (!isInWhiteSpacePreservedElement) {\r
+                                                               // Trim whitespace at beginning of block\r
+                                                               for (textNode = node.firstChild; textNode && textNode.type === 3; ) {\r
+                                                                       text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
 \r
-(function(ns) {\r
-       // Range constructor\r
-       function Range(dom) {\r
-               var t = this,\r
-                       doc = dom.doc,\r
-                       EXTRACT = 0,\r
-                       CLONE = 1,\r
-                       DELETE = 2,\r
-                       TRUE = true,\r
-                       FALSE = false,\r
-                       START_OFFSET = 'startOffset',\r
-                       START_CONTAINER = 'startContainer',\r
-                       END_CONTAINER = 'endContainer',\r
-                       END_OFFSET = 'endOffset',\r
-                       extend = tinymce.extend,\r
-                       nodeIndex = dom.nodeIndex;\r
+                                                                       if (text.length > 0) {\r
+                                                                               textNode.value = text;\r
+                                                                               textNode = textNode.next;\r
+                                                                       } else {\r
+                                                                               sibling = textNode.next;\r
+                                                                               textNode.remove();\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+                                                               }\r
 \r
-               extend(t, {\r
-                       // Inital states\r
-                       startContainer : doc,\r
-                       startOffset : 0,\r
-                       endContainer : doc,\r
-                       endOffset : 0,\r
-                       collapsed : TRUE,\r
-                       commonAncestorContainer : doc,\r
+                                                               // Trim whitespace at end of block\r
+                                                               for (textNode = node.lastChild; textNode && textNode.type === 3; ) {\r
+                                                                       text = textNode.value.replace(endWhiteSpaceRegExp, '');\r
 \r
-                       // Range constants\r
-                       START_TO_START : 0,\r
-                       START_TO_END : 1,\r
-                       END_TO_END : 2,\r
-                       END_TO_START : 3,\r
+                                                                       if (text.length > 0) {\r
+                                                                               textNode.value = text;\r
+                                                                               textNode = textNode.prev;\r
+                                                                       } else {\r
+                                                                               sibling = textNode.prev;\r
+                                                                               textNode.remove();\r
+                                                                               textNode = sibling;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
 \r
-                       // Public methods\r
-                       setStart : setStart,\r
-                       setEnd : setEnd,\r
-                       setStartBefore : setStartBefore,\r
-                       setStartAfter : setStartAfter,\r
-                       setEndBefore : setEndBefore,\r
-                       setEndAfter : setEndAfter,\r
-                       collapse : collapse,\r
-                       selectNode : selectNode,\r
-                       selectNodeContents : selectNodeContents,\r
-                       compareBoundaryPoints : compareBoundaryPoints,\r
-                       deleteContents : deleteContents,\r
-                       extractContents : extractContents,\r
-                       cloneContents : cloneContents,\r
-                       insertNode : insertNode,\r
-                       surroundContents : surroundContents,\r
-                       cloneRange : cloneRange\r
-               });\r
+                                                       // Trim start white space\r
+                                                       textNode = node.prev;\r
+                                                       if (textNode && textNode.type === 3) {\r
+                                                               text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
 \r
-               function setStart(n, o) {\r
-                       _setEndPoint(TRUE, n, o);\r
-               };\r
+                                                               if (text.length > 0)\r
+                                                                       textNode.value = text;\r
+                                                               else\r
+                                                                       textNode.remove();\r
+                                                       }\r
+                                               }\r
 \r
-               function setEnd(n, o) {\r
-                       _setEndPoint(FALSE, n, o);\r
-               };\r
+                                               // Check if we exited a whitespace preserved element\r
+                                               if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\r
+                                                       isInWhiteSpacePreservedElement = false;\r
+                                               }\r
 \r
-               function setStartBefore(n) {\r
-                       setStart(n.parentNode, nodeIndex(n));\r
-               };\r
+                                               // Handle empty nodes\r
+                                               if (elementRule.removeEmpty || elementRule.paddEmpty) {\r
+                                                       if (node.isEmpty(nonEmptyElements)) {\r
+                                                               if (elementRule.paddEmpty)\r
+                                                                       node.empty().append(new Node('#text', '3')).value = '\u00a0';\r
+                                                               else {\r
+                                                                       // Leave nodes that have a name like <a name="name">\r
+                                                                       if (!node.attributes.map.name) {\r
+                                                                               tempNode = node.parent;\r
+                                                                               node.empty().remove();\r
+                                                                               node = tempNode;\r
+                                                                               return;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
 \r
-               function setStartAfter(n) {\r
-                       setStart(n.parentNode, nodeIndex(n) + 1);\r
-               };\r
+                                               node = node.parent;\r
+                                       }\r
+                               }\r
+                       }, schema);\r
 \r
-               function setEndBefore(n) {\r
-                       setEnd(n.parentNode, nodeIndex(n));\r
-               };\r
+                       rootNode = node = new Node(args.context || settings.root_name, 11);\r
 \r
-               function setEndAfter(n) {\r
-                       setEnd(n.parentNode, nodeIndex(n) + 1);\r
-               };\r
+                       parser.parse(html);\r
 \r
-               function collapse(ts) {\r
-                       if (ts) {\r
-                               t[END_CONTAINER] = t[START_CONTAINER];\r
-                               t[END_OFFSET] = t[START_OFFSET];\r
-                       } else {\r
-                               t[START_CONTAINER] = t[END_CONTAINER];\r
-                               t[START_OFFSET] = t[END_OFFSET];\r
+                       // Fix invalid children or report invalid children in a contextual parsing\r
+                       if (validate && invalidChildren.length) {\r
+                               if (!args.context)\r
+                                       fixInvalidChildren(invalidChildren);\r
+                               else\r
+                                       args.invalid = true;\r
                        }\r
 \r
-                       t.collapsed = TRUE;\r
-               };\r
-\r
-               function selectNode(n) {\r
-                       setStartBefore(n);\r
-                       setEndAfter(n);\r
-               };\r
+                       // Wrap nodes in the root into block elements if the root is body\r
+                       if (rootBlockName && rootNode.name == 'body')\r
+                               addRootBlocks();\r
 \r
-               function selectNodeContents(n) {\r
-                       setStart(n, 0);\r
-                       setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);\r
-               };\r
+                       // Run filters only when the contents is valid\r
+                       if (!args.invalid) {\r
+                               // Run node filters\r
+                               for (name in matchedNodes) {\r
+                                       list = nodeFilters[name];\r
+                                       nodes = matchedNodes[name];\r
 \r
-               function compareBoundaryPoints(h, r) {\r
-                       var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET];\r
+                                       // Remove already removed children\r
+                                       fi = nodes.length;\r
+                                       while (fi--) {\r
+                                               if (!nodes[fi].parent)\r
+                                                       nodes.splice(fi, 1);\r
+                                       }\r
 \r
-                       // Check START_TO_START\r
-                       if (h === 0)\r
-                               return _compareBoundaryPoints(sc, so, sc, so);\r
+                                       for (i = 0, l = list.length; i < l; i++)\r
+                                               list[i](nodes, name, args);\r
+                               }\r
 \r
-                       // Check START_TO_END\r
-                       if (h === 1)\r
-                               return _compareBoundaryPoints(sc, so, ec, eo);\r
+                               // Run attribute filters\r
+                               for (i = 0, l = attributeFilters.length; i < l; i++) {\r
+                                       list = attributeFilters[i];\r
 \r
-                       // Check END_TO_END\r
-                       if (h === 2)\r
-                               return _compareBoundaryPoints(ec, eo, ec, eo);\r
+                                       if (list.name in matchedAttributes) {\r
+                                               nodes = matchedAttributes[list.name];\r
 \r
-                       // Check END_TO_START\r
-                       if (h === 3)\r
-                               return _compareBoundaryPoints(ec, eo, sc, so);\r
-               };\r
+                                               // Remove already removed children\r
+                                               fi = nodes.length;\r
+                                               while (fi--) {\r
+                                                       if (!nodes[fi].parent)\r
+                                                               nodes.splice(fi, 1);\r
+                                               }\r
 \r
-               function deleteContents() {\r
-                       _traverse(DELETE);\r
-               };\r
+                                               for (fi = 0, fl = list.callbacks.length; fi < fl; fi++)\r
+                                                       list.callbacks[fi](nodes, list.name, args);\r
+                                       }\r
+                               }\r
+                       }\r
 \r
-               function extractContents() {\r
-                       return _traverse(EXTRACT);\r
+                       return rootNode;\r
                };\r
 \r
-               function cloneContents() {\r
-                       return _traverse(CLONE);\r
-               };\r
+               // Remove <br> at end of block elements Gecko and WebKit injects BR elements to\r
+               // make it possible to place the caret inside empty blocks. This logic tries to remove\r
+               // these elements and keep br elements that where intended to be there intact\r
+               if (settings.remove_trailing_brs) {\r
+                       self.addNodeFilter('br', function(nodes, name) {\r
+                               var i, l = nodes.length, node, blockElements = schema.getBlockElements(),\r
+                                       nonEmptyElements = schema.getNonEmptyElements(), parent, prev, prevName;\r
+\r
+                               // Remove brs from body element as well\r
+                               blockElements.body = 1;\r
+\r
+                               // Must loop forwards since it will otherwise remove all brs in <p>a<br><br><br></p>\r
+                               for (i = 0; i < l; i++) {\r
+                                       node = nodes[i];\r
+                                       parent = node.parent;\r
+\r
+                                       if (blockElements[node.parent.name] && node === parent.lastChild) {\r
+                                               // Loop all nodes to the right of the current node and check for other BR elements\r
+                                               // excluding bookmarks since they are invisible\r
+                                               prev = node.prev;\r
+                                               while (prev) {\r
+                                                       prevName = prev.name;\r
+\r
+                                                       // Ignore bookmarks\r
+                                                       if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') {\r
+                                                               // Found a non BR element\r
+                                                               if (prevName !== "br")\r
+                                                                       break;\r
+       \r
+                                                               // Found another br it's a <br><br> structure then don't remove anything\r
+                                                               if (prevName === 'br') {\r
+                                                                       node = null;\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
 \r
-               function insertNode(n) {\r
-                       var startContainer = this[START_CONTAINER],\r
-                               startOffset = this[START_OFFSET], nn, o;\r
+                                                       prev = prev.prev;\r
+                                               }\r
 \r
-                       // Node is TEXT_NODE or CDATA\r
-                       if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {\r
-                               if (!startOffset) {\r
-                                       // At the start of text\r
-                                       startContainer.parentNode.insertBefore(n, startContainer);\r
-                               } else if (startOffset >= startContainer.nodeValue.length) {\r
-                                       // At the end of text\r
-                                       dom.insertAfter(n, startContainer);\r
-                               } else {\r
-                                       // Middle, need to split\r
-                                       nn = startContainer.splitText(startOffset);\r
-                                       startContainer.parentNode.insertBefore(n, nn);\r
+                                               if (node) {\r
+                                                       node.remove();\r
+\r
+                                                       // Is the parent to be considered empty after we removed the BR\r
+                                                       if (parent.isEmpty(nonEmptyElements)) {\r
+                                                               elementRule = schema.getElementRule(parent.name);\r
+\r
+                                                               // Remove or padd the element depending on schema rule\r
+                                                               if (elementRule) {\r
+                                                                       if (elementRule.removeEmpty)\r
+                                                                               parent.remove();\r
+                                                                       else if (elementRule.paddEmpty)\r
+                                                                               parent.empty().append(new tinymce.html.Node('#text', 3)).value = '\u00a0';\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }\r
                                }\r
-                       } else {\r
-                               // Insert element node\r
-                               if (startContainer.childNodes.length > 0)\r
-                                       o = startContainer.childNodes[startOffset];\r
+                       });\r
+               }\r
+       }\r
+})(tinymce);\r
 \r
-                               if (o)\r
-                                       startContainer.insertBefore(n, o);\r
-                               else\r
-                                       startContainer.appendChild(n);\r
-                       }\r
-               };\r
+tinymce.html.Writer = function(settings) {\r
+       var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;\r
 \r
-               function surroundContents(n) {\r
-                       var f = t.extractContents();\r
+       settings = settings || {};\r
+       indent = settings.indent;\r
+       indentBefore = tinymce.makeMap(settings.indent_before || '');\r
+       indentAfter = tinymce.makeMap(settings.indent_after || '');\r
+       encode = tinymce.html.Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);\r
+       htmlOutput = settings.element_format == "html";\r
 \r
-                       t.insertNode(n);\r
-                       n.appendChild(f);\r
-                       t.selectNode(n);\r
-               };\r
+       return {\r
+               start: function(name, attrs, empty) {\r
+                       var i, l, attr, value;\r
 \r
-               function cloneRange() {\r
-                       return extend(new Range(dom), {\r
-                               startContainer : t[START_CONTAINER],\r
-                               startOffset : t[START_OFFSET],\r
-                               endContainer : t[END_CONTAINER],\r
-                               endOffset : t[END_OFFSET],\r
-                               collapsed : t.collapsed,\r
-                               commonAncestorContainer : t.commonAncestorContainer\r
-                       });\r
-               };\r
+                       if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-               // Private methods\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
 \r
-               function _getSelectedNode(container, offset) {\r
-                       var child;\r
+                       html.push('<', name);\r
 \r
-                       if (container.nodeType == 3 /* TEXT_NODE */)\r
-                               return container;\r
+                       if (attrs) {\r
+                               for (i = 0, l = attrs.length; i < l; i++) {\r
+                                       attr = attrs[i];\r
+                                       html.push(' ', attr.name, '="', encode(attr.value, true), '"');\r
+                               }\r
+                       }\r
 \r
-                       if (offset < 0)\r
-                               return container;\r
+                       if (!empty || htmlOutput)\r
+                               html[html.length] = '>';\r
+                       else\r
+                               html[html.length] = ' />';\r
 \r
-                       child = container.firstChild;\r
-                       while (child && offset > 0) {\r
-                               --offset;\r
-                               child = child.nextSibling;\r
-                       }\r
+                       if (empty && indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-                       if (child)\r
-                               return child;\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
+               },\r
 \r
-                       return container;\r
-               };\r
+               end: function(name) {\r
+                       var value;\r
 \r
-               function _isCollapsed() {\r
-                       return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);\r
-               };\r
+                       /*if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-               function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {\r
-                       var c, offsetC, n, cmnRoot, childA, childB;\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }*/\r
 \r
-                       // In the first case the boundary-points have the same container. A is before B\r
-                       // if its offset is less than the offset of B, A is equal to B if its offset is\r
-                       // equal to the offset of B, and A is after B if its offset is greater than the\r
-                       // offset of B.\r
-                       if (containerA == containerB) {\r
-                               if (offsetA == offsetB)\r
-                                       return 0; // equal\r
+                       html.push('</', name, '>');\r
 \r
-                               if (offsetA < offsetB)\r
-                                       return -1; // before\r
+                       if (indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-                               return 1; // after\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
                        }\r
+               },\r
 \r
-                       // In the second case a child node C of the container of A is an ancestor\r
-                       // container of B. In this case, A is before B if the offset of A is less than or\r
-                       // equal to the index of the child node C and A is after B otherwise.\r
-                       c = containerB;\r
-                       while (c && c.parentNode != containerA)\r
-                               c = c.parentNode;\r
+               text: function(text, raw) {\r
+                       if (text.length > 0)\r
+                               html[html.length] = raw ? text : encode(text);\r
+               },\r
 \r
-                       if (c) {\r
-                               offsetC = 0;\r
-                               n = containerA.firstChild;\r
-\r
-                               while (n != c && offsetC < offsetA) {\r
-                                       offsetC++;\r
-                                       n = n.nextSibling;\r
-                               }\r
-\r
-                               if (offsetA <= offsetC)\r
-                                       return -1; // before\r
-\r
-                               return 1; // after\r
-                       }\r
+               cdata: function(text) {\r
+                       html.push('<![CDATA[', text, ']]>');\r
+               },\r
 \r
-                       // In the third case a child node C of the container of B is an ancestor container\r
-                       // of A. In this case, A is before B if the index of the child node C is less than\r
-                       // the offset of B and A is after B otherwise.\r
-                       c = containerA;\r
-                       while (c && c.parentNode != containerB) {\r
-                               c = c.parentNode;\r
-                       }\r
+               comment: function(text) {\r
+                       html.push('<!--', text, '-->');\r
+               },\r
 \r
-                       if (c) {\r
-                               offsetC = 0;\r
-                               n = containerB.firstChild;\r
+               pi: function(name, text) {\r
+                       if (text)\r
+                               html.push('<?', name, ' ', text, '?>');\r
+                       else\r
+                               html.push('<?', name, '?>');\r
 \r
-                               while (n != c && offsetC < offsetB) {\r
-                                       offsetC++;\r
-                                       n = n.nextSibling;\r
-                               }\r
+                       if (indent)\r
+                               html.push('\n');\r
+               },\r
 \r
-                               if (offsetC < offsetB)\r
-                                       return -1; // before\r
+               doctype: function(text) {\r
+                       html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');\r
+               },\r
 \r
-                               return 1; // after\r
-                       }\r
+               reset: function() {\r
+                       html.length = 0;\r
+               },\r
 \r
-                       // In the fourth case, none of three other cases hold: the containers of A and B\r
-                       // are siblings or descendants of sibling nodes. In this case, A is before B if\r
-                       // the container of A is before the container of B in a pre-order traversal of the\r
-                       // Ranges' context tree and A is after B otherwise.\r
-                       cmnRoot = dom.findCommonAncestor(containerA, containerB);\r
-                       childA = containerA;\r
+               getContent: function() {\r
+                       return html.join('').replace(/\n$/, '');\r
+               }\r
+       };\r
+};\r
 \r
-                       while (childA && childA.parentNode != cmnRoot)\r
-                               childA = childA.parentNode;\r
+(function(tinymce) {\r
+       tinymce.html.Serializer = function(settings, schema) {\r
+               var self = this, writer = new tinymce.html.Writer(settings);\r
 \r
-                       if (!childA)\r
-                               childA = cmnRoot;\r
+               settings = settings || {};\r
+               settings.validate = "validate" in settings ? settings.validate : true;\r
 \r
-                       childB = containerB;\r
-                       while (childB && childB.parentNode != cmnRoot)\r
-                               childB = childB.parentNode;\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
+               self.writer = writer;\r
 \r
-                       if (!childB)\r
-                               childB = cmnRoot;\r
+               self.serialize = function(node) {\r
+                       var handlers, validate;\r
 \r
-                       if (childA == childB)\r
-                               return 0; // equal\r
+                       validate = settings.validate;\r
 \r
-                       n = cmnRoot.firstChild;\r
-                       while (n) {\r
-                               if (n == childA)\r
-                                       return -1; // before\r
+                       handlers = {\r
+                               // #text\r
+                               3: function(node, raw) {\r
+                                       writer.text(node.value, node.raw);\r
+                               },\r
 \r
-                               if (n == childB)\r
-                                       return 1; // after\r
+                               // #comment\r
+                               8: function(node) {\r
+                                       writer.comment(node.value);\r
+                               },\r
 \r
-                               n = n.nextSibling;\r
-                       }\r
-               };\r
+                               // Processing instruction\r
+                               7: function(node) {\r
+                                       writer.pi(node.name, node.value);\r
+                               },\r
 \r
-               function _setEndPoint(st, n, o) {\r
-                       var ec, sc;\r
+                               // Doctype\r
+                               10: function(node) {\r
+                                       writer.doctype(node.value);\r
+                               },\r
 \r
-                       if (st) {\r
-                               t[START_CONTAINER] = n;\r
-                               t[START_OFFSET] = o;\r
-                       } else {\r
-                               t[END_CONTAINER] = n;\r
-                               t[END_OFFSET] = o;\r
-                       }\r
+                               // CDATA\r
+                               4: function(node) {\r
+                                       writer.cdata(node.value);\r
+                               },\r
 \r
-                       // If one boundary-point of a Range is set to have a root container\r
-                       // other than the current one for the Range, the Range is collapsed to\r
-                       // the new position. This enforces the restriction that both boundary-\r
-                       // points of a Range must have the same root container.\r
-                       ec = t[END_CONTAINER];\r
-                       while (ec.parentNode)\r
-                               ec = ec.parentNode;\r
+                               // Document fragment\r
+                               11: function(node) {\r
+                                       if ((node = node.firstChild)) {\r
+                                               do {\r
+                                                       walk(node);\r
+                                               } while (node = node.next);\r
+                                       }\r
+                               }\r
+                       };\r
 \r
-                       sc = t[START_CONTAINER];\r
-                       while (sc.parentNode)\r
-                               sc = sc.parentNode;\r
+                       writer.reset();\r
 \r
-                       if (sc == ec) {\r
-                               // The start position of a Range is guaranteed to never be after the\r
-                               // end position. To enforce this restriction, if the start is set to\r
-                               // be at a position after the end, the Range is collapsed to that\r
-                               // position.\r
-                               if (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)\r
-                                       t.collapse(st);\r
-                       } else\r
-                               t.collapse(st);\r
+                       function walk(node) {\r
+                               var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;\r
 \r
-                       t.collapsed = _isCollapsed();\r
-                       t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);\r
-               };\r
+                               if (!handler) {\r
+                                       name = node.name;\r
+                                       isEmpty = node.shortEnded;\r
+                                       attrs = node.attributes;\r
 \r
-               function _traverse(how) {\r
-                       var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;\r
+                                       // Sort attributes\r
+                                       if (validate && attrs && attrs.length > 1) {\r
+                                               sortedAttrs = [];\r
+                                               sortedAttrs.map = {};\r
 \r
-                       if (t[START_CONTAINER] == t[END_CONTAINER])\r
-                               return _traverseSameContainer(how);\r
+                                               elementRule = schema.getElementRule(node.name);\r
+                                               for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {\r
+                                                       attrName = elementRule.attributesOrder[i];\r
 \r
-                       for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
-                               if (p == t[START_CONTAINER])\r
-                                       return _traverseCommonStartContainer(c, how);\r
+                                                       if (attrName in attrs.map) {\r
+                                                               attrValue = attrs.map[attrName];\r
+                                                               sortedAttrs.map[attrName] = attrValue;\r
+                                                               sortedAttrs.push({name: attrName, value: attrValue});\r
+                                                       }\r
+                                               }\r
 \r
-                               ++endContainerDepth;\r
-                       }\r
+                                               for (i = 0, l = attrs.length; i < l; i++) {\r
+                                                       attrName = attrs[i].name;\r
 \r
-                       for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
-                               if (p == t[END_CONTAINER])\r
-                                       return _traverseCommonEndContainer(c, how);\r
+                                                       if (!(attrName in sortedAttrs.map)) {\r
+                                                               attrValue = attrs.map[attrName];\r
+                                                               sortedAttrs.map[attrName] = attrValue;\r
+                                                               sortedAttrs.push({name: attrName, value: attrValue});\r
+                                                       }\r
+                                               }\r
 \r
-                               ++startContainerDepth;\r
-                       }\r
+                                               attrs = sortedAttrs;\r
+                                       }\r
 \r
-                       depthDiff = startContainerDepth - endContainerDepth;\r
+                                       writer.start(node.name, attrs, isEmpty);\r
 \r
-                       startNode = t[START_CONTAINER];\r
-                       while (depthDiff > 0) {\r
-                               startNode = startNode.parentNode;\r
-                               depthDiff--;\r
-                       }\r
+                                       if (!isEmpty) {\r
+                                               if ((node = node.firstChild)) {\r
+                                                       do {\r
+                                                               walk(node);\r
+                                                       } while (node = node.next);\r
+                                               }\r
 \r
-                       endNode = t[END_CONTAINER];\r
-                       while (depthDiff < 0) {\r
-                               endNode = endNode.parentNode;\r
-                               depthDiff++;\r
+                                               writer.end(name);\r
+                                       }\r
+                               } else\r
+                                       handler(node);\r
                        }\r
 \r
-                       // ascend the ancestor hierarchy until we have a common parent.\r
-                       for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {\r
-                               startNode = sp;\r
-                               endNode = ep;\r
-                       }\r
+                       // Serialize element and treat all non elements as fragments\r
+                       if (node.type == 1 && !settings.inner)\r
+                               walk(node);\r
+                       else\r
+                               handlers[11](node);\r
 \r
-                       return _traverseCommonAncestors(startNode, endNode, how);\r
+                       return writer.getContent();\r
                };\r
+       }\r
+})(tinymce);\r
 \r
-                function _traverseSameContainer(how) {\r
-                       var frag, s, sub, n, cnt, sibling, xferNode;\r
+// JSLint defined globals\r
+/*global tinymce:false, window:false */\r
 \r
-                       if (how != DELETE)\r
-                               frag = doc.createDocumentFragment();\r
+tinymce.dom = {};\r
 \r
-                       // If selection is empty, just return the fragment\r
-                       if (t[START_OFFSET] == t[END_OFFSET])\r
-                               return frag;\r
+(function(namespace, expando) {\r
+       var w3cEventModel = !!document.addEventListener;\r
 \r
-                       // Text node needs special case handling\r
-                       if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {\r
-                               // get the substring\r
-                               s = t[START_CONTAINER].nodeValue;\r
-                               sub = s.substring(t[START_OFFSET], t[END_OFFSET]);\r
+       function addEvent(target, name, callback, capture) {\r
+               if (target.addEventListener) {\r
+                       target.addEventListener(name, callback, capture || false);\r
+               } else if (target.attachEvent) {\r
+                       target.attachEvent('on' + name, callback);\r
+               }\r
+       }\r
 \r
-                               // set the original text node to its new value\r
-                               if (how != CLONE) {\r
-                                       t[START_CONTAINER].deleteData(t[START_OFFSET], t[END_OFFSET] - t[START_OFFSET]);\r
+       function removeEvent(target, name, callback, capture) {\r
+               if (target.removeEventListener) {\r
+                       target.removeEventListener(name, callback, capture || false);\r
+               } else if (target.detachEvent) {\r
+                       target.detachEvent('on' + name, callback);\r
+               }\r
+       }\r
 \r
-                                       // Nothing is partially selected, so collapse to start point\r
-                                       t.collapse(TRUE);\r
-                               }\r
+       function fix(original_event, data) {\r
+               var name, event = data || {};\r
 \r
-                               if (how == DELETE)\r
-                                       return;\r
+               // Dummy function that gets replaced on the delegation state functions\r
+               function returnFalse() {\r
+                       return false;\r
+               }\r
 \r
-                               frag.appendChild(doc.createTextNode(sub));\r
-                               return frag;\r
-                       }\r
+               // Dummy function that gets replaced on the delegation state functions\r
+               function returnTrue() {\r
+                       return true;\r
+               }\r
 \r
-                       // Copy nodes between the start/end offsets.\r
-                       n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);\r
-                       cnt = t[END_OFFSET] - t[START_OFFSET];\r
+               // Copy all properties from the original event\r
+               for (name in original_event) {\r
+                       // layerX/layerY is deprecated in Chrome and produces a warning\r
+                       if (name !== "layerX" && name !== "layerY") {\r
+                               event[name] = original_event[name];\r
+                       }\r
+               }\r
 \r
-                       while (cnt > 0) {\r
-                               sibling = n.nextSibling;\r
-                               xferNode = _traverseFullySelected(n, how);\r
+               // Normalize target IE uses srcElement\r
+               if (!event.target) {\r
+                       event.target = event.srcElement || document;\r
+               }\r
 \r
-                               if (frag)\r
-                                       frag.appendChild( xferNode );\r
+               // Add preventDefault method\r
+               event.preventDefault = function() {\r
+                       event.isDefaultPrevented = returnTrue;\r
 \r
-                               --cnt;\r
-                               n = sibling;\r
+                       // Execute preventDefault on the original event object\r
+                       if (original_event) {\r
+                               if (original_event.preventDefault) {\r
+                                       original_event.preventDefault();\r
+                               } else {\r
+                                       original_event.returnValue = false; // IE\r
+                               }\r
                        }\r
-\r
-                       // Nothing is partially selected, so collapse to start point\r
-                       if (how != CLONE)\r
-                               t.collapse(TRUE);\r
-\r
-                       return frag;\r
                };\r
 \r
-               function _traverseCommonStartContainer(endAncestor, how) {\r
-                       var frag, n, endIdx, cnt, sibling, xferNode;\r
+               // Add stopPropagation\r
+               event.stopPropagation = function() {\r
+                       event.isPropagationStopped = returnTrue;\r
 \r
-                       if (how != DELETE)\r
-                               frag = doc.createDocumentFragment();\r
+                       // Execute stopPropagation on the original event object\r
+                       if (original_event) {\r
+                               if (original_event.stopPropagation) {\r
+                                       original_event.stopPropagation();\r
+                               } else {\r
+                                       original_event.cancelBubble = true; // IE\r
+                               }\r
+                        }\r
+               };\r
 \r
-                       n = _traverseRightBoundary(endAncestor, how);\r
+               // Add stopImmediatePropagation\r
+               event.stopImmediatePropagation = function() {\r
+                       event.isImmediatePropagationStopped = returnTrue;\r
+                       event.stopPropagation();\r
+               };\r
 \r
-                       if (frag)\r
-                               frag.appendChild(n);\r
+               // Add event delegation states\r
+               if (!event.isDefaultPrevented) {\r
+                       event.isDefaultPrevented = returnFalse;\r
+                       event.isPropagationStopped = returnFalse;\r
+                       event.isImmediatePropagationStopped = returnFalse;\r
+               }\r
 \r
-                       endIdx = nodeIndex(endAncestor);\r
-                       cnt = endIdx - t[START_OFFSET];\r
+               return event;\r
+       }\r
 \r
-                       if (cnt <= 0) {\r
-                               // Collapse to just before the endAncestor, which\r
-                               // is partially selected.\r
-                               if (how != CLONE) {\r
-                                       t.setEndBefore(endAncestor);\r
-                                       t.collapse(FALSE);\r
-                               }\r
+       function bindOnReady(win, callback, event_utils) {\r
+               var doc = win.document, event = {type: 'ready'};\r
 \r
-                               return frag;\r
+               // Gets called when the DOM is ready\r
+               function readyHandler() {\r
+                       if (!event_utils.domLoaded) {\r
+                               event_utils.domLoaded = true;\r
+                               callback(event);\r
                        }\r
+               }\r
 \r
-                       n = endAncestor.previousSibling;\r
-                       while (cnt > 0) {\r
-                               sibling = n.previousSibling;\r
-                               xferNode = _traverseFullySelected(n, how);\r
+               // Use W3C method\r
+               if (w3cEventModel) {\r
+                       addEvent(win, 'DOMContentLoaded', readyHandler);\r
+               } else {\r
+                       // Use IE method\r
+                       addEvent(doc, "readystatechange", function() {\r
+                               if (doc.readyState === "complete") {\r
+                                       removeEvent(doc, "readystatechange", arguments.callee);\r
+                                       readyHandler();\r
+                               }\r
+                       });\r
 \r
-                               if (frag)\r
-                                       frag.insertBefore(xferNode, frag.firstChild);\r
+                       // Wait until we can scroll, when we can the DOM is initialized\r
+                       if (doc.documentElement.doScroll && win === win.top) {\r
+                               (function() {\r
+                                       try {\r
+                                               // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author.\r
+                                               // http://javascript.nwbox.com/IEContentLoaded/\r
+                                               doc.documentElement.doScroll("left");\r
+                                       } catch (ex) {\r
+                                               setTimeout(arguments.callee, 0);\r
+                                               return;\r
+                                       }\r
 \r
-                               --cnt;\r
-                               n = sibling;\r
+                                       readyHandler();\r
+                               })();\r
                        }\r
+               }\r
 \r
-                       // Collapse to just before the endAncestor, which\r
-                       // is partially selected.\r
-                       if (how != CLONE) {\r
-                               t.setEndBefore(endAncestor);\r
-                               t.collapse(FALSE);\r
-                       }\r
+               // Fallback if any of the above methods should fail for some odd reason\r
+               addEvent(win, 'load', readyHandler);\r
+       }\r
 \r
-                       return frag;\r
-               };\r
+       function EventUtils(proxy) {\r
+               var self = this, events = {}, count, isFocusBlurBound, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;\r
 \r
-               function _traverseCommonEndContainer(startAncestor, how) {\r
-                       var frag, startIdx, n, cnt, sibling, xferNode;\r
+               hasMouseEnterLeave = "onmouseenter" in document.documentElement;\r
+               hasFocusIn = "onfocusin" in document.documentElement;\r
+               mouseEnterLeave = {mouseenter: 'mouseover', mouseleave: 'mouseout'};\r
+               count = 1;\r
 \r
-                       if (how != DELETE)\r
-                               frag = doc.createDocumentFragment();\r
+               // State if the DOMContentLoaded was executed or not\r
+               self.domLoaded = false;\r
+               self.events = events;\r
 \r
-                       n = _traverseLeftBoundary(startAncestor, how);\r
-                       if (frag)\r
-                               frag.appendChild(n);\r
+               function executeHandlers(evt, id) {\r
+                       var callbackList, i, l, callback;\r
 \r
-                       startIdx = nodeIndex(startAncestor);\r
-                       ++startIdx;  // Because we already traversed it....\r
+                       callbackList = events[id][evt.type];\r
+                       if (callbackList) {\r
+                               for (i = 0, l = callbackList.length; i < l; i++) {\r
+                                       callback = callbackList[i];\r
+                                       \r
+                                       // Check if callback exists might be removed if a unbind is called inside the callback\r
+                                       if (callback && callback.func.call(callback.scope, evt) === false) {\r
+                                               evt.preventDefault();\r
+                                       }\r
 \r
-                       cnt = t[END_OFFSET] - startIdx;\r
-                       n = startAncestor.nextSibling;\r
-                       while (cnt > 0) {\r
-                               sibling = n.nextSibling;\r
-                               xferNode = _traverseFullySelected(n, how);\r
-\r
-                               if (frag)\r
-                                       frag.appendChild(xferNode);\r
-\r
-                               --cnt;\r
-                               n = sibling;\r
-                       }\r
-\r
-                       if (how != CLONE) {\r
-                               t.setStartAfter(startAncestor);\r
-                               t.collapse(TRUE);\r
+                                       // Should we stop propagation to immediate listeners\r
+                                       if (evt.isImmediatePropagationStopped()) {\r
+                                               return;\r
+                                       }\r
+                               }\r
                        }\r
+               }\r
 \r
-                       return frag;\r
-               };\r
-\r
-               function _traverseCommonAncestors(startAncestor, endAncestor, how) {\r
-                       var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;\r
-\r
-                       if (how != DELETE)\r
-                               frag = doc.createDocumentFragment();\r
-\r
-                       n = _traverseLeftBoundary(startAncestor, how);\r
-                       if (frag)\r
-                               frag.appendChild(n);\r
-\r
-                       commonParent = startAncestor.parentNode;\r
-                       startOffset = nodeIndex(startAncestor);\r
-                       endOffset = nodeIndex(endAncestor);\r
-                       ++startOffset;\r
-\r
-                       cnt = endOffset - startOffset;\r
-                       sibling = startAncestor.nextSibling;\r
-\r
-                       while (cnt > 0) {\r
-                               nextSibling = sibling.nextSibling;\r
-                               n = _traverseFullySelected(sibling, how);\r
-\r
-                               if (frag)\r
-                                       frag.appendChild(n);\r
+               self.bind = function(target, names, callback, scope) {\r
+                       var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window;\r
 \r
-                               sibling = nextSibling;\r
-                               --cnt;\r
+                       // Native event handler function patches the event and executes the callbacks for the expando\r
+                       function defaultNativeHandler(evt) {\r
+                               executeHandlers(fix(evt || win.event), id);\r
                        }\r
 \r
-                       n = _traverseRightBoundary(endAncestor, how);\r
-\r
-                       if (frag)\r
-                               frag.appendChild(n);\r
-\r
-                       if (how != CLONE) {\r
-                               t.setStartAfter(startAncestor);\r
-                               t.collapse(TRUE);\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return;\r
                        }\r
 \r
-                       return frag;\r
-               };\r
-\r
-               function _traverseRightBoundary(root, how) {\r
-                       var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];\r
-\r
-                       if (next == root)\r
-                               return _traverseNode(next, isFullySelected, FALSE, how);\r
-\r
-                       parent = next.parentNode;\r
-                       clonedParent = _traverseNode(parent, FALSE, FALSE, how);\r
-\r
-                       while (parent) {\r
-                               while (next) {\r
-                                       prevSibling = next.previousSibling;\r
-                                       clonedChild = _traverseNode(next, isFullySelected, FALSE, how);\r
-\r
-                                       if (how != DELETE)\r
-                                               clonedParent.insertBefore(clonedChild, clonedParent.firstChild);\r
+                       // Create or get events id for the target\r
+                       if (!target[expando]) {\r
+                               id = count++;\r
+                               target[expando] = id;\r
+                               events[id] = {};\r
+                       } else {\r
+                               id = target[expando];\r
 \r
-                                       isFullySelected = TRUE;\r
-                                       next = prevSibling;\r
+                               if (!events[id]) {\r
+                                       events[id] = {};\r
                                }\r
+                       }\r
 \r
-                               if (parent == root)\r
-                                       return clonedParent;\r
-\r
-                               next = parent.previousSibling;\r
-                               parent = parent.parentNode;\r
-\r
-                               clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);\r
+                       // Setup the specified scope or use the target as a default\r
+                       scope = scope || target;\r
 \r
-                               if (how != DELETE)\r
-                                       clonedGrandParent.appendChild(clonedParent);\r
+                       // Split names and bind each event, enables you to bind multiple events with one call\r
+                       names = names.split(' ');\r
+                       i = names.length;\r
+                       while (i--) {\r
+                               name = names[i];\r
+                               nativeHandler = defaultNativeHandler;\r
+                               fakeName = capture = false;\r
 \r
-                               clonedParent = clonedGrandParent;\r
-                       }\r
-               };\r
+                               // Use ready instead of DOMContentLoaded\r
+                               if (name === "DOMContentLoaded") {\r
+                                       name = "ready";\r
+                               }\r
 \r
-               function _traverseLeftBoundary(root, how) {\r
-                       var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;\r
+                               // DOM is already ready\r
+                               if ((self.domLoaded || target.readyState == 'complete') && name === "ready") {\r
+                                       self.domLoaded = true;\r
+                                       callback.call(scope, fix({type: name}));\r
+                                       continue;\r
+                               }\r
 \r
-                       if (next == root)\r
-                               return _traverseNode(next, isFullySelected, TRUE, how);\r
+                               // Handle mouseenter/mouseleaver\r
+                               if (!hasMouseEnterLeave) {\r
+                                       fakeName = mouseEnterLeave[name];\r
 \r
-                       parent = next.parentNode;\r
-                       clonedParent = _traverseNode(parent, FALSE, TRUE, how);\r
+                                       if (fakeName) {\r
+                                               nativeHandler = function(evt) {\r
+                                                       var current, related;\r
 \r
-                       while (parent) {\r
-                               while (next) {\r
-                                       nextSibling = next.nextSibling;\r
-                                       clonedChild = _traverseNode(next, isFullySelected, TRUE, how);\r
+                                                       current = evt.currentTarget;\r
+                                                       related = evt.relatedTarget;\r
 \r
-                                       if (how != DELETE)\r
-                                               clonedParent.appendChild(clonedChild);\r
+                                                       // Check if related is inside the current target if it's not then the event should be ignored since it's a mouseover/mouseout inside the element\r
+                                                       if (related && current.contains) {\r
+                                                               // Use contains for performance\r
+                                                               related = current.contains(related);\r
+                                                       } else {\r
+                                                               while (related && related !== current) {\r
+                                                                       related = related.parentNode;\r
+                                                               }\r
+                                                       }\r
 \r
-                                       isFullySelected = TRUE;\r
-                                       next = nextSibling;\r
+                                                       // Fire fake event\r
+                                                       if (!related) {\r
+                                                               evt = fix(evt || win.event);\r
+                                                               evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';\r
+                                                               evt.target = current;\r
+                                                               executeHandlers(evt, id);\r
+                                                       }\r
+                                               };\r
+                                       }\r
                                }\r
 \r
-                               if (parent == root)\r
-                                       return clonedParent;\r
-\r
-                               next = parent.nextSibling;\r
-                               parent = parent.parentNode;\r
-\r
-                               clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);\r
+                               // Fake bubbeling of focusin/focusout\r
+                               if (!hasFocusIn && (name === "focusin" || name === "focusout")) {\r
+                                       capture = true;\r
+                                       fakeName = name === "focusin" ? "focus" : "blur";\r
+                                       nativeHandler = function(evt) {\r
+                                               evt = fix(evt || win.event);\r
+                                               evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';\r
+                                               executeHandlers(evt, id);\r
+                                       };\r
+                               }\r
 \r
-                               if (how != DELETE)\r
-                                       clonedGrandParent.appendChild(clonedParent);\r
+                               // Setup callback list and bind native event\r
+                               callbackList = events[id][name];\r
+                               if (!callbackList) {\r
+                                       events[id][name] = callbackList = [{func: callback, scope: scope}];\r
+                                       callbackList.fakeName = fakeName;\r
+                                       callbackList.capture = capture;\r
+\r
+                                       // Add the nativeHandler to the callback list so that we can later unbind it\r
+                                       callbackList.nativeHandler = nativeHandler;\r
+                                       if (!w3cEventModel) {\r
+                                               callbackList.proxyHandler = proxy(id);\r
+                                       }\r
 \r
-                               clonedParent = clonedGrandParent;\r
+                                       // Check if the target has native events support\r
+                                       if (name === "ready") {\r
+                                               bindOnReady(target, nativeHandler, self);\r
+                                       } else {\r
+                                               addEvent(target, fakeName || name, w3cEventModel ? nativeHandler : callbackList.proxyHandler, capture);\r
+                                       }\r
+                               } else {\r
+                                       // If it already has an native handler then just push the callback\r
+                                       callbackList.push({func: callback, scope: scope});\r
+                               }\r
                        }\r
-               };\r
 \r
-               function _traverseNode(n, isFullySelected, isLeft, how) {\r
-                       var txtValue, newNodeValue, oldNodeValue, offset, newNode;\r
+                       target = callbackList = 0; // Clean memory for IE\r
 \r
-                       if (isFullySelected)\r
-                               return _traverseFullySelected(n, how);\r
+                       return callback;\r
+               };\r
 \r
-                       if (n.nodeType == 3 /* TEXT_NODE */) {\r
-                               txtValue = n.nodeValue;\r
+               self.unbind = function(target, names, callback) {\r
+                       var id, callbackList, i, ci, name, eventMap;\r
+\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
+                       }\r
+\r
+                       // Unbind event or events if the target has the expando\r
+                       id = target[expando];\r
+                       if (id) {\r
+                               eventMap = events[id];\r
+\r
+                               // Specific callback\r
+                               if (names) {\r
+                                       names = names.split(' ');\r
+                                       i = names.length;\r
+                                       while (i--) {\r
+                                               name = names[i];\r
+                                               callbackList = eventMap[name];\r
+\r
+                                               // Unbind the event if it exists in the map\r
+                                               if (callbackList) {\r
+                                                       // Remove specified callback\r
+                                                       if (callback) {\r
+                                                               ci = callbackList.length;\r
+                                                               while (ci--) {\r
+                                                                       if (callbackList[ci].func === callback) {\r
+                                                                               callbackList.splice(ci, 1);\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
 \r
-                               if (isLeft) {\r
-                                       offset = t[START_OFFSET];\r
-                                       newNodeValue = txtValue.substring(offset);\r
-                                       oldNodeValue = txtValue.substring(0, offset);\r
+                                                       // Remove all callbacks if there isn't a specified callback or there is no callbacks left\r
+                                                       if (!callback || callbackList.length === 0) {\r
+                                                               delete eventMap[name];\r
+                                                               removeEvent(target, callbackList.fakeName || name, w3cEventModel ? callbackList.nativeHandler : callbackList.proxyHandler, callbackList.capture);\r
+                                                       }\r
+                                               }\r
+                                       }\r
                                } else {\r
-                                       offset = t[END_OFFSET];\r
-                                       newNodeValue = txtValue.substring(0, offset);\r
-                                       oldNodeValue = txtValue.substring(offset);\r
-                               }\r
+                                       // All events for a specific element\r
+                                       for (name in eventMap) {\r
+                                               callbackList = eventMap[name];\r
+                                               removeEvent(target, callbackList.fakeName || name, w3cEventModel ? callbackList.nativeHandler : callbackList.proxyHandler, callbackList.capture);\r
+                                       }\r
 \r
-                               if (how != CLONE)\r
-                                       n.nodeValue = oldNodeValue;\r
+                                       eventMap = {};\r
+                               }\r
 \r
-                               if (how == DELETE)\r
-                                       return;\r
+                               // Check if object is empty, if it isn't then we won't remove the expando map\r
+                               for (name in eventMap) {\r
+                                       return self;\r
+                               }\r
 \r
-                               newNode = n.cloneNode(FALSE);\r
-                               newNode.nodeValue = newNodeValue;\r
+                               // Delete event object\r
+                               delete events[id];\r
 \r
-                               return newNode;\r
+                               // Remove expando from target\r
+                               try {\r
+                                       // IE will fail here since it can't delete properties from window\r
+                                       delete target[expando];\r
+                               } catch (ex) {\r
+                                       // IE will set it to null\r
+                                       target[expando] = null;\r
+                               }\r
                        }\r
 \r
-                       if (how == DELETE)\r
-                               return;\r
-\r
-                       return n.cloneNode(FALSE);\r
+                       return self;\r
                };\r
 \r
-               function _traverseFullySelected(n, how) {\r
-                       if (how != DELETE)\r
-                               return how == CLONE ? n.cloneNode(TRUE) : n;\r
-\r
-                       n.parentNode.removeChild(n);\r
-               };\r
-       };\r
+               self.fire = function(target, name, args) {\r
+                       var id, event;\r
 \r
-       ns.Range = Range;\r
-})(tinymce.dom);\r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
+                       }\r
 \r
-(function() {\r
-       function Selection(selection) {\r
-               var t = this, invisibleChar = '\uFEFF', range, lastIERng, dom = selection.dom, TRUE = true, FALSE = false;\r
+                       // Build event object by patching the args\r
+                       event = fix(null, args);\r
+                       event.type = name;\r
 \r
-               // Returns a W3C DOM compatible range object by using the IE Range API\r
-               function getRange() {\r
-                       var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed;\r
+                       do {\r
+                               // Found an expando that means there is listeners to execute\r
+                               id = target[expando];\r
+                               if (id) {\r
+                                       executeHandlers(event, id);\r
+                               }\r
 \r
-                       // If selection is outside the current document just return an empty range\r
-                       element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();\r
-                       if (element.ownerDocument != dom.doc)\r
-                               return domRange;\r
+                               // Walk up the DOM\r
+                               target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;\r
+                       } while (target && !event.isPropagationStopped());\r
 \r
-                       // Handle control selection or text selection of a image\r
-                       if (ieRange.item || !element.hasChildNodes()) {\r
-                               domRange.setStart(element.parentNode, dom.nodeIndex(element));\r
-                               domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);\r
+                       return self;\r
+               };\r
 \r
-                               return domRange;\r
+               self.clean = function(target) {\r
+                       var i, children, unbind = self.unbind;\r
+       \r
+                       // Don't bind to text nodes or comments\r
+                       if (!target || target.nodeType === 3 || target.nodeType === 8) {\r
+                               return self;\r
                        }\r
 \r
-                       collapsed = selection.isCollapsed();\r
+                       // Unbind any element on the specificed target\r
+                       if (target[expando]) {\r
+                               unbind(target);\r
+                       }\r
 \r
-                       function findEndPoint(start) {\r
-                               var marker, container, offset, nodes, startIndex = 0, endIndex, index, parent, checkRng, position;\r
+                       // Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children\r
+                       if (!target.getElementsByTagName) {\r
+                               target = target.document;\r
+                       }\r
 \r
-                               // Setup temp range and collapse it\r
-                               checkRng = ieRange.duplicate();\r
-                               checkRng.collapse(start);\r
+                       // Remove events from each child element\r
+                       if (target && target.getElementsByTagName) {\r
+                               unbind(target);\r
 \r
-                               // Create marker and insert it at the end of the endpoints parent\r
-                               marker = dom.create('a');\r
-                               parent = checkRng.parentElement();\r
+                               children = target.getElementsByTagName('*');\r
+                               i = children.length;\r
+                               while (i--) {\r
+                                       target = children[i];\r
 \r
-                               // If parent doesn't have any children then set the container to that parent and the index to 0\r
-                               if (!parent.hasChildNodes()) {\r
-                                       domRange[start ? 'setStart' : 'setEnd'](parent, 0);\r
-                                       return;\r
+                                       if (target[expando]) {\r
+                                               unbind(target);\r
+                                       }\r
                                }\r
+                       }\r
 \r
-                               parent.appendChild(marker);\r
-                               checkRng.moveToElementText(marker);\r
-                               position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);\r
-                               if (position > 0) {\r
-                                       // The position is after the end of the parent element.\r
-                                       // This is the case where IE puts the caret to the left edge of a table.\r
-                                       domRange[start ? 'setStartAfter' : 'setEndAfter'](parent);\r
-                                       dom.remove(marker);\r
-                                       return;\r
-                               }\r
+                       return self;\r
+               };\r
 \r
-                               // Setup node list and endIndex\r
-                               nodes = tinymce.grep(parent.childNodes);\r
-                               endIndex = nodes.length - 1;\r
-                               // Perform a binary search for the position\r
-                               while (startIndex <= endIndex) {\r
-                                       index = Math.floor((startIndex + endIndex) / 2);\r
-\r
-                                       // Insert marker and check it's position relative to the selection\r
-                                       parent.insertBefore(marker, nodes[index]);\r
-                                       checkRng.moveToElementText(marker);\r
-                                       position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);\r
-                                       if (position > 0) {\r
-                                               // Marker is to the right\r
-                                               startIndex = index + 1;\r
-                                       } else if (position < 0) {\r
-                                               // Marker is to the left\r
-                                               endIndex = index - 1;\r
-                                       } else {\r
-                                               // Maker is where we are\r
-                                               found = true;\r
-                                               break;\r
-                                       }\r
-                               }\r
+               self.callNativeHandler = function(id, evt) {\r
+                       if (events) {\r
+                               events[id][evt.type].nativeHandler(evt);\r
+                       }\r
+               };\r
 \r
-                               // Setup container\r
-                               container = position > 0 || index == 0 ? marker.nextSibling : marker.previousSibling;\r
+               self.destory = function() {\r
+                       events = {};\r
+               };\r
 \r
-                               // Handle element selection\r
-                               if (container.nodeType == 1) {\r
-                                       dom.remove(marker);\r
+               // Legacy function calls\r
 \r
-                                       // Find offset and container\r
-                                       offset = dom.nodeIndex(container);\r
-                                       container = container.parentNode;\r
+               self.add = function(target, events, func, scope) {\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
+                       }\r
 \r
-                                       // Move the offset if we are setting the end or the position is after an element\r
-                                       if (!start || index > 0)\r
-                                               offset++;\r
-                               } else {\r
-                                       // Calculate offset within text node\r
-                                       if (position > 0 || index == 0) {\r
-                                               checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);\r
-                                               offset = checkRng.text.length;\r
-                                       } else {\r
-                                               checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);\r
-                                               offset = container.nodeValue.length - checkRng.text.length;\r
-                                       }\r
+                       // Old API supported multiple targets\r
+                       if (target && target instanceof Array) {\r
+                               var i = target;\r
 \r
-                                       dom.remove(marker);\r
+                               while (i--) {\r
+                                       self.add(target[i], events, func, scope);\r
                                }\r
 \r
-                               domRange[start ? 'setStart' : 'setEnd'](container, offset);\r
-                       };\r
-\r
-                       // Find start point\r
-                       findEndPoint(true);\r
+                               return;\r
+                       }\r
 \r
-                       // Find end point if needed\r
-                       if (!collapsed)\r
-                               findEndPoint();\r
+                       // Old API called ready init\r
+                       if (events === "init") {\r
+                               events = "ready";\r
+                       }\r
 \r
-                       return domRange;\r
+                       return self.bind(target, events instanceof Array ? events.join(' ') : events, func, scope);\r
                };\r
 \r
-               this.addRange = function(rng) {\r
-                       var ieRng, ieRng2, doc = selection.dom.doc, body = doc.body, startPos, endPos, sc, so, ec, eo, marker, lastIndex, skipStart, skipEnd;\r
+               self.remove = function(target, events, func) {\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
+                       }\r
 \r
-                       this.destroy();\r
+                       // Old API supported multiple targets\r
+                       if (target instanceof Array) {\r
+                               var i = target;\r
 \r
-                       // Setup some shorter versions\r
-                       sc = rng.startContainer;\r
-                       so = rng.startOffset;\r
-                       ec = rng.endContainer;\r
-                       eo = rng.endOffset;\r
-                       ieRng = body.createTextRange();\r
+                               while (i--) {\r
+                                       self.remove(target[i], events, func, scope);\r
+                               }\r
 \r
-                       // If document selection move caret to first node in document\r
-                       if (sc == doc || ec == doc) {\r
-                               ieRng = body.createTextRange();\r
-                               ieRng.collapse();\r
-                               ieRng.select();\r
-                               return;\r
+                               return self;\r
                        }\r
 \r
-                       // If child index resolve it\r
-                       if (sc.nodeType == 1 && sc.hasChildNodes()) {\r
-                               lastIndex = sc.childNodes.length - 1;\r
-\r
-                               // Index is higher that the child count then we need to jump over the start container\r
-                               if (so > lastIndex) {\r
-                                       skipStart = 1;\r
-                                       sc = sc.childNodes[lastIndex];\r
-                               } else\r
-                                       sc = sc.childNodes[so];\r
+                       return self.unbind(target, events instanceof Array ? events.join(' ') : events, func);\r
+               };\r
 \r
-                               // Child was text node then move offset to start of it\r
-                               if (sc.nodeType == 3)\r
-                                       so = 0;\r
+               self.clear = function(target) {\r
+                       // Old API supported direct ID assignment\r
+                       if (typeof(target) === "string") {\r
+                               target = document.getElementById(target);\r
                        }\r
 \r
-                       // If child index resolve it\r
-                       if (ec.nodeType == 1 && ec.hasChildNodes()) {\r
-                               lastIndex = ec.childNodes.length - 1;\r
-\r
-                               if (eo == 0) {\r
-                                       skipEnd = 1;\r
-                                       ec = ec.childNodes[0];\r
-                               } else {\r
-                                       ec = ec.childNodes[Math.min(lastIndex, eo - 1)];\r
+                       return self.clean(target);\r
+               };\r
 \r
-                                       // Child was text node then move offset to end of text node\r
-                                       if (ec.nodeType == 3)\r
-                                               eo = ec.nodeValue.length;\r
-                               }\r
+               self.cancel = function(e) {\r
+                       if (e) {\r
+                               self.prevent(e);\r
+                               self.stop(e);\r
                        }\r
 \r
-                       // Single element selection\r
-                       if (sc == ec && sc.nodeType == 1) {\r
-                               // Make control selection for some elements\r
-                               if (/^(IMG|TABLE)$/.test(sc.nodeName) && so != eo) {\r
-                                       ieRng = body.createControlRange();\r
-                                       ieRng.addElement(sc);\r
-                               } else {\r
-                                       ieRng = body.createTextRange();\r
+                       return false;\r
+               };\r
 \r
-                                       // Padd empty elements with invisible character\r
-                                       if (!sc.hasChildNodes() && sc.canHaveHTML)\r
-                                               sc.innerHTML = invisibleChar;\r
+               self.prevent = function(e) {\r
+                       e.preventDefault();\r
 \r
-                                       // Select element contents\r
-                                       ieRng.moveToElementText(sc);\r
+                       return false;\r
+               };\r
 \r
-                                       // If it's only containing a padding remove it so the caret remains\r
-                                       if (sc.innerHTML == invisibleChar) {\r
-                                               ieRng.collapse(TRUE);\r
-                                               sc.removeChild(sc.firstChild);\r
-                                       }\r
-                               }\r
+               self.stop = function(e) {\r
+                       e.stopPropagation();\r
 \r
-                               if (so == eo)\r
-                                       ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1);\r
+                       return false;\r
+               };\r
+       }\r
 \r
-                               ieRng.select();\r
-                               ieRng.scrollIntoView();\r
-                               return;\r
-                       }\r
+       namespace.EventUtils = EventUtils;\r
 \r
-                       // Create range and marker\r
-                       ieRng = body.createTextRange();\r
-                       marker = doc.createElement('span');\r
-                       marker.innerHTML = ' ';\r
-\r
-                       // Set start of range to startContainer/startOffset\r
-                       if (sc.nodeType == 3) {\r
-                               // Insert marker after/before startContainer\r
-                               if (skipStart)\r
-                                       dom.insertAfter(marker, sc);\r
-                               else\r
-                                       sc.parentNode.insertBefore(marker, sc);\r
+       namespace.Event = new EventUtils(function(id) {\r
+               return function(evt) {\r
+                       tinymce.dom.Event.callNativeHandler(id, evt);\r
+               };\r
+       });\r
 \r
-                               // Select marker the caret to offset position\r
-                               ieRng.moveToElementText(marker);\r
-                               marker.parentNode.removeChild(marker);\r
+       // Bind ready event when tinymce script is loaded\r
+       namespace.Event.bind(window, 'ready', function() {});\r
 \r
-                               // Move if we need to, moving it 0 characters actually moves it!\r
-                               if (so > 0)\r
-                                       ieRng.move('character', so);\r
-                       } else {\r
-                               ieRng.moveToElementText(sc);\r
+       namespace = 0;\r
+})(tinymce.dom, 'data-mce-expando'); // Namespace and expando\r
 \r
-                               if (skipStart)\r
-                                       ieRng.collapse(FALSE);\r
-                       }\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var each = tinymce.each,\r
+               is = tinymce.is,\r
+               isWebKit = tinymce.isWebKit,\r
+               isIE = tinymce.isIE,\r
+               Entities = tinymce.html.Entities,\r
+               simpleSelectorRe = /^([a-z0-9],?)+$/i,\r
+               whiteSpaceRegExp = /^[ \t\r\n]*$/;\r
 \r
-                       // If same text container then we can do a more simple move\r
-                       if (sc == ec && sc.nodeType == 3) {\r
-                               try {\r
-                                       ieRng.moveEnd('character', eo - so);\r
-                                       ieRng.select();\r
-                                       ieRng.scrollIntoView();\r
-                               } catch (ex) {\r
-                                       // Some times a Runtime error of the 800a025e type gets thrown\r
-                                       // especially when the caret is placed before a table.\r
-                                       // This is a somewhat strange location for the caret.\r
-                                       // TODO: Find a better solution for this would possible require a rewrite of the setRng method\r
-                               }\r
+       tinymce.create('tinymce.dom.DOMUtils', {\r
+               doc : null,\r
+               root : null,\r
+               files : null,\r
+               pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,\r
+               props : {\r
+                       "for" : "htmlFor",\r
+                       "class" : "className",\r
+                       className : "className",\r
+                       checked : "checked",\r
+                       disabled : "disabled",\r
+                       maxlength : "maxLength",\r
+                       readonly : "readOnly",\r
+                       selected : "selected",\r
+                       value : "value",\r
+                       id : "id",\r
+                       name : "name",\r
+                       type : "type"\r
+               },\r
 \r
-                               return;\r
-                       }\r
+               DOMUtils : function(d, s) {\r
+                       var t = this, globalStyle, name, blockElementsMap;\r
 \r
-                       // Set end of range to endContainer/endOffset\r
-                       ieRng2 = body.createTextRange();\r
-                       if (ec.nodeType == 3) {\r
-                               // Insert marker after/before startContainer\r
-                               ec.parentNode.insertBefore(marker, ec);\r
+                       t.doc = d;\r
+                       t.win = window;\r
+                       t.files = {};\r
+                       t.cssFlicker = false;\r
+                       t.counter = 0;\r
+                       t.stdMode = !tinymce.isIE || d.documentMode >= 8;\r
+                       t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat" || t.stdMode;\r
+                       t.hasOuterHTML = "outerHTML" in d.createElement("a");\r
 \r
-                               // Move selection to end marker and move caret to end offset\r
-                               ieRng2.moveToElementText(marker);\r
-                               marker.parentNode.removeChild(marker);\r
-                               ieRng2.move('character', eo);\r
-                               ieRng.setEndPoint('EndToStart', ieRng2);\r
-                       } else {\r
-                               ieRng2.moveToElementText(ec);\r
-                               ieRng2.collapse(!!skipEnd);\r
-                               ieRng.setEndPoint('EndToEnd', ieRng2);\r
+                       t.settings = s = tinymce.extend({\r
+                               keep_values : false,\r
+                               hex_colors : 1\r
+                       }, s);\r
+                       \r
+                       t.schema = s.schema;\r
+                       t.styles = new tinymce.html.Styles({\r
+                               url_converter : s.url_converter,\r
+                               url_converter_scope : s.url_converter_scope\r
+                       }, s.schema);\r
+\r
+                       // Fix IE6SP2 flicker and check it failed for pre SP2\r
+                       if (tinymce.isIE6) {\r
+                               try {\r
+                                       d.execCommand('BackgroundImageCache', false, true);\r
+                               } catch (e) {\r
+                                       t.cssFlicker = true;\r
+                               }\r
                        }\r
 \r
-                       ieRng.select();\r
-                       ieRng.scrollIntoView();\r
-               };\r
+                       t.fixDoc(d);\r
+                       t.events = s.ownEvents ? new tinymce.dom.EventUtils(s.proxy) : tinymce.dom.Event;\r
+                       tinymce.addUnload(t.destroy, t);\r
+                       blockElementsMap = s.schema ? s.schema.getBlockElements() : {};\r
 \r
-               this.getRangeAt = function() {\r
-                       // Setup new range if the cache is empty\r
-                       if (!range || !tinymce.dom.RangeUtils.compareRanges(lastIERng, selection.getRng())) {\r
-                               range = getRange();\r
+                       t.isBlock = function(node) {\r
+                               // This function is called in module pattern style since it might be executed with the wrong this scope\r
+                               var type = node.nodeType;\r
 \r
-                               // Store away text range for next call\r
-                               lastIERng = selection.getRng();\r
-                       }\r
+                               // If it's a node then check the type and use the nodeName\r
+                               if (type)\r
+                                       return !!(type === 1 && blockElementsMap[node.nodeName]);\r
 \r
-                       // IE will say that the range is equal then produce an invalid argument exception\r
-                       // if you perform specific operations in a keyup event. For example Ctrl+Del.\r
-                       // This hack will invalidate the range cache if the exception occurs\r
-                       try {\r
-                               range.startContainer.nextSibling;\r
-                       } catch (ex) {\r
-                               range = getRange();\r
-                               lastIERng = null;\r
-                       }\r
+                               return !!blockElementsMap[node];\r
+                       };\r
+               },\r
 \r
-                       // Return cached range\r
-                       return range;\r
-               };\r
+               fixDoc: function(doc) {\r
+                       var settings = this.settings, name;\r
 \r
-               this.destroy = function() {\r
-                       // Destroy cached range and last IE range to avoid memory leaks\r
-                       lastIERng = range = null;\r
-               };\r
+                       if (isIE && settings.schema) {\r
+                               // Add missing HTML 4/5 elements to IE\r
+                               ('abbr article aside audio canvas ' +\r
+                               'details figcaption figure footer ' +\r
+                               'header hgroup mark menu meter nav ' +\r
+                               'output progress section summary ' +\r
+                               'time video').replace(/\w+/g, function(name) {\r
+                                       doc.createElement(name);\r
+                               });\r
 \r
-               // IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode\r
-               if (selection.dom.boxModel) {\r
-                       (function() {\r
-                               var doc = dom.doc, body = doc.body, started, startRng;\r
+                               // Create all custom elements\r
+                               for (name in settings.schema.getCustomElements()) {\r
+                                       doc.createElement(name);\r
+                               }\r
+                       }\r
+               },\r
 \r
-                               // Make HTML element unselectable since we are going to handle selection by hand\r
-                               doc.documentElement.unselectable = TRUE;\r
+               clone: function(node, deep) {\r
+                       var self = this, clone, doc;\r
 \r
-                               // Return range from point or null if it failed\r
-                               function rngFromPoint(x, y) {\r
-                                       var rng = body.createTextRange();\r
+                       // TODO: Add feature detection here in the future\r
+                       if (!isIE || node.nodeType !== 1 || deep) {\r
+                               return node.cloneNode(deep);\r
+                       }\r
 \r
-                                       try {\r
-                                               rng.moveToPoint(x, y);\r
-                                       } catch (ex) {\r
-                                               // IE sometimes throws and exception, so lets just ignore it\r
-                                               rng = null;\r
-                                       }\r
+                       doc = self.doc;\r
 \r
-                                       return rng;\r
-                               };\r
+                       // Make a HTML5 safe shallow copy\r
+                       if (!deep) {\r
+                               clone = doc.createElement(node.nodeName);\r
 \r
-                               // Fires while the selection is changing\r
-                               function selectionChange(e) {\r
-                                       var pointRng;\r
+                               // Copy attribs\r
+                               each(self.getAttribs(node), function(attr) {\r
+                                       self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName));\r
+                               });\r
 \r
-                                       // Check if the button is down or not\r
-                                       if (e.button) {\r
-                                               // Create range from mouse position\r
-                                               pointRng = rngFromPoint(e.x, e.y);\r
+                               return clone;\r
+                       }\r
+/*\r
+                       // Setup HTML5 patched document fragment\r
+                       if (!self.frag) {\r
+                               self.frag = doc.createDocumentFragment();\r
+                               self.fixDoc(self.frag);\r
+                       }\r
 \r
-                                               if (pointRng) {\r
-                                                       // Check if pointRange is before/after selection then change the endPoint\r
-                                                       if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\r
-                                                               pointRng.setEndPoint('StartToStart', startRng);\r
-                                                       else\r
-                                                               pointRng.setEndPoint('EndToEnd', startRng);\r
+                       // Make a deep copy by adding it to the document fragment then removing it this removed the :section\r
+                       clone = doc.createElement('div');\r
+                       self.frag.appendChild(clone);\r
+                       clone.innerHTML = node.outerHTML;\r
+                       self.frag.removeChild(clone);\r
+*/\r
+                       return clone.firstChild;\r
+               },\r
 \r
-                                                       pointRng.select();\r
-                                               }\r
-                                       } else\r
-                                               endSelection();\r
-                               }\r
+               getRoot : function() {\r
+                       var t = this, s = t.settings;\r
 \r
-                               // Removes listeners\r
-                               function endSelection() {\r
-                                       dom.unbind(doc, 'mouseup', endSelection);\r
-                                       dom.unbind(doc, 'mousemove', selectionChange);\r
-                                       started = 0;\r
-                               };\r
+                       return (s && t.get(s.root_element)) || t.doc.body;\r
+               },\r
 \r
-                               // Detect when user selects outside BODY\r
-                               dom.bind(doc, 'mousedown', function(e) {\r
-                                       if (e.target.nodeName === 'HTML') {\r
-                                               if (started)\r
-                                                       endSelection();\r
+               getViewPort : function(w) {\r
+                       var d, b;\r
 \r
-                                               started = 1;\r
+                       w = !w ? this.win : w;\r
+                       d = w.document;\r
+                       b = this.boxModel ? d.documentElement : d.body;\r
 \r
-                                               // Setup start position\r
-                                               startRng = rngFromPoint(e.x, e.y);\r
-                                               if (startRng) {\r
-                                                       // Listen for selection change events\r
-                                                       dom.bind(doc, 'mouseup', endSelection);\r
-                                                       dom.bind(doc, 'mousemove', selectionChange);\r
+                       // Returns viewport size excluding scrollbars\r
+                       return {\r
+                               x : w.pageXOffset || b.scrollLeft,\r
+                               y : w.pageYOffset || b.scrollTop,\r
+                               w : w.innerWidth || b.clientWidth,\r
+                               h : w.innerHeight || b.clientHeight\r
+                       };\r
+               },\r
 \r
-                                                       startRng.select();\r
-                                               }\r
-                                       }\r
-                               });\r
-                       })();\r
-               }\r
-       };\r
+               getRect : function(e) {\r
+                       var p, t = this, sr;\r
 \r
-       // Expose the selection object\r
-       tinymce.dom.TridentSelection = Selection;\r
-})();\r
+                       e = t.get(e);\r
+                       p = t.getPos(e);\r
+                       sr = t.getSize(e);\r
 \r
+                       return {\r
+                               x : p.x,\r
+                               y : p.y,\r
+                               w : sr.w,\r
+                               h : sr.h\r
+                       };\r
+               },\r
 \r
-/*\r
- * Sizzle CSS Selector Engine - v1.0\r
- *  Copyright 2009, The Dojo Foundation\r
- *  Released under the MIT, BSD, and GPL Licenses.\r
- *  More information: http://sizzlejs.com/\r
- */\r
-(function(){\r
+               getSize : function(e) {\r
+                       var t = this, w, h;\r
 \r
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,\r
-       done = 0,\r
-       toString = Object.prototype.toString,\r
-       hasDuplicate = false,\r
-       baseHasDuplicate = true;\r
+                       e = t.get(e);\r
+                       w = t.getStyle(e, 'width');\r
+                       h = t.getStyle(e, 'height');\r
 \r
-// Here we check if the JavaScript engine is using some sort of\r
-// optimization where it does not always call our comparision\r
-// function. If that is the case, discard the hasDuplicate value.\r
-//   Thus far that includes Google Chrome.\r
-[0, 0].sort(function(){\r
-       baseHasDuplicate = false;\r
-       return 0;\r
-});\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (w.indexOf('px') === -1)\r
+                               w = 0;\r
 \r
-var Sizzle = function(selector, context, results, seed) {\r
-       results = results || [];\r
-       context = context || document;\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (h.indexOf('px') === -1)\r
+                               h = 0;\r
 \r
-       var origContext = context;\r
+                       return {\r
+                               w : parseInt(w) || e.offsetWidth || e.clientWidth,\r
+                               h : parseInt(h) || e.offsetHeight || e.clientHeight\r
+                       };\r
+               },\r
 \r
-       if ( context.nodeType !== 1 && context.nodeType !== 9 ) {\r
-               return [];\r
-       }\r
-       \r
-       if ( !selector || typeof selector !== "string" ) {\r
-               return results;\r
-       }\r
+               getParent : function(n, f, r) {\r
+                       return this.getParents(n, f, r, false);\r
+               },\r
 \r
-       var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),\r
-               soFar = selector, ret, cur, pop, i;\r
-       \r
-       // Reset the position of the chunker regexp (start from head)\r
-       do {\r
-               chunker.exec("");\r
-               m = chunker.exec(soFar);\r
+               getParents : function(n, f, r, c) {\r
+                       var t = this, na, se = t.settings, o = [];\r
 \r
-               if ( m ) {\r
-                       soFar = m[3];\r
-               \r
-                       parts.push( m[1] );\r
-               \r
-                       if ( m[2] ) {\r
-                               extra = m[3];\r
-                               break;\r
-                       }\r
-               }\r
-       } while ( m );\r
+                       n = t.get(n);\r
+                       c = c === undefined;\r
 \r
-       if ( parts.length > 1 && origPOS.exec( selector ) ) {\r
-               if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {\r
-                       set = posProcess( parts[0] + parts[1], context );\r
-               } else {\r
-                       set = Expr.relative[ parts[0] ] ?\r
-                               [ context ] :\r
-                               Sizzle( parts.shift(), context );\r
+                       if (se.strict_root)\r
+                               r = r || t.getRoot();\r
 \r
-                       while ( parts.length ) {\r
-                               selector = parts.shift();\r
+                       // Wrap node name as func\r
+                       if (is(f, 'string')) {\r
+                               na = f;\r
 \r
-                               if ( Expr.relative[ selector ] ) {\r
-                                       selector += parts.shift();\r
+                               if (f === '*') {\r
+                                       f = function(n) {return n.nodeType == 1;};\r
+                               } else {\r
+                                       f = function(n) {\r
+                                               return t.is(n, na);\r
+                                       };\r
                                }\r
-                               \r
-                               set = posProcess( selector, set );\r
                        }\r
-               }\r
-       } else {\r
-               // Take a shortcut and set the context if the root selector is an ID\r
-               // (but not if it'll be faster if the inner selector is an ID)\r
-               if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&\r
-                               Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {\r
-                       ret = Sizzle.find( parts.shift(), context, contextXML );\r
-                       context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];\r
-               }\r
 \r
-               if ( context ) {\r
-                       ret = seed ?\r
-                               { expr: parts.pop(), set: makeArray(seed) } :\r
-                               Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );\r
-                       set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;\r
+                       while (n) {\r
+                               if (n == r || !n.nodeType || n.nodeType === 9)\r
+                                       break;\r
 \r
-                       if ( parts.length > 0 ) {\r
-                               checkSet = makeArray(set);\r
-                       } else {\r
-                               prune = false;\r
+                               if (!f || f(n)) {\r
+                                       if (c)\r
+                                               o.push(n);\r
+                                       else\r
+                                               return n;\r
+                               }\r
+\r
+                               n = n.parentNode;\r
                        }\r
 \r
-                       while ( parts.length ) {\r
-                               cur = parts.pop();\r
-                               pop = cur;\r
+                       return c ? o : null;\r
+               },\r
 \r
-                               if ( !Expr.relative[ cur ] ) {\r
-                                       cur = "";\r
-                               } else {\r
-                                       pop = parts.pop();\r
-                               }\r
+               get : function(e) {\r
+                       var n;\r
 \r
-                               if ( pop == null ) {\r
-                                       pop = context;\r
-                               }\r
+                       if (e && this.doc && typeof(e) == 'string') {\r
+                               n = e;\r
+                               e = this.doc.getElementById(e);\r
 \r
-                               Expr.relative[ cur ]( checkSet, pop, contextXML );\r
+                               // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick\r
+                               if (e && e.id !== n)\r
+                                       return this.doc.getElementsByName(n)[1];\r
                        }\r
-               } else {\r
-                       checkSet = parts = [];\r
-               }\r
-       }\r
 \r
-       if ( !checkSet ) {\r
-               checkSet = set;\r
-       }\r
+                       return e;\r
+               },\r
 \r
-       if ( !checkSet ) {\r
-               Sizzle.error( cur || selector );\r
-       }\r
+               getNext : function(node, selector) {\r
+                       return this._findSib(node, selector, 'nextSibling');\r
+               },\r
 \r
-       if ( toString.call(checkSet) === "[object Array]" ) {\r
-               if ( !prune ) {\r
-                       results.push.apply( results, checkSet );\r
-               } else if ( context && context.nodeType === 1 ) {\r
-                       for ( i = 0; checkSet[i] != null; i++ ) {\r
-                               if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {\r
-                                       results.push( set[i] );\r
-                               }\r
-                       }\r
-               } else {\r
-                       for ( i = 0; checkSet[i] != null; i++ ) {\r
-                               if ( checkSet[i] && checkSet[i].nodeType === 1 ) {\r
-                                       results.push( set[i] );\r
-                               }\r
-                       }\r
-               }\r
-       } else {\r
-               makeArray( checkSet, results );\r
-       }\r
+               getPrev : function(node, selector) {\r
+                       return this._findSib(node, selector, 'previousSibling');\r
+               },\r
 \r
-       if ( extra ) {\r
-               Sizzle( extra, origContext, results, seed );\r
-               Sizzle.uniqueSort( results );\r
-       }\r
 \r
-       return results;\r
-};\r
+               select : function(pa, s) {\r
+                       var t = this;\r
 \r
-Sizzle.uniqueSort = function(results){\r
-       if ( sortOrder ) {\r
-               hasDuplicate = baseHasDuplicate;\r
-               results.sort(sortOrder);\r
+                       return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);\r
+               },\r
 \r
-               if ( hasDuplicate ) {\r
-                       for ( var i = 1; i < results.length; i++ ) {\r
-                               if ( results[i] === results[i-1] ) {\r
-                                       results.splice(i--, 1);\r
+               is : function(n, selector) {\r
+                       var i;\r
+\r
+                       // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance\r
+                       if (n.length === undefined) {\r
+                               // Simple all selector\r
+                               if (selector === '*')\r
+                                       return n.nodeType == 1;\r
+\r
+                               // Simple selector just elements\r
+                               if (simpleSelectorRe.test(selector)) {\r
+                                       selector = selector.toLowerCase().split(/,/);\r
+                                       n = n.nodeName.toLowerCase();\r
+\r
+                                       for (i = selector.length - 1; i >= 0; i--) {\r
+                                               if (selector[i] == n)\r
+                                                       return true;\r
+                                       }\r
+\r
+                                       return false;\r
                                }\r
                        }\r
-               }\r
-       }\r
 \r
-       return results;\r
-};\r
+                       return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;\r
+               },\r
 \r
-Sizzle.matches = function(expr, set){\r
-       return Sizzle(expr, null, null, set);\r
-};\r
 \r
-Sizzle.find = function(expr, context, isXML){\r
-       var set;\r
+               add : function(p, n, a, h, c) {\r
+                       var t = this;\r
 \r
-       if ( !expr ) {\r
-               return [];\r
-       }\r
+                       return this.run(p, function(p) {\r
+                               var e, k;\r
 \r
-       for ( var i = 0, l = Expr.order.length; i < l; i++ ) {\r
-               var type = Expr.order[i], match;\r
-               \r
-               if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {\r
-                       var left = match[1];\r
-                       match.splice(1,1);\r
+                               e = is(n, 'string') ? t.doc.createElement(n) : n;\r
+                               t.setAttribs(e, a);\r
 \r
-                       if ( left.substr( left.length - 1 ) !== "\\" ) {\r
-                               match[1] = (match[1] || "").replace(/\\/g, "");\r
-                               set = Expr.find[ type ]( match, context, isXML );\r
-                               if ( set != null ) {\r
-                                       expr = expr.replace( Expr.match[ type ], "" );\r
-                                       break;\r
+                               if (h) {\r
+                                       if (h.nodeType)\r
+                                               e.appendChild(h);\r
+                                       else\r
+                                               t.setHTML(e, h);\r
                                }\r
-                       }\r
-               }\r
-       }\r
 \r
-       if ( !set ) {\r
-               set = context.getElementsByTagName("*");\r
-       }\r
-\r
-       return {set: set, expr: expr};\r
-};\r
+                               return !c ? p.appendChild(e) : e;\r
+                       });\r
+               },\r
 \r
-Sizzle.filter = function(expr, set, inplace, not){\r
-       var old = expr, result = [], curLoop = set, match, anyFound,\r
-               isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);\r
+               create : function(n, a, h) {\r
+                       return this.add(this.doc.createElement(n), n, a, h, 1);\r
+               },\r
 \r
-       while ( expr && set.length ) {\r
-               for ( var type in Expr.filter ) {\r
-                       if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {\r
-                               var filter = Expr.filter[ type ], found, item, left = match[1];\r
-                               anyFound = false;\r
+               createHTML : function(n, a, h) {\r
+                       var o = '', t = this, k;\r
 \r
-                               match.splice(1,1);\r
+                       o += '<' + n;\r
 \r
-                               if ( left.substr( left.length - 1 ) === "\\" ) {\r
-                                       continue;\r
-                               }\r
+                       for (k in a) {\r
+                               if (a.hasOwnProperty(k))\r
+                                       o += ' ' + k + '="' + t.encode(a[k]) + '"';\r
+                       }\r
 \r
-                               if ( curLoop === result ) {\r
-                                       result = [];\r
-                               }\r
+                       // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime\r
+                       if (typeof(h) != "undefined")\r
+                               return o + '>' + h + '</' + n + '>';\r
 \r
-                               if ( Expr.preFilter[ type ] ) {\r
-                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\r
+                       return o + ' />';\r
+               },\r
 \r
-                                       if ( !match ) {\r
-                                               anyFound = found = true;\r
-                                       } else if ( match === true ) {\r
-                                               continue;\r
-                                       }\r
-                               }\r
+               remove : function(node, keep_children) {\r
+                       return this.run(node, function(node) {\r
+                               var child, parent = node.parentNode;\r
 \r
-                               if ( match ) {\r
-                                       for ( var i = 0; (item = curLoop[i]) != null; i++ ) {\r
-                                               if ( item ) {\r
-                                                       found = filter( item, match, i, curLoop );\r
-                                                       var pass = not ^ !!found;\r
+                               if (!parent)\r
+                                       return null;\r
 \r
-                                                       if ( inplace && found != null ) {\r
-                                                               if ( pass ) {\r
-                                                                       anyFound = true;\r
-                                                               } else {\r
-                                                                       curLoop[i] = false;\r
-                                                               }\r
-                                                       } else if ( pass ) {\r
-                                                               result.push( item );\r
-                                                               anyFound = true;\r
-                                                       }\r
-                                               }\r
+                               if (keep_children) {\r
+                                       while (child = node.firstChild) {\r
+                                               // IE 8 will crash if you don't remove completely empty text nodes\r
+                                               if (!tinymce.isIE || child.nodeType !== 3 || child.nodeValue)\r
+                                                       parent.insertBefore(child, node);\r
+                                               else\r
+                                                       node.removeChild(child);\r
                                        }\r
                                }\r
 \r
-                               if ( found !== undefined ) {\r
-                                       if ( !inplace ) {\r
-                                               curLoop = result;\r
-                                       }\r
+                               return parent.removeChild(node);\r
+                       });\r
+               },\r
 \r
-                                       expr = expr.replace( Expr.match[ type ], "" );\r
+               setStyle : function(n, na, v) {\r
+                       var t = this;\r
 \r
-                                       if ( !anyFound ) {\r
-                                               return [];\r
-                                       }\r
+                       return t.run(n, function(e) {\r
+                               var s, i;\r
 \r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
+                               s = e.style;\r
 \r
-               // Improper expression\r
-               if ( expr === old ) {\r
-                       if ( anyFound == null ) {\r
-                               Sizzle.error( expr );\r
-                       } else {\r
-                               break;\r
-                       }\r
-               }\r
+                               // Camelcase it, if needed\r
+                               na = na.replace(/-(\D)/g, function(a, b){\r
+                                       return b.toUpperCase();\r
+                               });\r
 \r
-               old = expr;\r
-       }\r
+                               // Default px suffix on these\r
+                               if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))\r
+                                       v += 'px';\r
 \r
-       return curLoop;\r
-};\r
+                               switch (na) {\r
+                                       case 'opacity':\r
+                                               // IE specific opacity\r
+                                               if (isIE) {\r
+                                                       s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";\r
 \r
-Sizzle.error = function( msg ) {\r
-       throw "Syntax error, unrecognized expression: " + msg;\r
-};\r
+                                                       if (!n.currentStyle || !n.currentStyle.hasLayout)\r
+                                                               s.display = 'inline-block';\r
+                                               }\r
 \r
-var Expr = Sizzle.selectors = {\r
-       order: [ "ID", "NAME", "TAG" ],\r
-       match: {\r
-               ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
-               CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
-               NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,\r
-               ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,\r
-               TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,\r
-               CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,\r
-               POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,\r
-               PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/\r
-       },\r
-       leftMatch: {},\r
-       attrMap: {\r
-               "class": "className",\r
-               "for": "htmlFor"\r
-       },\r
-       attrHandle: {\r
-               href: function(elem){\r
-                       return elem.getAttribute("href");\r
-               }\r
-       },\r
-       relative: {\r
-               "+": function(checkSet, part){\r
-                       var isPartStr = typeof part === "string",\r
-                               isTag = isPartStr && !/\W/.test(part),\r
-                               isPartStrNotTag = isPartStr && !isTag;\r
-\r
-                       if ( isTag ) {\r
-                               part = part.toLowerCase();\r
-                       }\r
-\r
-                       for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {\r
-                               if ( (elem = checkSet[i]) ) {\r
-                                       while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}\r
+                                               // Fix for older browsers\r
+                                               s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';\r
+                                               break;\r
 \r
-                                       checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\r
-                                               elem || false :\r
-                                               elem === part;\r
+                                       case 'float':\r
+                                               isIE ? s.styleFloat = v : s.cssFloat = v;\r
+                                               break;\r
+                                       \r
+                                       default:\r
+                                               s[na] = v || '';\r
                                }\r
-                       }\r
 \r
-                       if ( isPartStrNotTag ) {\r
-                               Sizzle.filter( part, checkSet, true );\r
-                       }\r
+                               // Force update of the style data\r
+                               if (t.settings.update_styles)\r
+                                       t.setAttrib(e, 'data-mce-style');\r
+                       });\r
                },\r
-               ">": function(checkSet, part){\r
-                       var isPartStr = typeof part === "string",\r
-                               elem, i = 0, l = checkSet.length;\r
 \r
-                       if ( isPartStr && !/\W/.test(part) ) {\r
-                               part = part.toLowerCase();\r
+               getStyle : function(n, na, c) {\r
+                       n = this.get(n);\r
 \r
-                               for ( ; i < l; i++ ) {\r
-                                       elem = checkSet[i];\r
-                                       if ( elem ) {\r
-                                               var parent = elem.parentNode;\r
-                                               checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;\r
-                                       }\r
-                               }\r
-                       } else {\r
-                               for ( ; i < l; i++ ) {\r
-                                       elem = checkSet[i];\r
-                                       if ( elem ) {\r
-                                               checkSet[i] = isPartStr ?\r
-                                                       elem.parentNode :\r
-                                                       elem.parentNode === part;\r
-                                       }\r
-                               }\r
+                       if (!n)\r
+                               return;\r
 \r
-                               if ( isPartStr ) {\r
-                                       Sizzle.filter( part, checkSet, true );\r
+                       // Gecko\r
+                       if (this.doc.defaultView && c) {\r
+                               // Remove camelcase\r
+                               na = na.replace(/[A-Z]/g, function(a){\r
+                                       return '-' + a;\r
+                               });\r
+\r
+                               try {\r
+                                       return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);\r
+                               } catch (ex) {\r
+                                       // Old safari might fail\r
+                                       return null;\r
                                }\r
                        }\r
-               },\r
-               "": function(checkSet, part, isXML){\r
-                       var doneName = done++, checkFn = dirCheck, nodeCheck;\r
 \r
-                       if ( typeof part === "string" && !/\W/.test(part) ) {\r
-                               part = part.toLowerCase();\r
-                               nodeCheck = part;\r
-                               checkFn = dirNodeCheck;\r
-                       }\r
+                       // Camelcase it, if needed\r
+                       na = na.replace(/-(\D)/g, function(a, b){\r
+                               return b.toUpperCase();\r
+                       });\r
 \r
-                       checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);\r
+                       if (na == 'float')\r
+                               na = isIE ? 'styleFloat' : 'cssFloat';\r
+\r
+                       // IE & Opera\r
+                       if (n.currentStyle && c)\r
+                               return n.currentStyle[na];\r
+\r
+                       return n.style ? n.style[na] : undefined;\r
                },\r
-               "~": function(checkSet, part, isXML){\r
-                       var doneName = done++, checkFn = dirCheck, nodeCheck;\r
 \r
-                       if ( typeof part === "string" && !/\W/.test(part) ) {\r
-                               part = part.toLowerCase();\r
-                               nodeCheck = part;\r
-                               checkFn = dirNodeCheck;\r
-                       }\r
+               setStyles : function(e, o) {\r
+                       var t = this, s = t.settings, ol;\r
 \r
-                       checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);\r
-               }\r
-       },\r
-       find: {\r
-               ID: function(match, context, isXML){\r
-                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
-                               var m = context.getElementById(match[1]);\r
-                               return m ? [m] : [];\r
-                       }\r
+                       ol = s.update_styles;\r
+                       s.update_styles = 0;\r
+\r
+                       each(o, function(v, n) {\r
+                               t.setStyle(e, n, v);\r
+                       });\r
+\r
+                       // Update style info\r
+                       s.update_styles = ol;\r
+                       if (s.update_styles)\r
+                               t.setAttrib(e, s.cssText);\r
                },\r
-               NAME: function(match, context){\r
-                       if ( typeof context.getElementsByName !== "undefined" ) {\r
-                               var ret = [], results = context.getElementsByName(match[1]);\r
 \r
-                               for ( var i = 0, l = results.length; i < l; i++ ) {\r
-                                       if ( results[i].getAttribute("name") === match[1] ) {\r
-                                               ret.push( results[i] );\r
-                                       }\r
+               removeAllAttribs: function(e) {\r
+                       return this.run(e, function(e) {\r
+                               var i, attrs = e.attributes;\r
+                               for (i = attrs.length - 1; i >= 0; i--) {\r
+                                       e.removeAttributeNode(attrs.item(i));\r
                                }\r
-\r
-                               return ret.length === 0 ? null : ret;\r
-                       }\r
+                       });\r
                },\r
-               TAG: function(match, context){\r
-                       return context.getElementsByTagName(match[1]);\r
-               }\r
-       },\r
-       preFilter: {\r
-               CLASS: function(match, curLoop, inplace, result, not, isXML){\r
-                       match = " " + match[1].replace(/\\/g, "") + " ";\r
 \r
-                       if ( isXML ) {\r
-                               return match;\r
-                       }\r
+               setAttrib : function(e, n, v) {\r
+                       var t = this;\r
 \r
-                       for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {\r
-                               if ( elem ) {\r
-                                       if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {\r
-                                               if ( !inplace ) {\r
-                                                       result.push( elem );\r
-                                               }\r
-                                       } else if ( inplace ) {\r
-                                               curLoop[i] = false;\r
+                       // Whats the point\r
+                       if (!e || !n)\r
+                               return;\r
+\r
+                       // Strict XML mode\r
+                       if (t.settings.strict)\r
+                               n = n.toLowerCase();\r
+\r
+                       return this.run(e, function(e) {\r
+                               var s = t.settings;\r
+                               var originalValue = e.getAttribute(n);\r
+                               if (v !== null) {\r
+                                       switch (n) {\r
+                                               case "style":\r
+                                                       if (!is(v, 'string')) {\r
+                                                               each(v, function(v, n) {\r
+                                                                       t.setStyle(e, n, v);\r
+                                                               });\r
+\r
+                                                               return;\r
+                                                       }\r
+\r
+                                                       // No mce_style for elements with these since they might get resized by the user\r
+                                                       if (s.keep_values) {\r
+                                                               if (v && !t._isRes(v))\r
+                                                                       e.setAttribute('data-mce-style', v, 2);\r
+                                                               else\r
+                                                                       e.removeAttribute('data-mce-style', 2);\r
+                                                       }\r
+\r
+                                                       e.style.cssText = v;\r
+                                                       break;\r
+\r
+                                               case "class":\r
+                                                       e.className = v || ''; // Fix IE null bug\r
+                                                       break;\r
+\r
+                                               case "src":\r
+                                               case "href":\r
+                                                       if (s.keep_values) {\r
+                                                               if (s.url_converter)\r
+                                                                       v = s.url_converter.call(s.url_converter_scope || t, v, n, e);\r
+\r
+                                                               t.setAttrib(e, 'data-mce-' + n, v, 2);\r
+                                                       }\r
+\r
+                                                       break;\r
+\r
+                                               case "shape":\r
+                                                       e.setAttribute('data-mce-style', v);\r
+                                                       break;\r
                                        }\r
                                }\r
-                       }\r
+                               if (is(v) && v !== null && v.length !== 0)\r
+                                       e.setAttribute(n, '' + v, 2);\r
+                               else\r
+                                       e.removeAttribute(n, 2);\r
 \r
-                       return false;\r
-               },\r
-               ID: function(match){\r
-                       return match[1].replace(/\\/g, "");\r
+                               // fire onChangeAttrib event for attributes that have changed\r
+                               if (tinyMCE.activeEditor && originalValue != v) {\r
+                                       var ed = tinyMCE.activeEditor;\r
+                                       ed.onSetAttrib.dispatch(ed, e, n, v);\r
+                               }\r
+                       });\r
                },\r
-               TAG: function(match, curLoop){\r
-                       return match[1].toLowerCase();\r
+\r
+               setAttribs : function(e, o) {\r
+                       var t = this;\r
+\r
+                       return this.run(e, function(e) {\r
+                               each(o, function(v, n) {\r
+                                       t.setAttrib(e, n, v);\r
+                               });\r
+                       });\r
                },\r
-               CHILD: function(match){\r
-                       if ( match[1] === "nth" ) {\r
-                               // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'\r
-                               var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(\r
-                                       match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||\r
-                                       !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);\r
 \r
-                               // calculate the numbers (first)n+(last) including if they are negative\r
-                               match[2] = (test[1] + (test[2] || 1)) - 0;\r
-                               match[3] = test[3] - 0;\r
-                       }\r
+               getAttrib : function(e, n, dv) {\r
+                       var v, t = this, undef;\r
 \r
-                       // TODO: Move to normal caching system\r
-                       match[0] = done++;\r
+                       e = t.get(e);\r
 \r
-                       return match;\r
-               },\r
-               ATTR: function(match, curLoop, inplace, result, not, isXML){\r
-                       var name = match[1].replace(/\\/g, "");\r
-                       \r
-                       if ( !isXML && Expr.attrMap[name] ) {\r
-                               match[1] = Expr.attrMap[name];\r
+                       if (!e || e.nodeType !== 1)\r
+                               return dv === undef ? false : dv;\r
+\r
+                       if (!is(dv))\r
+                               dv = '';\r
+\r
+                       // Try the mce variant for these\r
+                       if (/^(src|href|style|coords|shape)$/.test(n)) {\r
+                               v = e.getAttribute("data-mce-" + n);\r
+\r
+                               if (v)\r
+                                       return v;\r
                        }\r
 \r
-                       if ( match[2] === "~=" ) {\r
-                               match[4] = " " + match[4] + " ";\r
+                       if (isIE && t.props[n]) {\r
+                               v = e[t.props[n]];\r
+                               v = v && v.nodeValue ? v.nodeValue : v;\r
                        }\r
 \r
-                       return match;\r
-               },\r
-               PSEUDO: function(match, curLoop, inplace, result, not){\r
-                       if ( match[1] === "not" ) {\r
-                               // If we're dealing with a complex expression, or a simple one\r
-                               if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {\r
-                                       match[3] = Sizzle(match[3], null, null, curLoop);\r
-                               } else {\r
-                                       var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);\r
-                                       if ( !inplace ) {\r
-                                               result.push.apply( result, ret );\r
-                                       }\r
-                                       return false;\r
+                       if (!v)\r
+                               v = e.getAttribute(n, 2);\r
+\r
+                       // Check boolean attribs\r
+                       if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {\r
+                               if (e[t.props[n]] === true && v === '')\r
+                                       return n;\r
+\r
+                               return v ? n : '';\r
+                       }\r
+\r
+                       // Inner input elements will override attributes on form elements\r
+                       if (e.nodeName === "FORM" && e.getAttributeNode(n))\r
+                               return e.getAttributeNode(n).nodeValue;\r
+\r
+                       if (n === 'style') {\r
+                               v = v || e.style.cssText;\r
+\r
+                               if (v) {\r
+                                       v = t.serializeStyle(t.parseStyle(v), e.nodeName);\r
+\r
+                                       if (t.settings.keep_values && !t._isRes(v))\r
+                                               e.setAttribute('data-mce-style', v);\r
                                }\r
-                       } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {\r
-                               return true;\r
                        }\r
-                       \r
-                       return match;\r
-               },\r
-               POS: function(match){\r
-                       match.unshift( true );\r
-                       return match;\r
-               }\r
-       },\r
-       filters: {\r
-               enabled: function(elem){\r
-                       return elem.disabled === false && elem.type !== "hidden";\r
+\r
+                       // Remove Apple and WebKit stuff\r
+                       if (isWebKit && n === "class" && v)\r
+                               v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');\r
+\r
+                       // Handle IE issues\r
+                       if (isIE) {\r
+                               switch (n) {\r
+                                       case 'rowspan':\r
+                                       case 'colspan':\r
+                                               // IE returns 1 as default value\r
+                                               if (v === 1)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'size':\r
+                                               // IE returns +0 as default value for size\r
+                                               if (v === '+0' || v === 20 || v === 0)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'width':\r
+                                       case 'height':\r
+                                       case 'vspace':\r
+                                       case 'checked':\r
+                                       case 'disabled':\r
+                                       case 'readonly':\r
+                                               if (v === 0)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'hspace':\r
+                                               // IE returns -1 as default value\r
+                                               if (v === -1)\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'maxlength':\r
+                                       case 'tabindex':\r
+                                               // IE returns default value\r
+                                               if (v === 32768 || v === 2147483647 || v === '32768')\r
+                                                       v = '';\r
+\r
+                                               break;\r
+\r
+                                       case 'multiple':\r
+                                       case 'compact':\r
+                                       case 'noshade':\r
+                                       case 'nowrap':\r
+                                               if (v === 65535)\r
+                                                       return n;\r
+\r
+                                               return dv;\r
+\r
+                                       case 'shape':\r
+                                               v = v.toLowerCase();\r
+                                               break;\r
+\r
+                                       default:\r
+                                               // IE has odd anonymous function for event attributes\r
+                                               if (n.indexOf('on') === 0 && v)\r
+                                                       v = tinymce._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1', '' + v);\r
+                               }\r
+                       }\r
+\r
+                       return (v !== undef && v !== null && v !== '') ? '' + v : dv;\r
                },\r
-               disabled: function(elem){\r
-                       return elem.disabled === true;\r
+\r
+               getPos : function(n, ro) {\r
+                       var t = this, x = 0, y = 0, e, d = t.doc, r;\r
+\r
+                       n = t.get(n);\r
+                       ro = ro || d.body;\r
+\r
+                       if (n) {\r
+                               // Use getBoundingClientRect if it exists since it's faster than looping offset nodes\r
+                               if (n.getBoundingClientRect) {\r
+                                       n = n.getBoundingClientRect();\r
+                                       e = t.boxModel ? d.documentElement : d.body;\r
+\r
+                                       // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit\r
+                                       // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position\r
+                                       x = n.left + (d.documentElement.scrollLeft || d.body.scrollLeft) - e.clientTop;\r
+                                       y = n.top + (d.documentElement.scrollTop || d.body.scrollTop) - e.clientLeft;\r
+\r
+                                       return {x : x, y : y};\r
+                               }\r
+\r
+                               r = n;\r
+                               while (r && r != ro && r.nodeType) {\r
+                                       x += r.offsetLeft || 0;\r
+                                       y += r.offsetTop || 0;\r
+                                       r = r.offsetParent;\r
+                               }\r
+\r
+                               r = n.parentNode;\r
+                               while (r && r != ro && r.nodeType) {\r
+                                       x -= r.scrollLeft || 0;\r
+                                       y -= r.scrollTop || 0;\r
+                                       r = r.parentNode;\r
+                               }\r
+                       }\r
+\r
+                       return {x : x, y : y};\r
                },\r
-               checked: function(elem){\r
-                       return elem.checked === true;\r
+\r
+               parseStyle : function(st) {\r
+                       return this.styles.parse(st);\r
                },\r
-               selected: function(elem){\r
-                       // Accessing this property makes selected-by-default\r
-                       // options in Safari work properly\r
-                       elem.parentNode.selectedIndex;\r
-                       return elem.selected === true;\r
+\r
+               serializeStyle : function(o, name) {\r
+                       return this.styles.serialize(o, name);\r
                },\r
-               parent: function(elem){\r
-                       return !!elem.firstChild;\r
+\r
+               loadCSS : function(u) {\r
+                       var t = this, d = t.doc, head;\r
+\r
+                       if (!u)\r
+                               u = '';\r
+\r
+                       head = t.select('head')[0];\r
+\r
+                       each(u.split(','), function(u) {\r
+                               var link;\r
+\r
+                               if (t.files[u])\r
+                                       return;\r
+\r
+                               t.files[u] = true;\r
+                               link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});\r
+\r
+                               // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug\r
+                               // This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading\r
+                               // It's ugly but it seems to work fine.\r
+                               if (isIE && d.documentMode && d.recalc) {\r
+                                       link.onload = function() {\r
+                                               if (d.recalc)\r
+                                                       d.recalc();\r
+\r
+                                               link.onload = null;\r
+                                       };\r
+                               }\r
+\r
+                               head.appendChild(link);\r
+                       });\r
                },\r
-               empty: function(elem){\r
-                       return !elem.firstChild;\r
+\r
+               addClass : function(e, c) {\r
+                       return this.run(e, function(e) {\r
+                               var o;\r
+\r
+                               if (!c)\r
+                                       return 0;\r
+\r
+                               if (this.hasClass(e, c))\r
+                                       return e.className;\r
+\r
+                               o = this.removeClass(e, c);\r
+\r
+                               return e.className = (o != '' ? (o + ' ') : '') + c;\r
+                       });\r
                },\r
-               has: function(elem, i, match){\r
-                       return !!Sizzle( match[3], elem ).length;\r
+\r
+               removeClass : function(e, c) {\r
+                       var t = this, re;\r
+\r
+                       return t.run(e, function(e) {\r
+                               var v;\r
+\r
+                               if (t.hasClass(e, c)) {\r
+                                       if (!re)\r
+                                               re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");\r
+\r
+                                       v = e.className.replace(re, ' ');\r
+                                       v = tinymce.trim(v != ' ' ? v : '');\r
+\r
+                                       e.className = v;\r
+\r
+                                       // Empty class attr\r
+                                       if (!v) {\r
+                                               e.removeAttribute('class');\r
+                                               e.removeAttribute('className');\r
+                                       }\r
+\r
+                                       return v;\r
+                               }\r
+\r
+                               return e.className;\r
+                       });\r
                },\r
-               header: function(elem){\r
-                       return (/h\d/i).test( elem.nodeName );\r
+\r
+               hasClass : function(n, c) {\r
+                       n = this.get(n);\r
+\r
+                       if (!n || !c)\r
+                               return false;\r
+\r
+                       return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;\r
                },\r
-               text: function(elem){\r
-                       return "text" === elem.type;\r
+\r
+               show : function(e) {\r
+                       return this.setStyle(e, 'display', 'block');\r
                },\r
-               radio: function(elem){\r
-                       return "radio" === elem.type;\r
+\r
+               hide : function(e) {\r
+                       return this.setStyle(e, 'display', 'none');\r
                },\r
-               checkbox: function(elem){\r
-                       return "checkbox" === elem.type;\r
-               },\r
-               file: function(elem){\r
-                       return "file" === elem.type;\r
-               },\r
-               password: function(elem){\r
-                       return "password" === elem.type;\r
-               },\r
-               submit: function(elem){\r
-                       return "submit" === elem.type;\r
-               },\r
-               image: function(elem){\r
-                       return "image" === elem.type;\r
-               },\r
-               reset: function(elem){\r
-                       return "reset" === elem.type;\r
-               },\r
-               button: function(elem){\r
-                       return "button" === elem.type || elem.nodeName.toLowerCase() === "button";\r
+\r
+               isHidden : function(e) {\r
+                       e = this.get(e);\r
+\r
+                       return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';\r
                },\r
-               input: function(elem){\r
-                       return (/input|select|textarea|button/i).test(elem.nodeName);\r
-               }\r
-       },\r
-       setFilters: {\r
-               first: function(elem, i){\r
-                       return i === 0;\r
+\r
+               uniqueId : function(p) {\r
+                       return (!p ? 'mce_' : p) + (this.counter++);\r
                },\r
-               last: function(elem, i, match, array){\r
-                       return i === array.length - 1;\r
+\r
+               setHTML : function(element, html) {\r
+                       var self = this;\r
+\r
+                       return self.run(element, function(element) {\r
+                               if (isIE) {\r
+                                       // Remove all child nodes, IE keeps empty text nodes in DOM\r
+                                       while (element.firstChild)\r
+                                               element.removeChild(element.firstChild);\r
+\r
+                                       try {\r
+                                               // IE will remove comments from the beginning\r
+                                               // unless you padd the contents with something\r
+                                               element.innerHTML = '<br />' + html;\r
+                                               element.removeChild(element.firstChild);\r
+                                       } catch (ex) {\r
+                                               // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p\r
+                                               // This seems to fix this problem\r
+\r
+                                               // Create new div with HTML contents and a BR infront to keep comments\r
+                                               element = self.create('div');\r
+                                               element.innerHTML = '<br />' + html;\r
+\r
+                                               // Add all children from div to target\r
+                                               each (element.childNodes, function(node, i) {\r
+                                                       // Skip br element\r
+                                                       if (i)\r
+                                                               element.appendChild(node);\r
+                                               });\r
+                                       }\r
+                               } else\r
+                                       element.innerHTML = html;\r
+\r
+                               return html;\r
+                       });\r
                },\r
-               even: function(elem, i){\r
-                       return i % 2 === 0;\r
+\r
+               getOuterHTML : function(elm) {\r
+                       var doc, self = this;\r
+\r
+                       elm = self.get(elm);\r
+\r
+                       if (!elm)\r
+                               return null;\r
+\r
+                       if (elm.nodeType === 1 && self.hasOuterHTML)\r
+                               return elm.outerHTML;\r
+\r
+                       doc = (elm.ownerDocument || self.doc).createElement("body");\r
+                       doc.appendChild(elm.cloneNode(true));\r
+\r
+                       return doc.innerHTML;\r
                },\r
-               odd: function(elem, i){\r
-                       return i % 2 === 1;\r
+\r
+               setOuterHTML : function(e, h, d) {\r
+                       var t = this;\r
+\r
+                       function setHTML(e, h, d) {\r
+                               var n, tp;\r
+\r
+                               tp = d.createElement("body");\r
+                               tp.innerHTML = h;\r
+\r
+                               n = tp.lastChild;\r
+                               while (n) {\r
+                                       t.insertAfter(n.cloneNode(true), e);\r
+                                       n = n.previousSibling;\r
+                               }\r
+\r
+                               t.remove(e);\r
+                       };\r
+\r
+                       return this.run(e, function(e) {\r
+                               e = t.get(e);\r
+\r
+                               // Only set HTML on elements\r
+                               if (e.nodeType == 1) {\r
+                                       d = d || e.ownerDocument || t.doc;\r
+\r
+                                       if (isIE) {\r
+                                               try {\r
+                                                       // Try outerHTML for IE it sometimes produces an unknown runtime error\r
+                                                       if (isIE && e.nodeType == 1)\r
+                                                               e.outerHTML = h;\r
+                                                       else\r
+                                                               setHTML(e, h, d);\r
+                                               } catch (ex) {\r
+                                                       // Fix for unknown runtime error\r
+                                                       setHTML(e, h, d);\r
+                                               }\r
+                                       } else\r
+                                               setHTML(e, h, d);\r
+                               }\r
+                       });\r
                },\r
-               lt: function(elem, i, match){\r
-                       return i < match[3] - 0;\r
+\r
+               decode : Entities.decode,\r
+\r
+               encode : Entities.encodeAllRaw,\r
+\r
+               insertAfter : function(node, reference_node) {\r
+                       reference_node = this.get(reference_node);\r
+\r
+                       return this.run(node, function(node) {\r
+                               var parent, nextSibling;\r
+\r
+                               parent = reference_node.parentNode;\r
+                               nextSibling = reference_node.nextSibling;\r
+\r
+                               if (nextSibling)\r
+                                       parent.insertBefore(node, nextSibling);\r
+                               else\r
+                                       parent.appendChild(node);\r
+\r
+                               return node;\r
+                       });\r
                },\r
-               gt: function(elem, i, match){\r
-                       return i > match[3] - 0;\r
+\r
+               replace : function(n, o, k) {\r
+                       var t = this;\r
+\r
+                       if (is(o, 'array'))\r
+                               n = n.cloneNode(true);\r
+\r
+                       return t.run(o, function(o) {\r
+                               if (k) {\r
+                                       each(tinymce.grep(o.childNodes), function(c) {\r
+                                               n.appendChild(c);\r
+                                       });\r
+                               }\r
+\r
+                               return o.parentNode.replaceChild(n, o);\r
+                       });\r
                },\r
-               nth: function(elem, i, match){\r
-                       return match[3] - 0 === i;\r
+\r
+               rename : function(elm, name) {\r
+                       var t = this, newElm;\r
+\r
+                       if (elm.nodeName != name.toUpperCase()) {\r
+                               // Rename block element\r
+                               newElm = t.create(name);\r
+\r
+                               // Copy attribs to new block\r
+                               each(t.getAttribs(elm), function(attr_node) {\r
+                                       t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));\r
+                               });\r
+\r
+                               // Replace block\r
+                               t.replace(newElm, elm, 1);\r
+                       }\r
+\r
+                       return newElm || elm;\r
                },\r
-               eq: function(elem, i, match){\r
-                       return match[3] - 0 === i;\r
-               }\r
-       },\r
-       filter: {\r
-               PSEUDO: function(elem, match, i, array){\r
-                       var name = match[1], filter = Expr.filters[ name ];\r
 \r
-                       if ( filter ) {\r
-                               return filter( elem, i, match, array );\r
-                       } else if ( name === "contains" ) {\r
-                               return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;\r
-                       } else if ( name === "not" ) {\r
-                               var not = match[3];\r
+               findCommonAncestor : function(a, b) {\r
+                       var ps = a, pe;\r
 \r
-                               for ( var j = 0, l = not.length; j < l; j++ ) {\r
-                                       if ( not[j] === elem ) {\r
-                                               return false;\r
-                                       }\r
-                               }\r
+                       while (ps) {\r
+                               pe = b;\r
 \r
-                               return true;\r
-                       } else {\r
-                               Sizzle.error( "Syntax error, unrecognized expression: " + name );\r
+                               while (pe && ps != pe)\r
+                                       pe = pe.parentNode;\r
+\r
+                               if (ps == pe)\r
+                                       break;\r
+\r
+                               ps = ps.parentNode;\r
                        }\r
+\r
+                       if (!ps && a.ownerDocument)\r
+                               return a.ownerDocument.documentElement;\r
+\r
+                       return ps;\r
                },\r
-               CHILD: function(elem, match){\r
-                       var type = match[1], node = elem;\r
-                       switch (type) {\r
-                               case 'only':\r
-                               case 'first':\r
-                                       while ( (node = node.previousSibling) )  {\r
-                                               if ( node.nodeType === 1 ) { \r
-                                                       return false; \r
-                                               }\r
-                                       }\r
-                                       if ( type === "first" ) { \r
-                                               return true; \r
-                                       }\r
-                                       node = elem;\r
-                               case 'last':\r
-                                       while ( (node = node.nextSibling) )      {\r
-                                               if ( node.nodeType === 1 ) { \r
-                                                       return false; \r
-                                               }\r
-                                       }\r
-                                       return true;\r
-                               case 'nth':\r
-                                       var first = match[2], last = match[3];\r
 \r
-                                       if ( first === 1 && last === 0 ) {\r
-                                               return true;\r
-                                       }\r
-                                       \r
-                                       var doneName = match[0],\r
-                                               parent = elem.parentNode;\r
-       \r
-                                       if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {\r
-                                               var count = 0;\r
-                                               for ( node = parent.firstChild; node; node = node.nextSibling ) {\r
-                                                       if ( node.nodeType === 1 ) {\r
-                                                               node.nodeIndex = ++count;\r
-                                                       }\r
-                                               } \r
-                                               parent.sizcache = doneName;\r
-                                       }\r
-                                       \r
-                                       var diff = elem.nodeIndex - last;\r
-                                       if ( first === 0 ) {\r
-                                               return diff === 0;\r
-                                       } else {\r
-                                               return ( diff % first === 0 && diff / first >= 0 );\r
-                                       }\r
+               toHex : function(s) {\r
+                       var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);\r
+\r
+                       function hex(s) {\r
+                               s = parseInt(s).toString(16);\r
+\r
+                               return s.length > 1 ? s : '0' + s; // 0 -> 00\r
+                       };\r
+\r
+                       if (c) {\r
+                               s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);\r
+\r
+                               return s;\r
                        }\r
+\r
+                       return s;\r
                },\r
-               ID: function(elem, match){\r
-                       return elem.nodeType === 1 && elem.getAttribute("id") === match;\r
+\r
+               getClasses : function() {\r
+                       var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;\r
+\r
+                       if (t.classes)\r
+                               return t.classes;\r
+\r
+                       function addClasses(s) {\r
+                               // IE style imports\r
+                               each(s.imports, function(r) {\r
+                                       addClasses(r);\r
+                               });\r
+\r
+                               each(s.cssRules || s.rules, function(r) {\r
+                                       // Real type or fake it on IE\r
+                                       switch (r.type || 1) {\r
+                                               // Rule\r
+                                               case 1:\r
+                                                       if (r.selectorText) {\r
+                                                               each(r.selectorText.split(','), function(v) {\r
+                                                                       v = v.replace(/^\s*|\s*$|^\s\./g, "");\r
+\r
+                                                                       // Is internal or it doesn't contain a class\r
+                                                                       if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))\r
+                                                                               return;\r
+\r
+                                                                       // Remove everything but class name\r
+                                                                       ov = v;\r
+                                                                       v = tinymce._replace(/.*\.([a-z0-9_\-]+).*/i, '$1', v);\r
+\r
+                                                                       // Filter classes\r
+                                                                       if (f && !(v = f(v, ov)))\r
+                                                                               return;\r
+\r
+                                                                       if (!lo[v]) {\r
+                                                                               cl.push({'class' : v});\r
+                                                                               lo[v] = 1;\r
+                                                                       }\r
+                                                               });\r
+                                                       }\r
+                                                       break;\r
+\r
+                                               // Import\r
+                                               case 3:\r
+                                                       addClasses(r.styleSheet);\r
+                                                       break;\r
+                                       }\r
+                               });\r
+                       };\r
+\r
+                       try {\r
+                               each(t.doc.styleSheets, addClasses);\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
+\r
+                       if (cl.length > 0)\r
+                               t.classes = cl;\r
+\r
+                       return cl;\r
                },\r
-               TAG: function(elem, match){\r
-                       return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;\r
+\r
+               run : function(e, f, s) {\r
+                       var t = this, o;\r
+\r
+                       if (t.doc && typeof(e) === 'string')\r
+                               e = t.get(e);\r
+\r
+                       if (!e)\r
+                               return false;\r
+\r
+                       s = s || this;\r
+                       if (!e.nodeType && (e.length || e.length === 0)) {\r
+                               o = [];\r
+\r
+                               each(e, function(e, i) {\r
+                                       if (e) {\r
+                                               if (typeof(e) == 'string')\r
+                                                       e = t.doc.getElementById(e);\r
+\r
+                                               o.push(f.call(s, e, i));\r
+                                       }\r
+                               });\r
+\r
+                               return o;\r
+                       }\r
+\r
+                       return f.call(s, e);\r
                },\r
-               CLASS: function(elem, match){\r
-                       return (" " + (elem.className || elem.getAttribute("class")) + " ")\r
-                               .indexOf( match ) > -1;\r
+\r
+               getAttribs : function(n) {\r
+                       var o;\r
+\r
+                       n = this.get(n);\r
+\r
+                       if (!n)\r
+                               return [];\r
+\r
+                       if (isIE) {\r
+                               o = [];\r
+\r
+                               // Object will throw exception in IE\r
+                               if (n.nodeName == 'OBJECT')\r
+                                       return n.attributes;\r
+\r
+                               // IE doesn't keep the selected attribute if you clone option elements\r
+                               if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))\r
+                                       o.push({specified : 1, nodeName : 'selected'});\r
+\r
+                               // It's crazy that this is faster in IE but it's because it returns all attributes all the time\r
+                               n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {\r
+                                       o.push({specified : 1, nodeName : a});\r
+                               });\r
+\r
+                               return o;\r
+                       }\r
+\r
+                       return n.attributes;\r
                },\r
-               ATTR: function(elem, match){\r
-                       var name = match[1],\r
-                               result = Expr.attrHandle[ name ] ?\r
-                                       Expr.attrHandle[ name ]( elem ) :\r
-                                       elem[ name ] != null ?\r
-                                               elem[ name ] :\r
-                                               elem.getAttribute( name ),\r
-                               value = result + "",\r
-                               type = match[2],\r
-                               check = match[4];\r
 \r
-                       return result == null ?\r
-                               type === "!=" :\r
-                               type === "=" ?\r
-                               value === check :\r
-                               type === "*=" ?\r
-                               value.indexOf(check) >= 0 :\r
-                               type === "~=" ?\r
-                               (" " + value + " ").indexOf(check) >= 0 :\r
-                               !check ?\r
-                               value && result !== false :\r
-                               type === "!=" ?\r
-                               value !== check :\r
-                               type === "^=" ?\r
-                               value.indexOf(check) === 0 :\r
-                               type === "$=" ?\r
-                               value.substr(value.length - check.length) === check :\r
-                               type === "|=" ?\r
-                               value === check || value.substr(0, check.length + 1) === check + "-" :\r
-                               false;\r
+               isEmpty : function(node, elements) {\r
+                       var self = this, i, attributes, type, walker, name, brCount = 0;\r
+\r
+                       node = node.firstChild;\r
+                       if (node) {\r
+                               walker = new tinymce.dom.TreeWalker(node, node.parentNode);\r
+                               elements = elements || self.schema ? self.schema.getNonEmptyElements() : null;\r
+\r
+                               do {\r
+                                       type = node.nodeType;\r
+\r
+                                       if (type === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (node.getAttribute('data-mce-bogus'))\r
+                                                       continue;\r
+\r
+                                               // Keep empty elements like <img />\r
+                                               name = node.nodeName.toLowerCase();\r
+                                               if (elements && elements[name]) {\r
+                                                       // Ignore single BR elements in blocks like <p><br /></p> or <p><span><br /></span></p>\r
+                                                       if (name === 'br') {\r
+                                                               brCount++;\r
+                                                               continue;\r
+                                                       }\r
+\r
+                                                       return false;\r
+                                               }\r
+\r
+                                               // Keep elements with data-bookmark attributes or name attribute like <a name="1"></a>\r
+                                               attributes = self.getAttribs(node);\r
+                                               i = node.attributes.length;\r
+                                               while (i--) {\r
+                                                       name = node.attributes[i].nodeName;\r
+                                                       if (name === "name" || name === 'data-mce-bookmark')\r
+                                                               return false;\r
+                                               }\r
+                                       }\r
+\r
+                                       // Keep comment nodes\r
+                                       if (type == 8)\r
+                                               return false;\r
+\r
+                                       // Keep non whitespace text nodes\r
+                                       if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue)))\r
+                                               return false;\r
+                               } while (node = walker.next());\r
+                       }\r
+\r
+                       return brCount <= 1;\r
                },\r
-               POS: function(elem, match, i, array){\r
-                       var name = match[2], filter = Expr.setFilters[ name ];\r
 \r
-                       if ( filter ) {\r
-                               return filter( elem, i, match, array );\r
+               destroy : function(s) {\r
+                       var t = this;\r
+\r
+                       t.win = t.doc = t.root = t.events = t.frag = null;\r
+\r
+                       // Manual destroy then remove unload handler\r
+                       if (!s)\r
+                               tinymce.removeUnload(t.destroy);\r
+               },\r
+\r
+               createRng : function() {\r
+                       var d = this.doc;\r
+\r
+                       return d.createRange ? d.createRange() : new tinymce.dom.Range(this);\r
+               },\r
+\r
+               nodeIndex : function(node, normalized) {\r
+                       var idx = 0, lastNodeType, lastNode, nodeType;\r
+\r
+                       if (node) {\r
+                               for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {\r
+                                       nodeType = node.nodeType;\r
+\r
+                                       // Normalize text nodes\r
+                                       if (normalized && nodeType == 3) {\r
+                                               if (nodeType == lastNodeType || !node.nodeValue.length)\r
+                                                       continue;\r
+                                       }\r
+                                       idx++;\r
+                                       lastNodeType = nodeType;\r
+                               }\r
                        }\r
-               }\r
-       }\r
-};\r
 \r
-var origPOS = Expr.match.POS,\r
-       fescape = function(all, num){\r
-               return "\\" + (num - 0 + 1);\r
-       };\r
+                       return idx;\r
+               },\r
+\r
+               split : function(pe, e, re) {\r
+                       var t = this, r = t.createRng(), bef, aft, pa;\r
+\r
+                       // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sense\r
+                       // but we don't want that in our code since it serves no purpose for the end user\r
+                       // For example if this is chopped:\r
+                       //   <p>text 1<span><b>CHOP</b></span>text 2</p>\r
+                       // would produce:\r
+                       //   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>\r
+                       // this function will then trim of empty edges and produce:\r
+                       //   <p>text 1</p><b>CHOP</b><p>text 2</p>\r
+                       function trim(node) {\r
+                               var i, children = node.childNodes, type = node.nodeType;\r
+\r
+                               function surroundedBySpans(node) {\r
+                                       var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN';\r
+                                       var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN';\r
+                                       return previousIsSpan && nextIsSpan;\r
+                               }\r
+\r
+                               if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark')\r
+                                       return;\r
+\r
+                               for (i = children.length - 1; i >= 0; i--)\r
+                                       trim(children[i]);\r
+\r
+                               if (type != 9) {\r
+                                       // Keep non whitespace text nodes\r
+                                       if (type == 3 && node.nodeValue.length > 0) {\r
+                                               // If parent element isn't a block or there isn't any useful contents for example "<p>   </p>"\r
+                                               // Also keep text nodes with only spaces if surrounded by spans.\r
+                                               // eg. "<p><span>a</span> <span>b</span></p>" should keep space between a and b\r
+                                               var trimmedLength = tinymce.trim(node.nodeValue).length;\r
+                                               if (!t.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength == 0 && surroundedBySpans(node))\r
+                                                       return;\r
+                                       } else if (type == 1) {\r
+                                               // If the only child is a bookmark then move it up\r
+                                               children = node.childNodes;\r
+                                               if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('data-mce-type') == 'bookmark')\r
+                                                       node.parentNode.insertBefore(children[0], node);\r
+\r
+                                               // Keep non empty elements or img, hr etc\r
+                                               if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))\r
+                                                       return;\r
+                                       }\r
+\r
+                                       t.remove(node);\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
+\r
+                       if (pe && e) {\r
+                               // Get before chunk\r
+                               r.setStart(pe.parentNode, t.nodeIndex(pe));\r
+                               r.setEnd(e.parentNode, t.nodeIndex(e));\r
+                               bef = r.extractContents();\r
+\r
+                               // Get after chunk\r
+                               r = t.createRng();\r
+                               r.setStart(e.parentNode, t.nodeIndex(e) + 1);\r
+                               r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);\r
+                               aft = r.extractContents();\r
+\r
+                               // Insert before chunk\r
+                               pa = pe.parentNode;\r
+                               pa.insertBefore(trim(bef), pe);\r
+\r
+                               // Insert middle chunk\r
+                               if (re)\r
+                               pa.replaceChild(re, e);\r
+                       else\r
+                               pa.insertBefore(e, pe);\r
+\r
+                               // Insert after chunk\r
+                               pa.insertBefore(trim(aft), pe);\r
+                               t.remove(pe);\r
+\r
+                               return re || e;\r
+                       }\r
+               },\r
+\r
+               bind : function(target, name, func, scope) {\r
+                       return this.events.add(target, name, func, scope || this);\r
+               },\r
+\r
+               unbind : function(target, name, func) {\r
+                       return this.events.remove(target, name, func);\r
+               },\r
+\r
+               fire : function(target, name, evt) {\r
+                       return this.events.fire(target, name, evt);\r
+               },\r
+\r
+\r
+               _findSib : function(node, selector, name) {\r
+                       var t = this, f = selector;\r
+\r
+                       if (node) {\r
+                               // If expression make a function of it using is\r
+                               if (is(f, 'string')) {\r
+                                       f = function(node) {\r
+                                               return t.is(node, selector);\r
+                                       };\r
+                               }\r
+\r
+                               // Loop all siblings\r
+                               for (node = node[name]; node; node = node[name]) {\r
+                                       if (f(node))\r
+                                               return node;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+               },\r
+\r
+               _isRes : function(c) {\r
+                       // Is live resizble element\r
+                       return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);\r
+               }\r
+\r
+               /*\r
+               walk : function(n, f, s) {\r
+                       var d = this.doc, w;\r
+\r
+                       if (d.createTreeWalker) {\r
+                               w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);\r
+\r
+                               while ((n = w.nextNode()) != null)\r
+                                       f.call(s || this, n);\r
+                       } else\r
+                               tinymce.walk(n, f, 'childNodes', s);\r
+               }\r
+               */\r
+\r
+               /*\r
+               toRGB : function(s) {\r
+                       var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);\r
+\r
+                       if (c) {\r
+                               // #FFF -> #FFFFFF\r
+                               if (!is(c[3]))\r
+                                       c[3] = c[2] = c[1];\r
+\r
+                               return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";\r
+                       }\r
+\r
+                       return s;\r
+               }\r
+               */\r
+       });\r
+\r
+       tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});\r
+})(tinymce);\r
+\r
+(function(ns) {\r
+       // Range constructor\r
+       function Range(dom) {\r
+               var t = this,\r
+                       doc = dom.doc,\r
+                       EXTRACT = 0,\r
+                       CLONE = 1,\r
+                       DELETE = 2,\r
+                       TRUE = true,\r
+                       FALSE = false,\r
+                       START_OFFSET = 'startOffset',\r
+                       START_CONTAINER = 'startContainer',\r
+                       END_CONTAINER = 'endContainer',\r
+                       END_OFFSET = 'endOffset',\r
+                       extend = tinymce.extend,\r
+                       nodeIndex = dom.nodeIndex;\r
+\r
+               extend(t, {\r
+                       // Inital states\r
+                       startContainer : doc,\r
+                       startOffset : 0,\r
+                       endContainer : doc,\r
+                       endOffset : 0,\r
+                       collapsed : TRUE,\r
+                       commonAncestorContainer : doc,\r
+\r
+                       // Range constants\r
+                       START_TO_START : 0,\r
+                       START_TO_END : 1,\r
+                       END_TO_END : 2,\r
+                       END_TO_START : 3,\r
+\r
+                       // Public methods\r
+                       setStart : setStart,\r
+                       setEnd : setEnd,\r
+                       setStartBefore : setStartBefore,\r
+                       setStartAfter : setStartAfter,\r
+                       setEndBefore : setEndBefore,\r
+                       setEndAfter : setEndAfter,\r
+                       collapse : collapse,\r
+                       selectNode : selectNode,\r
+                       selectNodeContents : selectNodeContents,\r
+                       compareBoundaryPoints : compareBoundaryPoints,\r
+                       deleteContents : deleteContents,\r
+                       extractContents : extractContents,\r
+                       cloneContents : cloneContents,\r
+                       insertNode : insertNode,\r
+                       surroundContents : surroundContents,\r
+                       cloneRange : cloneRange\r
+               });\r
+\r
+               function createDocumentFragment() {\r
+                       return doc.createDocumentFragment();\r
+               };\r
+\r
+               function setStart(n, o) {\r
+                       _setEndPoint(TRUE, n, o);\r
+               };\r
+\r
+               function setEnd(n, o) {\r
+                       _setEndPoint(FALSE, n, o);\r
+               };\r
+\r
+               function setStartBefore(n) {\r
+                       setStart(n.parentNode, nodeIndex(n));\r
+               };\r
+\r
+               function setStartAfter(n) {\r
+                       setStart(n.parentNode, nodeIndex(n) + 1);\r
+               };\r
+\r
+               function setEndBefore(n) {\r
+                       setEnd(n.parentNode, nodeIndex(n));\r
+               };\r
+\r
+               function setEndAfter(n) {\r
+                       setEnd(n.parentNode, nodeIndex(n) + 1);\r
+               };\r
+\r
+               function collapse(ts) {\r
+                       if (ts) {\r
+                               t[END_CONTAINER] = t[START_CONTAINER];\r
+                               t[END_OFFSET] = t[START_OFFSET];\r
+                       } else {\r
+                               t[START_CONTAINER] = t[END_CONTAINER];\r
+                               t[START_OFFSET] = t[END_OFFSET];\r
+                       }\r
+\r
+                       t.collapsed = TRUE;\r
+               };\r
+\r
+               function selectNode(n) {\r
+                       setStartBefore(n);\r
+                       setEndAfter(n);\r
+               };\r
+\r
+               function selectNodeContents(n) {\r
+                       setStart(n, 0);\r
+                       setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);\r
+               };\r
+\r
+               function compareBoundaryPoints(h, r) {\r
+                       var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET],\r
+                       rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset;\r
+\r
+                       // Check START_TO_START\r
+                       if (h === 0)\r
+                               return _compareBoundaryPoints(sc, so, rsc, rso);\r
+       \r
+                       // Check START_TO_END\r
+                       if (h === 1)\r
+                               return _compareBoundaryPoints(ec, eo, rsc, rso);\r
+       \r
+                       // Check END_TO_END\r
+                       if (h === 2)\r
+                               return _compareBoundaryPoints(ec, eo, rec, reo);\r
+       \r
+                       // Check END_TO_START\r
+                       if (h === 3) \r
+                               return _compareBoundaryPoints(sc, so, rec, reo);\r
+               };\r
+\r
+               function deleteContents() {\r
+                       _traverse(DELETE);\r
+               };\r
+\r
+               function extractContents() {\r
+                       return _traverse(EXTRACT);\r
+               };\r
+\r
+               function cloneContents() {\r
+                       return _traverse(CLONE);\r
+               };\r
+\r
+               function insertNode(n) {\r
+                       var startContainer = this[START_CONTAINER],\r
+                               startOffset = this[START_OFFSET], nn, o;\r
+\r
+                       // Node is TEXT_NODE or CDATA\r
+                       if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {\r
+                               if (!startOffset) {\r
+                                       // At the start of text\r
+                                       startContainer.parentNode.insertBefore(n, startContainer);\r
+                               } else if (startOffset >= startContainer.nodeValue.length) {\r
+                                       // At the end of text\r
+                                       dom.insertAfter(n, startContainer);\r
+                               } else {\r
+                                       // Middle, need to split\r
+                                       nn = startContainer.splitText(startOffset);\r
+                                       startContainer.parentNode.insertBefore(n, nn);\r
+                               }\r
+                       } else {\r
+                               // Insert element node\r
+                               if (startContainer.childNodes.length > 0)\r
+                                       o = startContainer.childNodes[startOffset];\r
+\r
+                               if (o)\r
+                                       startContainer.insertBefore(n, o);\r
+                               else\r
+                                       startContainer.appendChild(n);\r
+                       }\r
+               };\r
+\r
+               function surroundContents(n) {\r
+                       var f = t.extractContents();\r
+\r
+                       t.insertNode(n);\r
+                       n.appendChild(f);\r
+                       t.selectNode(n);\r
+               };\r
+\r
+               function cloneRange() {\r
+                       return extend(new Range(dom), {\r
+                               startContainer : t[START_CONTAINER],\r
+                               startOffset : t[START_OFFSET],\r
+                               endContainer : t[END_CONTAINER],\r
+                               endOffset : t[END_OFFSET],\r
+                               collapsed : t.collapsed,\r
+                               commonAncestorContainer : t.commonAncestorContainer\r
+                       });\r
+               };\r
+\r
+               // Private methods\r
+\r
+               function _getSelectedNode(container, offset) {\r
+                       var child;\r
+\r
+                       if (container.nodeType == 3 /* TEXT_NODE */)\r
+                               return container;\r
+\r
+                       if (offset < 0)\r
+                               return container;\r
+\r
+                       child = container.firstChild;\r
+                       while (child && offset > 0) {\r
+                               --offset;\r
+                               child = child.nextSibling;\r
+                       }\r
+\r
+                       if (child)\r
+                               return child;\r
+\r
+                       return container;\r
+               };\r
+\r
+               function _isCollapsed() {\r
+                       return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);\r
+               };\r
+\r
+               function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {\r
+                       var c, offsetC, n, cmnRoot, childA, childB;\r
+                       \r
+                       // In the first case the boundary-points have the same container. A is before B\r
+                       // if its offset is less than the offset of B, A is equal to B if its offset is\r
+                       // equal to the offset of B, and A is after B if its offset is greater than the\r
+                       // offset of B.\r
+                       if (containerA == containerB) {\r
+                               if (offsetA == offsetB)\r
+                                       return 0; // equal\r
+\r
+                               if (offsetA < offsetB)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the second case a child node C of the container of A is an ancestor\r
+                       // container of B. In this case, A is before B if the offset of A is less than or\r
+                       // equal to the index of the child node C and A is after B otherwise.\r
+                       c = containerB;\r
+                       while (c && c.parentNode != containerA)\r
+                               c = c.parentNode;\r
+\r
+                       if (c) {\r
+                               offsetC = 0;\r
+                               n = containerA.firstChild;\r
+\r
+                               while (n != c && offsetC < offsetA) {\r
+                                       offsetC++;\r
+                                       n = n.nextSibling;\r
+                               }\r
+\r
+                               if (offsetA <= offsetC)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the third case a child node C of the container of B is an ancestor container\r
+                       // of A. In this case, A is before B if the index of the child node C is less than\r
+                       // the offset of B and A is after B otherwise.\r
+                       c = containerA;\r
+                       while (c && c.parentNode != containerB) {\r
+                               c = c.parentNode;\r
+                       }\r
+\r
+                       if (c) {\r
+                               offsetC = 0;\r
+                               n = containerB.firstChild;\r
+\r
+                               while (n != c && offsetC < offsetB) {\r
+                                       offsetC++;\r
+                                       n = n.nextSibling;\r
+                               }\r
+\r
+                               if (offsetC < offsetB)\r
+                                       return -1; // before\r
+\r
+                               return 1; // after\r
+                       }\r
+\r
+                       // In the fourth case, none of three other cases hold: the containers of A and B\r
+                       // are siblings or descendants of sibling nodes. In this case, A is before B if\r
+                       // the container of A is before the container of B in a pre-order traversal of the\r
+                       // Ranges' context tree and A is after B otherwise.\r
+                       cmnRoot = dom.findCommonAncestor(containerA, containerB);\r
+                       childA = containerA;\r
+\r
+                       while (childA && childA.parentNode != cmnRoot)\r
+                               childA = childA.parentNode;\r
+\r
+                       if (!childA)\r
+                               childA = cmnRoot;\r
+\r
+                       childB = containerB;\r
+                       while (childB && childB.parentNode != cmnRoot)\r
+                               childB = childB.parentNode;\r
+\r
+                       if (!childB)\r
+                               childB = cmnRoot;\r
+\r
+                       if (childA == childB)\r
+                               return 0; // equal\r
+\r
+                       n = cmnRoot.firstChild;\r
+                       while (n) {\r
+                               if (n == childA)\r
+                                       return -1; // before\r
+\r
+                               if (n == childB)\r
+                                       return 1; // after\r
+\r
+                               n = n.nextSibling;\r
+                       }\r
+               };\r
+\r
+               function _setEndPoint(st, n, o) {\r
+                       var ec, sc;\r
+\r
+                       if (st) {\r
+                               t[START_CONTAINER] = n;\r
+                               t[START_OFFSET] = o;\r
+                       } else {\r
+                               t[END_CONTAINER] = n;\r
+                               t[END_OFFSET] = o;\r
+                       }\r
+\r
+                       // If one boundary-point of a Range is set to have a root container\r
+                       // other than the current one for the Range, the Range is collapsed to\r
+                       // the new position. This enforces the restriction that both boundary-\r
+                       // points of a Range must have the same root container.\r
+                       ec = t[END_CONTAINER];\r
+                       while (ec.parentNode)\r
+                               ec = ec.parentNode;\r
+\r
+                       sc = t[START_CONTAINER];\r
+                       while (sc.parentNode)\r
+                               sc = sc.parentNode;\r
+\r
+                       if (sc == ec) {\r
+                               // The start position of a Range is guaranteed to never be after the\r
+                               // end position. To enforce this restriction, if the start is set to\r
+                               // be at a position after the end, the Range is collapsed to that\r
+                               // position.\r
+                               if (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)\r
+                                       t.collapse(st);\r
+                       } else\r
+                               t.collapse(st);\r
+\r
+                       t.collapsed = _isCollapsed();\r
+                       t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);\r
+               };\r
+\r
+               function _traverse(how) {\r
+                       var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;\r
+\r
+                       if (t[START_CONTAINER] == t[END_CONTAINER])\r
+                               return _traverseSameContainer(how);\r
+\r
+                       for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
+                               if (p == t[START_CONTAINER])\r
+                                       return _traverseCommonStartContainer(c, how);\r
+\r
+                               ++endContainerDepth;\r
+                       }\r
+\r
+                       for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {\r
+                               if (p == t[END_CONTAINER])\r
+                                       return _traverseCommonEndContainer(c, how);\r
+\r
+                               ++startContainerDepth;\r
+                       }\r
+\r
+                       depthDiff = startContainerDepth - endContainerDepth;\r
+\r
+                       startNode = t[START_CONTAINER];\r
+                       while (depthDiff > 0) {\r
+                               startNode = startNode.parentNode;\r
+                               depthDiff--;\r
+                       }\r
+\r
+                       endNode = t[END_CONTAINER];\r
+                       while (depthDiff < 0) {\r
+                               endNode = endNode.parentNode;\r
+                               depthDiff++;\r
+                       }\r
+\r
+                       // ascend the ancestor hierarchy until we have a common parent.\r
+                       for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {\r
+                               startNode = sp;\r
+                               endNode = ep;\r
+                       }\r
+\r
+                       return _traverseCommonAncestors(startNode, endNode, how);\r
+               };\r
+\r
+                function _traverseSameContainer(how) {\r
+                       var frag, s, sub, n, cnt, sibling, xferNode, start, len;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       // If selection is empty, just return the fragment\r
+                       if (t[START_OFFSET] == t[END_OFFSET])\r
+                               return frag;\r
+\r
+                       // Text node needs special case handling\r
+                       if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {\r
+                               // get the substring\r
+                               s = t[START_CONTAINER].nodeValue;\r
+                               sub = s.substring(t[START_OFFSET], t[END_OFFSET]);\r
+\r
+                               // set the original text node to its new value\r
+                               if (how != CLONE) {\r
+                                       n = t[START_CONTAINER];\r
+                                       start = t[START_OFFSET];\r
+                                       len = t[END_OFFSET] - t[START_OFFSET];\r
+\r
+                                       if (start === 0 && len >= n.nodeValue.length - 1) {\r
+                                               n.parentNode.removeChild(n);\r
+                                       } else {\r
+                                               n.deleteData(start, len);\r
+                                       }\r
+\r
+                                       // Nothing is partially selected, so collapse to start point\r
+                                       t.collapse(TRUE);\r
+                               }\r
+\r
+                               if (how == DELETE)\r
+                                       return;\r
+\r
+                               if (sub.length > 0) {\r
+                                       frag.appendChild(doc.createTextNode(sub));\r
+                               }\r
+\r
+                               return frag;\r
+                       }\r
+\r
+                       // Copy nodes between the start/end offsets.\r
+                       n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);\r
+                       cnt = t[END_OFFSET] - t[START_OFFSET];\r
+\r
+                       while (n && cnt > 0) {\r
+                               sibling = n.nextSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild( xferNode );\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       // Nothing is partially selected, so collapse to start point\r
+                       if (how != CLONE)\r
+                               t.collapse(TRUE);\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonStartContainer(endAncestor, how) {\r
+                       var frag, n, endIdx, cnt, sibling, xferNode;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseRightBoundary(endAncestor, how);\r
+\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       endIdx = nodeIndex(endAncestor);\r
+                       cnt = endIdx - t[START_OFFSET];\r
+\r
+                       if (cnt <= 0) {\r
+                               // Collapse to just before the endAncestor, which\r
+                               // is partially selected.\r
+                               if (how != CLONE) {\r
+                                       t.setEndBefore(endAncestor);\r
+                                       t.collapse(FALSE);\r
+                               }\r
+\r
+                               return frag;\r
+                       }\r
+\r
+                       n = endAncestor.previousSibling;\r
+                       while (cnt > 0) {\r
+                               sibling = n.previousSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.insertBefore(xferNode, frag.firstChild);\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       // Collapse to just before the endAncestor, which\r
+                       // is partially selected.\r
+                       if (how != CLONE) {\r
+                               t.setEndBefore(endAncestor);\r
+                               t.collapse(FALSE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonEndContainer(startAncestor, how) {\r
+                       var frag, startIdx, n, cnt, sibling, xferNode;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseLeftBoundary(startAncestor, how);\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       startIdx = nodeIndex(startAncestor);\r
+                       ++startIdx; // Because we already traversed it\r
+\r
+                       cnt = t[END_OFFSET] - startIdx;\r
+                       n = startAncestor.nextSibling;\r
+                       while (n && cnt > 0) {\r
+                               sibling = n.nextSibling;\r
+                               xferNode = _traverseFullySelected(n, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild(xferNode);\r
+\r
+                               --cnt;\r
+                               n = sibling;\r
+                       }\r
+\r
+                       if (how != CLONE) {\r
+                               t.setStartAfter(startAncestor);\r
+                               t.collapse(TRUE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseCommonAncestors(startAncestor, endAncestor, how) {\r
+                       var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;\r
+\r
+                       if (how != DELETE)\r
+                               frag = createDocumentFragment();\r
+\r
+                       n = _traverseLeftBoundary(startAncestor, how);\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       commonParent = startAncestor.parentNode;\r
+                       startOffset = nodeIndex(startAncestor);\r
+                       endOffset = nodeIndex(endAncestor);\r
+                       ++startOffset;\r
+\r
+                       cnt = endOffset - startOffset;\r
+                       sibling = startAncestor.nextSibling;\r
+\r
+                       while (cnt > 0) {\r
+                               nextSibling = sibling.nextSibling;\r
+                               n = _traverseFullySelected(sibling, how);\r
+\r
+                               if (frag)\r
+                                       frag.appendChild(n);\r
+\r
+                               sibling = nextSibling;\r
+                               --cnt;\r
+                       }\r
+\r
+                       n = _traverseRightBoundary(endAncestor, how);\r
+\r
+                       if (frag)\r
+                               frag.appendChild(n);\r
+\r
+                       if (how != CLONE) {\r
+                               t.setStartAfter(startAncestor);\r
+                               t.collapse(TRUE);\r
+                       }\r
+\r
+                       return frag;\r
+               };\r
+\r
+               function _traverseRightBoundary(root, how) {\r
+                       var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];\r
+\r
+                       if (next == root)\r
+                               return _traverseNode(next, isFullySelected, FALSE, how);\r
+\r
+                       parent = next.parentNode;\r
+                       clonedParent = _traverseNode(parent, FALSE, FALSE, how);\r
+\r
+                       while (parent) {\r
+                               while (next) {\r
+                                       prevSibling = next.previousSibling;\r
+                                       clonedChild = _traverseNode(next, isFullySelected, FALSE, how);\r
+\r
+                                       if (how != DELETE)\r
+                                               clonedParent.insertBefore(clonedChild, clonedParent.firstChild);\r
+\r
+                                       isFullySelected = TRUE;\r
+                                       next = prevSibling;\r
+                               }\r
+\r
+                               if (parent == root)\r
+                                       return clonedParent;\r
+\r
+                               next = parent.previousSibling;\r
+                               parent = parent.parentNode;\r
+\r
+                               clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);\r
+\r
+                               if (how != DELETE)\r
+                                       clonedGrandParent.appendChild(clonedParent);\r
+\r
+                               clonedParent = clonedGrandParent;\r
+                       }\r
+               };\r
+\r
+               function _traverseLeftBoundary(root, how) {\r
+                       var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;\r
+\r
+                       if (next == root)\r
+                               return _traverseNode(next, isFullySelected, TRUE, how);\r
+\r
+                       parent = next.parentNode;\r
+                       clonedParent = _traverseNode(parent, FALSE, TRUE, how);\r
+\r
+                       while (parent) {\r
+                               while (next) {\r
+                                       nextSibling = next.nextSibling;\r
+                                       clonedChild = _traverseNode(next, isFullySelected, TRUE, how);\r
+\r
+                                       if (how != DELETE)\r
+                                               clonedParent.appendChild(clonedChild);\r
+\r
+                                       isFullySelected = TRUE;\r
+                                       next = nextSibling;\r
+                               }\r
+\r
+                               if (parent == root)\r
+                                       return clonedParent;\r
+\r
+                               next = parent.nextSibling;\r
+                               parent = parent.parentNode;\r
+\r
+                               clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);\r
 \r
-for ( var type in Expr.match ) {\r
-       Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );\r
-       Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );\r
-}\r
+                               if (how != DELETE)\r
+                                       clonedGrandParent.appendChild(clonedParent);\r
 \r
-var makeArray = function(array, results) {\r
-       array = Array.prototype.slice.call( array, 0 );\r
+                               clonedParent = clonedGrandParent;\r
+                       }\r
+               };\r
 \r
-       if ( results ) {\r
-               results.push.apply( results, array );\r
-               return results;\r
-       }\r
-       \r
-       return array;\r
-};\r
+               function _traverseNode(n, isFullySelected, isLeft, how) {\r
+                       var txtValue, newNodeValue, oldNodeValue, offset, newNode;\r
 \r
-// Perform a simple check to determine if the browser is capable of\r
-// converting a NodeList to an array using builtin methods.\r
-// Also verifies that the returned array holds DOM nodes\r
-// (which is not the case in the Blackberry browser)\r
-try {\r
-       Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;\r
+                       if (isFullySelected)\r
+                               return _traverseFullySelected(n, how);\r
 \r
-// Provide a fallback method if it does not work\r
-} catch(e){\r
-       makeArray = function(array, results) {\r
-               var ret = results || [], i = 0;\r
+                       if (n.nodeType == 3 /* TEXT_NODE */) {\r
+                               txtValue = n.nodeValue;\r
 \r
-               if ( toString.call(array) === "[object Array]" ) {\r
-                       Array.prototype.push.apply( ret, array );\r
-               } else {\r
-                       if ( typeof array.length === "number" ) {\r
-                               for ( var l = array.length; i < l; i++ ) {\r
-                                       ret.push( array[i] );\r
-                               }\r
-                       } else {\r
-                               for ( ; array[i]; i++ ) {\r
-                                       ret.push( array[i] );\r
+                               if (isLeft) {\r
+                                       offset = t[START_OFFSET];\r
+                                       newNodeValue = txtValue.substring(offset);\r
+                                       oldNodeValue = txtValue.substring(0, offset);\r
+                               } else {\r
+                                       offset = t[END_OFFSET];\r
+                                       newNodeValue = txtValue.substring(0, offset);\r
+                                       oldNodeValue = txtValue.substring(offset);\r
                                }\r
-                       }\r
-               }\r
 \r
-               return ret;\r
-       };\r
-}\r
+                               if (how != CLONE)\r
+                                       n.nodeValue = oldNodeValue;\r
 \r
-var sortOrder;\r
+                               if (how == DELETE)\r
+                                       return;\r
 \r
-if ( document.documentElement.compareDocumentPosition ) {\r
-       sortOrder = function( a, b ) {\r
-               if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {\r
-                       if ( a == b ) {\r
-                               hasDuplicate = true;\r
-                       }\r
-                       return a.compareDocumentPosition ? -1 : 1;\r
-               }\r
+                               newNode = dom.clone(n, FALSE);\r
+                               newNode.nodeValue = newNodeValue;\r
 \r
-               var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;\r
-               if ( ret === 0 ) {\r
-                       hasDuplicate = true;\r
-               }\r
-               return ret;\r
-       };\r
-} else if ( "sourceIndex" in document.documentElement ) {\r
-       sortOrder = function( a, b ) {\r
-               if ( !a.sourceIndex || !b.sourceIndex ) {\r
-                       if ( a == b ) {\r
-                               hasDuplicate = true;\r
+                               return newNode;\r
                        }\r
-                       return a.sourceIndex ? -1 : 1;\r
-               }\r
 \r
-               var ret = a.sourceIndex - b.sourceIndex;\r
-               if ( ret === 0 ) {\r
-                       hasDuplicate = true;\r
-               }\r
-               return ret;\r
-       };\r
-} else if ( document.createRange ) {\r
-       sortOrder = function( a, b ) {\r
-               if ( !a.ownerDocument || !b.ownerDocument ) {\r
-                       if ( a == b ) {\r
-                               hasDuplicate = true;\r
-                       }\r
-                       return a.ownerDocument ? -1 : 1;\r
-               }\r
+                       if (how == DELETE)\r
+                               return;\r
 \r
-               var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();\r
-               aRange.setStart(a, 0);\r
-               aRange.setEnd(a, 0);\r
-               bRange.setStart(b, 0);\r
-               bRange.setEnd(b, 0);\r
-               var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);\r
-               if ( ret === 0 ) {\r
-                       hasDuplicate = true;\r
-               }\r
-               return ret;\r
-       };\r
-}\r
+                       return dom.clone(n, FALSE);\r
+               };\r
 \r
-// Utility function for retreiving the text value of an array of DOM nodes\r
-Sizzle.getText = function( elems ) {\r
-       var ret = "", elem;\r
+               function _traverseFullySelected(n, how) {\r
+                       if (how != DELETE)\r
+                               return how == CLONE ? dom.clone(n, TRUE) : n;\r
 \r
-       for ( var i = 0; elems[i]; i++ ) {\r
-               elem = elems[i];\r
+                       n.parentNode.removeChild(n);\r
+               };\r
+       };\r
 \r
-               // Get the text from text nodes and CDATA nodes\r
-               if ( elem.nodeType === 3 || elem.nodeType === 4 ) {\r
-                       ret += elem.nodeValue;\r
+       ns.Range = Range;\r
+})(tinymce.dom);\r
 \r
-               // Traverse everything else, except comment nodes\r
-               } else if ( elem.nodeType !== 8 ) {\r
-                       ret += Sizzle.getText( elem.childNodes );\r
-               }\r
-       }\r
+(function() {\r
+       function Selection(selection) {\r
+               var self = this, dom = selection.dom, TRUE = true, FALSE = false;\r
 \r
-       return ret;\r
-};\r
+               function getPosition(rng, start) {\r
+                       var checkRng, startIndex = 0, endIndex, inside,\r
+                               children, child, offset, index, position = -1, parent;\r
 \r
-// Check to see if the browser returns elements by name when\r
-// querying by getElementById (and provide a workaround)\r
-(function(){\r
-       // We're going to inject a fake input element with a specified name\r
-       var form = document.createElement("div"),\r
-               id = "script" + (new Date()).getTime();\r
-       form.innerHTML = "<a name='" + id + "'/>";\r
+                       // Setup test range, collapse it and get the parent\r
+                       checkRng = rng.duplicate();\r
+                       checkRng.collapse(start);\r
+                       parent = checkRng.parentElement();\r
 \r
-       // Inject it into the root element, check its status, and remove it quickly\r
-       var root = document.documentElement;\r
-       root.insertBefore( form, root.firstChild );\r
+                       // Check if the selection is within the right document\r
+                       if (parent.ownerDocument !== selection.dom.doc)\r
+                               return;\r
 \r
-       // The workaround has to do additional checks after a getElementById\r
-       // Which slows things down for other browsers (hence the branching)\r
-       if ( document.getElementById( id ) ) {\r
-               Expr.find.ID = function(match, context, isXML){\r
-                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
-                               var m = context.getElementById(match[1]);\r
-                               return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];\r
+                       // IE will report non editable elements as it's parent so look for an editable one\r
+                       while (parent.contentEditable === "false") {\r
+                               parent = parent.parentNode;\r
                        }\r
-               };\r
 \r
-               Expr.filter.ID = function(elem, match){\r
-                       var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");\r
-                       return elem.nodeType === 1 && node && node.nodeValue === match;\r
-               };\r
-       }\r
+                       // If parent doesn't have any children then return that we are inside the element\r
+                       if (!parent.hasChildNodes()) {\r
+                               return {node : parent, inside : 1};\r
+                       }\r
 \r
-       root.removeChild( form );\r
-       root = form = null; // release memory in IE\r
-})();\r
+                       // Setup node list and endIndex\r
+                       children = parent.children;\r
+                       endIndex = children.length - 1;\r
 \r
-(function(){\r
-       // Check to see if the browser returns only elements\r
-       // when doing getElementsByTagName("*")\r
+                       // Perform a binary search for the position\r
+                       while (startIndex <= endIndex) {\r
+                               index = Math.floor((startIndex + endIndex) / 2);\r
 \r
-       // Create a fake element\r
-       var div = document.createElement("div");\r
-       div.appendChild( document.createComment("") );\r
+                               // Move selection to node and compare the ranges\r
+                               child = children[index];\r
+                               checkRng.moveToElementText(child);\r
+                               position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng);\r
 \r
-       // Make sure no comments are found\r
-       if ( div.getElementsByTagName("*").length > 0 ) {\r
-               Expr.find.TAG = function(match, context){\r
-                       var results = context.getElementsByTagName(match[1]);\r
+                               // Before/after or an exact match\r
+                               if (position > 0) {\r
+                                       endIndex = index - 1;\r
+                               } else if (position < 0) {\r
+                                       startIndex = index + 1;\r
+                               } else {\r
+                                       return {node : child};\r
+                               }\r
+                       }\r
 \r
-                       // Filter out possible comments\r
-                       if ( match[1] === "*" ) {\r
-                               var tmp = [];\r
+                       // Check if child position is before or we didn't find a position\r
+                       if (position < 0) {\r
+                               // No element child was found use the parent element and the offset inside that\r
+                               if (!child) {\r
+                                       checkRng.moveToElementText(parent);\r
+                                       checkRng.collapse(true);\r
+                                       child = parent;\r
+                                       inside = true;\r
+                               } else\r
+                                       checkRng.collapse(false);\r
 \r
-                               for ( var i = 0; results[i]; i++ ) {\r
-                                       if ( results[i].nodeType === 1 ) {\r
-                                               tmp.push( results[i] );\r
+                               // Walk character by character in text node until we hit the selected range endpoint, hit the end of document or parent isn't the right one\r
+                               // We need to walk char by char since rng.text or rng.htmlText will trim line endings\r
+                               offset = 0;\r
+                               while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {\r
+                                       if (checkRng.move('character', 1) == 0 || parent != checkRng.parentElement()) {\r
+                                               break;\r
                                        }\r
+\r
+                                       offset++;\r
                                }\r
+                       } else {\r
+                               // Child position is after the selection endpoint\r
+                               checkRng.collapse(true);\r
 \r
-                               results = tmp;\r
+                               // Walk character by character in text node until we hit the selected range endpoint, hit the end of document or parent isn't the right one\r
+                               offset = 0;\r
+                               while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {\r
+                                       if (checkRng.move('character', -1) == 0 || parent != checkRng.parentElement()) {\r
+                                               break;\r
+                                       }\r
+\r
+                                       offset++;\r
+                               }\r
                        }\r
 \r
-                       return results;\r
+                       return {node : child, position : position, offset : offset, inside : inside};\r
                };\r
-       }\r
 \r
-       // Check to see if an attribute returns normalized href attributes\r
-       div.innerHTML = "<a href='#'></a>";\r
-       if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&\r
-                       div.firstChild.getAttribute("href") !== "#" ) {\r
-               Expr.attrHandle.href = function(elem){\r
-                       return elem.getAttribute("href", 2);\r
-               };\r
-       }\r
+               // Returns a W3C DOM compatible range object by using the IE Range API\r
+               function getRange() {\r
+                       var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark, fail;\r
 \r
-       div = null; // release memory in IE\r
-})();\r
+                       // If selection is outside the current document just return an empty range\r
+                       element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();\r
+                       if (element.ownerDocument != dom.doc)\r
+                               return domRange;\r
 \r
-if ( document.querySelectorAll ) {\r
-       (function(){\r
-               var oldSizzle = Sizzle, div = document.createElement("div");\r
-               div.innerHTML = "<p class='TEST'></p>";\r
+                       collapsed = selection.isCollapsed();\r
 \r
-               // Safari can't handle uppercase or unicode characters when\r
-               // in quirks mode.\r
-               if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {\r
-                       return;\r
-               }\r
-       \r
-               Sizzle = function(query, context, extra, seed){\r
-                       context = context || document;\r
+                       // Handle control selection\r
+                       if (ieRange.item) {\r
+                               domRange.setStart(element.parentNode, dom.nodeIndex(element));\r
+                               domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);\r
 \r
-                       // Only use querySelectorAll on non-XML documents\r
-                       // (ID selectors don't work in non-HTML documents)\r
-                       if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) {\r
-                               try {\r
-                                       return makeArray( context.querySelectorAll(query), extra );\r
-                               } catch(e){}\r
+                               return domRange;\r
                        }\r
-               \r
-                       return oldSizzle(query, context, extra, seed);\r
-               };\r
 \r
-               for ( var prop in oldSizzle ) {\r
-                       Sizzle[ prop ] = oldSizzle[ prop ];\r
-               }\r
+                       function findEndPoint(start) {\r
+                               var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue;\r
+\r
+                               container = endPoint.node;\r
+                               offset = endPoint.offset;\r
+\r
+                               if (endPoint.inside && !container.hasChildNodes()) {\r
+                                       domRange[start ? 'setStart' : 'setEnd'](container, 0);\r
+                                       return;\r
+                               }\r
+\r
+                               if (offset === undef) {\r
+                                       domRange[start ? 'setStartBefore' : 'setEndAfter'](container);\r
+                                       return;\r
+                               }\r
+\r
+                               if (endPoint.position < 0) {\r
+                                       sibling = endPoint.inside ? container.firstChild : container.nextSibling;\r
+\r
+                                       if (!sibling) {\r
+                                               domRange[start ? 'setStartAfter' : 'setEndAfter'](container);\r
+                                               return;\r
+                                       }\r
+\r
+                                       if (!offset) {\r
+                                               if (sibling.nodeType == 3)\r
+                                                       domRange[start ? 'setStart' : 'setEnd'](sibling, 0);\r
+                                               else\r
+                                                       domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling);\r
 \r
-               div = null; // release memory in IE\r
-       })();\r
-}\r
+                                               return;\r
+                                       }\r
 \r
-(function(){\r
-       var div = document.createElement("div");\r
+                                       // Find the text node and offset\r
+                                       while (sibling) {\r
+                                               nodeValue = sibling.nodeValue;\r
+                                               textNodeOffset += nodeValue.length;\r
 \r
-       div.innerHTML = "<div class='test e'></div><div class='test'></div>";\r
+                                               // We are at or passed the position we where looking for\r
+                                               if (textNodeOffset >= offset) {\r
+                                                       container = sibling;\r
+                                                       textNodeOffset -= offset;\r
+                                                       textNodeOffset = nodeValue.length - textNodeOffset;\r
+                                                       break;\r
+                                               }\r
 \r
-       // Opera can't find a second classname (in 9.6)\r
-       // Also, make sure that getElementsByClassName actually exists\r
-       if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {\r
-               return;\r
-       }\r
+                                               sibling = sibling.nextSibling;\r
+                                       }\r
+                               } else {\r
+                                       // Find the text node and offset\r
+                                       sibling = container.previousSibling;\r
 \r
-       // Safari caches class attributes, doesn't catch changes (in 3.2)\r
-       div.lastChild.className = "e";\r
+                                       if (!sibling)\r
+                                               return domRange[start ? 'setStartBefore' : 'setEndBefore'](container);\r
 \r
-       if ( div.getElementsByClassName("e").length === 1 ) {\r
-               return;\r
-       }\r
-       \r
-       Expr.order.splice(1, 0, "CLASS");\r
-       Expr.find.CLASS = function(match, context, isXML) {\r
-               if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {\r
-                       return context.getElementsByClassName(match[1]);\r
-               }\r
-       };\r
+                                       // If there isn't any text to loop then use the first position\r
+                                       if (!offset) {\r
+                                               if (container.nodeType == 3)\r
+                                                       domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length);\r
+                                               else\r
+                                                       domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling);\r
 \r
-       div = null; // release memory in IE\r
-})();\r
+                                               return;\r
+                                       }\r
 \r
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
-       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
-               var elem = checkSet[i];\r
-               if ( elem ) {\r
-                       elem = elem[dir];\r
-                       var match = false;\r
+                                       while (sibling) {\r
+                                               textNodeOffset += sibling.nodeValue.length;\r
 \r
-                       while ( elem ) {\r
-                               if ( elem.sizcache === doneName ) {\r
-                                       match = checkSet[elem.sizset];\r
-                                       break;\r
-                               }\r
+                                               // We are at or passed the position we where looking for\r
+                                               if (textNodeOffset >= offset) {\r
+                                                       container = sibling;\r
+                                                       textNodeOffset -= offset;\r
+                                                       break;\r
+                                               }\r
 \r
-                               if ( elem.nodeType === 1 && !isXML ){\r
-                                       elem.sizcache = doneName;\r
-                                       elem.sizset = i;\r
+                                               sibling = sibling.previousSibling;\r
+                                       }\r
                                }\r
 \r
-                               if ( elem.nodeName.toLowerCase() === cur ) {\r
-                                       match = elem;\r
-                                       break;\r
-                               }\r
+                               domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset);\r
+                       };\r
 \r
-                               elem = elem[dir];\r
+                       try {\r
+                               // Find start point\r
+                               findEndPoint(true);\r
+\r
+                               // Find end point if needed\r
+                               if (!collapsed)\r
+                                       findEndPoint();\r
+                       } catch (ex) {\r
+                               // IE has a nasty bug where text nodes might throw "invalid argument" when you\r
+                               // access the nodeValue or other properties of text nodes. This seems to happend when\r
+                               // text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it.\r
+                               if (ex.number == -2147024809) {\r
+                                       // Get the current selection\r
+                                       bookmark = self.getBookmark(2);\r
+\r
+                                       // Get start element\r
+                                       tmpRange = ieRange.duplicate();\r
+                                       tmpRange.collapse(true);\r
+                                       element = tmpRange.parentElement();\r
+\r
+                                       // Get end element\r
+                                       if (!collapsed) {\r
+                                               tmpRange = ieRange.duplicate();\r
+                                               tmpRange.collapse(false);\r
+                                               element2 = tmpRange.parentElement();\r
+                                               element2.innerHTML = element2.innerHTML;\r
+                                       }\r
+\r
+                                       // Remove the broken elements\r
+                                       element.innerHTML = element.innerHTML;\r
+\r
+                                       // Restore the selection\r
+                                       self.moveToBookmark(bookmark);\r
+\r
+                                       // Since the range has moved we need to re-get it\r
+                                       ieRange = selection.getRng();\r
+\r
+                                       // Find start point\r
+                                       findEndPoint(true);\r
+\r
+                                       // Find end point if needed\r
+                                       if (!collapsed)\r
+                                               findEndPoint();\r
+                               } else\r
+                                       throw ex; // Throw other errors\r
                        }\r
 \r
-                       checkSet[i] = match;\r
-               }\r
-       }\r
-}\r
+                       return domRange;\r
+               };\r
 \r
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
-       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
-               var elem = checkSet[i];\r
-               if ( elem ) {\r
-                       elem = elem[dir];\r
-                       var match = false;\r
+               this.getBookmark = function(type) {\r
+                       var rng = selection.getRng(), start, end, bookmark = {};\r
 \r
-                       while ( elem ) {\r
-                               if ( elem.sizcache === doneName ) {\r
-                                       match = checkSet[elem.sizset];\r
-                                       break;\r
-                               }\r
+                       function getIndexes(node) {\r
+                               var node, parent, root, children, i, indexes = [];\r
 \r
-                               if ( elem.nodeType === 1 ) {\r
-                                       if ( !isXML ) {\r
-                                               elem.sizcache = doneName;\r
-                                               elem.sizset = i;\r
-                                       }\r
-                                       if ( typeof cur !== "string" ) {\r
-                                               if ( elem === cur ) {\r
-                                                       match = true;\r
+                               parent = node.parentNode;\r
+                               root = dom.getRoot().parentNode;\r
+\r
+                               while (parent != root && parent.nodeType !== 9) {\r
+                                       children = parent.children;\r
+\r
+                                       i = children.length;\r
+                                       while (i--) {\r
+                                               if (node === children[i]) {\r
+                                                       indexes.push(i);\r
                                                        break;\r
                                                }\r
-\r
-                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\r
-                                               match = elem;\r
-                                               break;\r
                                        }\r
+\r
+                                       node = parent;\r
+                                       parent = parent.parentNode;\r
                                }\r
 \r
-                               elem = elem[dir];\r
+                               return indexes;\r
+                       };\r
+\r
+                       function getBookmarkEndPoint(start) {\r
+                               var position;\r
+\r
+                               position = getPosition(rng, start);\r
+                               if (position) {\r
+                                       return {\r
+                                               position : position.position,\r
+                                               offset : position.offset,\r
+                                               indexes : getIndexes(position.node),\r
+                                               inside : position.inside\r
+                                       };\r
+                               }\r
+                       };\r
+\r
+                       // Non ubstructive bookmark\r
+                       if (type === 2) {\r
+                               // Handle text selection\r
+                               if (!rng.item) {\r
+                                       bookmark.start = getBookmarkEndPoint(true);\r
+\r
+                                       if (!selection.isCollapsed())\r
+                                               bookmark.end = getBookmarkEndPoint();\r
+                               } else\r
+                                       bookmark.start = {ctrl : true, indexes : getIndexes(rng.item(0))};\r
                        }\r
 \r
-                       checkSet[i] = match;\r
-               }\r
-       }\r
-}\r
+                       return bookmark;\r
+               };\r
 \r
-Sizzle.contains = document.compareDocumentPosition ? function(a, b){\r
-       return !!(a.compareDocumentPosition(b) & 16);\r
-} : function(a, b){\r
-       return a !== b && (a.contains ? a.contains(b) : true);\r
-};\r
+               this.moveToBookmark = function(bookmark) {\r
+                       var rng, body = dom.doc.body;\r
 \r
-Sizzle.isXML = function(elem){\r
-       // documentElement is verified for cases where it doesn't yet exist\r
-       // (such as loading iframes in IE - #4833) \r
-       var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;\r
-       return documentElement ? documentElement.nodeName !== "HTML" : false;\r
-};\r
+                       function resolveIndexes(indexes) {\r
+                               var node, i, idx, children;\r
 \r
-var posProcess = function(selector, context){\r
-       var tmpSet = [], later = "", match,\r
-               root = context.nodeType ? [context] : context;\r
+                               node = dom.getRoot();\r
+                               for (i = indexes.length - 1; i >= 0; i--) {\r
+                                       children = node.children;\r
+                                       idx = indexes[i];\r
 \r
-       // Position selectors must be done after the filter\r
-       // And so must :not(positional) so we move all PSEUDOs to the end\r
-       while ( (match = Expr.match.PSEUDO.exec( selector )) ) {\r
-               later += match[0];\r
-               selector = selector.replace( Expr.match.PSEUDO, "" );\r
-       }\r
+                                       if (idx <= children.length - 1) {\r
+                                               node = children[idx];\r
+                                       }\r
+                               }\r
 \r
-       selector = Expr.relative[selector] ? selector + "*" : selector;\r
+                               return node;\r
+                       };\r
+                       \r
+                       function setBookmarkEndPoint(start) {\r
+                               var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef;\r
 \r
-       for ( var i = 0, l = root.length; i < l; i++ ) {\r
-               Sizzle( selector, root[i], tmpSet );\r
-       }\r
+                               if (endPoint) {\r
+                                       moveLeft = endPoint.position > 0;\r
 \r
-       return Sizzle.filter( later, tmpSet );\r
-};\r
+                                       moveRng = body.createTextRange();\r
+                                       moveRng.moveToElementText(resolveIndexes(endPoint.indexes));\r
 \r
-// EXPOSE\r
+                                       offset = endPoint.offset;\r
+                                       if (offset !== undef) {\r
+                                               moveRng.collapse(endPoint.inside || moveLeft);\r
+                                               moveRng.moveStart('character', moveLeft ? -offset : offset);\r
+                                       } else\r
+                                               moveRng.collapse(start);\r
 \r
-window.tinymce.dom.Sizzle = Sizzle;\r
+                                       rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng);\r
 \r
-})();\r
+                                       if (start)\r
+                                               rng.collapse(true);\r
+                               }\r
+                       };\r
 \r
+                       if (bookmark.start) {\r
+                               if (bookmark.start.ctrl) {\r
+                                       rng = body.createControlRange();\r
+                                       rng.addElement(resolveIndexes(bookmark.start.indexes));\r
+                                       rng.select();\r
+                               } else {\r
+                                       rng = body.createTextRange();\r
+                                       setBookmarkEndPoint(true);\r
+                                       setBookmarkEndPoint();\r
+                                       rng.select();\r
+                               }\r
+                       }\r
+               };\r
 \r
-(function(tinymce) {\r
-       // Shorten names\r
-       var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;\r
+               this.addRange = function(rng) {\r
+                       var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, doc = selection.dom.doc, body = doc.body;\r
 \r
-       tinymce.create('tinymce.dom.EventUtils', {\r
-               EventUtils : function() {\r
-                       this.inits = [];\r
-                       this.events = [];\r
-               },\r
+                       function setEndPoint(start) {\r
+                               var container, offset, marker, tmpRng, nodes;\r
 \r
-               add : function(o, n, f, s) {\r
-                       var cb, t = this, el = t.events, r;\r
+                               marker = dom.create('a');\r
+                               container = start ? startContainer : endContainer;\r
+                               offset = start ? startOffset : endOffset;\r
+                               tmpRng = ieRng.duplicate();\r
 \r
-                       if (n instanceof Array) {\r
-                               r = [];\r
+                               if (container == doc || container == doc.documentElement) {\r
+                                       container = body;\r
+                                       offset = 0;\r
+                               }\r
 \r
-                               each(n, function(n) {\r
-                                       r.push(t.add(o, n, f, s));\r
-                               });\r
+                               if (container.nodeType == 3) {\r
+                                       container.parentNode.insertBefore(marker, container);\r
+                                       tmpRng.moveToElementText(marker);\r
+                                       tmpRng.moveStart('character', offset);\r
+                                       dom.remove(marker);\r
+                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
+                               } else {\r
+                                       nodes = container.childNodes;\r
 \r
-                               return r;\r
+                                       if (nodes.length) {\r
+                                               if (offset >= nodes.length) {\r
+                                                       dom.insertAfter(marker, nodes[nodes.length - 1]);\r
+                                               } else {\r
+                                                       container.insertBefore(marker, nodes[offset]);\r
+                                               }\r
+\r
+                                               tmpRng.moveToElementText(marker);\r
+                                       } else if (container.canHaveHTML) {\r
+                                               // Empty node selection for example <div>|</div>\r
+                                               // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open\r
+                                               container.innerHTML = '<span>\uFEFF</span>';\r
+                                               marker = container.firstChild;\r
+                                               tmpRng.moveToElementText(marker);\r
+                                               tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason\r
+                                       }\r
+\r
+                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
+                                       dom.remove(marker);\r
+                               }\r
                        }\r
 \r
-                       // Handle array\r
-                       if (o && o.hasOwnProperty && o instanceof Array) {\r
-                               r = [];\r
+                       // Setup some shorter versions\r
+                       startContainer = rng.startContainer;\r
+                       startOffset = rng.startOffset;\r
+                       endContainer = rng.endContainer;\r
+                       endOffset = rng.endOffset;\r
+                       ieRng = body.createTextRange();\r
 \r
-                               each(o, function(o) {\r
-                                       o = DOM.get(o);\r
-                                       r.push(t.add(o, n, f, s));\r
-                               });\r
+                       // If single element selection then try making a control selection out of it\r
+                       if (startContainer == endContainer && startContainer.nodeType == 1) {\r
+                               // Trick to place the caret inside an empty block element like <p></p>\r
+                               if (!startContainer.hasChildNodes()) {\r
+                                       startContainer.innerHTML = '<span>\uFEFF</span><span>\uFEFF</span>';\r
+                                       ieRng.moveToElementText(startContainer.lastChild);\r
+                                       ieRng.select();\r
+                                       dom.doc.selection.clear();\r
+                                       startContainer.innerHTML = '';\r
+                                       return;\r
+                               }\r
 \r
-                               return r;\r
+                               if (startOffset == endOffset - 1) {\r
+                                       try {\r
+                                               ctrlRng = body.createControlRange();\r
+                                               ctrlRng.addElement(startContainer.childNodes[startOffset]);\r
+                                               ctrlRng.select();\r
+                                               return;\r
+                                       } catch (ex) {\r
+                                               // Ignore\r
+                                       }\r
+                               }\r
                        }\r
 \r
-                       o = DOM.get(o);\r
+                       // Set start/end point of selection\r
+                       setEndPoint(true);\r
+                       setEndPoint();\r
 \r
-                       if (!o)\r
-                               return;\r
+                       // Select the new range and scroll it into view\r
+                       ieRng.select();\r
+               };\r
 \r
-                       // Setup event callback\r
-                       cb = function(e) {\r
-                               // Is all events disabled\r
-                               if (t.disabled)\r
-                                       return;\r
+               // Expose range method\r
+               this.getRangeAt = getRange;\r
+       };\r
 \r
-                               e = e || window.event;\r
+       // Expose the selection object\r
+       tinymce.dom.TridentSelection = Selection;\r
+})();\r
 \r
-                               // Patch in target, preventDefault and stopPropagation in IE it's W3C valid\r
-                               if (e && isIE) {\r
-                                       if (!e.target)\r
-                                               e.target = e.srcElement;\r
 \r
-                                       // Patch in preventDefault, stopPropagation methods for W3C compatibility\r
-                                       tinymce.extend(e, t._stoppers);\r
-                               }\r
+/*\r
+ * Sizzle CSS Selector Engine - v1.0\r
+ *  Copyright 2009, The Dojo Foundation\r
+ *  Released under the MIT, BSD, and GPL Licenses.\r
+ *  More information: http://sizzlejs.com/\r
+ */\r
+(function(){\r
 \r
-                               if (!s)\r
-                                       return f(e);\r
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,\r
+       done = 0,\r
+       toString = Object.prototype.toString,\r
+       hasDuplicate = false,\r
+       baseHasDuplicate = true;\r
 \r
-                               return f.call(s, e);\r
-                       };\r
+// Here we check if the JavaScript engine is using some sort of\r
+// optimization where it does not always call our comparision\r
+// function. If that is the case, discard the hasDuplicate value.\r
+//   Thus far that includes Google Chrome.\r
+[0, 0].sort(function(){\r
+       baseHasDuplicate = false;\r
+       return 0;\r
+});\r
 \r
-                       if (n == 'unload') {\r
-                               tinymce.unloads.unshift({func : cb});\r
-                               return cb;\r
-                       }\r
+var Sizzle = function(selector, context, results, seed) {\r
+       results = results || [];\r
+       context = context || document;\r
 \r
-                       if (n == 'init') {\r
-                               if (t.domLoaded)\r
-                                       cb();\r
-                               else\r
-                                       t.inits.push(cb);\r
+       var origContext = context;\r
 \r
-                               return cb;\r
-                       }\r
+       if ( context.nodeType !== 1 && context.nodeType !== 9 ) {\r
+               return [];\r
+       }\r
+       \r
+       if ( !selector || typeof selector !== "string" ) {\r
+               return results;\r
+       }\r
 \r
-                       // Store away listener reference\r
-                       el.push({\r
-                               obj : o,\r
-                               name : n,\r
-                               func : f,\r
-                               cfunc : cb,\r
-                               scope : s\r
-                       });\r
+       var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),\r
+               soFar = selector, ret, cur, pop, i;\r
+       \r
+       // Reset the position of the chunker regexp (start from head)\r
+       do {\r
+               chunker.exec("");\r
+               m = chunker.exec(soFar);\r
 \r
-                       t._add(o, n, cb);\r
+               if ( m ) {\r
+                       soFar = m[3];\r
+               \r
+                       parts.push( m[1] );\r
+               \r
+                       if ( m[2] ) {\r
+                               extra = m[3];\r
+                               break;\r
+                       }\r
+               }\r
+       } while ( m );\r
 \r
-                       return f;\r
-               },\r
+       if ( parts.length > 1 && origPOS.exec( selector ) ) {\r
+               if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {\r
+                       set = posProcess( parts[0] + parts[1], context );\r
+               } else {\r
+                       set = Expr.relative[ parts[0] ] ?\r
+                               [ context ] :\r
+                               Sizzle( parts.shift(), context );\r
 \r
-               remove : function(o, n, f) {\r
-                       var t = this, a = t.events, s = false, r;\r
+                       while ( parts.length ) {\r
+                               selector = parts.shift();\r
 \r
-                       // Handle array\r
-                       if (o && o.hasOwnProperty && o instanceof Array) {\r
-                               r = [];\r
+                               if ( Expr.relative[ selector ] ) {\r
+                                       selector += parts.shift();\r
+                               }\r
+                               \r
+                               set = posProcess( selector, set );\r
+                       }\r
+               }\r
+       } else {\r
+               // Take a shortcut and set the context if the root selector is an ID\r
+               // (but not if it'll be faster if the inner selector is an ID)\r
+               if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&\r
+                               Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {\r
+                       ret = Sizzle.find( parts.shift(), context, contextXML );\r
+                       context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];\r
+               }\r
 \r
-                               each(o, function(o) {\r
-                                       o = DOM.get(o);\r
-                                       r.push(t.remove(o, n, f));\r
-                               });\r
+               if ( context ) {\r
+                       ret = seed ?\r
+                               { expr: parts.pop(), set: makeArray(seed) } :\r
+                               Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );\r
+                       set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;\r
 \r
-                               return r;\r
+                       if ( parts.length > 0 ) {\r
+                               checkSet = makeArray(set);\r
+                       } else {\r
+                               prune = false;\r
                        }\r
 \r
-                       o = DOM.get(o);\r
+                       while ( parts.length ) {\r
+                               cur = parts.pop();\r
+                               pop = cur;\r
 \r
-                       each(a, function(e, i) {\r
-                               if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) {\r
-                                       a.splice(i, 1);\r
-                                       t._remove(o, n, e.cfunc);\r
-                                       s = true;\r
-                                       return false;\r
+                               if ( !Expr.relative[ cur ] ) {\r
+                                       cur = "";\r
+                               } else {\r
+                                       pop = parts.pop();\r
                                }\r
-                       });\r
 \r
-                       return s;\r
-               },\r
+                               if ( pop == null ) {\r
+                                       pop = context;\r
+                               }\r
 \r
-               clear : function(o) {\r
-                       var t = this, a = t.events, i, e;\r
+                               Expr.relative[ cur ]( checkSet, pop, contextXML );\r
+                       }\r
+               } else {\r
+                       checkSet = parts = [];\r
+               }\r
+       }\r
 \r
-                       if (o) {\r
-                               o = DOM.get(o);\r
+       if ( !checkSet ) {\r
+               checkSet = set;\r
+       }\r
 \r
-                               for (i = a.length - 1; i >= 0; i--) {\r
-                                       e = a[i];\r
+       if ( !checkSet ) {\r
+               Sizzle.error( cur || selector );\r
+       }\r
 \r
-                                       if (e.obj === o) {\r
-                                               t._remove(e.obj, e.name, e.cfunc);\r
-                                               e.obj = e.cfunc = null;\r
-                                               a.splice(i, 1);\r
-                                       }\r
+       if ( toString.call(checkSet) === "[object Array]" ) {\r
+               if ( !prune ) {\r
+                       results.push.apply( results, checkSet );\r
+               } else if ( context && context.nodeType === 1 ) {\r
+                       for ( i = 0; checkSet[i] != null; i++ ) {\r
+                               if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {\r
+                                       results.push( set[i] );\r
                                }\r
                        }\r
-               },\r
-\r
-               cancel : function(e) {\r
-                       if (!e)\r
-                               return false;\r
-\r
-                       this.stop(e);\r
-\r
-                       return this.prevent(e);\r
-               },\r
-\r
-               stop : function(e) {\r
-                       if (e.stopPropagation)\r
-                               e.stopPropagation();\r
-                       else\r
-                               e.cancelBubble = true;\r
-\r
-                       return false;\r
-               },\r
-\r
-               prevent : function(e) {\r
-                       if (e.preventDefault)\r
-                               e.preventDefault();\r
-                       else\r
-                               e.returnValue = false;\r
-\r
-                       return false;\r
-               },\r
-\r
-               destroy : function() {\r
-                       var t = this;\r
-\r
-                       each(t.events, function(e, i) {\r
-                               t._remove(e.obj, e.name, e.cfunc);\r
-                               e.obj = e.cfunc = null;\r
-                       });\r
-\r
-                       t.events = [];\r
-                       t = null;\r
-               },\r
-\r
-               _add : function(o, n, f) {\r
-                       if (o.attachEvent)\r
-                               o.attachEvent('on' + n, f);\r
-                       else if (o.addEventListener)\r
-                               o.addEventListener(n, f, false);\r
-                       else\r
-                               o['on' + n] = f;\r
-               },\r
-\r
-               _remove : function(o, n, f) {\r
-                       if (o) {\r
-                               try {\r
-                                       if (o.detachEvent)\r
-                                               o.detachEvent('on' + n, f);\r
-                                       else if (o.removeEventListener)\r
-                                               o.removeEventListener(n, f, false);\r
-                                       else\r
-                                               o['on' + n] = null;\r
-                               } catch (ex) {\r
-                                       // Might fail with permission denined on IE so we just ignore that\r
+               } else {\r
+                       for ( i = 0; checkSet[i] != null; i++ ) {\r
+                               if ( checkSet[i] && checkSet[i].nodeType === 1 ) {\r
+                                       results.push( set[i] );\r
                                }\r
                        }\r
-               },\r
-\r
-               _pageInit : function(win) {\r
-                       var t = this;\r
-\r
-                       // Keep it from running more than once\r
-                       if (t.domLoaded)\r
-                               return;\r
-\r
-                       t.domLoaded = true;\r
+               }\r
+       } else {\r
+               makeArray( checkSet, results );\r
+       }\r
 \r
-                       each(t.inits, function(c) {\r
-                               c();\r
-                       });\r
+       if ( extra ) {\r
+               Sizzle( extra, origContext, results, seed );\r
+               Sizzle.uniqueSort( results );\r
+       }\r
 \r
-                       t.inits = [];\r
-               },\r
+       return results;\r
+};\r
 \r
-               _wait : function(win) {\r
-                       var t = this, doc = win.document;\r
+Sizzle.uniqueSort = function(results){\r
+       if ( sortOrder ) {\r
+               hasDuplicate = baseHasDuplicate;\r
+               results.sort(sortOrder);\r
 \r
-                       // No need since the document is already loaded\r
-                       if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {\r
-                               t.domLoaded = 1;\r
-                               return;\r
+               if ( hasDuplicate ) {\r
+                       for ( var i = 1; i < results.length; i++ ) {\r
+                               if ( results[i] === results[i-1] ) {\r
+                                       results.splice(i--, 1);\r
+                               }\r
                        }\r
+               }\r
+       }\r
 \r
-                       // Use IE method\r
-                       if (doc.attachEvent) {\r
-                               doc.attachEvent("onreadystatechange", function() {\r
-                                       if (doc.readyState === "complete") {\r
-                                               doc.detachEvent("onreadystatechange", arguments.callee);\r
-                                               t._pageInit(win);\r
-                                       }\r
-                               });\r
-\r
-                               if (doc.documentElement.doScroll && win == win.top) {\r
-                                       (function() {\r
-                                               if (t.domLoaded)\r
-                                                       return;\r
+       return results;\r
+};\r
 \r
-                                               try {\r
-                                                       // If IE is used, use the trick by Diego Perini\r
-                                                       // http://javascript.nwbox.com/IEContentLoaded/\r
-                                                       doc.documentElement.doScroll("left");\r
-                                               } catch (ex) {\r
-                                                       setTimeout(arguments.callee, 0);\r
-                                                       return;\r
-                                               }\r
+Sizzle.matches = function(expr, set){\r
+       return Sizzle(expr, null, null, set);\r
+};\r
 \r
-                                               t._pageInit(win);\r
-                                       })();\r
-                               }\r
-                       } else if (doc.addEventListener) {\r
-                               t._add(win, 'DOMContentLoaded', function() {\r
-                                       t._pageInit(win);\r
-                               });\r
-                       }\r
+Sizzle.find = function(expr, context, isXML){\r
+       var set;\r
 \r
-                       t._add(win, 'load', function() {\r
-                               t._pageInit(win);\r
-                       });\r
-               },\r
+       if ( !expr ) {\r
+               return [];\r
+       }\r
 \r
-               _stoppers : {\r
-                       preventDefault :  function() {\r
-                               this.returnValue = false;\r
-                       },\r
+       for ( var i = 0, l = Expr.order.length; i < l; i++ ) {\r
+               var type = Expr.order[i], match;\r
+               \r
+               if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {\r
+                       var left = match[1];\r
+                       match.splice(1,1);\r
 \r
-                       stopPropagation : function() {\r
-                               this.cancelBubble = true;\r
+                       if ( left.substr( left.length - 1 ) !== "\\" ) {\r
+                               match[1] = (match[1] || "").replace(/\\/g, "");\r
+                               set = Expr.find[ type ]( match, context, isXML );\r
+                               if ( set != null ) {\r
+                                       expr = expr.replace( Expr.match[ type ], "" );\r
+                                       break;\r
+                               }\r
                        }\r
                }\r
-       });\r
-\r
-       Event = tinymce.dom.Event = new tinymce.dom.EventUtils();\r
-\r
-       // Dispatch DOM content loaded event for IE and Safari\r
-       Event._wait(window);\r
-\r
-       tinymce.addUnload(function() {\r
-               Event.destroy();\r
-       });\r
-})(tinymce);\r
+       }\r
 \r
-(function(tinymce) {\r
-       tinymce.dom.Element = function(id, settings) {\r
-               var t = this, dom, el;\r
+       if ( !set ) {\r
+               set = context.getElementsByTagName("*");\r
+       }\r
 \r
-               t.settings = settings = settings || {};\r
-               t.id = id;\r
-               t.dom = dom = settings.dom || tinymce.DOM;\r
+       return {set: set, expr: expr};\r
+};\r
 \r
-               // Only IE leaks DOM references, this is a lot faster\r
-               if (!tinymce.isIE)\r
-                       el = dom.get(t.id);\r
+Sizzle.filter = function(expr, set, inplace, not){\r
+       var old = expr, result = [], curLoop = set, match, anyFound,\r
+               isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);\r
 \r
-               tinymce.each(\r
-                               ('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' + \r
-                               'setAttrib,setAttribs,getAttrib,addClass,removeClass,' + \r
-                               'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' + \r
-                               'isHidden,setHTML,get').split(/,/)\r
-                       , function(k) {\r
-                               t[k] = function() {\r
-                                       var a = [id], i;\r
+       while ( expr && set.length ) {\r
+               for ( var type in Expr.filter ) {\r
+                       if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {\r
+                               var filter = Expr.filter[ type ], found, item, left = match[1];\r
+                               anyFound = false;\r
 \r
-                                       for (i = 0; i < arguments.length; i++)\r
-                                               a.push(arguments[i]);\r
+                               match.splice(1,1);\r
 \r
-                                       a = dom[k].apply(dom, a);\r
-                                       t.update(k);\r
+                               if ( left.substr( left.length - 1 ) === "\\" ) {\r
+                                       continue;\r
+                               }\r
 \r
-                                       return a;\r
-                               };\r
-               });\r
+                               if ( curLoop === result ) {\r
+                                       result = [];\r
+                               }\r
 \r
-               tinymce.extend(t, {\r
-                       on : function(n, f, s) {\r
-                               return tinymce.dom.Event.add(t.id, n, f, s);\r
-                       },\r
+                               if ( Expr.preFilter[ type ] ) {\r
+                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\r
 \r
-                       getXY : function() {\r
-                               return {\r
-                                       x : parseInt(t.getStyle('left')),\r
-                                       y : parseInt(t.getStyle('top'))\r
-                               };\r
-                       },\r
+                                       if ( !match ) {\r
+                                               anyFound = found = true;\r
+                                       } else if ( match === true ) {\r
+                                               continue;\r
+                                       }\r
+                               }\r
 \r
-                       getSize : function() {\r
-                               var n = dom.get(t.id);\r
+                               if ( match ) {\r
+                                       for ( var i = 0; (item = curLoop[i]) != null; i++ ) {\r
+                                               if ( item ) {\r
+                                                       found = filter( item, match, i, curLoop );\r
+                                                       var pass = not ^ !!found;\r
 \r
-                               return {\r
-                                       w : parseInt(t.getStyle('width') || n.clientWidth),\r
-                                       h : parseInt(t.getStyle('height') || n.clientHeight)\r
-                               };\r
-                       },\r
+                                                       if ( inplace && found != null ) {\r
+                                                               if ( pass ) {\r
+                                                                       anyFound = true;\r
+                                                               } else {\r
+                                                                       curLoop[i] = false;\r
+                                                               }\r
+                                                       } else if ( pass ) {\r
+                                                               result.push( item );\r
+                                                               anyFound = true;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
 \r
-                       moveTo : function(x, y) {\r
-                               t.setStyles({left : x, top : y});\r
-                       },\r
+                               if ( found !== undefined ) {\r
+                                       if ( !inplace ) {\r
+                                               curLoop = result;\r
+                                       }\r
 \r
-                       moveBy : function(x, y) {\r
-                               var p = t.getXY();\r
+                                       expr = expr.replace( Expr.match[ type ], "" );\r
 \r
-                               t.moveTo(p.x + x, p.y + y);\r
-                       },\r
+                                       if ( !anyFound ) {\r
+                                               return [];\r
+                                       }\r
 \r
-                       resizeTo : function(w, h) {\r
-                               t.setStyles({width : w, height : h});\r
-                       },\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
 \r
-                       resizeBy : function(w, h) {\r
-                               var s = t.getSize();\r
+               // Improper expression\r
+               if ( expr === old ) {\r
+                       if ( anyFound == null ) {\r
+                               Sizzle.error( expr );\r
+                       } else {\r
+                               break;\r
+                       }\r
+               }\r
 \r
-                               t.resizeTo(s.w + w, s.h + h);\r
-                       },\r
+               old = expr;\r
+       }\r
 \r
-                       update : function(k) {\r
-                               var b;\r
+       return curLoop;\r
+};\r
 \r
-                               if (tinymce.isIE6 && settings.blocker) {\r
-                                       k = k || '';\r
+Sizzle.error = function( msg ) {\r
+       throw "Syntax error, unrecognized expression: " + msg;\r
+};\r
 \r
-                                       // Ignore getters\r
-                                       if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)\r
-                                               return;\r
+var Expr = Sizzle.selectors = {\r
+       order: [ "ID", "NAME", "TAG" ],\r
+       match: {\r
+               ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+               CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+               NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,\r
+               ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,\r
+               TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,\r
+               CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,\r
+               POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,\r
+               PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/\r
+       },\r
+       leftMatch: {},\r
+       attrMap: {\r
+               "class": "className",\r
+               "for": "htmlFor"\r
+       },\r
+       attrHandle: {\r
+               href: function(elem){\r
+                       return elem.getAttribute("href");\r
+               }\r
+       },\r
+       relative: {\r
+               "+": function(checkSet, part){\r
+                       var isPartStr = typeof part === "string",\r
+                               isTag = isPartStr && !/\W/.test(part),\r
+                               isPartStrNotTag = isPartStr && !isTag;\r
 \r
-                                       // Remove blocker on remove\r
-                                       if (k == 'remove') {\r
-                                               dom.remove(t.blocker);\r
-                                               return;\r
-                                       }\r
+                       if ( isTag ) {\r
+                               part = part.toLowerCase();\r
+                       }\r
 \r
-                                       if (!t.blocker) {\r
-                                               t.blocker = dom.uniqueId();\r
-                                               b = dom.add(settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});\r
-                                               dom.setStyle(b, 'opacity', 0);\r
-                                       } else\r
-                                               b = dom.get(t.blocker);\r
+                       for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {\r
+                               if ( (elem = checkSet[i]) ) {\r
+                                       while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}\r
 \r
-                                       dom.setStyles(b, {\r
-                                               left : t.getStyle('left', 1),\r
-                                               top : t.getStyle('top', 1),\r
-                                               width : t.getStyle('width', 1),\r
-                                               height : t.getStyle('height', 1),\r
-                                               display : t.getStyle('display', 1),\r
-                                               zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1\r
-                                       });\r
+                                       checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\r
+                                               elem || false :\r
+                                               elem === part;\r
                                }\r
                        }\r
-               });\r
-       };\r
-})(tinymce);\r
-\r
-(function(tinymce) {\r
-       function trimNl(s) {\r
-               return s.replace(/[\n\r]+/g, '');\r
-       };\r
 \r
-       // Shorten names\r
-       var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;\r
-\r
-       tinymce.create('tinymce.dom.Selection', {\r
-               Selection : function(dom, win, serializer) {\r
-                       var t = this;\r
-\r
-                       t.dom = dom;\r
-                       t.win = win;\r
-                       t.serializer = serializer;\r
+                       if ( isPartStrNotTag ) {\r
+                               Sizzle.filter( part, checkSet, true );\r
+                       }\r
+               },\r
+               ">": function(checkSet, part){\r
+                       var isPartStr = typeof part === "string",\r
+                               elem, i = 0, l = checkSet.length;\r
 \r
-                       // Add events\r
-                       each([\r
-                               'onBeforeSetContent',\r
-                               'onBeforeGetContent',\r
-                               'onSetContent',\r
-                               'onGetContent'\r
-                       ], function(e) {\r
-                               t[e] = new tinymce.util.Dispatcher(t);\r
-                       });\r
+                       if ( isPartStr && !/\W/.test(part) ) {\r
+                               part = part.toLowerCase();\r
 \r
-                       // No W3C Range support\r
-                       if (!t.win.getSelection)\r
-                               t.tridentSel = new tinymce.dom.TridentSelection(t);\r
+                               for ( ; i < l; i++ ) {\r
+                                       elem = checkSet[i];\r
+                                       if ( elem ) {\r
+                                               var parent = elem.parentNode;\r
+                                               checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               for ( ; i < l; i++ ) {\r
+                                       elem = checkSet[i];\r
+                                       if ( elem ) {\r
+                                               checkSet[i] = isPartStr ?\r
+                                                       elem.parentNode :\r
+                                                       elem.parentNode === part;\r
+                                       }\r
+                               }\r
 \r
-                       // Prevent leaks\r
-                       tinymce.addUnload(t.destroy, t);\r
+                               if ( isPartStr ) {\r
+                                       Sizzle.filter( part, checkSet, true );\r
+                               }\r
+                       }\r
                },\r
+               "": function(checkSet, part, isXML){\r
+                       var doneName = done++, checkFn = dirCheck, nodeCheck;\r
 \r
-               getContent : function(s) {\r
-                       var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;\r
-\r
-                       s = s || {};\r
-                       wb = wa = '';\r
-                       s.get = true;\r
-                       s.format = s.format || 'html';\r
-                       t.onBeforeGetContent.dispatch(t, s);\r
+                       if ( typeof part === "string" && !/\W/.test(part) ) {\r
+                               part = part.toLowerCase();\r
+                               nodeCheck = part;\r
+                               checkFn = dirNodeCheck;\r
+                       }\r
 \r
-                       if (s.format == 'text')\r
-                               return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));\r
+                       checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);\r
+               },\r
+               "~": function(checkSet, part, isXML){\r
+                       var doneName = done++, checkFn = dirCheck, nodeCheck;\r
 \r
-                       if (r.cloneContents) {\r
-                               n = r.cloneContents();\r
+                       if ( typeof part === "string" && !/\W/.test(part) ) {\r
+                               part = part.toLowerCase();\r
+                               nodeCheck = part;\r
+                               checkFn = dirNodeCheck;\r
+                       }\r
 \r
-                               if (n)\r
-                                       e.appendChild(n);\r
-                       } else if (is(r.item) || is(r.htmlText))\r
-                               e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;\r
-                       else\r
-                               e.innerHTML = r.toString();\r
+                       checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);\r
+               }\r
+       },\r
+       find: {\r
+               ID: function(match, context, isXML){\r
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+                               var m = context.getElementById(match[1]);\r
+                               return m ? [m] : [];\r
+                       }\r
+               },\r
+               NAME: function(match, context){\r
+                       if ( typeof context.getElementsByName !== "undefined" ) {\r
+                               var ret = [], results = context.getElementsByName(match[1]);\r
 \r
-                       // Keep whitespace before and after\r
-                       if (/^\s/.test(e.innerHTML))\r
-                               wb = ' ';\r
+                               for ( var i = 0, l = results.length; i < l; i++ ) {\r
+                                       if ( results[i].getAttribute("name") === match[1] ) {\r
+                                               ret.push( results[i] );\r
+                                       }\r
+                               }\r
 \r
-                       if (/\s+$/.test(e.innerHTML))\r
-                               wa = ' ';\r
+                               return ret.length === 0 ? null : ret;\r
+                       }\r
+               },\r
+               TAG: function(match, context){\r
+                       return context.getElementsByTagName(match[1]);\r
+               }\r
+       },\r
+       preFilter: {\r
+               CLASS: function(match, curLoop, inplace, result, not, isXML){\r
+                       match = " " + match[1].replace(/\\/g, "") + " ";\r
 \r
-                       s.getInner = true;\r
+                       if ( isXML ) {\r
+                               return match;\r
+                       }\r
 \r
-                       s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;\r
-                       t.onGetContent.dispatch(t, s);\r
+                       for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {\r
+                               if ( elem ) {\r
+                                       if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {\r
+                                               if ( !inplace ) {\r
+                                                       result.push( elem );\r
+                                               }\r
+                                       } else if ( inplace ) {\r
+                                               curLoop[i] = false;\r
+                                       }\r
+                               }\r
+                       }\r
 \r
-                       return s.content;\r
+                       return false;\r
+               },\r
+               ID: function(match){\r
+                       return match[1].replace(/\\/g, "");\r
                },\r
+               TAG: function(match, curLoop){\r
+                       return match[1].toLowerCase();\r
+               },\r
+               CHILD: function(match){\r
+                       if ( match[1] === "nth" ) {\r
+                               // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'\r
+                               var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(\r
+                                       match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||\r
+                                       !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);\r
 \r
-               setContent : function(h, s) {\r
-                       var t = this, r = t.getRng(), c, d = t.win.document;\r
+                               // calculate the numbers (first)n+(last) including if they are negative\r
+                               match[2] = (test[1] + (test[2] || 1)) - 0;\r
+                               match[3] = test[3] - 0;\r
+                       }\r
 \r
-                       s = s || {format : 'html'};\r
-                       s.set = true;\r
-                       h = s.content = t.dom.processHTML(h);\r
+                       // TODO: Move to normal caching system\r
+                       match[0] = done++;\r
 \r
-                       // Dispatch before set content event\r
-                       t.onBeforeSetContent.dispatch(t, s);\r
-                       h = s.content;\r
+                       return match;\r
+               },\r
+               ATTR: function(match, curLoop, inplace, result, not, isXML){\r
+                       var name = match[1].replace(/\\/g, "");\r
+                       \r
+                       if ( !isXML && Expr.attrMap[name] ) {\r
+                               match[1] = Expr.attrMap[name];\r
+                       }\r
 \r
-                       if (r.insertNode) {\r
-                               // Make caret marker since insertNode places the caret in the beginning of text after insert\r
-                               h += '<span id="__caret">_</span>';\r
+                       if ( match[2] === "~=" ) {\r
+                               match[4] = " " + match[4] + " ";\r
+                       }\r
 \r
-                               // Delete and insert new node\r
-                               \r
-                               if (r.startContainer == d && r.endContainer ==  d) {\r
-                                       // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents\r
-                                       d.body.innerHTML = h;\r
+                       return match;\r
+               },\r
+               PSEUDO: function(match, curLoop, inplace, result, not){\r
+                       if ( match[1] === "not" ) {\r
+                               // If we're dealing with a complex expression, or a simple one\r
+                               if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {\r
+                                       match[3] = Sizzle(match[3], null, null, curLoop);\r
                                } else {\r
-                                       r.deleteContents();\r
-                                       if (d.body.childNodes.length == 0) {\r
-                                               d.body.innerHTML = h;\r
-                                       } else {\r
-                                               r.insertNode(r.createContextualFragment(h));\r
+                                       var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);\r
+                                       if ( !inplace ) {\r
+                                               result.push.apply( result, ret );\r
                                        }\r
+                                       return false;\r
                                }\r
-\r
-                               // Move to caret marker\r
-                               c = t.dom.get('__caret');\r
-                               // Make sure we wrap it compleatly, Opera fails with a simple select call\r
-                               r = d.createRange();\r
-                               r.setStartBefore(c);\r
-                               r.setEndBefore(c);\r
-                               t.setRng(r);\r
-\r
-                               // Remove the caret position\r
-                               t.dom.remove('__caret');\r
-                       } else {\r
-                               if (r.item) {\r
-                                       // Delete content and get caret text selection\r
-                                       d.execCommand('Delete', false, null);\r
-                                       r = t.getRng();\r
-                               }\r
-\r
-                               r.pasteHTML(h);\r
+                       } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {\r
+                               return true;\r
                        }\r
-\r
-                       // Dispatch set content event\r
-                       t.onSetContent.dispatch(t, s);\r
+                       \r
+                       return match;\r
                },\r
+               POS: function(match){\r
+                       match.unshift( true );\r
+                       return match;\r
+               }\r
+       },\r
+       filters: {\r
+               enabled: function(elem){\r
+                       return elem.disabled === false && elem.type !== "hidden";\r
+               },\r
+               disabled: function(elem){\r
+                       return elem.disabled === true;\r
+               },\r
+               checked: function(elem){\r
+                       return elem.checked === true;\r
+               },\r
+               selected: function(elem){\r
+                       // Accessing this property makes selected-by-default\r
+                       // options in Safari work properly\r
+                       elem.parentNode.selectedIndex;\r
+                       return elem.selected === true;\r
+               },\r
+               parent: function(elem){\r
+                       return !!elem.firstChild;\r
+               },\r
+               empty: function(elem){\r
+                       return !elem.firstChild;\r
+               },\r
+               has: function(elem, i, match){\r
+                       return !!Sizzle( match[3], elem ).length;\r
+               },\r
+               header: function(elem){\r
+                       return (/h\d/i).test( elem.nodeName );\r
+               },\r
+               text: function(elem){\r
+                       return "text" === elem.type;\r
+               },\r
+               radio: function(elem){\r
+                       return "radio" === elem.type;\r
+               },\r
+               checkbox: function(elem){\r
+                       return "checkbox" === elem.type;\r
+               },\r
+               file: function(elem){\r
+                       return "file" === elem.type;\r
+               },\r
+               password: function(elem){\r
+                       return "password" === elem.type;\r
+               },\r
+               submit: function(elem){\r
+                       return "submit" === elem.type;\r
+               },\r
+               image: function(elem){\r
+                       return "image" === elem.type;\r
+               },\r
+               reset: function(elem){\r
+                       return "reset" === elem.type;\r
+               },\r
+               button: function(elem){\r
+                       return "button" === elem.type || elem.nodeName.toLowerCase() === "button";\r
+               },\r
+               input: function(elem){\r
+                       return (/input|select|textarea|button/i).test(elem.nodeName);\r
+               }\r
+       },\r
+       setFilters: {\r
+               first: function(elem, i){\r
+                       return i === 0;\r
+               },\r
+               last: function(elem, i, match, array){\r
+                       return i === array.length - 1;\r
+               },\r
+               even: function(elem, i){\r
+                       return i % 2 === 0;\r
+               },\r
+               odd: function(elem, i){\r
+                       return i % 2 === 1;\r
+               },\r
+               lt: function(elem, i, match){\r
+                       return i < match[3] - 0;\r
+               },\r
+               gt: function(elem, i, match){\r
+                       return i > match[3] - 0;\r
+               },\r
+               nth: function(elem, i, match){\r
+                       return match[3] - 0 === i;\r
+               },\r
+               eq: function(elem, i, match){\r
+                       return match[3] - 0 === i;\r
+               }\r
+       },\r
+       filter: {\r
+               PSEUDO: function(elem, match, i, array){\r
+                       var name = match[1], filter = Expr.filters[ name ];\r
 \r
-               getStart : function() {\r
-                       var rng = this.getRng(), startElement, parentElement, checkRng, node;\r
-\r
-                       if (rng.duplicate || rng.item) {\r
-                               // Control selection, return first item\r
-                               if (rng.item)\r
-                                       return rng.item(0);\r
-\r
-                               // Get start element\r
-                               checkRng = rng.duplicate();\r
-                               checkRng.collapse(1);\r
-                               startElement = checkRng.parentElement();\r
+                       if ( filter ) {\r
+                               return filter( elem, i, match, array );\r
+                       } else if ( name === "contains" ) {\r
+                               return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;\r
+                       } else if ( name === "not" ) {\r
+                               var not = match[3];\r
 \r
-                               // Check if range parent is inside the start element, then return the inner parent element\r
-                               // This will fix issues when a single element is selected, IE would otherwise return the wrong start element\r
-                               parentElement = node = rng.parentElement();\r
-                               while (node = node.parentNode) {\r
-                                       if (node == startElement) {\r
-                                               startElement = parentElement;\r
-                                               break;\r
+                               for ( var j = 0, l = not.length; j < l; j++ ) {\r
+                                       if ( not[j] === elem ) {\r
+                                               return false;\r
                                        }\r
                                }\r
 \r
-                               // If start element is body element try to move to the first child if it exists\r
-                               if (startElement && startElement.nodeName == 'BODY')\r
-                                       return startElement.firstChild || startElement;\r
-\r
-                               return startElement;\r
+                               return true;\r
                        } else {\r
-                               startElement = rng.startContainer;\r
-\r
-                               if (startElement.nodeType == 1 && startElement.hasChildNodes())\r
-                                       startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];\r
-\r
-                               if (startElement && startElement.nodeType == 3)\r
-                                       return startElement.parentNode;\r
-\r
-                               return startElement;\r
+                               Sizzle.error( "Syntax error, unrecognized expression: " + name );\r
                        }\r
                },\r
+               CHILD: function(elem, match){\r
+                       var type = match[1], node = elem;\r
+                       switch (type) {\r
+                               case 'only':\r
+                               case 'first':\r
+                                       while ( (node = node.previousSibling) )  {\r
+                                               if ( node.nodeType === 1 ) { \r
+                                                       return false; \r
+                                               }\r
+                                       }\r
+                                       if ( type === "first" ) { \r
+                                               return true; \r
+                                       }\r
+                                       node = elem;\r
+                               case 'last':\r
+                                       while ( (node = node.nextSibling) )      {\r
+                                               if ( node.nodeType === 1 ) { \r
+                                                       return false; \r
+                                               }\r
+                                       }\r
+                                       return true;\r
+                               case 'nth':\r
+                                       var first = match[2], last = match[3];\r
 \r
-               getEnd : function() {\r
-                       var t = this, r = t.getRng(), e, eo;\r
-\r
-                       if (r.duplicate || r.item) {\r
-                               if (r.item)\r
-                                       return r.item(0);\r
-\r
-                               r = r.duplicate();\r
-                               r.collapse(0);\r
-                               e = r.parentElement();\r
-\r
-                               if (e && e.nodeName == 'BODY')\r
-                                       return e.lastChild || e;\r
-\r
-                               return e;\r
-                       } else {\r
-                               e = r.endContainer;\r
-                               eo = r.endOffset;\r
-\r
-                               if (e.nodeType == 1 && e.hasChildNodes())\r
-                                       e = e.childNodes[eo > 0 ? eo - 1 : eo];\r
-\r
-                               if (e && e.nodeType == 3)\r
-                                       return e.parentNode;\r
-\r
-                               return e;\r
+                                       if ( first === 1 && last === 0 ) {\r
+                                               return true;\r
+                                       }\r
+                                       \r
+                                       var doneName = match[0],\r
+                                               parent = elem.parentNode;\r
+       \r
+                                       if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {\r
+                                               var count = 0;\r
+                                               for ( node = parent.firstChild; node; node = node.nextSibling ) {\r
+                                                       if ( node.nodeType === 1 ) {\r
+                                                               node.nodeIndex = ++count;\r
+                                                       }\r
+                                               } \r
+                                               parent.sizcache = doneName;\r
+                                       }\r
+                                       \r
+                                       var diff = elem.nodeIndex - last;\r
+                                       if ( first === 0 ) {\r
+                                               return diff === 0;\r
+                                       } else {\r
+                                               return ( diff % first === 0 && diff / first >= 0 );\r
+                                       }\r
                        }\r
                },\r
+               ID: function(elem, match){\r
+                       return elem.nodeType === 1 && elem.getAttribute("id") === match;\r
+               },\r
+               TAG: function(elem, match){\r
+                       return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;\r
+               },\r
+               CLASS: function(elem, match){\r
+                       return (" " + (elem.className || elem.getAttribute("class")) + " ")\r
+                               .indexOf( match ) > -1;\r
+               },\r
+               ATTR: function(elem, match){\r
+                       var name = match[1],\r
+                               result = Expr.attrHandle[ name ] ?\r
+                                       Expr.attrHandle[ name ]( elem ) :\r
+                                       elem[ name ] != null ?\r
+                                               elem[ name ] :\r
+                                               elem.getAttribute( name ),\r
+                               value = result + "",\r
+                               type = match[2],\r
+                               check = match[4];\r
 \r
-               getBookmark : function(type, normalized) {\r
-                       var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;\r
-\r
-                       function findIndex(name, element) {\r
-                               var index = 0;\r
-\r
-                               each(dom.select(name), function(node, i) {\r
-                                       if (node == element)\r
-                                               index = i;\r
-                               });\r
+                       return result == null ?\r
+                               type === "!=" :\r
+                               type === "=" ?\r
+                               value === check :\r
+                               type === "*=" ?\r
+                               value.indexOf(check) >= 0 :\r
+                               type === "~=" ?\r
+                               (" " + value + " ").indexOf(check) >= 0 :\r
+                               !check ?\r
+                               value && result !== false :\r
+                               type === "!=" ?\r
+                               value !== check :\r
+                               type === "^=" ?\r
+                               value.indexOf(check) === 0 :\r
+                               type === "$=" ?\r
+                               value.substr(value.length - check.length) === check :\r
+                               type === "|=" ?\r
+                               value === check || value.substr(0, check.length + 1) === check + "-" :\r
+                               false;\r
+               },\r
+               POS: function(elem, match, i, array){\r
+                       var name = match[2], filter = Expr.setFilters[ name ];\r
 \r
-                               return index;\r
-                       };\r
+                       if ( filter ) {\r
+                               return filter( elem, i, match, array );\r
+                       }\r
+               }\r
+       }\r
+};\r
 \r
-                       if (type == 2) {\r
-                               function getLocation() {\r
-                                       var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};\r
+var origPOS = Expr.match.POS,\r
+       fescape = function(all, num){\r
+               return "\\" + (num - 0 + 1);\r
+       };\r
 \r
-                                       function getPoint(rng, start) {\r
-                                               var container = rng[start ? 'startContainer' : 'endContainer'],\r
-                                                       offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;\r
+for ( var type in Expr.match ) {\r
+       Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );\r
+       Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );\r
+}\r
 \r
-                                               if (container.nodeType == 3) {\r
-                                                       if (normalized) {\r
-                                                               for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)\r
-                                                                       offset += node.nodeValue.length;\r
-                                                       }\r
+var makeArray = function(array, results) {\r
+       array = Array.prototype.slice.call( array, 0 );\r
 \r
-                                                       point.push(offset);\r
-                                               } else {\r
-                                                       childNodes = container.childNodes;\r
+       if ( results ) {\r
+               results.push.apply( results, array );\r
+               return results;\r
+       }\r
+       \r
+       return array;\r
+};\r
 \r
-                                                       if (offset >= childNodes.length && childNodes.length) {\r
-                                                               after = 1;\r
-                                                               offset = Math.max(0, childNodes.length - 1);\r
-                                                       }\r
+// Perform a simple check to determine if the browser is capable of\r
+// converting a NodeList to an array using builtin methods.\r
+// Also verifies that the returned array holds DOM nodes\r
+// (which is not the case in the Blackberry browser)\r
+try {\r
+       Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;\r
 \r
-                                                       point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);\r
-                                               }\r
+// Provide a fallback method if it does not work\r
+} catch(e){\r
+       makeArray = function(array, results) {\r
+               var ret = results || [], i = 0;\r
 \r
-                                               for (; container && container != root; container = container.parentNode)\r
-                                                       point.push(t.dom.nodeIndex(container, normalized));\r
+               if ( toString.call(array) === "[object Array]" ) {\r
+                       Array.prototype.push.apply( ret, array );\r
+               } else {\r
+                       if ( typeof array.length === "number" ) {\r
+                               for ( var l = array.length; i < l; i++ ) {\r
+                                       ret.push( array[i] );\r
+                               }\r
+                       } else {\r
+                               for ( ; array[i]; i++ ) {\r
+                                       ret.push( array[i] );\r
+                               }\r
+                       }\r
+               }\r
 \r
-                                               return point;\r
-                                       };\r
+               return ret;\r
+       };\r
+}\r
 \r
-                                       bookmark.start = getPoint(rng, true);\r
+var sortOrder;\r
 \r
-                                       if (!t.isCollapsed())\r
-                                               bookmark.end = getPoint(rng);\r
+if ( document.documentElement.compareDocumentPosition ) {\r
+       sortOrder = function( a, b ) {\r
+               if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {\r
+                       if ( a == b ) {\r
+                               hasDuplicate = true;\r
+                       }\r
+                       return a.compareDocumentPosition ? -1 : 1;\r
+               }\r
 \r
-                                       return bookmark;\r
-                               };\r
+               var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;\r
+               if ( ret === 0 ) {\r
+                       hasDuplicate = true;\r
+               }\r
+               return ret;\r
+       };\r
+} else if ( "sourceIndex" in document.documentElement ) {\r
+       sortOrder = function( a, b ) {\r
+               if ( !a.sourceIndex || !b.sourceIndex ) {\r
+                       if ( a == b ) {\r
+                               hasDuplicate = true;\r
+                       }\r
+                       return a.sourceIndex ? -1 : 1;\r
+               }\r
 \r
-                               return getLocation();\r
+               var ret = a.sourceIndex - b.sourceIndex;\r
+               if ( ret === 0 ) {\r
+                       hasDuplicate = true;\r
+               }\r
+               return ret;\r
+       };\r
+} else if ( document.createRange ) {\r
+       sortOrder = function( a, b ) {\r
+               if ( !a.ownerDocument || !b.ownerDocument ) {\r
+                       if ( a == b ) {\r
+                               hasDuplicate = true;\r
                        }\r
+                       return a.ownerDocument ? -1 : 1;\r
+               }\r
 \r
-                       // Handle simple range\r
-                       if (type)\r
-                               return {rng : t.getRng()};\r
+               var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();\r
+               aRange.setStart(a, 0);\r
+               aRange.setEnd(a, 0);\r
+               bRange.setStart(b, 0);\r
+               bRange.setEnd(b, 0);\r
+               var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);\r
+               if ( ret === 0 ) {\r
+                       hasDuplicate = true;\r
+               }\r
+               return ret;\r
+       };\r
+}\r
 \r
-                       rng = t.getRng();\r
-                       id = dom.uniqueId();\r
-                       collapsed = tinyMCE.activeEditor.selection.isCollapsed();\r
-                       styles = 'overflow:hidden;line-height:0px';\r
+// Utility function for retreiving the text value of an array of DOM nodes\r
+Sizzle.getText = function( elems ) {\r
+       var ret = "", elem;\r
 \r
-                       // Explorer method\r
-                       if (rng.duplicate || rng.item) {\r
-                               // Text selection\r
-                               if (!rng.item) {\r
-                                       rng2 = rng.duplicate();\r
+       for ( var i = 0; elems[i]; i++ ) {\r
+               elem = elems[i];\r
 \r
-                                       // Insert start marker\r
-                                       rng.collapse();\r
-                                       rng.pasteHTML('<span _mce_type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');\r
+               // Get the text from text nodes and CDATA nodes\r
+               if ( elem.nodeType === 3 || elem.nodeType === 4 ) {\r
+                       ret += elem.nodeValue;\r
 \r
-                                       // Insert end marker\r
-                                       if (!collapsed) {\r
-                                               rng2.collapse(false);\r
-                                               rng2.pasteHTML('<span _mce_type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');\r
-                                       }\r
-                               } else {\r
-                                       // Control selection\r
-                                       element = rng.item(0);\r
-                                       name = element.nodeName;\r
+               // Traverse everything else, except comment nodes\r
+               } else if ( elem.nodeType !== 8 ) {\r
+                       ret += Sizzle.getText( elem.childNodes );\r
+               }\r
+       }\r
 \r
-                                       return {name : name, index : findIndex(name, element)};\r
-                               }\r
-                       } else {\r
-                               element = t.getNode();\r
-                               name = element.nodeName;\r
-                               if (name == 'IMG')\r
-                                       return {name : name, index : findIndex(name, element)};\r
+       return ret;\r
+};\r
 \r
-                               // W3C method\r
-                               rng2 = rng.cloneRange();\r
+// Check to see if the browser returns elements by name when\r
+// querying by getElementById (and provide a workaround)\r
+(function(){\r
+       // We're going to inject a fake input element with a specified name\r
+       var form = document.createElement("div"),\r
+               id = "script" + (new Date()).getTime();\r
+       form.innerHTML = "<a name='" + id + "'/>";\r
 \r
-                               // Insert end marker\r
-                               if (!collapsed) {\r
-                                       rng2.collapse(false);\r
-                                       rng2.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_end', style : styles}, chr));\r
-                               }\r
+       // Inject it into the root element, check its status, and remove it quickly\r
+       var root = document.documentElement;\r
+       root.insertBefore( form, root.firstChild );\r
 \r
-                               rng.collapse(true);\r
-                               rng.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_start', style : styles}, chr));\r
+       // The workaround has to do additional checks after a getElementById\r
+       // Which slows things down for other browsers (hence the branching)\r
+       if ( document.getElementById( id ) ) {\r
+               Expr.find.ID = function(match, context, isXML){\r
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+                               var m = context.getElementById(match[1]);\r
+                               return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];\r
                        }\r
+               };\r
 \r
-                       t.moveToBookmark({id : id, keep : 1});\r
+               Expr.filter.ID = function(elem, match){\r
+                       var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");\r
+                       return elem.nodeType === 1 && node && node.nodeValue === match;\r
+               };\r
+       }\r
 \r
-                       return {id : id};\r
-               },\r
+       root.removeChild( form );\r
+       root = form = null; // release memory in IE\r
+})();\r
 \r
-               moveToBookmark : function(bookmark) {\r
-                       var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;\r
+(function(){\r
+       // Check to see if the browser returns only elements\r
+       // when doing getElementsByTagName("*")\r
 \r
-                       // Clear selection cache\r
-                       if (t.tridentSel)\r
-                               t.tridentSel.destroy();\r
+       // Create a fake element\r
+       var div = document.createElement("div");\r
+       div.appendChild( document.createComment("") );\r
 \r
-                       if (bookmark) {\r
-                               if (bookmark.start) {\r
-                                       rng = dom.createRng();\r
-                                       root = dom.getRoot();\r
+       // Make sure no comments are found\r
+       if ( div.getElementsByTagName("*").length > 0 ) {\r
+               Expr.find.TAG = function(match, context){\r
+                       var results = context.getElementsByTagName(match[1]);\r
 \r
-                                       function setEndPoint(start) {\r
-                                               var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;\r
+                       // Filter out possible comments\r
+                       if ( match[1] === "*" ) {\r
+                               var tmp = [];\r
 \r
-                                               if (point) {\r
-                                                       // Find container node\r
-                                                       for (node = root, i = point.length - 1; i >= 1; i--) {\r
-                                                               children = node.childNodes;\r
+                               for ( var i = 0; results[i]; i++ ) {\r
+                                       if ( results[i].nodeType === 1 ) {\r
+                                               tmp.push( results[i] );\r
+                                       }\r
+                               }\r
 \r
-                                                               if (children.length)\r
-                                                                       node = children[point[i]];\r
-                                                       }\r
+                               results = tmp;\r
+                       }\r
 \r
-                                                       // Set offset within container node\r
-                                                       if (start)\r
-                                                               rng.setStart(node, point[0]);\r
-                                                       else\r
-                                                               rng.setEnd(node, point[0]);\r
-                                               }\r
-                                       };\r
+                       return results;\r
+               };\r
+       }\r
 \r
-                                       setEndPoint(true);\r
-                                       setEndPoint();\r
+       // Check to see if an attribute returns normalized href attributes\r
+       div.innerHTML = "<a href='#'></a>";\r
+       if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&\r
+                       div.firstChild.getAttribute("href") !== "#" ) {\r
+               Expr.attrHandle.href = function(elem){\r
+                       return elem.getAttribute("href", 2);\r
+               };\r
+       }\r
 \r
-                                       t.setRng(rng);\r
-                               } else if (bookmark.id) {\r
-                                       function restoreEndPoint(suffix) {\r
-                                               var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;\r
+       div = null; // release memory in IE\r
+})();\r
 \r
-                                               if (marker) {\r
-                                                       node = marker.parentNode;\r
+if ( document.querySelectorAll ) {\r
+       (function(){\r
+               var oldSizzle = Sizzle, div = document.createElement("div");\r
+               div.innerHTML = "<p class='TEST'></p>";\r
 \r
-                                                       if (suffix == 'start') {\r
-                                                               if (!keep) {\r
-                                                                       idx = dom.nodeIndex(marker);\r
-                                                               } else {\r
-                                                                       node = marker.firstChild;\r
-                                                                       idx = 1;\r
-                                                               }\r
+               // Safari can't handle uppercase or unicode characters when\r
+               // in quirks mode.\r
+               if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {\r
+                       return;\r
+               }\r
+       \r
+               Sizzle = function(query, context, extra, seed){\r
+                       context = context || document;\r
 \r
-                                                               startContainer = endContainer = node;\r
-                                                               startOffset = endOffset = idx;\r
-                                                       } else {\r
-                                                               if (!keep) {\r
-                                                                       idx = dom.nodeIndex(marker);\r
-                                                               } else {\r
-                                                                       node = marker.firstChild;\r
-                                                                       idx = 1;\r
-                                                               }\r
+                       // Only use querySelectorAll on non-XML documents\r
+                       // (ID selectors don't work in non-HTML documents)\r
+                       if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) {\r
+                               try {\r
+                                       return makeArray( context.querySelectorAll(query), extra );\r
+                               } catch(e){}\r
+                       }\r
+               \r
+                       return oldSizzle(query, context, extra, seed);\r
+               };\r
 \r
-                                                               endContainer = node;\r
-                                                               endOffset = idx;\r
-                                                       }\r
+               for ( var prop in oldSizzle ) {\r
+                       Sizzle[ prop ] = oldSizzle[ prop ];\r
+               }\r
 \r
-                                                       if (!keep) {\r
-                                                               prev = marker.previousSibling;\r
-                                                               next = marker.nextSibling;\r
+               div = null; // release memory in IE\r
+       })();\r
+}\r
 \r
-                                                               // Remove all marker text nodes\r
-                                                               each(tinymce.grep(marker.childNodes), function(node) {\r
-                                                                       if (node.nodeType == 3)\r
-                                                                               node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');\r
-                                                               });\r
+(function(){\r
+       var div = document.createElement("div");\r
 \r
-                                                               // Remove marker but keep children if for example contents where inserted into the marker\r
-                                                               // Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature\r
-                                                               while (marker = dom.get(bookmark.id + '_' + suffix))\r
-                                                                       dom.remove(marker, 1);\r
+       div.innerHTML = "<div class='test e'></div><div class='test'></div>";\r
 \r
-                                                               // If siblings are text nodes then merge them\r
-                                                               if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3) {\r
-                                                                       idx = prev.nodeValue.length;\r
-                                                                       prev.appendData(next.nodeValue);\r
-                                                                       dom.remove(next);\r
+       // Opera can't find a second classname (in 9.6)\r
+       // Also, make sure that getElementsByClassName actually exists\r
+       if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {\r
+               return;\r
+       }\r
 \r
-                                                                       if (suffix == 'start') {\r
-                                                                               startContainer = endContainer = prev;\r
-                                                                               startOffset = endOffset = idx;\r
-                                                                       } else {\r
-                                                                               endContainer = prev;\r
-                                                                               endOffset = idx;\r
-                                                                       }\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       };\r
+       // Safari caches class attributes, doesn't catch changes (in 3.2)\r
+       div.lastChild.className = "e";\r
 \r
-                                       function addBogus(node) {\r
-                                               // Adds a bogus BR element for empty block elements\r
-                                               // on non IE browsers just to have a place to put the caret\r
-                                               if (!isIE && dom.isBlock(node) && !node.innerHTML)\r
-                                                       node.innerHTML = '<br _mce_bogus="1" />';\r
+       if ( div.getElementsByClassName("e").length === 1 ) {\r
+               return;\r
+       }\r
+       \r
+       Expr.order.splice(1, 0, "CLASS");\r
+       Expr.find.CLASS = function(match, context, isXML) {\r
+               if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {\r
+                       return context.getElementsByClassName(match[1]);\r
+               }\r
+       };\r
 \r
-                                               return node;\r
-                                       };\r
+       div = null; // release memory in IE\r
+})();\r
 \r
-                                       // Restore start/end points\r
-                                       restoreEndPoint('start');\r
-                                       restoreEndPoint('end');\r
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+               var elem = checkSet[i];\r
+               if ( elem ) {\r
+                       elem = elem[dir];\r
+                       var match = false;\r
 \r
-                                       rng = dom.createRng();\r
-                                       rng.setStart(addBogus(startContainer), startOffset);\r
-                                       rng.setEnd(addBogus(endContainer), endOffset);\r
-                                       t.setRng(rng);\r
-                               } else if (bookmark.name) {\r
-                                       t.select(dom.select(bookmark.name)[bookmark.index]);\r
-                               } else if (bookmark.rng)\r
-                                       t.setRng(bookmark.rng);\r
-                       }\r
-               },\r
+                       while ( elem ) {\r
+                               if ( elem.sizcache === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\r
+                               }\r
 \r
-               select : function(node, content) {\r
-                       var t = this, dom = t.dom, rng = dom.createRng(), idx;\r
+                               if ( elem.nodeType === 1 && !isXML ){\r
+                                       elem.sizcache = doneName;\r
+                                       elem.sizset = i;\r
+                               }\r
 \r
-                       idx = dom.nodeIndex(node);\r
-                       rng.setStart(node.parentNode, idx);\r
-                       rng.setEnd(node.parentNode, idx + 1);\r
+                               if ( elem.nodeName.toLowerCase() === cur ) {\r
+                                       match = elem;\r
+                                       break;\r
+                               }\r
 \r
-                       // Find first/last text node or BR element\r
-                       if (content) {\r
-                               function setPoint(node, start) {\r
-                                       var walker = new tinymce.dom.TreeWalker(node, node);\r
+                               elem = elem[dir];\r
+                       }\r
 \r
-                                       do {\r
-                                               // Text node\r
-                                               if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {\r
-                                                       if (start)\r
-                                                               rng.setStart(node, 0);\r
-                                                       else\r
-                                                               rng.setEnd(node, node.nodeValue.length);\r
+                       checkSet[i] = match;\r
+               }\r
+       }\r
+}\r
 \r
-                                                       return;\r
-                                               }\r
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+               var elem = checkSet[i];\r
+               if ( elem ) {\r
+                       elem = elem[dir];\r
+                       var match = false;\r
 \r
-                                               // BR element\r
-                                               if (node.nodeName == 'BR') {\r
-                                                       if (start)\r
-                                                               rng.setStartBefore(node);\r
-                                                       else\r
-                                                               rng.setEndBefore(node);\r
+                       while ( elem ) {\r
+                               if ( elem.sizcache === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\r
+                               }\r
 \r
-                                                       return;\r
+                               if ( elem.nodeType === 1 ) {\r
+                                       if ( !isXML ) {\r
+                                               elem.sizcache = doneName;\r
+                                               elem.sizset = i;\r
+                                       }\r
+                                       if ( typeof cur !== "string" ) {\r
+                                               if ( elem === cur ) {\r
+                                                       match = true;\r
+                                                       break;\r
                                                }\r
-                                       } while (node = (start ? walker.next() : walker.prev()));\r
-                               };\r
 \r
-                               setPoint(node, 1);\r
-                               setPoint(node);\r
+                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\r
+                                               match = elem;\r
+                                               break;\r
+                                       }\r
+                               }\r
+\r
+                               elem = elem[dir];\r
                        }\r
 \r
-                       t.setRng(rng);\r
+                       checkSet[i] = match;\r
+               }\r
+       }\r
+}\r
 \r
-                       return node;\r
-               },\r
+Sizzle.contains = document.compareDocumentPosition ? function(a, b){\r
+       return !!(a.compareDocumentPosition(b) & 16);\r
+} : function(a, b){\r
+       return a !== b && (a.contains ? a.contains(b) : true);\r
+};\r
 \r
-               isCollapsed : function() {\r
-                       var t = this, r = t.getRng(), s = t.getSel();\r
+Sizzle.isXML = function(elem){\r
+       // documentElement is verified for cases where it doesn't yet exist\r
+       // (such as loading iframes in IE - #4833) \r
+       var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;\r
+       return documentElement ? documentElement.nodeName !== "HTML" : false;\r
+};\r
 \r
-                       if (!r || r.item)\r
-                               return false;\r
+var posProcess = function(selector, context){\r
+       var tmpSet = [], later = "", match,\r
+               root = context.nodeType ? [context] : context;\r
 \r
-                       if (r.compareEndPoints)\r
-                               return r.compareEndPoints('StartToEnd', r) === 0;\r
+       // Position selectors must be done after the filter\r
+       // And so must :not(positional) so we move all PSEUDOs to the end\r
+       while ( (match = Expr.match.PSEUDO.exec( selector )) ) {\r
+               later += match[0];\r
+               selector = selector.replace( Expr.match.PSEUDO, "" );\r
+       }\r
 \r
-                       return !s || r.collapsed;\r
-               },\r
+       selector = Expr.relative[selector] ? selector + "*" : selector;\r
 \r
-               collapse : function(b) {\r
-                       var t = this, r = t.getRng(), n;\r
+       for ( var i = 0, l = root.length; i < l; i++ ) {\r
+               Sizzle( selector, root[i], tmpSet );\r
+       }\r
 \r
-                       // Control range on IE\r
-                       if (r.item) {\r
-                               n = r.item(0);\r
-                               r = this.win.document.body.createTextRange();\r
-                               r.moveToElementText(n);\r
-                       }\r
+       return Sizzle.filter( later, tmpSet );\r
+};\r
 \r
-                       r.collapse(!!b);\r
-                       t.setRng(r);\r
-               },\r
+// EXPOSE\r
 \r
-               getSel : function() {\r
-                       var t = this, w = this.win;\r
+window.tinymce.dom.Sizzle = Sizzle;\r
 \r
-                       return w.getSelection ? w.getSelection() : w.document.selection;\r
-               },\r
+})();\r
 \r
-               getRng : function(w3c) {\r
-                       var t = this, s, r;\r
 \r
-                       // Found tridentSel object then we need to use that one\r
-                       if (w3c && t.tridentSel)\r
-                               return t.tridentSel.getRangeAt(0);\r
+(function(tinymce) {\r
+       tinymce.dom.Element = function(id, settings) {\r
+               var t = this, dom, el;\r
 \r
-                       try {\r
-                               if (s = t.getSel())\r
-                                       r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange());\r
-                       } catch (ex) {\r
-                               // IE throws unspecified error here if TinyMCE is placed in a frame/iframe\r
-                       }\r
+               t.settings = settings = settings || {};\r
+               t.id = id;\r
+               t.dom = dom = settings.dom || tinymce.DOM;\r
 \r
-                       // No range found then create an empty one\r
-                       // This can occur when the editor is placed in a hidden container element on Gecko\r
-                       // Or on IE when there was an exception\r
-                       if (!r)\r
-                               r = t.win.document.createRange ? t.win.document.createRange() : t.win.document.body.createTextRange();\r
+               // Only IE leaks DOM references, this is a lot faster\r
+               if (!tinymce.isIE)\r
+                       el = dom.get(t.id);\r
 \r
-                       if (t.selectedRange && t.explicitRange) {\r
-                               if (r.compareBoundaryPoints(r.START_TO_START, t.selectedRange) === 0 && r.compareBoundaryPoints(r.END_TO_END, t.selectedRange) === 0) {\r
-                                       // Safari, Opera and Chrome only ever select text which causes the range to change.\r
-                                       // This lets us use the originally set range if the selection hasn't been changed by the user.\r
-                                       r = t.explicitRange;\r
-                               } else {\r
-                                       t.selectedRange = null;\r
-                                       t.explicitRange = null;\r
-                               }\r
-                       }\r
-                       return r;\r
-               },\r
+               tinymce.each(\r
+                               ('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' + \r
+                               'setAttrib,setAttribs,getAttrib,addClass,removeClass,' + \r
+                               'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' + \r
+                               'isHidden,setHTML,get').split(/,/)\r
+                       , function(k) {\r
+                               t[k] = function() {\r
+                                       var a = [id], i;\r
 \r
-               setRng : function(r) {\r
-                       var s, t = this;\r
-                       \r
-                       if (!t.tridentSel) {\r
-                               s = t.getSel();\r
+                                       for (i = 0; i < arguments.length; i++)\r
+                                               a.push(arguments[i]);\r
 \r
-                               if (s) {\r
-                                       t.explicitRange = r;\r
-                                       s.removeAllRanges();\r
-                                       s.addRange(r);\r
-                                       t.selectedRange = s.getRangeAt(0);\r
-                               }\r
-                       } else {\r
-                               // Is W3C Range\r
-                               if (r.cloneRange) {\r
-                                       t.tridentSel.addRange(r);\r
-                                       return;\r
-                               }\r
+                                       a = dom[k].apply(dom, a);\r
+                                       t.update(k);\r
 \r
-                               // Is IE specific range\r
-                               try {\r
-                                       r.select();\r
-                               } catch (ex) {\r
-                                       // Needed for some odd IE bug #1843306\r
-                               }\r
-                       }\r
-               },\r
+                                       return a;\r
+                               };\r
+               });\r
 \r
-               setNode : function(n) {\r
-                       var t = this;\r
+               tinymce.extend(t, {\r
+                       on : function(n, f, s) {\r
+                               return tinymce.dom.Event.add(t.id, n, f, s);\r
+                       },\r
 \r
-                       t.setContent(t.dom.getOuterHTML(n));\r
+                       getXY : function() {\r
+                               return {\r
+                                       x : parseInt(t.getStyle('left')),\r
+                                       y : parseInt(t.getStyle('top'))\r
+                               };\r
+                       },\r
 \r
-                       return n;\r
-               },\r
+                       getSize : function() {\r
+                               var n = dom.get(t.id);\r
 \r
-               getNode : function() {\r
-                       var t = this, rng = t.getRng(), sel = t.getSel(), elm;\r
+                               return {\r
+                                       w : parseInt(t.getStyle('width') || n.clientWidth),\r
+                                       h : parseInt(t.getStyle('height') || n.clientHeight)\r
+                               };\r
+                       },\r
 \r
-                       if (rng.setStart) {\r
-                               // Range maybe lost after the editor is made visible again\r
-                               if (!rng)\r
-                                       return t.dom.getRoot();\r
+                       moveTo : function(x, y) {\r
+                               t.setStyles({left : x, top : y});\r
+                       },\r
 \r
-                               elm = rng.commonAncestorContainer;\r
+                       moveBy : function(x, y) {\r
+                               var p = t.getXY();\r
 \r
-                               // Handle selection a image or other control like element such as anchors\r
-                               if (!rng.collapsed) {\r
-                                       if (rng.startContainer == rng.endContainer) {\r
-                                               if (rng.startOffset - rng.endOffset < 2) {\r
-                                                       if (rng.startContainer.hasChildNodes())\r
-                                                               elm = rng.startContainer.childNodes[rng.startOffset];\r
-                                               }\r
-                                       }\r
+                               t.moveTo(p.x + x, p.y + y);\r
+                       },\r
 \r
-                                       // If the anchor node is a element instead of a text node then return this element\r
-                                       if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) \r
-                                               return sel.anchorNode.childNodes[sel.anchorOffset]; \r
-                               }\r
+                       resizeTo : function(w, h) {\r
+                               t.setStyles({width : w, height : h});\r
+                       },\r
 \r
-                               if (elm && elm.nodeType == 3)\r
-                                       return elm.parentNode;\r
+                       resizeBy : function(w, h) {\r
+                               var s = t.getSize();\r
 \r
-                               return elm;\r
-                       }\r
+                               t.resizeTo(s.w + w, s.h + h);\r
+                       },\r
 \r
-                       return rng.item ? rng.item(0) : rng.parentElement();\r
-               },\r
+                       update : function(k) {\r
+                               var b;\r
 \r
-               getSelectedBlocks : function(st, en) {\r
-                       var t = this, dom = t.dom, sb, eb, n, bl = [];\r
+                               if (tinymce.isIE6 && settings.blocker) {\r
+                                       k = k || '';\r
 \r
-                       sb = dom.getParent(st || t.getStart(), dom.isBlock);\r
-                       eb = dom.getParent(en || t.getEnd(), dom.isBlock);\r
+                                       // Ignore getters\r
+                                       if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)\r
+                                               return;\r
 \r
-                       if (sb)\r
-                               bl.push(sb);\r
+                                       // Remove blocker on remove\r
+                                       if (k == 'remove') {\r
+                                               dom.remove(t.blocker);\r
+                                               return;\r
+                                       }\r
 \r
-                       if (sb && eb && sb != eb) {\r
-                               n = sb;\r
+                                       if (!t.blocker) {\r
+                                               t.blocker = dom.uniqueId();\r
+                                               b = dom.add(settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});\r
+                                               dom.setStyle(b, 'opacity', 0);\r
+                                       } else\r
+                                               b = dom.get(t.blocker);\r
 \r
-                               while ((n = n.nextSibling) && n != eb) {\r
-                                       if (dom.isBlock(n))\r
-                                               bl.push(n);\r
+                                       dom.setStyles(b, {\r
+                                               left : t.getStyle('left', 1),\r
+                                               top : t.getStyle('top', 1),\r
+                                               width : t.getStyle('width', 1),\r
+                                               height : t.getStyle('height', 1),\r
+                                               display : t.getStyle('display', 1),\r
+                                               zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1\r
+                                       });\r
                                }\r
                        }\r
+               });\r
+       };\r
+})(tinymce);\r
 \r
-                       if (eb && sb != eb)\r
-                               bl.push(eb);\r
+(function(tinymce) {\r
+       function trimNl(s) {\r
+               return s.replace(/[\n\r]+/g, '');\r
+       };\r
 \r
-                       return bl;\r
-               },\r
+       // Shorten names\r
+       var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;\r
 \r
-               destroy : function(s) {\r
+       tinymce.create('tinymce.dom.Selection', {\r
+               Selection : function(dom, win, serializer) {\r
                        var t = this;\r
 \r
-                       t.win = null;\r
+                       t.dom = dom;\r
+                       t.win = win;\r
+                       t.serializer = serializer;\r
 \r
-                       if (t.tridentSel)\r
-                               t.tridentSel.destroy();\r
+                       // Add events\r
+                       each([\r
+                               'onBeforeSetContent',\r
 \r
-                       // Manual destroy then remove unload handler\r
-                       if (!s)\r
-                               tinymce.removeUnload(t.destroy);\r
-               }\r
-       });\r
-})(tinymce);\r
+                               'onBeforeGetContent',\r
 \r
-(function(tinymce) {\r
-       tinymce.create('tinymce.dom.XMLWriter', {\r
-               node : null,\r
-\r
-               XMLWriter : function(s) {\r
-                       // Get XML document\r
-                       function getXML() {\r
-                               var i = document.implementation;\r
-\r
-                               if (!i || !i.createDocument) {\r
-                                       // Try IE objects\r
-                                       try {return new ActiveXObject('MSXML2.DOMDocument');} catch (ex) {}\r
-                                       try {return new ActiveXObject('Microsoft.XmlDom');} catch (ex) {}\r
-                               } else\r
-                                       return i.createDocument('', '', null);\r
-                       };\r
+                               'onSetContent',\r
 \r
-                       this.doc = getXML();\r
-                       \r
-                       // Since Opera and WebKit doesn't escape > into &gt; we need to do it our self to normalize the output for all browsers\r
-                       this.valid = tinymce.isOpera || tinymce.isWebKit;\r
+                               'onGetContent'\r
+                       ], function(e) {\r
+                               t[e] = new tinymce.util.Dispatcher(t);\r
+                       });\r
+\r
+                       // No W3C Range support\r
+                       if (!t.win.getSelection)\r
+                               t.tridentSel = new tinymce.dom.TridentSelection(t);\r
+\r
+                       if (tinymce.isIE && dom.boxModel)\r
+                               this._fixIESelection();\r
+\r
+                       // Prevent leaks\r
+                       tinymce.addUnload(t.destroy, t);\r
+               },\r
 \r
-                       this.reset();\r
+               setCursorLocation: function(node, offset) {\r
+                       var t = this; var r = t.dom.createRng();\r
+                       r.setStart(node, offset);\r
+                       r.setEnd(node, offset);\r
+                       t.setRng(r);\r
+                       t.collapse(false);\r
                },\r
+               getContent : function(s) {\r
+                       var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;\r
+\r
+                       s = s || {};\r
+                       wb = wa = '';\r
+                       s.get = true;\r
+                       s.format = s.format || 'html';\r
+                       s.forced_root_block = '';\r
+                       t.onBeforeGetContent.dispatch(t, s);\r
 \r
-               reset : function() {\r
-                       var t = this, d = t.doc;\r
+                       if (s.format == 'text')\r
+                               return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));\r
 \r
-                       if (d.firstChild)\r
-                               d.removeChild(d.firstChild);\r
+                       if (r.cloneContents) {\r
+                               n = r.cloneContents();\r
 \r
-                       t.node = d.appendChild(d.createElement("html"));\r
-               },\r
+                               if (n)\r
+                                       e.appendChild(n);\r
+                       } else if (is(r.item) || is(r.htmlText)) {\r
+                               // IE will produce invalid markup if elements are present that\r
+                               // it doesn't understand like custom elements or HTML5 elements.\r
+                               // Adding a BR in front of the contents and then remoiving it seems to fix it though.\r
+                               e.innerHTML = '<br>' + (r.item ? r.item(0).outerHTML : r.htmlText);\r
+                               e.removeChild(e.firstChild);\r
+                       } else\r
+                               e.innerHTML = r.toString();\r
 \r
-               writeStartElement : function(n) {\r
-                       var t = this;\r
+                       // Keep whitespace before and after\r
+                       if (/^\s/.test(e.innerHTML))\r
+                               wb = ' ';\r
 \r
-                       t.node = t.node.appendChild(t.doc.createElement(n));\r
-               },\r
+                       if (/\s+$/.test(e.innerHTML))\r
+                               wa = ' ';\r
 \r
-               writeAttribute : function(n, v) {\r
-                       if (this.valid)\r
-                               v = v.replace(/>/g, '%MCGT%');\r
+                       s.getInner = true;\r
 \r
-                       this.node.setAttribute(n, v);\r
-               },\r
+                       s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;\r
+                       t.onGetContent.dispatch(t, s);\r
 \r
-               writeEndElement : function() {\r
-                       this.node = this.node.parentNode;\r
+                       return s.content;\r
                },\r
 \r
-               writeFullEndElement : function() {\r
-                       var t = this, n = t.node;\r
+               setContent : function(content, args) {\r
+                       var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;\r
 \r
-                       n.appendChild(t.doc.createTextNode(""));\r
-                       t.node = n.parentNode;\r
-               },\r
+                       args = args || {format : 'html'};\r
+                       args.set = true;\r
+                       content = args.content = content;\r
 \r
-               writeText : function(v) {\r
-                       if (this.valid)\r
-                               v = v.replace(/>/g, '%MCGT%');\r
+                       // Dispatch before set content event\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
 \r
-                       this.node.appendChild(this.doc.createTextNode(v));\r
-               },\r
+                       content = args.content;\r
 \r
-               writeCDATA : function(v) {\r
-                       this.node.appendChild(this.doc.createCDATASection(v));\r
-               },\r
+                       if (rng.insertNode) {\r
+                               // Make caret marker since insertNode places the caret in the beginning of text after insert\r
+                               content += '<span id="__caret">_</span>';\r
 \r
-               writeComment : function(v) {\r
-                       // Fix for bug #2035694\r
-                       if (tinymce.isIE)\r
-                               v = v.replace(/^\-|\-$/g, ' ');\r
+                               // Delete and insert new node\r
+                               if (rng.startContainer == doc && rng.endContainer == doc) {\r
+                                       // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents\r
+                                       doc.body.innerHTML = content;\r
+                               } else {\r
+                                       rng.deleteContents();\r
 \r
-                       this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));\r
-               },\r
+                                       if (doc.body.childNodes.length == 0) {\r
+                                               doc.body.innerHTML = content;\r
+                                       } else {\r
+                                               // createContextualFragment doesn't exists in IE 9 DOMRanges\r
+                                               if (rng.createContextualFragment) {\r
+                                                       rng.insertNode(rng.createContextualFragment(content));\r
+                                               } else {\r
+                                                       // Fake createContextualFragment call in IE 9\r
+                                                       frag = doc.createDocumentFragment();\r
+                                                       temp = doc.createElement('div');\r
 \r
-               getContent : function() {\r
-                       var h;\r
+                                                       frag.appendChild(temp);\r
+                                                       temp.outerHTML = content;\r
 \r
-                       h = this.doc.xml || new XMLSerializer().serializeToString(this.doc);\r
-                       h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, '');\r
-                       h = h.replace(/ ?\/>/g, ' />');\r
+                                                       rng.insertNode(frag);\r
+                                               }\r
+                                       }\r
+                               }\r
 \r
-                       if (this.valid)\r
-                               h = h.replace(/\%MCGT%/g, '&gt;');\r
+                               // Move to caret marker\r
+                               caretNode = self.dom.get('__caret');\r
 \r
-                       return h;\r
-               }\r
-       });\r
-})(tinymce);\r
+                               // Make sure we wrap it compleatly, Opera fails with a simple select call\r
+                               rng = doc.createRange();\r
+                               rng.setStartBefore(caretNode);\r
+                               rng.setEndBefore(caretNode);\r
+                               self.setRng(rng);\r
 \r
-(function(tinymce) {\r
-       tinymce.create('tinymce.dom.StringWriter', {\r
-               str : null,\r
-               tags : null,\r
-               count : 0,\r
-               settings : null,\r
-               indent : null,\r
-\r
-               StringWriter : function(s) {\r
-                       this.settings = tinymce.extend({\r
-                               indent_char : ' ',\r
-                               indentation : 0\r
-                       }, s);\r
+                               // Remove the caret position\r
+                               self.dom.remove('__caret');\r
 \r
-                       this.reset();\r
-               },\r
+                               try {\r
+                                       self.setRng(rng);\r
+                               } catch (ex) {\r
+                                       // Might fail on Opera for some odd reason\r
+                               }\r
+                       } else {\r
+                               if (rng.item) {\r
+                                       // Delete content and get caret text selection\r
+                                       doc.execCommand('Delete', false, null);\r
+                                       rng = self.getRng();\r
+                               }\r
 \r
-               reset : function() {\r
-                       this.indent = '';\r
-                       this.str = "";\r
-                       this.tags = [];\r
-                       this.count = 0;\r
-               },\r
+                               // Explorer removes spaces from the beginning of pasted contents\r
+                               if (/^\s+/.test(content)) {\r
+                                       rng.pasteHTML('<span id="__mce_tmp">_</span>' + content);\r
+                                       self.dom.remove('__mce_tmp');\r
+                               } else\r
+                                       rng.pasteHTML(content);\r
+                       }\r
 \r
-               writeStartElement : function(n) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw('<' + n);\r
-                       this.tags.push(n);\r
-                       this.inAttr = true;\r
-                       this.count++;\r
-                       this.elementCount = this.count;\r
+                       // Dispatch set content event\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
                },\r
 \r
-               writeAttribute : function(n, v) {\r
-                       var t = this;\r
+               getStart : function() {\r
+                       var rng = this.getRng(), startElement, parentElement, checkRng, node;\r
 \r
-                       t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"');\r
-               },\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Control selection, return first item\r
+                               if (rng.item)\r
+                                       return rng.item(0);\r
 \r
-               writeEndElement : function() {\r
-                       var n;\r
+                               // Get start element\r
+                               checkRng = rng.duplicate();\r
+                               checkRng.collapse(1);\r
+                               startElement = checkRng.parentElement();\r
 \r
-                       if (this.tags.length > 0) {\r
-                               n = this.tags.pop();\r
+                               // Check if range parent is inside the start element, then return the inner parent element\r
+                               // This will fix issues when a single element is selected, IE would otherwise return the wrong start element\r
+                               parentElement = node = rng.parentElement();\r
+                               while (node = node.parentNode) {\r
+                                       if (node == startElement) {\r
+                                               startElement = parentElement;\r
+                                               break;\r
+                                       }\r
+                               }\r
 \r
-                               if (this._writeAttributesEnd(1))\r
-                                       this.writeRaw('</' + n + '>');\r
+                               return startElement;\r
+                       } else {\r
+                               startElement = rng.startContainer;\r
 \r
-                               if (this.settings.indentation > 0)\r
-                                       this.writeRaw('\n');\r
-                       }\r
-               },\r
+                               if (startElement.nodeType == 1 && startElement.hasChildNodes())\r
+                                       startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];\r
 \r
-               writeFullEndElement : function() {\r
-                       if (this.tags.length > 0) {\r
-                               this._writeAttributesEnd();\r
-                               this.writeRaw('</' + this.tags.pop() + '>');\r
+                               if (startElement && startElement.nodeType == 3)\r
+                                       return startElement.parentNode;\r
 \r
-                               if (this.settings.indentation > 0)\r
-                                       this.writeRaw('\n');\r
+                               return startElement;\r
                        }\r
                },\r
 \r
-               writeText : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw(this.encode(v));\r
-                       this.count++;\r
-               },\r
-\r
-               writeCDATA : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw('<![CDATA[' + v + ']]>');\r
-                       this.count++;\r
-               },\r
+               getEnd : function() {\r
+                       var t = this, r = t.getRng(), e, eo;\r
 \r
-               writeComment : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw('<!-- ' + v + '-->');\r
-                       this.count++;\r
-               },\r
+                       if (r.duplicate || r.item) {\r
+                               if (r.item)\r
+                                       return r.item(0);\r
 \r
-               writeRaw : function(v) {\r
-                       this.str += v;\r
-               },\r
+                               r = r.duplicate();\r
+                               r.collapse(0);\r
+                               e = r.parentElement();\r
 \r
-               encode : function(s) {\r
-                       return s.replace(/[<>&"]/g, function(v) {\r
-                               switch (v) {\r
-                                       case '<':\r
-                                               return '&lt;';\r
+                               if (e && e.nodeName == 'BODY')\r
+                                       return e.lastChild || e;\r
 \r
-                                       case '>':\r
-                                               return '&gt;';\r
+                               return e;\r
+                       } else {\r
+                               e = r.endContainer;\r
+                               eo = r.endOffset;\r
 \r
-                                       case '&':\r
-                                               return '&amp;';\r
+                               if (e.nodeType == 1 && e.hasChildNodes())\r
+                                       e = e.childNodes[eo > 0 ? eo - 1 : eo];\r
 \r
-                                       case '"':\r
-                                               return '&quot;';\r
-                               }\r
+                               if (e && e.nodeType == 3)\r
+                                       return e.parentNode;\r
 \r
-                               return v;\r
-                       });\r
+                               return e;\r
+                       }\r
                },\r
 \r
-               getContent : function() {\r
-                       return this.str;\r
-               },\r
+               getBookmark : function(type, normalized) {\r
+                       var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;\r
 \r
-               _writeAttributesEnd : function(s) {\r
-                       if (!this.inAttr)\r
-                               return;\r
+                       function findIndex(name, element) {\r
+                               var index = 0;\r
 \r
-                       this.inAttr = false;\r
+                               each(dom.select(name), function(node, i) {\r
+                                       if (node == element)\r
+                                               index = i;\r
+                               });\r
 \r
-                       if (s && this.elementCount == this.count) {\r
-                               this.writeRaw(' />');\r
-                               return false;\r
-                       }\r
+                               return index;\r
+                       };\r
 \r
-                       this.writeRaw('>');\r
+                       if (type == 2) {\r
+                               function getLocation() {\r
+                                       var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};\r
 \r
-                       return true;\r
-               }\r
-       });\r
-})(tinymce);\r
+                                       function getPoint(rng, start) {\r
+                                               var container = rng[start ? 'startContainer' : 'endContainer'],\r
+                                                       offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;\r
 \r
-(function(tinymce) {\r
-       // Shorten names\r
-       var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;\r
+                                               if (container.nodeType == 3) {\r
+                                                       if (normalized) {\r
+                                                               for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)\r
+                                                                       offset += node.nodeValue.length;\r
+                                                       }\r
 \r
-       function wildcardToRE(s) {\r
-               return s.replace(/([?+*])/g, '.$1');\r
-       };\r
+                                                       point.push(offset);\r
+                                               } else {\r
+                                                       childNodes = container.childNodes;\r
 \r
-       tinymce.create('tinymce.dom.Serializer', {\r
-               Serializer : function(s) {\r
-                       var t = this;\r
+                                                       if (offset >= childNodes.length && childNodes.length) {\r
+                                                               after = 1;\r
+                                                               offset = Math.max(0, childNodes.length - 1);\r
+                                                       }\r
 \r
-                       t.key = 0;\r
-                       t.onPreProcess = new Dispatcher(t);\r
-                       t.onPostProcess = new Dispatcher(t);\r
+                                                       point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);\r
+                                               }\r
 \r
-                       try {\r
-                               t.writer = new tinymce.dom.XMLWriter();\r
-                       } catch (ex) {\r
-                               // IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter\r
-                               t.writer = new tinymce.dom.StringWriter();\r
-                       }\r
+                                               for (; container && container != root; container = container.parentNode)\r
+                                                       point.push(t.dom.nodeIndex(container, normalized));\r
 \r
-                       // Default settings\r
-                       t.settings = s = extend({\r
-                               dom : tinymce.DOM,\r
-                               valid_nodes : 0,\r
-                               node_filter : 0,\r
-                               attr_filter : 0,\r
-                               invalid_attrs : /^(_mce_|_moz_|sizset|sizcache)/,\r
-                               closed : /^(br|hr|input|meta|img|link|param|area)$/,\r
-                               entity_encoding : 'named',\r
-                               entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',\r
-                               valid_elements : '*[*]',\r
-                               extended_valid_elements : 0,\r
-                               invalid_elements : 0,\r
-                               fix_table_elements : 1,\r
-                               fix_list_elements : true,\r
-                               fix_content_duplication : true,\r
-                               convert_fonts_to_spans : false,\r
-                               font_size_classes : 0,\r
-                               apply_source_formatting : 0,\r
-                               indent_mode : 'simple',\r
-                               indent_char : '\t',\r
-                               indent_levels : 1,\r
-                               remove_linebreaks : 1,\r
-                               remove_redundant_brs : 1,\r
-                               element_format : 'xhtml'\r
-                       }, s);\r
+                                               return point;\r
+                                       };\r
 \r
-                       t.dom = s.dom;\r
-                       t.schema = s.schema;\r
+                                       bookmark.start = getPoint(rng, true);\r
 \r
-                       // Use raw entities if no entities are defined\r
-                       if (s.entity_encoding == 'named' && !s.entities)\r
-                               s.entity_encoding = 'raw';\r
+                                       if (!t.isCollapsed())\r
+                                               bookmark.end = getPoint(rng);\r
 \r
-                       if (s.remove_redundant_brs) {\r
-                               t.onPostProcess.add(function(se, o) {\r
-                                       // Remove single BR at end of block elements since they get rendered\r
-                                       o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) {\r
-                                               // Check if it's a single element\r
-                                               if (/^<br \/>\s*<\//.test(a))\r
-                                                       return '</' + c + '>';\r
+                                       return bookmark;\r
+                               };\r
 \r
-                                               return a;\r
-                                       });\r
-                               });\r
-                       }\r
+                               if (t.tridentSel)\r
+                                       return t.tridentSel.getBookmark(type);\r
 \r
-                       // Remove XHTML element endings i.e. produce crap :) XHTML is better\r
-                       if (s.element_format == 'html') {\r
-                               t.onPostProcess.add(function(se, o) {\r
-                                       o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>');\r
-                               });\r
+                               return getLocation();\r
                        }\r
 \r
-                       if (s.fix_list_elements) {\r
-                               t.onPreProcess.add(function(se, o) {\r
-                                       var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;\r
-\r
-                                       function prevNode(e, n) {\r
-                                               var a = n.split(','), i;\r
+                       // Handle simple range\r
+                       if (type)\r
+                               return {rng : t.getRng()};\r
 \r
-                                               while ((e = e.previousSibling) != null) {\r
-                                                       for (i=0; i<a.length; i++) {\r
-                                                               if (e.nodeName == a[i])\r
-                                                                       return e;\r
-                                                       }\r
-                                               }\r
+                       rng = t.getRng();\r
+                       id = dom.uniqueId();\r
+                       collapsed = tinyMCE.activeEditor.selection.isCollapsed();\r
+                       styles = 'overflow:hidden;line-height:0px';\r
 \r
-                                               return null;\r
-                                       };\r
+                       // Explorer method\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Text selection\r
+                               if (!rng.item) {\r
+                                       rng2 = rng.duplicate();\r
 \r
-                                       for (x=0; x<a.length; x++) {\r
-                                               nl = t.dom.select(a[x], o.node);\r
+                                       try {\r
+                                               // Insert start marker\r
+                                               rng.collapse();\r
+                                               rng.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');\r
 \r
-                                               for (i=0; i<nl.length; i++) {\r
-                                                       n = nl[i];\r
-                                                       p = n.parentNode;\r
+                                               // Insert end marker\r
+                                               if (!collapsed) {\r
+                                                       rng2.collapse(false);\r
 \r
-                                                       if (r.test(p.nodeName)) {\r
-                                                               np = prevNode(n, 'LI');\r
+                                                       // Detect the empty space after block elements in IE and move the end back one character <p></p>] becomes <p>]</p>\r
+                                                       rng.moveToElementText(rng2.parentElement());\r
+                                                       if (rng.compareEndPoints('StartToEnd', rng2) == 0)\r
+                                                               rng2.move('character', -1);\r
 \r
-                                                               if (!np) {\r
-                                                                       np = t.dom.create('li');\r
-                                                                       np.innerHTML = '&nbsp;';\r
-                                                                       np.appendChild(n);\r
-                                                                       p.insertBefore(np, p.firstChild);\r
-                                                               } else\r
-                                                                       np.appendChild(n);\r
-                                                       }\r
+                                                       rng2.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');\r
                                                }\r
+                                       } catch (ex) {\r
+                                               // IE might throw unspecified error so lets ignore it\r
+                                               return null;\r
                                        }\r
-                               });\r
-                       }\r
-\r
-                       if (s.fix_table_elements) {\r
-                               t.onPreProcess.add(function(se, o) {\r
-                                       // Since Opera will crash if you attach the node to a dynamic document we need to brrowser sniff a specific build\r
-                                       // so Opera users with an older version will have to live with less compaible output not much we can do here\r
-                                       if (!tinymce.isOpera || opera.buildNumber() >= 1767) {\r
-                                               each(t.dom.select('p table', o.node).reverse(), function(n) {\r
-                                                       var parent = t.dom.getParent(n.parentNode, 'table,p');\r
-\r
-                                                       if (parent.nodeName != 'TABLE') {\r
-                                                               try {\r
-                                                                       t.dom.split(parent, n);\r
-                                                               } catch (ex) {\r
-                                                                       // IE can sometimes fire an unknown runtime error so we just ignore it\r
-                                                               }\r
-                                                       }\r
-                                               });\r
-                                       }\r
-                               });\r
-                       }\r
-               },\r
-\r
-               setEntities : function(s) {\r
-                       var t = this, a, i, l = {}, v;\r
+                               } else {\r
+                                       // Control selection\r
+                                       element = rng.item(0);\r
+                                       name = element.nodeName;\r
 \r
-                       // No need to setup more than once\r
-                       if (t.entityLookup)\r
-                               return;\r
+                                       return {name : name, index : findIndex(name, element)};\r
+                               }\r
+                       } else {\r
+                               element = t.getNode();\r
+                               name = element.nodeName;\r
+                               if (name == 'IMG')\r
+                                       return {name : name, index : findIndex(name, element)};\r
 \r
-                       // Build regex and lookup array\r
-                       a = s.split(',');\r
-                       for (i = 0; i < a.length; i += 2) {\r
-                               v = a[i];\r
+                               // Can't insert a node into the root of document WebKit defaults to document\r
+                               if (rng.startContainer.nodeType == 9) {\r
+                                       return;\r
+                               }\r
 \r
-                               // Don't add default &amp; &quot; etc.\r
-                               if (v == 34 || v == 38 || v == 60 || v == 62)\r
-                                       continue;\r
+                               // W3C method\r
+                               rng2 = rng.cloneRange();\r
 \r
-                               l[String.fromCharCode(a[i])] = a[i + 1];\r
+                               // Insert end marker\r
+                               if (!collapsed) {\r
+                                       rng2.collapse(false);\r
+                                       rng2.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_end', style : styles}, chr));\r
+                               }\r
 \r
-                               v = parseInt(a[i]).toString(16);\r
+                               rng.collapse(true);\r
+                               rng.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_start', style : styles}, chr));\r
                        }\r
 \r
-                       t.entityLookup = l;\r
-               },\r
-\r
-               setRules : function(s) {\r
-                       var t = this;\r
-\r
-                       t._setup();\r
-                       t.rules = {};\r
-                       t.wildRules = [];\r
-                       t.validElements = {};\r
+                       t.moveToBookmark({id : id, keep : 1});\r
 \r
-                       return t.addRules(s);\r
+                       return {id : id};\r
                },\r
 \r
-               addRules : function(s) {\r
-                       var t = this, dr;\r
-\r
-                       if (!s)\r
-                               return;\r
-\r
-                       t._setup();\r
-\r
-                       each(s.split(','), function(s) {\r
-                               var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];\r
-\r
-                               // Extend with default rules\r
-                               if (dr)\r
-                                       at = tinymce.extend([], dr.attribs);\r
+               moveToBookmark : function(bookmark) {\r
+                       var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;\r
 \r
-                               // Parse attributes\r
-                               if (p.length > 1) {\r
-                                       each(p[1].split('|'), function(s) {\r
-                                               var ar = {}, i;\r
+                       if (bookmark) {\r
+                               if (bookmark.start) {\r
+                                       rng = dom.createRng();\r
+                                       root = dom.getRoot();\r
 \r
-                                               at = at || [];\r
+                                       function setEndPoint(start) {\r
+                                               var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;\r
 \r
-                                               // Parse attribute rule\r
-                                               s = s.replace(/::/g, '~');\r
-                                               s = /^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);\r
-                                               s[2] = s[2].replace(/~/g, ':');\r
+                                               if (point) {\r
+                                                       offset = point[0];\r
 \r
-                                               // Add required attributes\r
-                                               if (s[1] == '!') {\r
-                                                       ra = ra || [];\r
-                                                       ra.push(s[2]);\r
-                                               }\r
+                                                       // Find container node\r
+                                                       for (node = root, i = point.length - 1; i >= 1; i--) {\r
+                                                               children = node.childNodes;\r
 \r
-                                               // Remove inherited attributes\r
-                                               if (s[1] == '-') {\r
-                                                       for (i = 0; i <at.length; i++) {\r
-                                                               if (at[i].name == s[2]) {\r
-                                                                       at.splice(i, 1);\r
+                                                               if (point[i] > children.length - 1)\r
                                                                        return;\r
-                                                               }\r
-                                                       }\r
-                                               }\r
 \r
-                                               switch (s[3]) {\r
-                                                       // Add default attrib values\r
-                                                       case '=':\r
-                                                               ar.defaultVal = s[4] || '';\r
-                                                               break;\r
+                                                               node = children[point[i]];\r
+                                                       }\r
 \r
-                                                       // Add forced attrib values\r
-                                                       case ':':\r
-                                                               ar.forcedVal = s[4];\r
-                                                               break;\r
+                                                       // Move text offset to best suitable location\r
+                                                       if (node.nodeType === 3)\r
+                                                               offset = Math.min(point[0], node.nodeValue.length);\r
 \r
-                                                       // Add validation values\r
-                                                       case '<':\r
-                                                               ar.validVals = s[4].split('?');\r
-                                                               break;\r
-                                               }\r
+                                                       // Move element offset to best suitable location\r
+                                                       if (node.nodeType === 1)\r
+                                                               offset = Math.min(point[0], node.childNodes.length);\r
 \r
-                                               if (/[*.?]/.test(s[2])) {\r
-                                                       wat = wat || [];\r
-                                                       ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$');\r
-                                                       wat.push(ar);\r
-                                               } else {\r
-                                                       ar.name = s[2];\r
-                                                       at.push(ar);\r
+                                                       // Set offset within container node\r
+                                                       if (start)\r
+                                                               rng.setStart(node, offset);\r
+                                                       else\r
+                                                               rng.setEnd(node, offset);\r
                                                }\r
 \r
-                                               va.push(s[2]);\r
-                                       });\r
-                               }\r
-\r
-                               // Handle element names\r
-                               each(tn, function(s, i) {\r
-                                       var pr = s.charAt(0), x = 1, ru = {};\r
-\r
-                                       // Extend with default rule data\r
-                                       if (dr) {\r
-                                               if (dr.noEmpty)\r
-                                                       ru.noEmpty = dr.noEmpty;\r
+                                               return true;\r
+                                       };\r
 \r
-                                               if (dr.fullEnd)\r
-                                                       ru.fullEnd = dr.fullEnd;\r
+                                       if (t.tridentSel)\r
+                                               return t.tridentSel.moveToBookmark(bookmark);\r
 \r
-                                               if (dr.padd)\r
-                                                       ru.padd = dr.padd;\r
+                                       if (setEndPoint(true) && setEndPoint()) {\r
+                                               t.setRng(rng);\r
                                        }\r
+                               } else if (bookmark.id) {\r
+                                       function restoreEndPoint(suffix) {\r
+                                               var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;\r
 \r
-                                       // Handle prefixes\r
-                                       switch (pr) {\r
-                                               case '-':\r
-                                                       ru.noEmpty = true;\r
-                                                       break;\r
+                                               if (marker) {\r
+                                                       node = marker.parentNode;\r
 \r
-                                               case '+':\r
-                                                       ru.fullEnd = true;\r
-                                                       break;\r
+                                                       if (suffix == 'start') {\r
+                                                               if (!keep) {\r
+                                                                       idx = dom.nodeIndex(marker);\r
+                                                               } else {\r
+                                                                       node = marker.firstChild;\r
+                                                                       idx = 1;\r
+                                                               }\r
 \r
-                                               case '#':\r
-                                                       ru.padd = true;\r
-                                                       break;\r
+                                                               startContainer = endContainer = node;\r
+                                                               startOffset = endOffset = idx;\r
+                                                       } else {\r
+                                                               if (!keep) {\r
+                                                                       idx = dom.nodeIndex(marker);\r
+                                                               } else {\r
+                                                                       node = marker.firstChild;\r
+                                                                       idx = 1;\r
+                                                               }\r
 \r
-                                               default:\r
-                                                       x = 0;\r
-                                       }\r
+                                                               endContainer = node;\r
+                                                               endOffset = idx;\r
+                                                       }\r
 \r
-                                       tn[i] = s = s.substring(x);\r
-                                       t.validElements[s] = 1;\r
+                                                       if (!keep) {\r
+                                                               prev = marker.previousSibling;\r
+                                                               next = marker.nextSibling;\r
 \r
-                                       // Add element name or element regex\r
-                                       if (/[*.?]/.test(tn[0])) {\r
-                                               ru.nameRE = new RegExp('^' + wildcardToRE(tn[0]) + '$');\r
-                                               t.wildRules = t.wildRules || {};\r
-                                               t.wildRules.push(ru);\r
-                                       } else {\r
-                                               ru.name = tn[0];\r
+                                                               // Remove all marker text nodes\r
+                                                               each(tinymce.grep(marker.childNodes), function(node) {\r
+                                                                       if (node.nodeType == 3)\r
+                                                                               node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');\r
+                                                               });\r
 \r
-                                               // Store away default rule\r
-                                               if (tn[0] == '@')\r
-                                                       dr = ru;\r
+                                                               // Remove marker but keep children if for example contents where inserted into the marker\r
+                                                               // Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature\r
+                                                               while (marker = dom.get(bookmark.id + '_' + suffix))\r
+                                                                       dom.remove(marker, 1);\r
 \r
-                                               t.rules[s] = ru;\r
-                                       }\r
+                                                               // If siblings are text nodes then merge them unless it's Opera since it some how removes the node\r
+                                                               // and we are sniffing since adding a lot of detection code for a browser with 3% of the market isn't worth the effort. Sorry, Opera but it's just a fact\r
+                                                               if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !tinymce.isOpera) {\r
+                                                                       idx = prev.nodeValue.length;\r
+                                                                       prev.appendData(next.nodeValue);\r
+                                                                       dom.remove(next);\r
+\r
+                                                                       if (suffix == 'start') {\r
+                                                                               startContainer = endContainer = prev;\r
+                                                                               startOffset = endOffset = idx;\r
+                                                                       } else {\r
+                                                                               endContainer = prev;\r
+                                                                               endOffset = idx;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       };\r
 \r
-                                       ru.attribs = at;\r
+                                       function addBogus(node) {\r
+                                               // Adds a bogus BR element for empty block elements or just a space on IE since it renders BR elements incorrectly\r
+                                               if (dom.isBlock(node) && !node.innerHTML)\r
+                                                       node.innerHTML = !isIE ? '<br data-mce-bogus="1" />' : ' ';\r
 \r
-                                       if (ra)\r
-                                               ru.requiredAttribs = ra;\r
+                                               return node;\r
+                                       };\r
 \r
-                                       if (wat) {\r
-                                               // Build valid attributes regexp\r
-                                               s = '';\r
-                                               each(va, function(v) {\r
-                                                       if (s)\r
-                                                               s += '|';\r
+                                       // Restore start/end points\r
+                                       restoreEndPoint('start');\r
+                                       restoreEndPoint('end');\r
 \r
-                                                       s += '(' + wildcardToRE(v) + ')';\r
-                                               });\r
-                                               ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$');\r
-                                               ru.wildAttribs = wat;\r
+                                       if (startContainer) {\r
+                                               rng = dom.createRng();\r
+                                               rng.setStart(addBogus(startContainer), startOffset);\r
+                                               rng.setEnd(addBogus(endContainer), endOffset);\r
+                                               t.setRng(rng);\r
                                        }\r
-                               });\r
-                       });\r
+                               } else if (bookmark.name) {\r
+                                       t.select(dom.select(bookmark.name)[bookmark.index]);\r
+                               } else if (bookmark.rng)\r
+                                       t.setRng(bookmark.rng);\r
+                       }\r
+               },\r
 \r
-                       // Build valid elements regexp\r
-                       s = '';\r
-                       each(t.validElements, function(v, k) {\r
-                               if (s)\r
-                                       s += '|';\r
+               select : function(node, content) {\r
+                       var t = this, dom = t.dom, rng = dom.createRng(), idx;\r
 \r
-                               if (k != '@')\r
-                                       s += k;\r
-                       });\r
-                       t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$');\r
+                       if (node) {\r
+                               idx = dom.nodeIndex(node);\r
+                               rng.setStart(node.parentNode, idx);\r
+                               rng.setEnd(node.parentNode, idx + 1);\r
+\r
+                               // Find first/last text node or BR element\r
+                               if (content) {\r
+                                       function setPoint(node, start) {\r
+                                               var walker = new tinymce.dom.TreeWalker(node, node);\r
+\r
+                                               do {\r
+                                                       // Text node\r
+                                                       if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {\r
+                                                               if (start)\r
+                                                                       rng.setStart(node, 0);\r
+                                                               else\r
+                                                                       rng.setEnd(node, node.nodeValue.length);\r
 \r
-                       //console.debug(t.validElementsRE.toString());\r
-                       //console.dir(t.rules);\r
-                       //console.dir(t.wildRules);\r
-               },\r
+                                                               return;\r
+                                                       }\r
 \r
-               findRule : function(n) {\r
-                       var t = this, rl = t.rules, i, r;\r
+                                                       // BR element\r
+                                                       if (node.nodeName == 'BR') {\r
+                                                               if (start)\r
+                                                                       rng.setStartBefore(node);\r
+                                                               else\r
+                                                                       rng.setEndBefore(node);\r
 \r
-                       t._setup();\r
+                                                               return;\r
+                                                       }\r
+                                               } while (node = (start ? walker.next() : walker.prev()));\r
+                                       };\r
 \r
-                       // Exact match\r
-                       r = rl[n];\r
-                       if (r)\r
-                               return r;\r
+                                       setPoint(node, 1);\r
+                                       setPoint(node);\r
+                               }\r
 \r
-                       // Try wildcards\r
-                       rl = t.wildRules;\r
-                       for (i = 0; i < rl.length; i++) {\r
-                               if (rl[i].nameRE.test(n))\r
-                                       return rl[i];\r
+                               t.setRng(rng);\r
                        }\r
 \r
-                       return null;\r
+                       return node;\r
                },\r
 \r
-               findAttribRule : function(ru, n) {\r
-                       var i, wa = ru.wildAttribs;\r
-\r
-                       for (i = 0; i < wa.length; i++) {\r
-                               if (wa[i].nameRE.test(n))\r
-                                       return wa[i];\r
-                       }\r
+               isCollapsed : function() {\r
+                       var t = this, r = t.getRng(), s = t.getSel();\r
 \r
-                       return null;\r
-               },\r
+                       if (!r || r.item)\r
+                               return false;\r
 \r
-               serialize : function(n, o) {\r
-                       var h, t = this, doc, oldDoc, impl, selected;\r
+                       if (r.compareEndPoints)\r
+                               return r.compareEndPoints('StartToEnd', r) === 0;\r
 \r
-                       t._setup();\r
-                       o = o || {};\r
-                       o.format = o.format || 'html';\r
-                       t.processObj = o;\r
+                       return !s || r.collapsed;\r
+               },\r
 \r
-                       // IE looses the selected attribute on option elements so we need to store it\r
-                       // See: http://support.microsoft.com/kb/829907\r
-                       if (isIE) {\r
-                               selected = [];\r
-                               each(n.getElementsByTagName('option'), function(n) {\r
-                                       var v = t.dom.getAttrib(n, 'selected');\r
+               collapse : function(to_start) {\r
+                       var self = this, rng = self.getRng(), node;\r
 \r
-                                       selected.push(v ? v : null);\r
-                               });\r
+                       // Control range on IE\r
+                       if (rng.item) {\r
+                               node = rng.item(0);\r
+                               rng = self.win.document.body.createTextRange();\r
+                               rng.moveToElementText(node);\r
                        }\r
 \r
-                       n = n.cloneNode(true);\r
+                       rng.collapse(!!to_start);\r
+                       self.setRng(rng);\r
+               },\r
 \r
-                       // IE looses the selected attribute on option elements so we need to restore it\r
-                       if (isIE) {\r
-                               each(n.getElementsByTagName('option'), function(n, i) {\r
-                                       t.dom.setAttrib(n, 'selected', selected[i]);\r
-                               });\r
-                       }\r
+               getSel : function() {\r
+                       var t = this, w = this.win;\r
 \r
-                       // Nodes needs to be attached to something in WebKit/Opera\r
-                       // Older builds of Opera crashes if you attach the node to an document created dynamically\r
-                       // and since we can't feature detect a crash we need to sniff the acutal build number\r
-                       // This fix will make DOM ranges and make Sizzle happy!\r
-                       impl = n.ownerDocument.implementation;\r
-                       if (impl.createHTMLDocument && (tinymce.isOpera && opera.buildNumber() >= 1767)) {\r
-                               // Create an empty HTML document\r
-                               doc = impl.createHTMLDocument("");\r
+                       return w.getSelection ? w.getSelection() : w.document.selection;\r
+               },\r
 \r
-                               // Add the element or it's children if it's a body element to the new document\r
-                               each(n.nodeName == 'BODY' ? n.childNodes : [n], function(node) {\r
-                                       doc.body.appendChild(doc.importNode(node, true));\r
-                               });\r
+               getRng : function(w3c) {\r
+                       var t = this, s, r, elm, doc = t.win.document;\r
 \r
-                               // Grab first child or body element for serialization\r
-                               if (n.nodeName != 'BODY')\r
-                                       n = doc.body.firstChild;\r
-                               else\r
-                                       n = doc.body;\r
+                       // Found tridentSel object then we need to use that one\r
+                       if (w3c && t.tridentSel)\r
+                               return t.tridentSel.getRangeAt(0);\r
+\r
+                       try {\r
+                               if (s = t.getSel())\r
+                                       r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : doc.createRange());\r
+                       } catch (ex) {\r
+                               // IE throws unspecified error here if TinyMCE is placed in a frame/iframe\r
+                       }\r
 \r
-                               // set the new document in DOMUtils so createElement etc works\r
-                               oldDoc = t.dom.doc;\r
-                               t.dom.doc = doc;\r
+                       // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet\r
+                       if (tinymce.isIE && r && r.setStart && doc.selection.createRange().item) {\r
+                               elm = doc.selection.createRange().item(0);\r
+                               r = doc.createRange();\r
+                               r.setStartBefore(elm);\r
+                               r.setEndAfter(elm);\r
                        }\r
 \r
-                       t.key = '' + (parseInt(t.key) + 1);\r
+                       // No range found then create an empty one\r
+                       // This can occur when the editor is placed in a hidden container element on Gecko\r
+                       // Or on IE when there was an exception\r
+                       if (!r)\r
+                               r = doc.createRange ? doc.createRange() : doc.body.createTextRange();\r
 \r
-                       // Pre process\r
-                       if (!o.no_events) {\r
-                               o.node = n;\r
-                               t.onPreProcess.dispatch(t, o);\r
+                       if (t.selectedRange && t.explicitRange) {\r
+                               if (r.compareBoundaryPoints(r.START_TO_START, t.selectedRange) === 0 && r.compareBoundaryPoints(r.END_TO_END, t.selectedRange) === 0) {\r
+                                       // Safari, Opera and Chrome only ever select text which causes the range to change.\r
+                                       // This lets us use the originally set range if the selection hasn't been changed by the user.\r
+                                       r = t.explicitRange;\r
+                               } else {\r
+                                       t.selectedRange = null;\r
+                                       t.explicitRange = null;\r
+                               }\r
                        }\r
 \r
-                       // Serialize HTML DOM into a string\r
-                       t.writer.reset();\r
-                       t._info = o;\r
-                       t._serializeNode(n, o.getInner);\r
+                       return r;\r
+               },\r
+\r
+               setRng : function(r) {\r
+                       var s, t = this;\r
 \r
-                       // Post process\r
-                       o.content = t.writer.getContent();\r
+                       if (!t.tridentSel) {\r
+                               s = t.getSel();\r
 \r
-                       // Restore the old document if it was changed\r
-                       if (oldDoc)\r
-                               t.dom.doc = oldDoc;\r
+                               if (s) {\r
+                                       t.explicitRange = r;\r
 \r
-                       if (!o.no_events)\r
-                               t.onPostProcess.dispatch(t, o);\r
+                                       try {\r
+                                               s.removeAllRanges();\r
+                                       } catch (ex) {\r
+                                               // IE9 might throw errors here don't know why\r
+                                       }\r
 \r
-                       t._postProcess(o);\r
-                       o.node = null;\r
+                                       s.addRange(r);\r
+                                       // adding range isn't always successful so we need to check range count otherwise an exception can occur\r
+                                       t.selectedRange = s.rangeCount > 0 ? s.getRangeAt(0) : null;\r
+                               }\r
+                       } else {\r
+                               // Is W3C Range\r
+                               if (r.cloneRange) {\r
+                                       try {\r
+                                               t.tridentSel.addRange(r);\r
+                                               return;\r
+                                       } catch (ex) {\r
+                                               //IE9 throws an error here if called before selection is placed in the editor\r
+                                       }\r
+                               }\r
 \r
-                       return tinymce.trim(o.content);\r
+                               // Is IE specific range\r
+                               try {\r
+                                       r.select();\r
+                               } catch (ex) {\r
+                                       // Needed for some odd IE bug #1843306\r
+                               }\r
+                       }\r
                },\r
 \r
-               // Internal functions\r
+               setNode : function(n) {\r
+                       var t = this;\r
 \r
-               _postProcess : function(o) {\r
-                       var t = this, s = t.settings, h = o.content, sc = [], p;\r
-\r
-                       if (o.format == 'html') {\r
-                               // Protect some elements\r
-                               p = t._protect({\r
-                                       content : h,\r
-                                       patterns : [\r
-                                               {pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},\r
-                                               {pattern : /(<noscript[^>]*>)(.*?)(<\/noscript>)/g},\r
-                                               {pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},\r
-                                               {pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1},\r
-                                               {pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g}\r
-                                       ]\r
-                               });\r
+                       t.setContent(t.dom.getOuterHTML(n));\r
 \r
-                               h = p.content;\r
+                       return n;\r
+               },\r
 \r
-                               // Entity encode\r
-                               if (s.entity_encoding !== 'raw')\r
-                                       h = t._encode(h);\r
+               getNode : function() {\r
+                       var t = this, rng = t.getRng(), sel = t.getSel(), elm, start = rng.startContainer, end = rng.endContainer;\r
 \r
-                               // Use BR instead of &nbsp; padded P elements inside editor and use <p>&nbsp;</p> outside editor\r
-/*                             if (o.set)\r
-                                       h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>');\r
-                               else\r
-                                       h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');*/\r
+                       // Range maybe lost after the editor is made visible again\r
+                       if (!rng)\r
+                               return t.dom.getRoot();\r
 \r
-                               // Since Gecko and Safari keeps whitespace in the DOM we need to\r
-                               // remove it inorder to match other browsers. But I think Gecko and Safari is right.\r
-                               // This process is only done when getting contents out from the editor.\r
-                               if (!o.set) {\r
-                                       // We need to replace paragraph whitespace with an nbsp before indentation to keep the \u00a0 char\r
-                                       h = h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g, s.entity_encoding == 'numeric' ? '<p$1>&#160;</p>' : '<p$1>&nbsp;</p>');\r
+                       if (rng.setStart) {\r
+                               elm = rng.commonAncestorContainer;\r
 \r
-                                       if (s.remove_linebreaks) {\r
-                                               h = h.replace(/\r?\n|\r/g, ' ');\r
-                                               h = h.replace(/(<[^>]+>)\s+/g, '$1 ');\r
-                                               h = h.replace(/\s+(<\/[^>]+>)/g, ' $1');\r
-                                               h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start\r
-                                               h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start\r
-                                               h = h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '</$1>'); // Trim block end\r
+                               // Handle selection a image or other control like element such as anchors\r
+                               if (!rng.collapsed) {\r
+                                       if (rng.startContainer == rng.endContainer) {\r
+                                               if (rng.endOffset - rng.startOffset < 2) {\r
+                                                       if (rng.startContainer.hasChildNodes())\r
+                                                               elm = rng.startContainer.childNodes[rng.startOffset];\r
+                                               }\r
                                        }\r
 \r
-                                       // Simple indentation\r
-                                       if (s.apply_source_formatting && s.indent_mode == 'simple') {\r
-                                               // Add line breaks before and after block elements\r
-                                               h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n');\r
-                                               h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>');\r
-                                               h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n');\r
-                                               h = h.replace(/\n\n/g, '\n');\r
+                                       // If the anchor node is a element instead of a text node then return this element\r
+                                       //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)\r
+                                       //      return sel.anchorNode.childNodes[sel.anchorOffset];\r
+\r
+                                       // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.\r
+                                       // This happens when you double click an underlined word in FireFox.\r
+                                       if (start.nodeType === 3 && end.nodeType === 3) {\r
+                                               function skipEmptyTextNodes(n, forwards) {\r
+                                                       var orig = n;\r
+                                                       while (n && n.nodeType === 3 && n.length === 0) {\r
+                                                               n = forwards ? n.nextSibling : n.previousSibling;\r
+                                                       }\r
+                                                       return n || orig;\r
+                                               }\r
+                                               if (start.length === rng.startOffset) {\r
+                                                       start = skipEmptyTextNodes(start.nextSibling, true);\r
+                                               } else {\r
+                                                       start = start.parentNode;\r
+                                               }\r
+                                               if (rng.endOffset === 0) {\r
+                                                       end = skipEmptyTextNodes(end.previousSibling, false);\r
+                                               } else {\r
+                                                       end = end.parentNode;\r
+                                               }\r
+\r
+                                               if (start && start === end)\r
+                                                       return start;\r
                                        }\r
                                }\r
 \r
-                               h = t._unprotect(h, p);\r
+                               if (elm && elm.nodeType == 3)\r
+                                       return elm.parentNode;\r
 \r
-                               // Restore CDATA sections\r
-                               h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');\r
+                               return elm;\r
+                       }\r
 \r
-                               // Restore the \u00a0 character if raw mode is enabled\r
-                               if (s.entity_encoding == 'raw')\r
-                                       h = h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g, '<p$1>\u00a0</p>');\r
+                       return rng.item ? rng.item(0) : rng.parentElement();\r
+               },\r
 \r
-                               // Restore noscript elements\r
-                               h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {\r
-                                       return '<noscript' + attribs + '>' + t.dom.decode(text.replace(/<!--|-->/g, '')) + '</noscript>';\r
-                               });\r
+               getSelectedBlocks : function(st, en) {\r
+                       var t = this, dom = t.dom, sb, eb, n, bl = [];\r
+\r
+                       sb = dom.getParent(st || t.getStart(), dom.isBlock);\r
+                       eb = dom.getParent(en || t.getEnd(), dom.isBlock);\r
+\r
+                       if (sb)\r
+                               bl.push(sb);\r
+\r
+                       if (sb && eb && sb != eb) {\r
+                               n = sb;\r
+\r
+                               var walker = new tinymce.dom.TreeWalker(sb, dom.getRoot());\r
+                               while ((n = walker.next()) && n != eb) {\r
+                                       if (dom.isBlock(n))\r
+                                               bl.push(n);\r
+                               }\r
                        }\r
 \r
-                       o.content = h;\r
+                       if (eb && sb != eb)\r
+                               bl.push(eb);\r
+\r
+                       return bl;\r
                },\r
 \r
-               _serializeNode : function(n, inner) {\r
-                       var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed, keep, type;\r
+               normalize : function() {\r
+                       var self = this, rng, normalized;\r
 \r
-                       if (!s.node_filter || s.node_filter(n)) {\r
-                               switch (n.nodeType) {\r
-                                       case 1: // Element\r
-                                               if (n.hasAttribute ? n.hasAttribute('_mce_bogus') : n.getAttribute('_mce_bogus'))\r
-                                                       return;\r
+                       // TODO:\r
+                       // Retain selection direction.\r
+                       // Lean left/right on Gecko for inline elements.\r
+                       // Run this on mouse up/key up when the user manually moves the selection\r
 \r
-                                               iv = keep = false;\r
-                                               hc = n.hasChildNodes();\r
-                                               nn = n.getAttribute('_mce_name') || n.nodeName.toLowerCase();\r
+                       // Normalize only on non IE browsers for now\r
+                       if (tinymce.isIE)\r
+                               return;\r
 \r
-                                               // Get internal type\r
-                                               type = n.getAttribute('_mce_type');\r
-                                               if (type) {\r
-                                                       if (!t._info.cleanup) {\r
-                                                               iv = true;\r
-                                                               return;\r
-                                                       } else\r
-                                                               keep = 1;\r
-                                               }\r
+                       function normalizeEndPoint(start) {\r
+                               var container, offset, walker, dom = self.dom, body = dom.getRoot(), node;\r
 \r
-                                               // Add correct prefix on IE\r
-                                               if (isIE) {\r
-                                                       if (n.scopeName !== 'HTML' && n.scopeName !== 'html')\r
-                                                               nn = n.scopeName + ':' + nn;\r
-                                               }\r
+                               container = rng[(start ? 'start' : 'end') + 'Container'];\r
+                               offset = rng[(start ? 'start' : 'end') + 'Offset'];\r
 \r
-                                               // Remove mce prefix on IE needed for the abbr element\r
-                                               if (nn.indexOf('mce:') === 0)\r
-                                                       nn = nn.substring(4);\r
+                               // If the container is a document move it to the body element\r
+                               if (container.nodeType === 9) {\r
+                                       container = container.body;\r
+                                       offset = 0;\r
+                               }\r
 \r
-                                               // Check if valid\r
-                                               if (!keep) {\r
-                                                       if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inner) {\r
-                                                               iv = true;\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
+                               // If the container is body try move it into the closest text node or position\r
+                               // TODO: Add more logic here to handle element selection cases\r
+                               if (container === body) {\r
+                                       // Resolve the index\r
+                                       if (container.hasChildNodes()) {\r
+                                               container = container.childNodes[Math.min(!start && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1)];\r
+                                               offset = 0;\r
+\r
+                                               // Don't walk into elements that doesn't have any child nodes like a IMG\r
+                                               if (container.hasChildNodes()) {\r
+                                                       // Walk the DOM to find a text node to place the caret at or a BR\r
+                                                       node = container;\r
+                                                       walker = new tinymce.dom.TreeWalker(container, body);\r
+                                                       do {\r
+                                                               // Found a text node use that position\r
+                                                               if (node.nodeType === 3) {\r
+                                                                       offset = start ? 0 : node.nodeValue.length - 1;\r
+                                                                       container = node;\r
+                                                                       normalized = true;\r
+                                                                       break;\r
+                                                               }\r
 \r
-                                               if (isIE) {\r
-                                                       // Fix IE content duplication (DOM can have multiple copies of the same node)\r
-                                                       if (s.fix_content_duplication) {\r
-                                                               if (n._mce_serialized == t.key)\r
-                                                                       return;\r
+                                                               // Found a BR/IMG element that we can place the caret before\r
+                                                               if (/^(BR|IMG)$/.test(node.nodeName)) {\r
+                                                                       offset = dom.nodeIndex(node);\r
+                                                                       container = node.parentNode;\r
 \r
-                                                               n._mce_serialized = t.key;\r
-                                                       }\r
+                                                                       // Put caret after image when moving the end point\r
+                                                                       if (node.nodeName ==  "IMG" && !start) {\r
+                                                                               offset++;\r
+                                                                       }\r
 \r
-                                                       // IE sometimes adds a / infront of the node name\r
-                                                       if (nn.charAt(0) == '/')\r
-                                                               nn = nn.substring(1);\r
-                                               } else if (isGecko) {\r
-                                                       // Ignore br elements\r
-                                                       if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz')\r
-                                                               return;\r
+                                                                       normalized = true;\r
+                                                                       break;\r
+                                                               }\r
+                                                       } while (node = (start ? walker.next() : walker.prev()));\r
                                                }\r
+                                       }\r
+                               }\r
 \r
-                                               // Check if valid child\r
-                                               if (s.validate_children) {\r
-                                                       if (t.elementName && !t.schema.isValid(t.elementName, nn)) {\r
-                                                               iv = true;\r
-                                                               break;\r
-                                                       }\r
+                               // Set endpoint if it was normalized\r
+                               if (normalized)\r
+                                       rng['set' + (start ? 'Start' : 'End')](container, offset);\r
+                       };\r
 \r
-                                                       t.elementName = nn;\r
-                                               }\r
+                       rng = self.getRng();\r
 \r
-                                               ru = t.findRule(nn);\r
-                                               \r
-                                               // No valid rule for this element could be found then skip it\r
-                                               if (!ru) {\r
-                                                       iv = true;\r
-                                                       break;\r
-                                               }\r
+                       // Normalize the end points\r
+                       normalizeEndPoint(true);\r
 \r
-                                               nn = ru.name || nn;\r
-                                               closed = s.closed.test(nn);\r
+                       if (!rng.collapsed)\r
+                               normalizeEndPoint();\r
 \r
-                                               // Skip empty nodes or empty node name in IE\r
-                                               if ((!hc && ru.noEmpty) || (isIE && !nn)) {\r
-                                                       iv = true;\r
-                                                       break;\r
-                                               }\r
+                       // Set the selection if it was normalized\r
+                       if (normalized) {\r
+                               //console.log(self.dom.dumpRng(rng));\r
+                               self.setRng(rng);\r
+                       }\r
+               },\r
 \r
-                                               // Check required\r
-                                               if (ru.requiredAttribs) {\r
-                                                       a = ru.requiredAttribs;\r
+               destroy : function(s) {\r
+                       var t = this;\r
 \r
-                                                       for (i = a.length - 1; i >= 0; i--) {\r
-                                                               if (this.dom.getAttrib(n, a[i]) !== '')\r
-                                                                       break;\r
-                                                       }\r
+                       t.win = null;\r
 \r
-                                                       // None of the required was there\r
-                                                       if (i == -1) {\r
-                                                               iv = true;\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
+                       // Manual destroy then remove unload handler\r
+                       if (!s)\r
+                               tinymce.removeUnload(t.destroy);\r
+               },\r
 \r
-                                               w.writeStartElement(nn);\r
+               // IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode\r
+               _fixIESelection : function() {\r
+                       var dom = this.dom, doc = dom.doc, body = doc.body, started, startRng, htmlElm;\r
 \r
-                                               // Add ordered attributes\r
-                                               if (ru.attribs) {\r
-                                                       for (i=0, at = ru.attribs, l = at.length; i<l; i++) {\r
-                                                               a = at[i];\r
-                                                               v = t._getAttrib(n, a);\r
+                       // Make HTML element unselectable since we are going to handle selection by hand\r
+                       doc.documentElement.unselectable = true;\r
 \r
-                                                               if (v !== null)\r
-                                                                       w.writeAttribute(a.name, v);\r
-                                                       }\r
-                                               }\r
+                       // Return range from point or null if it failed\r
+                       function rngFromPoint(x, y) {\r
+                               var rng = body.createTextRange();\r
 \r
-                                               // Add wild attributes\r
-                                               if (ru.validAttribsRE) {\r
-                                                       at = t.dom.getAttribs(n);\r
-                                                       for (i=at.length-1; i>-1; i--) {\r
-                                                               no = at[i];\r
+                               try {\r
+                                       rng.moveToPoint(x, y);\r
+                               } catch (ex) {\r
+                                       // IE sometimes throws and exception, so lets just ignore it\r
+                                       rng = null;\r
+                               }\r
 \r
-                                                               if (no.specified) {\r
-                                                                       a = no.nodeName.toLowerCase();\r
+                               return rng;\r
+                       };\r
 \r
-                                                                       if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))\r
-                                                                               continue;\r
+                       // Fires while the selection is changing\r
+                       function selectionChange(e) {\r
+                               var pointRng;\r
 \r
-                                                                       ar = t.findAttribRule(ru, a);\r
-                                                                       v = t._getAttrib(n, ar, a);\r
+                               // Check if the button is down or not\r
+                               if (e.button) {\r
+                                       // Create range from mouse position\r
+                                       pointRng = rngFromPoint(e.x, e.y);\r
 \r
-                                                                       if (v !== null)\r
-                                                                               w.writeAttribute(a, v);\r
-                                                               }\r
-                                                       }\r
-                                               }\r
+                                       if (pointRng) {\r
+                                               // Check if pointRange is before/after selection then change the endPoint\r
+                                               if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\r
+                                                       pointRng.setEndPoint('StartToStart', startRng);\r
+                                               else\r
+                                                       pointRng.setEndPoint('EndToEnd', startRng);\r
 \r
-                                               // Keep type attribute\r
-                                               if (type && keep)\r
-                                                       w.writeAttribute('_mce_type', type);\r
+                                               pointRng.select();\r
+                                       }\r
+                               } else\r
+                                       endSelection();\r
+                       }\r
 \r
-                                               // Write text from script\r
-                                               if (nn === 'script' && tinymce.trim(n.innerHTML)) {\r
-                                                       w.writeText('// '); // Padd it with a comment so it will parse on older browsers\r
-                                                       w.writeCDATA(n.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g, '')); // Remove comments and cdata stuctures\r
-                                                       hc = false;\r
-                                                       break;\r
-                                               }\r
+                       // Removes listeners\r
+                       function endSelection() {\r
+                               var rng = doc.selection.createRange();\r
 \r
-                                               // Padd empty nodes with a &nbsp;\r
-                                               if (ru.padd) {\r
-                                                       // If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug\r
-                                                       if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {\r
-                                                               if (cn.hasAttribute ? cn.hasAttribute('_mce_bogus') : cn.getAttribute('_mce_bogus'))\r
-                                                                       w.writeText('\u00a0');\r
-                                                       } else if (!hc)\r
-                                                               w.writeText('\u00a0'); // No children then padd it\r
-                                               }\r
+                               // If the range is collapsed then use the last start range\r
+                               if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0)\r
+                                       startRng.select();\r
 \r
-                                               break;\r
+                               dom.unbind(doc, 'mouseup', endSelection);\r
+                               dom.unbind(doc, 'mousemove', selectionChange);\r
+                               startRng = started = 0;\r
+                       };\r
 \r
-                                       case 3: // Text\r
-                                               // Check if valid child\r
-                                               if (s.validate_children && t.elementName && !t.schema.isValid(t.elementName, '#text'))\r
-                                                       return;\r
+                       // Detect when user selects outside BODY\r
+                       dom.bind(doc, ['mousedown', 'contextmenu'], function(e) {\r
+                               if (e.target.nodeName === 'HTML') {\r
+                                       if (started)\r
+                                               endSelection();\r
 \r
-                                               return w.writeText(n.nodeValue);\r
+                                       // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\r
+                                       htmlElm = doc.documentElement;\r
+                                       if (htmlElm.scrollHeight > htmlElm.clientHeight)\r
+                                               return;\r
 \r
-                                       case 4: // CDATA\r
-                                               return w.writeCDATA(n.nodeValue);\r
+                                       started = 1;\r
+                                       // Setup start position\r
+                                       startRng = rngFromPoint(e.x, e.y);\r
+                                       if (startRng) {\r
+                                               // Listen for selection change events\r
+                                               dom.bind(doc, 'mouseup', endSelection);\r
+                                               dom.bind(doc, 'mousemove', selectionChange);\r
 \r
-                                       case 8: // Comment\r
-                                               return w.writeComment(n.nodeValue);\r
+                                               dom.win.focus();\r
+                                               startRng.select();\r
+                                       }\r
                                }\r
-                       } else if (n.nodeType == 1)\r
-                               hc = n.hasChildNodes();\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                       if (hc && !closed) {\r
-                               cn = n.firstChild;\r
+(function(tinymce) {\r
+       tinymce.dom.Serializer = function(settings, dom, schema) {\r
+               var onPreProcess, onPostProcess, isIE = tinymce.isIE, each = tinymce.each, htmlParser;\r
 \r
-                               while (cn) {\r
-                                       t._serializeNode(cn);\r
-                                       t.elementName = nn;\r
-                                       cn = cn.nextSibling;\r
-                               }\r
-                       }\r
+               // Support the old apply_source_formatting option\r
+               if (!settings.apply_source_formatting)\r
+                       settings.indent = false;\r
 \r
-                       // Write element end\r
-                       if (!iv) {\r
-                               if (!closed)\r
-                                       w.writeFullEndElement();\r
-                               else\r
-                                       w.writeEndElement();\r
-                       }\r
-               },\r
+               // Default DOM and Schema if they are undefined\r
+               dom = dom || tinymce.DOM;\r
+               schema = schema || new tinymce.html.Schema(settings);\r
+               settings.entity_encoding = settings.entity_encoding || 'named';\r
+               settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true;\r
 \r
-               _protect : function(o) {\r
-                       var t = this;\r
+               onPreProcess = new tinymce.util.Dispatcher(self);\r
 \r
-                       o.items = o.items || [];\r
+               onPostProcess = new tinymce.util.Dispatcher(self);\r
 \r
-                       function enc(s) {\r
-                               return s.replace(/[\r\n\\]/g, function(c) {\r
-                                       if (c === '\n')\r
-                                               return '\\n';\r
-                                       else if (c === '\\')\r
-                                               return '\\\\';\r
+               htmlParser = new tinymce.html.DomParser(settings, schema);\r
 \r
-                                       return '\\r';\r
-                               });\r
-                       };\r
+               // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed\r
+               htmlParser.addAttributeFilter('src,href,style', function(nodes, name) {\r
+                       var i = nodes.length, node, value, internalName = 'data-mce-' + name, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef;\r
 \r
-                       function dec(s) {\r
-                               return s.replace(/\\[\\rn]/g, function(c) {\r
-                                       if (c === '\\n')\r
-                                               return '\n';\r
-                                       else if (c === '\\\\')\r
-                                               return '\\';\r
+                       while (i--) {\r
+                               node = nodes[i];\r
 \r
-                                       return '\r';\r
-                               });\r
-                       };\r
+                               value = node.attributes.map[internalName];\r
+                               if (value !== undef) {\r
+                                       // Set external name to internal value and remove internal\r
+                                       node.attr(name, value.length > 0 ? value : null);\r
+                                       node.attr(internalName, null);\r
+                               } else {\r
+                                       // No internal attribute found then convert the value we have in the DOM\r
+                                       value = node.attributes.map[name];\r
 \r
-                       each(o.patterns, function(p) {\r
-                               o.content = dec(enc(o.content).replace(p.pattern, function(x, a, b, c) {\r
-                                       b = dec(b);\r
+                                       if (name === "style")\r
+                                               value = dom.serializeStyle(dom.parseStyle(value), node.name);\r
+                                       else if (urlConverter)\r
+                                               value = urlConverter.call(urlConverterScope, value, name, node.name);\r
 \r
-                                       if (p.encode)\r
-                                               b = t._encode(b);\r
+                                       node.attr(name, value.length > 0 ? value : null);\r
+                               }\r
+                       }\r
+               });\r
 \r
-                                       o.items.push(b);\r
-                                       return a + '<!--mce:' + (o.items.length - 1) + '-->' + c;\r
-                               }));\r
-                       });\r
+               // Remove internal classes mceItem<..>\r
+               htmlParser.addAttributeFilter('class', function(nodes, name) {\r
+                       var i = nodes.length, node, value;\r
 \r
-                       return o;\r
-               },\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               value = node.attr('class').replace(/\s*mce(Item\w+|Selected)\s*/g, '');\r
+                               node.attr('class', value.length > 0 ? value : null);\r
+                       }\r
+               });\r
 \r
-               _unprotect : function(h, o) {\r
-                       h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {\r
-                               return o.items[parseInt(b)];\r
-                       });\r
+               // Remove bookmark elements\r
+               htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) {\r
+                       var i = nodes.length, node;\r
 \r
-                       o.items = [];\r
+                       while (i--) {\r
+                               node = nodes[i];\r
 \r
-                       return h;\r
-               },\r
+                               if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup)\r
+                                       node.remove();\r
+                       }\r
+               });\r
 \r
-               _encode : function(h) {\r
-                       var t = this, s = t.settings, l;\r
+               // Remove expando attributes\r
+               htmlParser.addAttributeFilter('data-mce-expando', function(nodes, name, args) {\r
+                       var i = nodes.length;\r
 \r
-                       // Entity encode\r
-                       if (s.entity_encoding !== 'raw') {\r
-                               if (s.entity_encoding.indexOf('named') != -1) {\r
-                                       t.setEntities(s.entities);\r
-                                       l = t.entityLookup;\r
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
+                       }\r
+               });\r
 \r
-                                       h = h.replace(/[\u007E-\uFFFF]/g, function(a) {\r
-                                               var v;\r
+               // Force script into CDATA sections and remove the mce- prefix also add comments around styles\r
+               htmlParser.addNodeFilter('script,style', function(nodes, name) {\r
+                       var i = nodes.length, node, value;\r
+\r
+                       function trim(value) {\r
+                               return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n')\r
+                                               .replace(/^[\r\n]*|[\r\n]*$/g, '')\r
+                                               .replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi, '')\r
+                                               .replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, '');\r
+                       };\r
 \r
-                                               if (v = l[a])\r
-                                                       a = '&' + v + ';';\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               value = node.firstChild ? node.firstChild.value : '';\r
 \r
-                                               return a;\r
-                                       });\r
+                               if (name === "script") {\r
+                                       // Remove mce- prefix from script elements\r
+                                       node.attr('type', (node.attr('type') || 'text/javascript').replace(/^mce\-/, ''));\r
+\r
+                                       if (value.length > 0)\r
+                                               node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';\r
+                               } else {\r
+                                       if (value.length > 0)\r
+                                               node.firstChild.value = '<!--\n' + trim(value) + '\n-->';\r
                                }\r
+                       }\r
+               });\r
 \r
-                               if (s.entity_encoding.indexOf('numeric') != -1) {\r
-                                       h = h.replace(/[\u007E-\uFFFF]/g, function(a) {\r
-                                               return '&#' + a.charCodeAt(0) + ';';\r
-                                       });\r
+               // Convert comments to cdata and handle protected comments\r
+               htmlParser.addNodeFilter('#comment', function(nodes, name) {\r
+                       var i = nodes.length, node;\r
+\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+\r
+                               if (node.value.indexOf('[CDATA[') === 0) {\r
+                                       node.name = '#cdata';\r
+                                       node.type = 4;\r
+                                       node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');\r
+                               } else if (node.value.indexOf('mce:protected ') === 0) {\r
+                                       node.name = "#text";\r
+                                       node.type = 3;\r
+                                       node.raw = true;\r
+                                       node.value = unescape(node.value).substr(14);\r
                                }\r
                        }\r
+               });\r
 \r
-                       return h;\r
-               },\r
+               htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) {\r
+                       var i = nodes.length, node;\r
 \r
-               _setup : function() {\r
-                       var t = this, s = this.settings;\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               if (node.type === 7)\r
+                                       node.remove();\r
+                               else if (node.type === 1) {\r
+                                       if (name === "input" && !("type" in node.attributes.map))\r
+                                               node.attr('type', 'text');\r
+                               }\r
+                       }\r
+               });\r
 \r
-                       if (t.done)\r
-                               return;\r
+               // Fix list elements, TODO: Replace this later\r
+               if (settings.fix_list_elements) {\r
+                       htmlParser.addNodeFilter('ul,ol', function(nodes, name) {\r
+                               var i = nodes.length, node, parentNode;\r
 \r
-                       t.done = 1;\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       parentNode = node.parent;\r
 \r
-                       t.setRules(s.valid_elements);\r
-                       t.addRules(s.extended_valid_elements);\r
+                                       if (parentNode.name === 'ul' || parentNode.name === 'ol') {\r
+                                               if (node.prev && node.prev.name === 'li') {\r
+                                                       node.prev.append(node);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
 \r
-                       if (s.invalid_elements)\r
-                               t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');\r
+               // Remove internal data attributes\r
+               htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style', function(nodes, name) {\r
+                       var i = nodes.length;\r
 \r
-                       if (s.attrib_value_filter)\r
-                               t.attribValueFilter = s.attribValueFilter;\r
-               },\r
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
+                       }\r
+               });\r
 \r
-               _getAttrib : function(n, a, na) {\r
-                       var i, v;\r
+               // Return public methods\r
+               return {\r
+                       schema : schema,\r
 \r
-                       na = na || a.name;\r
+                       addNodeFilter : htmlParser.addNodeFilter,\r
 \r
-                       if (a.forcedVal && (v = a.forcedVal)) {\r
-                               if (v === '{$uid}')\r
-                                       return this.dom.uniqueId();\r
+                       addAttributeFilter : htmlParser.addAttributeFilter,\r
 \r
-                               return v;\r
-                       }\r
+                       onPreProcess : onPreProcess,\r
 \r
-                       v = this.dom.getAttrib(n, na);\r
+                       onPostProcess : onPostProcess,\r
 \r
-                       switch (na) {\r
-                               case 'rowspan':\r
-                               case 'colspan':\r
-                                       // Whats the point? Remove usless attribute value\r
-                                       if (v == '1')\r
-                                               v = '';\r
+                       serialize : function(node, args) {\r
+                               var impl, doc, oldDoc, htmlSerializer, content;\r
 \r
-                                       break;\r
-                       }\r
+                               // Explorer won't clone contents of script and style and the\r
+                               // selected index of select elements are cleared on a clone operation.\r
+                               if (isIE && dom.select('script,style,select,map').length > 0) {\r
+                                       content = node.innerHTML;\r
+                                       node = node.cloneNode(false);\r
+                                       dom.setHTML(node, content);\r
+                               } else\r
+                                       node = node.cloneNode(true);\r
+\r
+                               // Nodes needs to be attached to something in WebKit/Opera\r
+                               // Older builds of Opera crashes if you attach the node to an document created dynamically\r
+                               // and since we can't feature detect a crash we need to sniff the acutal build number\r
+                               // This fix will make DOM ranges and make Sizzle happy!\r
+                               impl = node.ownerDocument.implementation;\r
+                               if (impl.createHTMLDocument) {\r
+                                       // Create an empty HTML document\r
+                                       doc = impl.createHTMLDocument("");\r
+\r
+                                       // Add the element or it's children if it's a body element to the new document\r
+                                       each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) {\r
+                                               doc.body.appendChild(doc.importNode(node, true));\r
+                                       });\r
 \r
-                       if (this.attribValueFilter)\r
-                               v = this.attribValueFilter(na, v, n);\r
+                                       // Grab first child or body element for serialization\r
+                                       if (node.nodeName != 'BODY')\r
+                                               node = doc.body.firstChild;\r
+                                       else\r
+                                               node = doc.body;\r
 \r
-                       if (a.validVals) {\r
-                               for (i = a.validVals.length - 1; i >= 0; i--) {\r
-                                       if (v == a.validVals[i])\r
-                                               break;\r
+                                       // set the new document in DOMUtils so createElement etc works\r
+                                       oldDoc = dom.doc;\r
+                                       dom.doc = doc;\r
                                }\r
 \r
-                               if (i == -1)\r
-                                       return null;\r
-                       }\r
+                               args = args || {};\r
+                               args.format = args.format || 'html';\r
 \r
-                       if (v === '' && typeof(a.defaultVal) != 'undefined') {\r
-                               v = a.defaultVal;\r
+                               // Pre process\r
+                               if (!args.no_events) {\r
+                                       args.node = node;\r
+                                       onPreProcess.dispatch(self, args);\r
+                               }\r
 \r
-                               if (v === '{$uid}')\r
-                                       return this.dom.uniqueId();\r
+                               // Setup serializer\r
+                               htmlSerializer = new tinymce.html.Serializer(settings, schema);\r
 \r
-                               return v;\r
-                       } else {\r
-                               // Remove internal mceItemXX classes when content is extracted from editor\r
-                               if (na == 'class' && this.processObj.get)\r
-                                       v = v.replace(/\s?mceItem\w+\s?/g, '');\r
-                       }\r
+                               // Parse and serialize HTML\r
+                               args.content = htmlSerializer.serialize(\r
+                                       htmlParser.parse(args.getInner ? node.innerHTML : tinymce.trim(dom.getOuterHTML(node), args), args)\r
+                               );\r
 \r
-                       if (v === '')\r
-                               return null;\r
+                               // Replace all BOM characters for now until we can find a better solution\r
+                               if (!args.cleanup)\r
+                                       args.content = args.content.replace(/\uFEFF|\u200B/g, '');\r
 \r
+                               // Post process\r
+                               if (!args.no_events)\r
+                                       onPostProcess.dispatch(self, args);\r
 \r
-                       return v;\r
-               }\r
-       });\r
-})(tinymce);\r
+                               // Restore the old document if it was changed\r
+                               if (oldDoc)\r
+                                       dom.doc = oldDoc;\r
+\r
+                               args.node = null;\r
+\r
+                               return args.content;\r
+                       },\r
 \r
+                       addRules : function(rules) {\r
+                               schema.addValidElements(rules);\r
+                       },\r
+\r
+                       setRules : function(rules) {\r
+                               schema.setValidElements(rules);\r
+                       }\r
+               };\r
+       };\r
+})(tinymce);\r
 (function(tinymce) {\r
        tinymce.dom.ScriptLoader = function(settings) {\r
                var QUEUED = 0,\r
@@ -6850,6 +9277,17 @@ window.tinymce.dom.Sizzle = Sizzle;
 \r
                                callback();\r
                        };\r
+                       \r
+                       function error() {\r
+                               // Report the error so it's easier for people to spot loading errors\r
+                               if (typeof(console) !== "undefined" && console.log)\r
+                                       console.log("Failed to load: " + url);\r
+\r
+                               // We can't mark it as done if there is a load error since\r
+                               // A) We don't want to produce 404 errors on the server and\r
+                               // B) the onerror event won't fire on all browsers.\r
+                               // done();\r
+                       };\r
 \r
                        id = dom.uniqueId();\r
 \r
@@ -6859,7 +9297,7 @@ window.tinymce.dom.Sizzle = Sizzle;
 \r
                                // If script is from same domain and we\r
                                // use IE 6 then use XHR since it's more reliable\r
-                               if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol) {\r
+                               if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol && uri.protocol.toLowerCase() != 'file') {\r
                                        tinymce.util.XHR.send({\r
                                                url : tinymce._addVer(uri.getURI()),\r
                                                success : function(content) {\r
@@ -6874,7 +9312,9 @@ window.tinymce.dom.Sizzle = Sizzle;
                                                        dom.remove(script);\r
 \r
                                                        done();\r
-                                               }\r
+                                               },\r
+                                               \r
+                                               error : error\r
                                        });\r
 \r
                                        return;\r
@@ -6888,17 +9328,26 @@ window.tinymce.dom.Sizzle = Sizzle;
                                src : tinymce._addVer(url)\r
                        });\r
 \r
-                       // Add onload and readystate listeners\r
-                       elm.onload = done;\r
-                       elm.onreadystatechange = function() {\r
-                               var state = elm.readyState;\r
+                       // Add onload listener for non IE browsers since IE9\r
+                       // fires onload event before the script is parsed and executed\r
+                       if (!tinymce.isIE)\r
+                               elm.onload = done;\r
 \r
-                               // Loaded state is passed on IE 6 however there\r
-                               // are known issues with this method but we can't use\r
-                               // XHR in a cross domain loading\r
-                               if (state == 'complete' || state == 'loaded')\r
-                                       done();\r
-                       };\r
+                       // Add onerror event will get fired on some browsers but not all of them\r
+                       elm.onerror = error;\r
+\r
+                       // Opera 9.60 doesn't seem to fire the onreadystate event at correctly\r
+                       if (!tinymce.isOpera) {\r
+                               elm.onreadystatechange = function() {\r
+                                       var state = elm.readyState;\r
+\r
+                                       // Loaded state is passed on IE 6 however there\r
+                                       // are known issues with this method but we can't use\r
+                                       // XHR in a cross domain loading\r
+                                       if (state == 'complete' || state == 'loaded')\r
+                                               done();\r
+                               };\r
+                       }\r
 \r
                        // Most browsers support this feature so we report errors\r
                        // for those at least to help users track their missing plugins etc\r
@@ -7046,164 +9495,10 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
        };\r
 \r
        this.prev = function(shallow) {\r
-               return (node = findSibling(node, 'lastChild', 'lastSibling', shallow));\r
+               return (node = findSibling(node, 'lastChild', 'previousSibling', shallow));\r
        };\r
 };\r
 \r
-(function() {\r
-       var transitional = {};\r
-\r
-       function unpack(lookup, data) {\r
-               var key;\r
-\r
-               function replace(value) {\r
-                       return value.replace(/[A-Z]+/g, function(key) {\r
-                               return replace(lookup[key]);\r
-                       });\r
-               };\r
-\r
-               // Unpack lookup\r
-               for (key in lookup) {\r
-                       if (lookup.hasOwnProperty(key))\r
-                               lookup[key] = replace(lookup[key]);\r
-               }\r
-\r
-               // Unpack and parse data into object map\r
-               replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]/g, function(str, name, children) {\r
-                       var i, map = {};\r
-\r
-                       children = children.split(/\|/);\r
-\r
-                       for (i = children.length - 1; i >= 0; i--)\r
-                               map[children[i]] = 1;\r
-\r
-                       transitional[name] = map;\r
-               });\r
-       };\r
-\r
-       // This is the XHTML 1.0 transitional elements with it's children packed to reduce it's size\r
-       // we will later include the attributes here and use it as a default for valid elements but it\r
-       // requires us to rewrite the serializer engine\r
-       unpack({\r
-               Z : '#|H|K|N|O|P',\r
-               Y : '#|X|form|R|Q',\r
-               X : 'p|T|div|U|W|isindex|fieldset|table',\r
-               W : 'pre|hr|blockquote|address|center|noframes',\r
-               U : 'ul|ol|dl|menu|dir',\r
-               ZC : '#|p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q',\r
-               T : 'h1|h2|h3|h4|h5|h6',\r
-               ZB : '#|X|S|Q',\r
-               S : 'R|P',\r
-               ZA : '#|a|G|J|M|O|P',\r
-               R : '#|a|H|K|N|O',\r
-               Q : 'noscript|P',\r
-               P : 'ins|del|script',\r
-               O : 'input|select|textarea|label|button',\r
-               N : 'M|L',\r
-               M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym',\r
-               L : 'sub|sup',\r
-               K : 'J|I',\r
-               J : 'tt|i|b|u|s|strike',\r
-               I : 'big|small|font|basefont',\r
-               H : 'G|F',\r
-               G : 'br|span|bdo',\r
-               F : 'object|applet|img|map|iframe'\r
-       }, 'script[]' + \r
-               'style[]' + \r
-               'object[#|param|X|form|a|H|K|N|O|Q]' + \r
-               'param[]' + \r
-               'p[S]' + \r
-               'a[Z]' + \r
-               'br[]' + \r
-               'span[S]' + \r
-               'bdo[S]' + \r
-               'applet[#|param|X|form|a|H|K|N|O|Q]' + \r
-               'h1[S]' + \r
-               'img[]' + \r
-               'map[X|form|Q|area]' + \r
-               'h2[S]' + \r
-               'iframe[#|X|form|a|H|K|N|O|Q]' + \r
-               'h3[S]' + \r
-               'tt[S]' + \r
-               'i[S]' + \r
-               'b[S]' + \r
-               'u[S]' + \r
-               's[S]' + \r
-               'strike[S]' + \r
-               'big[S]' + \r
-               'small[S]' + \r
-               'font[S]' + \r
-               'basefont[]' + \r
-               'em[S]' + \r
-               'strong[S]' + \r
-               'dfn[S]' + \r
-               'code[S]' + \r
-               'q[S]' + \r
-               'samp[S]' + \r
-               'kbd[S]' + \r
-               'var[S]' + \r
-               'cite[S]' + \r
-               'abbr[S]' + \r
-               'acronym[S]' + \r
-               'sub[S]' + \r
-               'sup[S]' + \r
-               'input[]' + \r
-               'select[optgroup|option]' + \r
-               'optgroup[option]' + \r
-               'option[]' + \r
-               'textarea[]' + \r
-               'label[S]' + \r
-               'button[#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' + \r
-               'h4[S]' + \r
-               'ins[#|X|form|a|H|K|N|O|Q]' + \r
-               'h5[S]' + \r
-               'del[#|X|form|a|H|K|N|O|Q]' + \r
-               'h6[S]' + \r
-               'div[#|X|form|a|H|K|N|O|Q]' + \r
-               'ul[li]' + \r
-               'li[#|X|form|a|H|K|N|O|Q]' + \r
-               'ol[li]' + \r
-               'dl[dt|dd]' + \r
-               'dt[S]' + \r
-               'dd[#|X|form|a|H|K|N|O|Q]' + \r
-               'menu[li]' + \r
-               'dir[li]' + \r
-               'pre[ZA]' + \r
-               'hr[]' + \r
-               'blockquote[#|X|form|a|H|K|N|O|Q]' + \r
-               'address[S|p]' + \r
-               'center[#|X|form|a|H|K|N|O|Q]' + \r
-               'noframes[#|X|form|a|H|K|N|O|Q]' + \r
-               'isindex[]' + \r
-               'fieldset[#|legend|X|form|a|H|K|N|O|Q]' + \r
-               'legend[S]' + \r
-               'table[caption|col|colgroup|thead|tfoot|tbody|tr]' + \r
-               'caption[S]' + \r
-               'col[]' + \r
-               'colgroup[col]' + \r
-               'thead[tr]' + \r
-               'tr[th|td]' + \r
-               'th[#|X|form|a|H|K|N|O|Q]' + \r
-               'form[#|X|a|H|K|N|O|Q]' + \r
-               'noscript[#|X|form|a|H|K|N|O|Q]' + \r
-               'td[#|X|form|a|H|K|N|O|Q]' + \r
-               'tfoot[tr]' + \r
-               'tbody[tr]' + \r
-               'area[]' + \r
-               'base[]' + \r
-               'body[#|X|form|a|H|K|N|O|Q]'\r
-       );\r
-\r
-       tinymce.dom.Schema = function() {\r
-               var t = this, elements = transitional;\r
-\r
-               t.isValid = function(name, child_name) {\r
-                       var element = elements[name];\r
-\r
-                       return !!(element && (!child_name || element[child_name]));\r
-               };\r
-       };\r
-})();\r
 (function(tinymce) {\r
        tinymce.dom.RangeUtils = function(dom) {\r
                var INVISIBLE_CHAR = '\uFEFF';\r
@@ -7227,6 +9522,24 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                                return;\r
                        }\r
 \r
+                       function exclude(nodes) {\r
+                               var node;\r
+\r
+                               // First node is excluded\r
+                               node = nodes[0];\r
+                               if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {\r
+                                       nodes.splice(0, 1);\r
+                               }\r
+\r
+                               // Last node is excluded\r
+                               node = nodes[nodes.length - 1];\r
+                               if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {\r
+                                       nodes.splice(nodes.length - 1, 1);\r
+                               }\r
+\r
+                               return nodes;\r
+                       };\r
+\r
                        function collectSiblings(node, name, end_node) {\r
                                var siblings = [];\r
 \r
@@ -7256,7 +9569,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                                                if (!next)\r
                                                        siblings.reverse();\r
 \r
-                                               callback(siblings);\r
+                                               callback(exclude(siblings));\r
                                        }\r
                                }\r
                        };\r
@@ -7267,30 +9580,30 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
 \r
                        // If index based end position then resolve it\r
                        if (endContainer.nodeType == 1 && endContainer.hasChildNodes())\r
-                               endContainer = endContainer.childNodes[Math.min(startOffset == endOffset ? endOffset : endOffset - 1, endContainer.childNodes.length - 1)];\r
-\r
-                       // Find common ancestor and end points\r
-                       ancestor = dom.findCommonAncestor(startContainer, endContainer);\r
+                               endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)];\r
 \r
                        // Same container\r
                        if (startContainer == endContainer)\r
-                               return callback([startContainer]);\r
+                               return callback(exclude([startContainer]));\r
 \r
+                       // Find common ancestor and end points\r
+                       ancestor = dom.findCommonAncestor(startContainer, endContainer);\r
+                               \r
                        // Process left side\r
                        for (node = startContainer; node; node = node.parentNode) {\r
-                               if (node == endContainer)\r
+                               if (node === endContainer)\r
                                        return walkBoundary(startContainer, ancestor, true);\r
 \r
-                               if (node == ancestor)\r
+                               if (node === ancestor)\r
                                        break;\r
                        }\r
 \r
                        // Process right side\r
                        for (node = endContainer; node; node = node.parentNode) {\r
-                               if (node == startContainer)\r
+                               if (node === startContainer)\r
                                        return walkBoundary(endContainer, ancestor);\r
 \r
-                               if (node == ancestor)\r
+                               if (node === ancestor)\r
                                        break;\r
                        }\r
 \r
@@ -7309,48 +9622,46 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                        );\r
 \r
                        if (siblings.length)\r
-                               callback(siblings);\r
+                               callback(exclude(siblings));\r
 \r
                        // Walk right leaf\r
                        walkBoundary(endContainer, endPoint);\r
                };\r
 \r
-               /*              this.split = function(rng) {\r
+               this.split = function(rng) {\r
                        var startContainer = rng.startContainer,\r
                                startOffset = rng.startOffset,\r
                                endContainer = rng.endContainer,\r
                                endOffset = rng.endOffset;\r
 \r
                        function splitText(node, offset) {\r
-                               if (offset == node.nodeValue.length)\r
-                                       node.appendData(INVISIBLE_CHAR);\r
-\r
-                               node = node.splitText(offset);\r
-\r
-                               if (node.nodeValue === INVISIBLE_CHAR)\r
-                                       node.nodeValue = '';\r
-\r
-                               return node;\r
+                               return node.splitText(offset);\r
                        };\r
 \r
                        // Handle single text node\r
-                       if (startContainer == endContainer) {\r
-                               if (startContainer.nodeType == 3) {\r
-                                       if (startOffset != 0)\r
-                                               startContainer = endContainer = splitText(startContainer, startOffset);\r
-\r
-                                       if (endOffset - startOffset != startContainer.nodeValue.length)\r
-                                               splitText(startContainer, endOffset - startOffset);\r
+                       if (startContainer == endContainer && startContainer.nodeType == 3) {\r
+                               if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {\r
+                                       endContainer = splitText(startContainer, startOffset);\r
+                                       startContainer = endContainer.previousSibling;\r
+\r
+                                       if (endOffset > startOffset) {\r
+                                               endOffset = endOffset - startOffset;\r
+                                               startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;\r
+                                               endOffset = endContainer.nodeValue.length;\r
+                                               startOffset = 0;\r
+                                       } else {\r
+                                               endOffset = 0;\r
+                                       }\r
                                }\r
                        } else {\r
                                // Split startContainer text node if needed\r
-                               if (startContainer.nodeType == 3 && startOffset != 0) {\r
+                               if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) {\r
                                        startContainer = splitText(startContainer, startOffset);\r
                                        startOffset = 0;\r
                                }\r
 \r
                                // Split endContainer text node if needed\r
-                               if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) {\r
+                               if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) {\r
                                        endContainer = splitText(endContainer, endOffset).previousSibling;\r
                                        endOffset = endContainer.nodeValue.length;\r
                                }\r
@@ -7363,7 +9674,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                                endOffset : endOffset\r
                        };\r
                };\r
-*/\r
+\r
        };\r
 \r
        tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) {\r
@@ -7374,17 +9685,164 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                                if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))\r
                                        return true;\r
 \r
-                               // Both are text ranges and the range matches\r
-                               if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))\r
-                                       return true;\r
-                       } else {\r
-                               // Compare w3c ranges\r
-                               return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;\r
+                               // Both are text ranges and the range matches\r
+                               if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))\r
+                                       return true;\r
+                       } else {\r
+                               // Compare w3c ranges\r
+                               return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;\r
+                       }\r
+               }\r
+\r
+               return false;\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Event = tinymce.dom.Event, each = tinymce.each;\r
+\r
+       tinymce.create('tinymce.ui.KeyboardNavigation', {\r
+               KeyboardNavigation: function(settings, dom) {\r
+                       var t = this, root = settings.root, items = settings.items,\r
+                                       enableUpDown = settings.enableUpDown, enableLeftRight = settings.enableLeftRight || !settings.enableUpDown,\r
+                                       excludeFromTabOrder = settings.excludeFromTabOrder,\r
+                                       itemFocussed, itemBlurred, rootKeydown, rootFocussed, focussedId;\r
+\r
+                       dom = dom || tinymce.DOM;\r
+\r
+                       itemFocussed = function(evt) {\r
+                               focussedId = evt.target.id;\r
+                       };\r
+                       \r
+                       itemBlurred = function(evt) {\r
+                               dom.setAttrib(evt.target.id, 'tabindex', '-1');\r
+                       };\r
+                       \r
+                       rootFocussed = function(evt) {\r
+                               var item = dom.get(focussedId);\r
+                               dom.setAttrib(item, 'tabindex', '0');\r
+                               item.focus();\r
+                       };\r
+                       \r
+                       t.focus = function() {\r
+                               dom.get(focussedId).focus();\r
+                       };\r
+\r
+                       t.destroy = function() {\r
+                               each(items, function(item) {\r
+                                       dom.unbind(dom.get(item.id), 'focus', itemFocussed);\r
+                                       dom.unbind(dom.get(item.id), 'blur', itemBlurred);\r
+                               });\r
+\r
+                               dom.unbind(dom.get(root), 'focus', rootFocussed);\r
+                               dom.unbind(dom.get(root), 'keydown', rootKeydown);\r
+\r
+                               items = dom = root = t.focus = itemFocussed = itemBlurred = rootKeydown = rootFocussed = null;\r
+                               t.destroy = function() {};\r
+                       };\r
+                       \r
+                       t.moveFocus = function(dir, evt) {\r
+                               var idx = -1, controls = t.controls, newFocus;\r
+\r
+                               if (!focussedId)\r
+                                       return;\r
+\r
+                               each(items, function(item, index) {\r
+                                       if (item.id === focussedId) {\r
+                                               idx = index;\r
+                                               return false;\r
+                                       }\r
+                               });\r
+\r
+                               idx += dir;\r
+                               if (idx < 0) {\r
+                                       idx = items.length - 1;\r
+                               } else if (idx >= items.length) {\r
+                                       idx = 0;\r
+                               }\r
+                               \r
+                               newFocus = items[idx];\r
+                               dom.setAttrib(focussedId, 'tabindex', '-1');\r
+                               dom.setAttrib(newFocus.id, 'tabindex', '0');\r
+                               dom.get(newFocus.id).focus();\r
+\r
+                               if (settings.actOnFocus) {\r
+                                       settings.onAction(newFocus.id);\r
+                               }\r
+\r
+                               if (evt)\r
+                                       Event.cancel(evt);\r
+                       };\r
+                       \r
+                       rootKeydown = function(evt) {\r
+                               var DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_ESCAPE = 27, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;\r
+                               \r
+                               switch (evt.keyCode) {\r
+                                       case DOM_VK_LEFT:\r
+                                               if (enableLeftRight) t.moveFocus(-1);\r
+                                               break;\r
+       \r
+                                       case DOM_VK_RIGHT:\r
+                                               if (enableLeftRight) t.moveFocus(1);\r
+                                               break;\r
+       \r
+                                       case DOM_VK_UP:\r
+                                               if (enableUpDown) t.moveFocus(-1);\r
+                                               break;\r
+\r
+                                       case DOM_VK_DOWN:\r
+                                               if (enableUpDown) t.moveFocus(1);\r
+                                               break;\r
+\r
+                                       case DOM_VK_ESCAPE:\r
+                                               if (settings.onCancel) {\r
+                                                       settings.onCancel();\r
+                                                       Event.cancel(evt);\r
+                                               }\r
+                                               break;\r
+\r
+                                       case DOM_VK_ENTER:\r
+                                       case DOM_VK_RETURN:\r
+                                       case DOM_VK_SPACE:\r
+                                               if (settings.onAction) {\r
+                                                       settings.onAction(focussedId);\r
+                                                       Event.cancel(evt);\r
+                                               }\r
+                                               break;\r
+                               }\r
+                       };\r
+\r
+                       // Set up state and listeners for each item.\r
+                       each(items, function(item, idx) {\r
+                               var tabindex;\r
+\r
+                               if (!item.id) {\r
+                                       item.id = dom.uniqueId('_mce_item_');\r
+                               }\r
+\r
+                               if (excludeFromTabOrder) {\r
+                                       dom.bind(item.id, 'blur', itemBlurred);\r
+                                       tabindex = '-1';\r
+                               } else {\r
+                                       tabindex = (idx === 0 ? '0' : '-1');\r
+                               }\r
+\r
+                               dom.setAttrib(item.id, 'tabindex', tabindex);\r
+                               dom.bind(dom.get(item.id), 'focus', itemFocussed);\r
+                       });\r
+                       \r
+                       // Setup initial state for root element.\r
+                       if (items[0]){\r
+                               focussedId = items[0].id;\r
                        }\r
-               }\r
 \r
-               return false;\r
-       };\r
+                       dom.setAttrib(root, 'tabindex', '-1');\r
+                       \r
+                       // Setup listeners for root element.\r
+                       dom.bind(dom.get(root), 'focus', rootFocussed);\r
+                       dom.bind(dom.get(root), 'keydown', rootKeydown);\r
+               }\r
+       });\r
 })(tinymce);\r
 \r
 (function(tinymce) {\r
@@ -7392,7 +9850,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
        var DOM = tinymce.DOM, is = tinymce.is;\r
 \r
        tinymce.create('tinymce.ui.Control', {\r
-               Control : function(id, s) {\r
+               Control : function(id, s, editor) {\r
                        this.id = id;\r
                        this.settings = s = s || {};\r
                        this.rendered = false;\r
@@ -7401,22 +9859,23 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                        this.scope = s.scope || this;\r
                        this.disabled = 0;\r
                        this.active = 0;\r
+                       this.editor = editor;\r
+               },\r
+               \r
+               setAriaProperty : function(property, value) {\r
+                       var element = DOM.get(this.id + '_aria') || DOM.get(this.id);\r
+                       if (element) {\r
+                               DOM.setAttrib(element, 'aria-' + property, !!value);\r
+                       }\r
+               },\r
+               \r
+               focus : function() {\r
+                       DOM.get(this.id).focus();\r
                },\r
 \r
                setDisabled : function(s) {\r
-                       var e;\r
-\r
                        if (s != this.disabled) {\r
-                               e = DOM.get(this.id);\r
-\r
-                               // Add accessibility title for unavailable actions\r
-                               if (e && this.settings.unavailable_prefix) {\r
-                                       if (s) {\r
-                                               this.prevTitle = e.title;\r
-                                               e.title = this.settings.unavailable_prefix + ": " + e.title;\r
-                                       } else\r
-                                               e.title = this.prevTitle;\r
-                               }\r
+                               this.setAriaProperty('disabled', s);\r
 \r
                                this.setState('Disabled', s);\r
                                this.setState('Enabled', !s);\r
@@ -7432,6 +9891,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                        if (s != this.active) {\r
                                this.setState('Active', s);\r
                                this.active = s;\r
+                               this.setAriaProperty('pressed', s);\r
                        }\r
                },\r
 \r
@@ -7489,8 +9949,8 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
        });\r
 })(tinymce);\r
 tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {\r
-       Container : function(id, s) {\r
-               this.parent(id, s);\r
+       Container : function(id, s, editor) {\r
+               this.parent(id, s, editor);\r
 \r
                this.controls = [];\r
 \r
@@ -7514,10 +9974,11 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        Separator : function(id, s) {\r
                this.parent(id, s);\r
                this.classPrefix = 'mceSeparator';\r
+               this.setDisabled(true);\r
        },\r
 \r
        renderHTML : function() {\r
-               return tinymce.DOM.createHTML('span', {'class' : this.classPrefix});\r
+               return tinymce.DOM.createHTML('span', {'class' : this.classPrefix, role : 'separator', 'aria-orientation' : 'vertical', tabindex : '-1'});\r
        }\r
 });\r
 \r
@@ -7532,6 +9993,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
 \r
                setSelected : function(s) {\r
                        this.setState('Selected', s);\r
+                       this.setAriaProperty('checked', !!s);\r
                        this.selected = s;\r
                },\r
 \r
@@ -7679,12 +10141,20 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        s['class'] = s['class'] || cs['class'];\r
                        s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x;\r
                        s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y;\r
+                       s.keyboard_focus = cs.keyboard_focus;\r
                        m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);\r
 \r
                        m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);\r
 \r
                        return m;\r
                },\r
+               \r
+               focus : function() {\r
+                       var t = this;\r
+                       if (t.keyboardNav) {\r
+                               t.keyboardNav.focus();\r
+                       }\r
+               },\r
 \r
                update : function() {\r
                        var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th;\r
@@ -7780,7 +10250,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                        if (m.settings.onclick)\r
                                                m.settings.onclick(e);\r
 \r
-                                       return Event.cancel(e); // Cancel to fix onbeforeunload problem\r
+                                       return false; // Cancel to fix onbeforeunload problem\r
                                }\r
                        });\r
 \r
@@ -7808,13 +10278,13 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                        }\r
                                });\r
                        }\r
+                       \r
+                       Event.add(co, 'keydown', t._keyHandler, t);\r
 \r
                        t.onShowMenu.dispatch(t);\r
 \r
-                       if (s.keyboard_focus) {\r
-                               Event.add(co, 'keydown', t._keyHandler, t);\r
-                               DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link\r
-                               t._focusIdx = 0;\r
+                       if (s.keyboard_focus) { \r
+                               t._setupKeyboardNav(); \r
                        }\r
                },\r
 \r
@@ -7824,6 +10294,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        if (!t.isMenuVisible)\r
                                return;\r
 \r
+                       if (t.keyboardNav) t.keyboardNav.destroy();\r
                        Event.remove(co, 'mouseover', t.mouseOverFunc);\r
                        Event.remove(co, 'click', t.mouseClickFunc);\r
                        Event.remove(co, 'keydown', t._keyHandler);\r
@@ -7868,8 +10339,11 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                destroy : function() {\r
                        var t = this, co = DOM.get('menu_' + t.id);\r
 \r
+                       if (t.keyboardNav) t.keyboardNav.destroy();\r
                        Event.remove(co, 'mouseover', t.mouseOverFunc);\r
+                       Event.remove(DOM.select('a', co), 'focus', t.mouseOverFunc);\r
                        Event.remove(co, 'click', t.mouseClickFunc);\r
+                       Event.remove(co, 'keydown', t._keyHandler);\r
 \r
                        if (t.element)\r
                                t.element.remove();\r
@@ -7880,432 +10354,203 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                renderNode : function() {\r
                        var t = this, s = t.settings, n, tb, co, w;\r
 \r
-                       w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000'});\r
-                       co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')});\r
+                       w = DOM.create('div', {role: 'listbox', id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000;outline:0'});\r
+                       if (t.settings.parent) {\r
+                               DOM.setAttrib(w, 'aria-parent', 'menu_' + t.settings.parent.id);\r
+                       }\r
+                       co = DOM.add(w, 'div', {role: 'presentation', id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')});\r
                        t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});\r
 \r
                        if (s.menu_line)\r
                                DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'});\r
 \r
 //                     n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});\r
-                       n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});\r
-                       tb = DOM.add(n, 'tbody');\r
-\r
-                       each(t.items, function(o) {\r
-                               t._add(tb, o);\r
-                       });\r
-\r
-                       t.rendered = true;\r
-\r
-                       return w;\r
-               },\r
-\r
-               // Internal functions\r
-\r
-               _keyHandler : function(e) {\r
-                       var t = this, kc = e.keyCode;\r
-\r
-                       function focus(d) {\r
-                               var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i];\r
-\r
-                               if (e) {\r
-                                       t._focusIdx = i;\r
-                                       e.focus();\r
-                               }\r
-                       };\r
-\r
-                       switch (kc) {\r
-                               case 38:\r
-                                       focus(-1); // Select first link\r
-                                       return;\r
-\r
-                               case 40:\r
-                                       focus(1);\r
-                                       return;\r
-\r
-                               case 13:\r
-                                       return;\r
-\r
-                               case 27:\r
-                                       return this.hideMenu();\r
-                       }\r
-               },\r
-\r
-               _add : function(tb, o) {\r
-                       var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;\r
-\r
-                       if (s.separator) {\r
-                               ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});\r
-                               DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});\r
-\r
-                               if (n = ro.previousSibling)\r
-                                       DOM.addClass(n, 'mceLast');\r
-\r
-                               return;\r
-                       }\r
-\r
-                       n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});\r
-                       n = it = DOM.add(n, 'td');\r
-                       n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});\r
-\r
-                       DOM.addClass(it, s['class']);\r
-//                     n = DOM.add(n, 'span', {'class' : 'item'});\r
-\r
-                       ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});\r
-\r
-                       if (s.icon_src)\r
-                               DOM.add(ic, 'img', {src : s.icon_src});\r
-\r
-                       n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);\r
-\r
-                       if (o.settings.style)\r
-                               DOM.setAttrib(n, 'style', o.settings.style);\r
-\r
-                       if (tb.childNodes.length == 1)\r
-                               DOM.addClass(ro, 'mceFirst');\r
-\r
-                       if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))\r
-                               DOM.addClass(ro, 'mceFirst');\r
-\r
-                       if (o.collapse)\r
-                               DOM.addClass(ro, cp + 'ItemSub');\r
-\r
-                       if (n = ro.previousSibling)\r
-                               DOM.removeClass(n, 'mceLast');\r
-\r
-                       DOM.addClass(ro, 'mceLast');\r
-               }\r
-       });\r
-})(tinymce);\r
-(function(tinymce) {\r
-       var DOM = tinymce.DOM;\r
-\r
-       tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {\r
-               Button : function(id, s) {\r
-                       this.parent(id, s);\r
-                       this.classPrefix = 'mceButton';\r
-               },\r
-\r
-               renderHTML : function() {\r
-                       var cp = this.classPrefix, s = this.settings, h, l;\r
-\r
-                       l = DOM.encode(s.label || '');\r
-                       h = '<a id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" title="' + DOM.encode(s.title) + '">';\r
-\r
-                       if (s.image)\r
-                               h += '<img class="mceIcon" src="' + s.image + '" />' + l + '</a>';\r
-                       else\r
-                               h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '') + '</a>';\r
-\r
-                       return h;\r
-               },\r
-\r
-               postRender : function() {\r
-                       var t = this, s = t.settings;\r
-\r
-                       tinymce.dom.Event.add(t.id, 'click', function(e) {\r
-                               if (!t.isDisabled())\r
-                                       return s.onclick.call(s.scope, e);\r
-                       });\r
-               }\r
-       });\r
-})(tinymce);\r
-\r
-(function(tinymce) {\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;\r
-\r
-       tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {\r
-               ListBox : function(id, s) {\r
-                       var t = this;\r
-\r
-                       t.parent(id, s);\r
-\r
-                       t.items = [];\r
-\r
-                       t.onChange = new Dispatcher(t);\r
-\r
-                       t.onPostRender = new Dispatcher(t);\r
-\r
-                       t.onAdd = new Dispatcher(t);\r
-\r
-                       t.onRenderMenu = new tinymce.util.Dispatcher(this);\r
-\r
-                       t.classPrefix = 'mceListBox';\r
-               },\r
-\r
-               select : function(va) {\r
-                       var t = this, fv, f;\r
-\r
-                       if (va == undefined)\r
-                               return t.selectByIndex(-1);\r
-\r
-                       // Is string or number make function selector\r
-                       if (va && va.call)\r
-                               f = va;\r
-                       else {\r
-                               f = function(v) {\r
-                                       return v == va;\r
-                               };\r
-                       }\r
-\r
-                       // Do we need to do something?\r
-                       if (va != t.selectedValue) {\r
-                               // Find item\r
-                               each(t.items, function(o, i) {\r
-                                       if (f(o.value)) {\r
-                                               fv = 1;\r
-                                               t.selectByIndex(i);\r
-                                               return false;\r
-                                       }\r
-                               });\r
-\r
-                               if (!fv)\r
-                                       t.selectByIndex(-1);\r
-                       }\r
-               },\r
-\r
-               selectByIndex : function(idx) {\r
-                       var t = this, e, o;\r
-\r
-                       if (idx != t.selectedIndex) {\r
-                               e = DOM.get(t.id + '_text');\r
-                               o = t.items[idx];\r
-\r
-                               if (o) {\r
-                                       t.selectedValue = o.value;\r
-                                       t.selectedIndex = idx;\r
-                                       DOM.setHTML(e, DOM.encode(o.title));\r
-                                       DOM.removeClass(e, 'mceTitle');\r
-                               } else {\r
-                                       DOM.setHTML(e, DOM.encode(t.settings.title));\r
-                                       DOM.addClass(e, 'mceTitle');\r
-                                       t.selectedValue = t.selectedIndex = null;\r
-                               }\r
-\r
-                               e = 0;\r
-                       }\r
-               },\r
-\r
-               add : function(n, v, o) {\r
-                       var t = this;\r
-\r
-                       o = o || {};\r
-                       o = tinymce.extend(o, {\r
-                               title : n,\r
-                               value : v\r
-                       });\r
-\r
-                       t.items.push(o);\r
-                       t.onAdd.dispatch(t, o);\r
-               },\r
-\r
-               getLength : function() {\r
-                       return this.items.length;\r
-               },\r
-\r
-               renderHTML : function() {\r
-                       var h = '', t = this, s = t.settings, cp = t.classPrefix;\r
-\r
-                       h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';\r
-                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';\r
-                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>';\r
-                       h += '</tr></tbody></table>';\r
-\r
-                       return h;\r
-               },\r
-\r
-               showMenu : function() {\r
-                       var t = this, p1, p2, e = DOM.get(this.id), m;\r
-\r
-                       if (t.isDisabled() || t.items.length == 0)\r
-                               return;\r
-\r
-                       if (t.menu && t.menu.isMenuVisible)\r
-                               return t.hideMenu();\r
-\r
-                       if (!t.isMenuRendered) {\r
-                               t.renderMenu();\r
-                               t.isMenuRendered = true;\r
-                       }\r
-\r
-                       p1 = DOM.getPos(this.settings.menu_container);\r
-                       p2 = DOM.getPos(e);\r
-\r
-                       m = t.menu;\r
-                       m.settings.offset_x = p2.x;\r
-                       m.settings.offset_y = p2.y;\r
-                       m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus\r
-\r
-                       // Select in menu\r
-                       if (t.oldID)\r
-                               m.items[t.oldID].setSelected(0);\r
+                       n = DOM.add(co, 'table', {role: 'presentation', id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});\r
+                       tb = DOM.add(n, 'tbody');\r
 \r
                        each(t.items, function(o) {\r
-                               if (o.value === t.selectedValue) {\r
-                                       m.items[o.id].setSelected(1);\r
-                                       t.oldID = o.id;\r
-                               }\r
+                               t._add(tb, o);\r
                        });\r
 \r
-                       m.showMenu(0, e.clientHeight);\r
-\r
-                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                       DOM.addClass(t.id, t.classPrefix + 'Selected');\r
+                       t.rendered = true;\r
 \r
-                       //DOM.get(t.id + '_text').focus();\r
+                       return w;\r
                },\r
 \r
-               hideMenu : function(e) {\r
-                       var t = this;\r
-\r
-                       if (t.menu && t.menu.isMenuVisible) {\r
-                               // Prevent double toogles by canceling the mouse click event to the button\r
-                               if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))\r
-                                       return;\r
+               // Internal functions\r
+               _setupKeyboardNav : function(){\r
+                       var contextMenu, menuItems, t=this; \r
+                       contextMenu = DOM.get('menu_' + t.id);\r
+                       menuItems = DOM.select('a[role=option]', 'menu_' + t.id);\r
+                       menuItems.splice(0,0,contextMenu);\r
+                       t.keyboardNav = new tinymce.ui.KeyboardNavigation({\r
+                               root: 'menu_' + t.id,\r
+                               items: menuItems,\r
+                               onCancel: function() {\r
+                                       t.hideMenu();\r
+                               },\r
+                               enableUpDown: true\r
+                       });\r
+                       contextMenu.focus();\r
+               },\r
 \r
-                               if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
-                                       DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
-                                       Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                                       t.menu.hideMenu();\r
-                               }\r
+               _keyHandler : function(evt) {\r
+                       var t = this, e;\r
+                       switch (evt.keyCode) {\r
+                               case 37: // Left\r
+                                       if (t.settings.parent) {\r
+                                               t.hideMenu();\r
+                                               t.settings.parent.focus();\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                                       break;\r
+                               case 39: // Right\r
+                                       if (t.mouseOverFunc)\r
+                                               t.mouseOverFunc(evt);\r
+                                       break;\r
                        }\r
                },\r
 \r
-               renderMenu : function() {\r
-                       var t = this, m;\r
+               _add : function(tb, o) {\r
+                       var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;\r
 \r
-                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
-                               menu_line : 1,\r
-                               'class' : t.classPrefix + 'Menu mceNoIcons',\r
-                               max_width : 150,\r
-                               max_height : 150\r
-                       });\r
+                       if (s.separator) {\r
+                               ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});\r
+                               DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});\r
 \r
-                       m.onHideMenu.add(t.hideMenu, t);\r
+                               if (n = ro.previousSibling)\r
+                                       DOM.addClass(n, 'mceLast');\r
 \r
-                       m.add({\r
-                               title : t.settings.title,\r
-                               'class' : 'mceMenuItemTitle',\r
-                               onclick : function() {\r
-                                       if (t.settings.onselect('') !== false)\r
-                                               t.select(''); // Must be runned after\r
-                               }\r
-                       });\r
+                               return;\r
+                       }\r
 \r
-                       each(t.items, function(o) {\r
-                               // No value then treat it as a title\r
-                               if (o.value === undefined) {\r
-                                       m.add({\r
-                                               title : o.title,\r
-                                               'class' : 'mceMenuItemTitle',\r
-                                               onclick : function() {\r
-                                                       if (t.settings.onselect('') !== false)\r
-                                                               t.select(''); // Must be runned after\r
-                                               }\r
-                                       });\r
-                               } else {\r
-                                       o.id = DOM.uniqueId();\r
-                                       o.onclick = function() {\r
-                                               if (t.settings.onselect(o.value) !== false)\r
-                                                       t.select(o.value); // Must be runned after\r
-                                       };\r
+                       n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});\r
+                       n = it = DOM.add(n, s.titleItem ? 'th' : 'td');\r
+                       n = a = DOM.add(n, 'a', {id: o.id + '_aria',  role: s.titleItem ? 'presentation' : 'option', href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});\r
 \r
-                                       m.add(o);\r
-                               }\r
-                       });\r
+                       if (s.parent) {\r
+                               DOM.setAttrib(a, 'aria-haspopup', 'true');\r
+                               DOM.setAttrib(a, 'aria-owns', 'menu_' + o.id);\r
+                       }\r
 \r
-                       t.onRenderMenu.dispatch(t, m);\r
-                       t.menu = m;\r
-               },\r
+                       DOM.addClass(it, s['class']);\r
+//                     n = DOM.add(n, 'span', {'class' : 'item'});\r
 \r
-               postRender : function() {\r
-                       var t = this, cp = t.classPrefix;\r
+                       ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});\r
 \r
-                       Event.add(t.id, 'click', t.showMenu, t);\r
-                       Event.add(t.id + '_text', 'focus', function() {\r
-                               if (!t._focused) {\r
-                                       t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) {\r
-                                               var idx = -1, v, kc = e.keyCode;\r
+                       if (s.icon_src)\r
+                               DOM.add(ic, 'img', {src : s.icon_src});\r
 \r
-                                               // Find current index\r
-                                               each(t.items, function(v, i) {\r
-                                                       if (t.selectedValue == v.value)\r
-                                                               idx = i;\r
-                                               });\r
+                       n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);\r
 \r
-                                               // Move up/down\r
-                                               if (kc == 38)\r
-                                                       v = t.items[idx - 1];\r
-                                               else if (kc == 40)\r
-                                                       v = t.items[idx + 1];\r
-                                               else if (kc == 13) {\r
-                                                       // Fake select on enter\r
-                                                       v = t.selectedValue;\r
-                                                       t.selectedValue = null; // Needs to be null to fake change\r
-                                                       t.settings.onselect(v);\r
-                                                       return Event.cancel(e);\r
-                                               }\r
+                       if (o.settings.style) {\r
+                               if (typeof o.settings.style == "function")\r
+                                       o.settings.style = o.settings.style();\r
 \r
-                                               if (v) {\r
-                                                       t.hideMenu();\r
-                                                       t.select(v.value);\r
-                                               }\r
-                                       });\r
-                               }\r
+                               DOM.setAttrib(n, 'style', o.settings.style);\r
+                       }\r
 \r
-                               t._focused = 1;\r
-                       });\r
-                       Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;});\r
+                       if (tb.childNodes.length == 1)\r
+                               DOM.addClass(ro, 'mceFirst');\r
 \r
-                       // Old IE doesn't have hover on all elements\r
-                       if (tinymce.isIE6 || !DOM.boxModel) {\r
-                               Event.add(t.id, 'mouseover', function() {\r
-                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
-                                               DOM.addClass(t.id, cp + 'Hover');\r
-                               });\r
+                       if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))\r
+                               DOM.addClass(ro, 'mceFirst');\r
 \r
-                               Event.add(t.id, 'mouseout', function() {\r
-                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
-                                               DOM.removeClass(t.id, cp + 'Hover');\r
-                               });\r
-                       }\r
+                       if (o.collapse)\r
+                               DOM.addClass(ro, cp + 'ItemSub');\r
 \r
-                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
+                       if (n = ro.previousSibling)\r
+                               DOM.removeClass(n, 'mceLast');\r
+\r
+                       DOM.addClass(ro, 'mceLast');\r
+               }\r
+       });\r
+})(tinymce);\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM;\r
+\r
+       tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {\r
+               Button : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
+                       this.classPrefix = 'mceButton';\r
                },\r
 \r
-               destroy : function() {\r
-                       this.parent();\r
+               renderHTML : function() {\r
+                       var cp = this.classPrefix, s = this.settings, h, l;\r
 \r
-                       Event.clear(this.id + '_text');\r
-                       Event.clear(this.id + '_open');\r
+                       l = DOM.encode(s.label || '');\r
+                       h = '<a role="button" id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" aria-labelledby="' + this.id + '_voice" title="' + DOM.encode(s.title) + '">';\r
+                       if (s.image && !(this.editor  &&this.editor.forcedHighContrastMode) )\r
+                               h += '<img class="mceIcon" src="' + s.image + '" alt="' + DOM.encode(s.title) + '" />' + l;\r
+                       else\r
+                               h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '');\r
+\r
+                       h += '<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="' + this.id + '_voice">' + s.title + '</span>'; \r
+                       h += '</a>';\r
+                       return h;\r
+               },\r
+\r
+               postRender : function() {\r
+                       var t = this, s = t.settings, imgBookmark;\r
+\r
+                       // In IE a large image that occupies the entire editor area will be deselected when a button is clicked, so\r
+                       // need to keep the selection in case the selection is lost\r
+                       if (tinymce.isIE && t.editor) {\r
+                               tinymce.dom.Event.add(t.id, 'mousedown', function(e) {\r
+                                       var nodeName = t.editor.selection.getNode().nodeName;\r
+                                       imgBookmark = nodeName === 'IMG' ? t.editor.selection.getBookmark() : null;\r
+                               });\r
+                       }\r
+                       tinymce.dom.Event.add(t.id, 'click', function(e) {\r
+                               if (!t.isDisabled()) {\r
+                                       // restore the selection in case the selection is lost in IE\r
+                                       if (tinymce.isIE && t.editor && imgBookmark !== null) {\r
+                                               t.editor.selection.moveToBookmark(imgBookmark);\r
+                                       }\r
+                                       return s.onclick.call(s.scope, e);\r
+                               }\r
+                       });\r
+                       tinymce.dom.Event.add(t.id, 'keyup', function(e) {\r
+                               if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR)\r
+                                       return s.onclick.call(s.scope, e);\r
+                       });\r
                }\r
        });\r
 })(tinymce);\r
+\r
 (function(tinymce) {\r
        var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;\r
 \r
-       tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {\r
-               NativeListBox : function(id, s) {\r
-                       this.parent(id, s);\r
-                       this.classPrefix = 'mceNativeListBox';\r
-               },\r
+       tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {\r
+               ListBox : function(id, s, ed) {\r
+                       var t = this;\r
 \r
-               setDisabled : function(s) {\r
-                       DOM.get(this.id).disabled = s;\r
-               },\r
+                       t.parent(id, s, ed);\r
 \r
-               isDisabled : function() {\r
-                       return DOM.get(this.id).disabled;\r
+                       t.items = [];\r
+\r
+                       t.onChange = new Dispatcher(t);\r
+\r
+                       t.onPostRender = new Dispatcher(t);\r
+\r
+                       t.onAdd = new Dispatcher(t);\r
+\r
+                       t.onRenderMenu = new tinymce.util.Dispatcher(this);\r
+\r
+                       t.classPrefix = 'mceListBox';\r
+                       t.marked = {};\r
                },\r
 \r
                select : function(va) {\r
                        var t = this, fv, f;\r
 \r
+                       t.marked = {};\r
+\r
                        if (va == undefined)\r
                                return t.selectByIndex(-1);\r
 \r
                        // Is string or number make function selector\r
-                       if (va && va.call)\r
+                       if (va && typeof(va)=="function")\r
                                f = va;\r
                        else {\r
                                f = function(v) {\r
@@ -8330,4003 +10575,4041 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                },\r
 \r
                selectByIndex : function(idx) {\r
-                       DOM.get(this.id).selectedIndex = idx + 1;\r
-                       this.selectedValue = this.items[idx] ? this.items[idx].value : null;\r
-               },\r
-\r
-               add : function(n, v, a) {\r
-                       var o, t = this;\r
+                       var t = this, e, o, label;\r
 \r
-                       a = a || {};\r
-                       a.value = v;\r
-\r
-                       if (t.isRendered())\r
-                               DOM.add(DOM.get(this.id), 'option', a, n);\r
-\r
-                       o = {\r
-                               title : n,\r
-                               value : v,\r
-                               attribs : a\r
-                       };\r
-\r
-                       t.items.push(o);\r
-                       t.onAdd.dispatch(t, o);\r
-               },\r
-\r
-               getLength : function() {\r
-                       return this.items.length;\r
-               },\r
-\r
-               renderHTML : function() {\r
-                       var h, t = this;\r
-\r
-                       h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');\r
-\r
-                       each(t.items, function(it) {\r
-                               h += DOM.createHTML('option', {value : it.value}, it.title);\r
-                       });\r
-\r
-                       h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h);\r
-\r
-                       return h;\r
-               },\r
+                       t.marked = {};\r
 \r
-               postRender : function() {\r
-                       var t = this, ch;\r
-\r
-                       t.rendered = true;\r
-\r
-                       function onChange(e) {\r
-                               var v = t.items[e.target.selectedIndex - 1];\r
-\r
-                               if (v && (v = v.value)) {\r
-                                       t.onChange.dispatch(t, v);\r
+                       if (idx != t.selectedIndex) {\r
+                               e = DOM.get(t.id + '_text');\r
+                               label = DOM.get(t.id + '_voiceDesc');\r
+                               o = t.items[idx];\r
 \r
-                                       if (t.settings.onselect)\r
-                                               t.settings.onselect(v);\r
+                               if (o) {\r
+                                       t.selectedValue = o.value;\r
+                                       t.selectedIndex = idx;\r
+                                       DOM.setHTML(e, DOM.encode(o.title));\r
+                                       DOM.setHTML(label, t.settings.title + " - " + o.title);\r
+                                       DOM.removeClass(e, 'mceTitle');\r
+                                       DOM.setAttrib(t.id, 'aria-valuenow', o.title);\r
+                               } else {\r
+                                       DOM.setHTML(e, DOM.encode(t.settings.title));\r
+                                       DOM.setHTML(label, DOM.encode(t.settings.title));\r
+                                       DOM.addClass(e, 'mceTitle');\r
+                                       t.selectedValue = t.selectedIndex = null;\r
+                                       DOM.setAttrib(t.id, 'aria-valuenow', t.settings.title);\r
                                }\r
-                       };\r
-\r
-                       Event.add(t.id, 'change', onChange);\r
-\r
-                       // Accessibility keyhandler\r
-                       Event.add(t.id, 'keydown', function(e) {\r
-                               var bf;\r
+                               e = 0;\r
+                       }\r
+               },\r
 \r
-                               Event.remove(t.id, 'change', ch);\r
+               mark : function(value) {\r
+                       this.marked[value] = true;\r
+               },\r
 \r
-                               bf = Event.add(t.id, 'blur', function() {\r
-                                       Event.add(t.id, 'change', onChange);\r
-                                       Event.remove(t.id, 'blur', bf);\r
-                               });\r
+               add : function(n, v, o) {\r
+                       var t = this;\r
 \r
-                               if (e.keyCode == 13 || e.keyCode == 32) {\r
-                                       onChange(e);\r
-                                       return Event.cancel(e);\r
-                               }\r
+                       o = o || {};\r
+                       o = tinymce.extend(o, {\r
+                               title : n,\r
+                               value : v\r
                        });\r
 \r
-                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
-               }\r
-       });\r
-})(tinymce);\r
-(function(tinymce) {\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
+                       t.items.push(o);\r
+                       t.onAdd.dispatch(t, o);\r
+               },\r
 \r
-       tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {\r
-               MenuButton : function(id, s) {\r
-                       this.parent(id, s);\r
+               getLength : function() {\r
+                       return this.items.length;\r
+               },\r
 \r
-                       this.onRenderMenu = new tinymce.util.Dispatcher(this);\r
+               renderHTML : function() {\r
+                       var h = '', t = this, s = t.settings, cp = t.classPrefix;\r
 \r
-                       s.menu_container = s.menu_container || DOM.doc.body;\r
+                       h = '<span role="listbox" aria-haspopup="true" aria-labelledby="' + t.id +'_voiceDesc" aria-describedby="' + t.id + '_voiceDesc"><table role="presentation" tabindex="0" id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';\r
+                       h += '<td>' + DOM.createHTML('span', {id: t.id + '_voiceDesc', 'class': 'voiceLabel', style:'display:none;'}, t.settings.title); \r
+                       h += DOM.createHTML('a', {id : t.id + '_text', tabindex : -1, href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';\r
+                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>') + '</td>';\r
+                       h += '</tr></tbody></table></span>';\r
+\r
+                       return h;\r
                },\r
 \r
                showMenu : function() {\r
-                       var t = this, p1, p2, e = DOM.get(t.id), m;\r
+                       var t = this, p2, e = DOM.get(this.id), m;\r
 \r
-                       if (t.isDisabled())\r
+                       if (t.isDisabled() || t.items.length == 0)\r
                                return;\r
 \r
+                       if (t.menu && t.menu.isMenuVisible)\r
+                               return t.hideMenu();\r
+\r
                        if (!t.isMenuRendered) {\r
                                t.renderMenu();\r
                                t.isMenuRendered = true;\r
                        }\r
 \r
-                       if (t.isMenuVisible)\r
-                               return t.hideMenu();\r
-\r
-                       p1 = DOM.getPos(t.settings.menu_container);\r
                        p2 = DOM.getPos(e);\r
 \r
                        m = t.menu;\r
                        m.settings.offset_x = p2.x;\r
                        m.settings.offset_y = p2.y;\r
-                       m.settings.vp_offset_x = p2.x;\r
-                       m.settings.vp_offset_y = p2.y;\r
-                       m.settings.keyboard_focus = t._focused;\r
-                       m.showMenu(0, e.clientHeight);\r
-\r
-                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                       t.setState('Selected', 1);\r
+                       m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus\r
 \r
-                       t.isMenuVisible = 1;\r
-               },\r
+                       // Select in menu\r
+                       each(t.items, function(o) {\r
+                               if (m.items[o.id]) {\r
+                                       m.items[o.id].setSelected(0);\r
+                               }\r
+                       });\r
 \r
-               renderMenu : function() {\r
-                       var t = this, m;\r
+                       each(t.items, function(o) {\r
+                               if (m.items[o.id] && t.marked[o.value]) {\r
+                                       m.items[o.id].setSelected(1);\r
+                               }\r
 \r
-                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
-                               menu_line : 1,\r
-                               'class' : this.classPrefix + 'Menu',\r
-                               icons : t.settings.icons\r
+                               if (o.value === t.selectedValue) {\r
+                                       m.items[o.id].setSelected(1);\r
+                               }\r
                        });\r
 \r
-                       m.onHideMenu.add(t.hideMenu, t);\r
+                       m.showMenu(0, e.clientHeight);\r
 \r
-                       t.onRenderMenu.dispatch(t, m);\r
-                       t.menu = m;\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       DOM.addClass(t.id, t.classPrefix + 'Selected');\r
+\r
+                       //DOM.get(t.id + '_text').focus();\r
                },\r
 \r
                hideMenu : function(e) {\r
                        var t = this;\r
 \r
-                       // Prevent double toogles by canceling the mouse click event to the button\r
-                       if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))\r
-                               return;\r
+                       if (t.menu && t.menu.isMenuVisible) {\r
+                               DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
 \r
-                       if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
-                               t.setState('Selected', 0);\r
-                               Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                               if (t.menu)\r
+                               // Prevent double toogles by canceling the mouse click event to the button\r
+                               if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))\r
+                                       return;\r
+\r
+                               if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
+                                       DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
+                                       Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
                                        t.menu.hideMenu();\r
+                               }\r
                        }\r
-\r
-                       t.isMenuVisible = 0;\r
                },\r
 \r
-               postRender : function() {\r
-                       var t = this, s = t.settings;\r
-\r
-                       Event.add(t.id, 'click', function() {\r
-                               if (!t.isDisabled()) {\r
-                                       if (s.onclick)\r
-                                               s.onclick(t.value);\r
+               renderMenu : function() {\r
+                       var t = this, m;\r
 \r
-                                       t.showMenu();\r
-                               }\r
+                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
+                               menu_line : 1,\r
+                               'class' : t.classPrefix + 'Menu mceNoIcons',\r
+                               max_width : 150,\r
+                               max_height : 150\r
                        });\r
-               }\r
-       });\r
-})(tinymce);\r
-\r
-(function(tinymce) {\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
-\r
-       tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {\r
-               SplitButton : function(id, s) {\r
-                       this.parent(id, s);\r
-                       this.classPrefix = 'mceSplitButton';\r
-               },\r
-\r
-               renderHTML : function() {\r
-                       var h, t = this, s = t.settings, h1;\r
 \r
-                       h = '<tbody><tr>';\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
 \r
-                       if (s.image)\r
-                               h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']});\r
-                       else\r
-                               h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');\r
+                       m.add({\r
+                               title : t.settings.title,\r
+                               'class' : 'mceMenuItemTitle',\r
+                               onclick : function() {\r
+                                       if (t.settings.onselect('') !== false)\r
+                                               t.select(''); // Must be runned after\r
+                               }\r
+                       });\r
 \r
-                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
-       \r
-                       h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']});\r
-                       h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
+                       each(t.items, function(o) {\r
+                               // No value then treat it as a title\r
+                               if (o.value === undefined) {\r
+                                       m.add({\r
+                                               title : o.title,\r
+                                               role : "option",\r
+                                               'class' : 'mceMenuItemTitle',\r
+                                               onclick : function() {\r
+                                                       if (t.settings.onselect('') !== false)\r
+                                                               t.select(''); // Must be runned after\r
+                                               }\r
+                                       });\r
+                               } else {\r
+                                       o.id = DOM.uniqueId();\r
+                                       o.role= "option";\r
+                                       o.onclick = function() {\r
+                                               if (t.settings.onselect(o.value) !== false)\r
+                                                       t.select(o.value); // Must be runned after\r
+                                       };\r
 \r
-                       h += '</tr></tbody>';\r
+                                       m.add(o);\r
+                               }\r
+                       });\r
 \r
-                       return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, h);\r
+                       t.onRenderMenu.dispatch(t, m);\r
+                       t.menu = m;\r
                },\r
 \r
                postRender : function() {\r
-                       var t = this, s = t.settings;\r
-\r
-                       if (s.onclick) {\r
-                               Event.add(t.id + '_action', 'click', function() {\r
-                                       if (!t.isDisabled())\r
-                                               s.onclick(t.value);\r
-                               });\r
-                       }\r
-\r
-                       Event.add(t.id + '_open', 'click', t.showMenu, t);\r
-                       Event.add(t.id + '_open', 'focus', function() {t._focused = 1;});\r
-                       Event.add(t.id + '_open', 'blur', function() {t._focused = 0;});\r
-\r
-                       // Old IE doesn't have hover on all elements\r
-                       if (tinymce.isIE6 || !DOM.boxModel) {\r
-                               Event.add(t.id, 'mouseover', function() {\r
-                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
-                                               DOM.addClass(t.id, 'mceSplitButtonHover');\r
-                               });\r
-\r
-                               Event.add(t.id, 'mouseout', function() {\r
-                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
-                                               DOM.removeClass(t.id, 'mceSplitButtonHover');\r
-                               });\r
-                       }\r
-               },\r
-\r
-               destroy : function() {\r
-                       this.parent();\r
-\r
-                       Event.clear(this.id + '_action');\r
-                       Event.clear(this.id + '_open');\r
-               }\r
-       });\r
-})(tinymce);\r
-\r
-(function(tinymce) {\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;\r
-\r
-       tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {\r
-               ColorSplitButton : function(id, s) {\r
-                       var t = this;\r
-\r
-                       t.parent(id, s);\r
-\r
-                       t.settings = s = tinymce.extend({\r
-                               colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',\r
-                               grid_width : 8,\r
-                               default_color : '#888888'\r
-                       }, t.settings);\r
-\r
-                       t.onShowMenu = new tinymce.util.Dispatcher(t);\r
-\r
-                       t.onHideMenu = new tinymce.util.Dispatcher(t);\r
-\r
-                       t.value = s.default_color;\r
-               },\r
-\r
-               showMenu : function() {\r
-                       var t = this, r, p, e, p2;\r
-\r
-                       if (t.isDisabled())\r
-                               return;\r
-\r
-                       if (!t.isMenuRendered) {\r
-                               t.renderMenu();\r
-                               t.isMenuRendered = true;\r
-                       }\r
-\r
-                       if (t.isMenuVisible)\r
-                               return t.hideMenu();\r
+                       var t = this, cp = t.classPrefix;\r
 \r
-                       e = DOM.get(t.id);\r
-                       DOM.show(t.id + '_menu');\r
-                       DOM.addClass(e, 'mceSplitButtonSelected');\r
-                       p2 = DOM.getPos(e);\r
-                       DOM.setStyles(t.id + '_menu', {\r
-                               left : p2.x,\r
-                               top : p2.y + e.clientHeight,\r
-                               zIndex : 200000\r
+                       Event.add(t.id, 'click', t.showMenu, t);\r
+                       Event.add(t.id, 'keydown', function(evt) {\r
+                               if (evt.keyCode == 32) { // Space\r
+                                       t.showMenu(evt);\r
+                                       Event.cancel(evt);\r
+                               }\r
                        });\r
-                       e = 0;\r
+                       Event.add(t.id, 'focus', function() {\r
+                               if (!t._focused) {\r
+                                       t.keyDownHandler = Event.add(t.id, 'keydown', function(e) {\r
+                                               if (e.keyCode == 40) {\r
+                                                       t.showMenu();\r
+                                                       Event.cancel(e);\r
+                                               }\r
+                                       });\r
+                                       t.keyPressHandler = Event.add(t.id, 'keypress', function(e) {\r
+                                               var v;\r
+                                               if (e.keyCode == 13) {\r
+                                                       // Fake select on enter\r
+                                                       v = t.selectedValue;\r
+                                                       t.selectedValue = null; // Needs to be null to fake change\r
+                                                       Event.cancel(e);\r
+                                                       t.settings.onselect(v);\r
+                                               }\r
+                                       });\r
+                               }\r
 \r
-                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                       t.onShowMenu.dispatch(t);\r
+                               t._focused = 1;\r
+                       });\r
+                       Event.add(t.id, 'blur', function() {\r
+                               Event.remove(t.id, 'keydown', t.keyDownHandler);\r
+                               Event.remove(t.id, 'keypress', t.keyPressHandler);\r
+                               t._focused = 0;\r
+                       });\r
 \r
-                       if (t._focused) {\r
-                               t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {\r
-                                       if (e.keyCode == 27)\r
-                                               t.hideMenu();\r
+                       // Old IE doesn't have hover on all elements\r
+                       if (tinymce.isIE6 || !DOM.boxModel) {\r
+                               Event.add(t.id, 'mouseover', function() {\r
+                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
+                                               DOM.addClass(t.id, cp + 'Hover');\r
                                });\r
 \r
-                               DOM.select('a', t.id + '_menu')[0].focus(); // Select first link\r
+                               Event.add(t.id, 'mouseout', function() {\r
+                                       if (!DOM.hasClass(t.id, cp + 'Disabled'))\r
+                                               DOM.removeClass(t.id, cp + 'Hover');\r
+                               });\r
                        }\r
 \r
-                       t.isMenuVisible = 1;\r
+                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
                },\r
 \r
-               hideMenu : function(e) {\r
-                       var t = this;\r
-\r
-                       // Prevent double toogles by canceling the mouse click event to the button\r
-                       if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))\r
-                               return;\r
+               destroy : function() {\r
+                       this.parent();\r
 \r
-                       if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {\r
-                               DOM.removeClass(t.id, 'mceSplitButtonSelected');\r
-                               Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
-                               Event.remove(t.id + '_menu', 'keydown', t._keyHandler);\r
-                               DOM.hide(t.id + '_menu');\r
-                       }\r
+                       Event.clear(this.id + '_text');\r
+                       Event.clear(this.id + '_open');\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                       t.onHideMenu.dispatch(t);\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;\r
 \r
-                       t.isMenuVisible = 0;\r
+       tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {\r
+               NativeListBox : function(id, s) {\r
+                       this.parent(id, s);\r
+                       this.classPrefix = 'mceNativeListBox';\r
                },\r
 \r
-               renderMenu : function() {\r
-                       var t = this, m, i = 0, s = t.settings, n, tb, tr, w;\r
-\r
-                       w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});\r
-                       m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});\r
-                       DOM.add(m, 'span', {'class' : 'mceMenuLine'});\r
+               setDisabled : function(s) {\r
+                       DOM.get(this.id).disabled = s;\r
+                       this.setAriaProperty('disabled', s);\r
+               },\r
 \r
-                       n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'});\r
-                       tb = DOM.add(n, 'tbody');\r
+               isDisabled : function() {\r
+                       return DOM.get(this.id).disabled;\r
+               },\r
 \r
-                       // Generate color grid\r
-                       i = 0;\r
-                       each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {\r
-                               c = c.replace(/^#/, '');\r
+               select : function(va) {\r
+                       var t = this, fv, f;\r
 \r
-                               if (!i--) {\r
-                                       tr = DOM.add(tb, 'tr');\r
-                                       i = s.grid_width - 1;\r
-                               }\r
+                       if (va == undefined)\r
+                               return t.selectByIndex(-1);\r
 \r
-                               n = DOM.add(tr, 'td');\r
+                       // Is string or number make function selector\r
+                       if (va && typeof(va)=="function")\r
+                               f = va;\r
+                       else {\r
+                               f = function(v) {\r
+                                       return v == va;\r
+                               };\r
+                       }\r
 \r
-                               n = DOM.add(n, 'a', {\r
-                                       href : 'javascript:;',\r
-                                       style : {\r
-                                               backgroundColor : '#' + c\r
-                                       },\r
-                                       _mce_color : '#' + c\r
+                       // Do we need to do something?\r
+                       if (va != t.selectedValue) {\r
+                               // Find item\r
+                               each(t.items, function(o, i) {\r
+                                       if (f(o.value)) {\r
+                                               fv = 1;\r
+                                               t.selectByIndex(i);\r
+                                               return false;\r
+                                       }\r
                                });\r
-                       });\r
 \r
-                       if (s.more_colors_func) {\r
-                               n = DOM.add(tb, 'tr');\r
-                               n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});\r
-                               n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);\r
-\r
-                               Event.add(n, 'click', function(e) {\r
-                                       s.more_colors_func.call(s.more_colors_scope || this);\r
-                                       return Event.cancel(e); // Cancel to fix onbeforeunload problem\r
-                               });\r
+                               if (!fv)\r
+                                       t.selectByIndex(-1);\r
                        }\r
+               },\r
 \r
-                       DOM.addClass(m, 'mceColorSplitMenu');\r
+               selectByIndex : function(idx) {\r
+                       DOM.get(this.id).selectedIndex = idx + 1;\r
+                       this.selectedValue = this.items[idx] ? this.items[idx].value : null;\r
+               },\r
 \r
-                       Event.add(t.id + '_menu', 'click', function(e) {\r
-                               var c;\r
+               add : function(n, v, a) {\r
+                       var o, t = this;\r
 \r
-                               e = e.target;\r
+                       a = a || {};\r
+                       a.value = v;\r
 \r
-                               if (e.nodeName == 'A' && (c = e.getAttribute('_mce_color')))\r
-                                       t.setColor(c);\r
+                       if (t.isRendered())\r
+                               DOM.add(DOM.get(this.id), 'option', a, n);\r
 \r
-                               return Event.cancel(e); // Prevent IE auto save warning\r
-                       });\r
+                       o = {\r
+                               title : n,\r
+                               value : v,\r
+                               attribs : a\r
+                       };\r
 \r
-                       return w;\r
+                       t.items.push(o);\r
+                       t.onAdd.dispatch(t, o);\r
                },\r
 \r
-               setColor : function(c) {\r
-                       var t = this;\r
+               getLength : function() {\r
+                       return this.items.length;\r
+               },\r
 \r
-                       DOM.setStyle(t.id + '_preview', 'backgroundColor', c);\r
+               renderHTML : function() {\r
+                       var h, t = this;\r
 \r
-                       t.value = c;\r
-                       t.hideMenu();\r
-                       t.settings.onselect(c);\r
-               },\r
+                       h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');\r
 \r
-               postRender : function() {\r
-                       var t = this, id = t.id;\r
+                       each(t.items, function(it) {\r
+                               h += DOM.createHTML('option', {value : it.value}, it.title);\r
+                       });\r
 \r
-                       t.parent();\r
-                       DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});\r
-                       DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);\r
+                       h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox', 'aria-labelledby': t.id + '_aria'}, h);\r
+                       h += DOM.createHTML('span', {id : t.id + '_aria', 'style': 'display: none'}, t.settings.title);\r
+                       return h;\r
                },\r
 \r
-               destroy : function() {\r
-                       this.parent();\r
+               postRender : function() {\r
+                       var t = this, ch, changeListenerAdded = true;\r
 \r
-                       Event.clear(this.id + '_menu');\r
-                       Event.clear(this.id + '_more');\r
-                       DOM.remove(this.id + '_menu');\r
-               }\r
-       });\r
-})(tinymce);\r
+                       t.rendered = true;\r
 \r
-tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {\r
-       renderHTML : function() {\r
-               var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;\r
+                       function onChange(e) {\r
+                               var v = t.items[e.target.selectedIndex - 1];\r
 \r
-               cl = t.controls;\r
-               for (i=0; i<cl.length; i++) {\r
-                       // Get current control, prev control, next control and if the control is a list box or not\r
-                       co = cl[i];\r
-                       pr = cl[i - 1];\r
-                       nx = cl[i + 1];\r
+                               if (v && (v = v.value)) {\r
+                                       t.onChange.dispatch(t, v);\r
 \r
-                       // Add toolbar start\r
-                       if (i === 0) {\r
-                               c = 'mceToolbarStart';\r
+                                       if (t.settings.onselect)\r
+                                               t.settings.onselect(v);\r
+                               }\r
+                       };\r
 \r
-                               if (co.Button)\r
-                                       c += ' mceToolbarStartButton';\r
-                               else if (co.SplitButton)\r
-                                       c += ' mceToolbarStartSplitButton';\r
-                               else if (co.ListBox)\r
-                                       c += ' mceToolbarStartListBox';\r
+                       Event.add(t.id, 'change', onChange);\r
 \r
-                               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
-                       }\r
+                       // Accessibility keyhandler\r
+                       Event.add(t.id, 'keydown', function(e) {\r
+                               var bf;\r
 \r
-                       // Add toolbar end before list box and after the previous button\r
-                       // This is to fix the o2k7 editor skins\r
-                       if (pr && co.ListBox) {\r
-                               if (pr.Button || pr.SplitButton)\r
-                                       h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));\r
-                       }\r
+                               Event.remove(t.id, 'change', ch);\r
+                               changeListenerAdded = false;\r
 \r
-                       // Render control HTML\r
+                               bf = Event.add(t.id, 'blur', function() {\r
+                                       if (changeListenerAdded) return;\r
+                                       changeListenerAdded = true;\r
+                                       Event.add(t.id, 'change', onChange);\r
+                                       Event.remove(t.id, 'blur', bf);\r
+                               });\r
 \r
-                       // IE 8 quick fix, needed to propertly generate a hit area for anchors\r
-                       if (dom.stdMode)\r
-                               h += '<td style="position: relative">' + co.renderHTML() + '</td>';\r
-                       else\r
-                               h += '<td>' + co.renderHTML() + '</td>';\r
+                               //prevent default left and right keys on chrome - so that the keyboard navigation is used.\r
+                               if (tinymce.isWebKit && (e.keyCode==37 ||e.keyCode==39)) {\r
+                                       return Event.prevent(e);\r
+                               }\r
+                               \r
+                               if (e.keyCode == 13 || e.keyCode == 32) {\r
+                                       onChange(e);\r
+                                       return Event.cancel(e);\r
+                               }\r
+                       });\r
 \r
-                       // Add toolbar start after list box and before the next button\r
-                       // This is to fix the o2k7 editor skins\r
-                       if (nx && co.ListBox) {\r
-                               if (nx.Button || nx.SplitButton)\r
-                                       h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));\r
-                       }\r
+                       t.onPostRender.dispatch(t, DOM.get(t.id));\r
                }\r
+       });\r
+})(tinymce);\r
 \r
-               c = 'mceToolbarEnd';\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
 \r
-               if (co.Button)\r
-                       c += ' mceToolbarEndButton';\r
-               else if (co.SplitButton)\r
-                       c += ' mceToolbarEndSplitButton';\r
-               else if (co.ListBox)\r
-                       c += ' mceToolbarEndListBox';\r
+       tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {\r
+               MenuButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
 \r
-               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       this.onRenderMenu = new tinymce.util.Dispatcher(this);\r
 \r
-               return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>');\r
-       }\r
-});\r
+                       s.menu_container = s.menu_container || DOM.doc.body;\r
+               },\r
 \r
-(function(tinymce) {\r
-       var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;\r
+               showMenu : function() {\r
+                       var t = this, p1, p2, e = DOM.get(t.id), m;\r
 \r
-       tinymce.create('tinymce.AddOnManager', {\r
-               items : [],\r
-               urls : {},\r
-               lookup : {},\r
+                       if (t.isDisabled())\r
+                               return;\r
+\r
+                       if (!t.isMenuRendered) {\r
+                               t.renderMenu();\r
+                               t.isMenuRendered = true;\r
+                       }\r
+\r
+                       if (t.isMenuVisible)\r
+                               return t.hideMenu();\r
+\r
+                       p1 = DOM.getPos(t.settings.menu_container);\r
+                       p2 = DOM.getPos(e);\r
+\r
+                       m = t.menu;\r
+                       m.settings.offset_x = p2.x;\r
+                       m.settings.offset_y = p2.y;\r
+                       m.settings.vp_offset_x = p2.x;\r
+                       m.settings.vp_offset_y = p2.y;\r
+                       m.settings.keyboard_focus = t._focused;\r
+                       m.showMenu(0, e.clientHeight);\r
 \r
-               onAdd : new Dispatcher(this),\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       t.setState('Selected', 1);\r
 \r
-               get : function(n) {\r
-                       return this.lookup[n];\r
+                       t.isMenuVisible = 1;\r
                },\r
 \r
-               requireLangPack : function(n) {\r
-                       var s = tinymce.settings;\r
+               renderMenu : function() {\r
+                       var t = this, m;\r
 \r
-                       if (s && s.language)\r
-                               tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');\r
-               },\r
+                       m = t.settings.control_manager.createDropMenu(t.id + '_menu', {\r
+                               menu_line : 1,\r
+                               'class' : this.classPrefix + 'Menu',\r
+                               icons : t.settings.icons\r
+                       });\r
 \r
-               add : function(id, o) {\r
-                       this.items.push(o);\r
-                       this.lookup[id] = o;\r
-                       this.onAdd.dispatch(this, id, o);\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
 \r
-                       return o;\r
+                       t.onRenderMenu.dispatch(t, m);\r
+                       t.menu = m;\r
                },\r
 \r
-               load : function(n, u, cb, s) {\r
+               hideMenu : function(e) {\r
                        var t = this;\r
 \r
-                       if (t.urls[n])\r
+                       // Prevent double toogles by canceling the mouse click event to the button\r
+                       if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))\r
                                return;\r
 \r
-                       if (u.indexOf('/') != 0 && u.indexOf('://') == -1)\r
-                               u = tinymce.baseURL + '/' +  u;\r
-\r
-                       t.urls[n] = u.substring(0, u.lastIndexOf('/'));\r
-                       tinymce.ScriptLoader.add(u, cb, s);\r
-               }\r
-       });\r
+                       if (!e || !DOM.getParent(e.target, '.mceMenu')) {\r
+                               t.setState('Selected', 0);\r
+                               Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                               if (t.menu)\r
+                                       t.menu.hideMenu();\r
+                       }\r
 \r
-       // Create plugin and theme managers\r
-       tinymce.PluginManager = new tinymce.AddOnManager();\r
-       tinymce.ThemeManager = new tinymce.AddOnManager();\r
-}(tinymce));\r
+                       t.isMenuVisible = 0;\r
+               },\r
 \r
-(function(tinymce) {\r
-       // Shorten names\r
-       var each = tinymce.each, extend = tinymce.extend,\r
-               DOM = tinymce.DOM, Event = tinymce.dom.Event,\r
-               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
-               explode = tinymce.explode,\r
-               Dispatcher = tinymce.util.Dispatcher, undefined, instanceCounter = 0;\r
+               postRender : function() {\r
+                       var t = this, s = t.settings;\r
 \r
-       // Setup some URLs where the editor API is located and where the document is\r
-       tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');\r
-       if (!/[\/\\]$/.test(tinymce.documentBaseURL))\r
-               tinymce.documentBaseURL += '/';\r
+                       Event.add(t.id, 'click', function() {\r
+                               if (!t.isDisabled()) {\r
+                                       if (s.onclick)\r
+                                               s.onclick(t.value);\r
 \r
-       tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);\r
+                                       t.showMenu();\r
+                               }\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-       tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
 \r
-       // Add before unload listener\r
-       // This was required since IE was leaking memory if you added and removed beforeunload listeners\r
-       // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event\r
-       tinymce.onBeforeUnload = new Dispatcher(tinymce);\r
+       tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {\r
+               SplitButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
+                       this.classPrefix = 'mceSplitButton';\r
+               },\r
 \r
-       // Must be on window or IE will leak if the editor is placed in frame or iframe\r
-       Event.add(window, 'beforeunload', function(e) {\r
-               tinymce.onBeforeUnload.dispatch(tinymce, e);\r
-       });\r
+               renderHTML : function() {\r
+                       var h, t = this, s = t.settings, h1;\r
 \r
-       tinymce.onAddEditor = new Dispatcher(tinymce);\r
+                       h = '<tbody><tr>';\r
 \r
-       tinymce.onRemoveEditor = new Dispatcher(tinymce);\r
+                       if (s.image)\r
+                               h1 = DOM.createHTML('img ', {src : s.image, role: 'presentation', 'class' : 'mceAction ' + s['class']});\r
+                       else\r
+                               h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');\r
 \r
-       tinymce.EditorManager = extend(tinymce, {\r
-               editors : [],\r
+                       h1 += DOM.createHTML('span', {'class': 'mceVoiceLabel mceIconOnly', id: t.id + '_voice', style: 'display:none;'}, s.title);\r
+                       h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_action', tabindex: '-1', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
+       \r
+                       h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']}, '<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');\r
+                       h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_open', tabindex: '-1', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';\r
 \r
-               i18n : {},\r
+                       h += '</tr></tbody>';\r
+                       h = DOM.createHTML('table', { role: 'presentation',   'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', title : s.title}, h);\r
+                       return DOM.createHTML('div', {id : t.id, role: 'button', tabindex: '0', 'aria-labelledby': t.id + '_voice', 'aria-haspopup': 'true'}, h);\r
+               },\r
 \r
-               activeEditor : null,\r
+               postRender : function() {\r
+                       var t = this, s = t.settings, activate;\r
 \r
-               init : function(s) {\r
-                       var t = this, pl, sl = tinymce.ScriptLoader, e, el = [], ed;\r
+                       if (s.onclick) {\r
+                               activate = function(evt) {\r
+                                       if (!t.isDisabled()) {\r
+                                               s.onclick(t.value);\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                               };\r
+                               Event.add(t.id + '_action', 'click', activate);\r
+                               Event.add(t.id, ['click', 'keydown'], function(evt) {\r
+                                       var DOM_VK_SPACE = 32, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_UP = 38, DOM_VK_DOWN = 40;\r
+                                       if ((evt.keyCode === 32 || evt.keyCode === 13 || evt.keyCode === 14) && !evt.altKey && !evt.ctrlKey && !evt.metaKey) {\r
+                                               activate();\r
+                                               Event.cancel(evt);\r
+                                       } else if (evt.type === 'click' || evt.keyCode === DOM_VK_DOWN) {\r
+                                               t.showMenu();\r
+                                               Event.cancel(evt);\r
+                                       }\r
+                               });\r
+                       }\r
 \r
-                       function execCallback(se, n, s) {\r
-                               var f = se[n];\r
+                       Event.add(t.id + '_open', 'click', function (evt) {\r
+                               t.showMenu();\r
+                               Event.cancel(evt);\r
+                       });\r
+                       Event.add([t.id, t.id + '_open'], 'focus', function() {t._focused = 1;});\r
+                       Event.add([t.id, t.id + '_open'], 'blur', function() {t._focused = 0;});\r
 \r
-                               if (!f)\r
-                                       return;\r
+                       // Old IE doesn't have hover on all elements\r
+                       if (tinymce.isIE6 || !DOM.boxModel) {\r
+                               Event.add(t.id, 'mouseover', function() {\r
+                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
+                                               DOM.addClass(t.id, 'mceSplitButtonHover');\r
+                               });\r
 \r
-                               if (tinymce.is(f, 'string')) {\r
-                                       s = f.replace(/\.\w+$/, '');\r
-                                       s = s ? tinymce.resolve(s) : 0;\r
-                                       f = tinymce.resolve(f);\r
-                               }\r
+                               Event.add(t.id, 'mouseout', function() {\r
+                                       if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))\r
+                                               DOM.removeClass(t.id, 'mceSplitButtonHover');\r
+                               });\r
+                       }\r
+               },\r
 \r
-                               return f.apply(s || this, Array.prototype.slice.call(arguments, 2));\r
-                       };\r
+               destroy : function() {\r
+                       this.parent();\r
 \r
-                       s = extend({\r
-                               theme : "simple",\r
-                               language : "en"\r
-                       }, s);\r
+                       Event.clear(this.id + '_action');\r
+                       Event.clear(this.id + '_open');\r
+                       Event.clear(this.id);\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                       t.settings = s;\r
+(function(tinymce) {\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;\r
 \r
-                       // Legacy call\r
-                       Event.add(document, 'init', function() {\r
-                               var l, co;\r
+       tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {\r
+               ColorSplitButton : function(id, s, ed) {\r
+                       var t = this;\r
 \r
-                               execCallback(s, 'onpageload');\r
+                       t.parent(id, s, ed);\r
 \r
-                               switch (s.mode) {\r
-                                       case "exact":\r
-                                               l = s.elements || '';\r
+                       t.settings = s = tinymce.extend({\r
+                               colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',\r
+                               grid_width : 8,\r
+                               default_color : '#888888'\r
+                       }, t.settings);\r
 \r
-                                               if(l.length > 0) {\r
-                                                       each(explode(l), function(v) {\r
-                                                               if (DOM.get(v)) {\r
-                                                                       ed = new tinymce.Editor(v, s);\r
-                                                                       el.push(ed);\r
-                                                                       ed.render(1);\r
-                                                               } else {\r
-                                                                       each(document.forms, function(f) {\r
-                                                                               each(f.elements, function(e) {\r
-                                                                                       if (e.name === v) {\r
-                                                                                               v = 'mce_editor_' + instanceCounter++;\r
-                                                                                               DOM.setAttrib(e, 'id', v);\r
+                       t.onShowMenu = new tinymce.util.Dispatcher(t);\r
 \r
-                                                                                               ed = new tinymce.Editor(v, s);\r
-                                                                                               el.push(ed);\r
-                                                                                               ed.render(1);\r
-                                                                                       }\r
-                                                                               });\r
-                                                                       });\r
-                                                               }\r
-                                                       });\r
-                                               }\r
-                                               break;\r
+                       t.onHideMenu = new tinymce.util.Dispatcher(t);\r
 \r
-                                       case "textareas":\r
-                                       case "specific_textareas":\r
-                                               function hasClass(n, c) {\r
-                                                       return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);\r
-                                               };\r
+                       t.value = s.default_color;\r
+               },\r
 \r
-                                               each(DOM.select('textarea'), function(v) {\r
-                                                       if (s.editor_deselector && hasClass(v, s.editor_deselector))\r
-                                                               return;\r
+               showMenu : function() {\r
+                       var t = this, r, p, e, p2;\r
 \r
-                                                       if (!s.editor_selector || hasClass(v, s.editor_selector)) {\r
-                                                               // Can we use the name\r
-                                                               e = DOM.get(v.name);\r
-                                                               if (!v.id && !e)\r
-                                                                       v.id = v.name;\r
+                       if (t.isDisabled())\r
+                               return;\r
 \r
-                                                               // Generate unique name if missing or already exists\r
-                                                               if (!v.id || t.get(v.id))\r
-                                                                       v.id = DOM.uniqueId();\r
+                       if (!t.isMenuRendered) {\r
+                               t.renderMenu();\r
+                               t.isMenuRendered = true;\r
+                       }\r
 \r
-                                                               ed = new tinymce.Editor(v.id, s);\r
-                                                               el.push(ed);\r
-                                                               ed.render(1);\r
-                                                       }\r
-                                               });\r
-                                               break;\r
-                               }\r
+                       if (t.isMenuVisible)\r
+                               return t.hideMenu();\r
 \r
-                               // Call onInit when all editors are initialized\r
-                               if (s.oninit) {\r
-                                       l = co = 0;\r
+                       e = DOM.get(t.id);\r
+                       DOM.show(t.id + '_menu');\r
+                       DOM.addClass(e, 'mceSplitButtonSelected');\r
+                       p2 = DOM.getPos(e);\r
+                       DOM.setStyles(t.id + '_menu', {\r
+                               left : p2.x,\r
+                               top : p2.y + e.clientHeight,\r
+                               zIndex : 200000\r
+                       });\r
+                       e = 0;\r
 \r
-                                       each(el, function(ed) {\r
-                                               co++;\r
+                       Event.add(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                       t.onShowMenu.dispatch(t);\r
 \r
-                                               if (!ed.initialized) {\r
-                                                       // Wait for it\r
-                                                       ed.onInit.add(function() {\r
-                                                               l++;\r
+                       if (t._focused) {\r
+                               t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {\r
+                                       if (e.keyCode == 27)\r
+                                               t.hideMenu();\r
+                               });\r
 \r
-                                                               // All done\r
-                                                               if (l == co)\r
-                                                                       execCallback(s, 'oninit');\r
-                                                       });\r
-                                               } else\r
-                                                       l++;\r
+                               DOM.select('a', t.id + '_menu')[0].focus(); // Select first link\r
+                       }\r
 \r
-                                               // All done\r
-                                               if (l == co)\r
-                                                       execCallback(s, 'oninit');                                      \r
-                                       });\r
-                               }\r
-                       });\r
+                       t.isMenuVisible = 1;\r
                },\r
 \r
-               get : function(id) {\r
-                       if (id === undefined)\r
-                               return this.editors;\r
+               hideMenu : function(e) {\r
+                       var t = this;\r
+\r
+                       if (t.isMenuVisible) {\r
+                               // Prevent double toogles by canceling the mouse click event to the button\r
+                               if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))\r
+                                       return;\r
 \r
-                       return this.editors[id];\r
-               },\r
+                               if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {\r
+                                       DOM.removeClass(t.id, 'mceSplitButtonSelected');\r
+                                       Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);\r
+                                       Event.remove(t.id + '_menu', 'keydown', t._keyHandler);\r
+                                       DOM.hide(t.id + '_menu');\r
+                               }\r
 \r
-               getInstanceById : function(id) {\r
-                       return this.get(id);\r
+                               t.isMenuVisible = 0;\r
+                               t.onHideMenu.dispatch();\r
+                       }\r
                },\r
 \r
-               add : function(editor) {\r
-                       var self = this, editors = self.editors;\r
+               renderMenu : function() {\r
+                       var t = this, m, i = 0, s = t.settings, n, tb, tr, w, context;\r
 \r
-                       // Add named and index editor instance\r
-                       editors[editor.id] = editor;\r
-                       editors.push(editor);\r
+                       w = DOM.add(s.menu_container, 'div', {role: 'listbox', id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});\r
+                       m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});\r
+                       DOM.add(m, 'span', {'class' : 'mceMenuLine'});\r
 \r
-                       self._setActive(editor);\r
-                       self.onAddEditor.dispatch(self, editor);\r
+                       n = DOM.add(m, 'table', {role: 'presentation', 'class' : 'mceColorSplitMenu'});\r
+                       tb = DOM.add(n, 'tbody');\r
 \r
+                       // Generate color grid\r
+                       i = 0;\r
+                       each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {\r
+                               c = c.replace(/^#/, '');\r
 \r
-                       return editor;\r
-               },\r
+                               if (!i--) {\r
+                                       tr = DOM.add(tb, 'tr');\r
+                                       i = s.grid_width - 1;\r
+                               }\r
 \r
-               remove : function(editor) {\r
-                       var t = this, i, editors = t.editors;\r
+                               n = DOM.add(tr, 'td');\r
+                               var settings = {\r
+                                       href : 'javascript:;',\r
+                                       style : {\r
+                                               backgroundColor : '#' + c\r
+                                       },\r
+                                       'title': t.editor.getLang('colors.' + c, c),\r
+                                       'data-mce-color' : '#' + c\r
+                               };\r
 \r
-                       // Not in the collection\r
-                       if (!editors[editor.id])\r
-                               return null;\r
+                               // adding a proper ARIA role = button causes JAWS to read things incorrectly on IE.\r
+                               if (!tinymce.isIE ) {\r
+                                       settings['role']= 'option';\r
+                               }\r
 \r
-                       delete editors[editor.id];\r
+                               n = DOM.add(n, 'a', settings);\r
 \r
-                       for (i = 0; i < editors.length; i++) {\r
-                               if (editors[i] == editor) {\r
-                                       editors.splice(i, 1);\r
-                                       break;\r
+                               if (t.editor.forcedHighContrastMode) {\r
+                                       n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' });\r
+                                       if (n.getContext && (context = n.getContext("2d"))) {\r
+                                               context.fillStyle = '#' + c;\r
+                                               context.fillRect(0, 0, 16, 16);\r
+                                       } else {\r
+                                               // No point leaving a canvas element around if it's not supported for drawing on anyway.\r
+                                               DOM.remove(n);\r
+                                       }\r
                                }\r
+                       });\r
+\r
+                       if (s.more_colors_func) {\r
+                               n = DOM.add(tb, 'tr');\r
+                               n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});\r
+                               n = DOM.add(n, 'a', {role: 'option', id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);\r
+\r
+                               Event.add(n, 'click', function(e) {\r
+                                       s.more_colors_func.call(s.more_colors_scope || this);\r
+                                       return Event.cancel(e); // Cancel to fix onbeforeunload problem\r
+                               });\r
                        }\r
 \r
-                       // Select another editor since the active one was removed\r
-                       if (t.activeEditor == editor)\r
-                               t._setActive(editors[0]);\r
+                       DOM.addClass(m, 'mceColorSplitMenu');\r
+                       \r
+                       new tinymce.ui.KeyboardNavigation({\r
+                               root: t.id + '_menu',\r
+                               items: DOM.select('a', t.id + '_menu'),\r
+                               onCancel: function() {\r
+                                       t.hideMenu();\r
+                                       t.focus();\r
+                               }\r
+                       });\r
 \r
-                       editor.destroy();\r
-                       t.onRemoveEditor.dispatch(t, editor);\r
+                       // Prevent IE from scrolling and hindering click to occur #4019\r
+                       Event.add(t.id + '_menu', 'mousedown', function(e) {return Event.cancel(e);});\r
 \r
-                       return editor;\r
-               },\r
+                       Event.add(t.id + '_menu', 'click', function(e) {\r
+                               var c;\r
 \r
-               execCommand : function(c, u, v) {\r
-                       var t = this, ed = t.get(v), w;\r
+                               e = DOM.getParent(e.target, 'a', tb);\r
 \r
-                       // Manager commands\r
-                       switch (c) {\r
-                               case "mceFocus":\r
-                                       ed.focus();\r
-                                       return true;\r
+                               if (e && e.nodeName.toLowerCase() == 'a' && (c = e.getAttribute('data-mce-color')))\r
+                                       t.setColor(c);\r
 \r
-                               case "mceAddEditor":\r
-                               case "mceAddControl":\r
-                                       if (!t.get(v))\r
-                                               new tinymce.Editor(v, t.settings).render();\r
+                               return false; // Prevent IE auto save warning\r
+                       });\r
 \r
-                                       return true;\r
+                       return w;\r
+               },\r
 \r
-                               case "mceAddFrameControl":\r
-                                       w = v.window;\r
+               setColor : function(c) {\r
+                       this.displayColor(c);\r
+                       this.hideMenu();\r
+                       this.settings.onselect(c);\r
+               },\r
+               \r
+               displayColor : function(c) {\r
+                       var t = this;\r
 \r
-                                       // Add tinyMCE global instance and tinymce namespace to specified window\r
-                                       w.tinyMCE = tinyMCE;\r
-                                       w.tinymce = tinymce;\r
+                       DOM.setStyle(t.id + '_preview', 'backgroundColor', c);\r
 \r
-                                       tinymce.DOM.doc = w.document;\r
-                                       tinymce.DOM.win = w;\r
+                       t.value = c;\r
+               },\r
 \r
-                                       ed = new tinymce.Editor(v.element_id, v);\r
-                                       ed.render();\r
+               postRender : function() {\r
+                       var t = this, id = t.id;\r
 \r
-                                       // Fix IE memory leaks\r
-                                       if (tinymce.isIE) {\r
-                                               function clr() {\r
-                                                       ed.destroy();\r
-                                                       w.detachEvent('onunload', clr);\r
-                                                       w = w.tinyMCE = w.tinymce = null; // IE leak\r
-                                               };\r
+                       t.parent();\r
+                       DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});\r
+                       DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);\r
+               },\r
 \r
-                                               w.attachEvent('onunload', clr);\r
-                                       }\r
+               destroy : function() {\r
+                       this.parent();\r
 \r
-                                       v.page_window = null;\r
+                       Event.clear(this.id + '_menu');\r
+                       Event.clear(this.id + '_more');\r
+                       DOM.remove(this.id + '_menu');\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                                       return true;\r
+(function(tinymce) {\r
+// Shorten class names\r
+var dom = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event;\r
+tinymce.create('tinymce.ui.ToolbarGroup:tinymce.ui.Container', {\r
+       renderHTML : function() {\r
+               var t = this, h = [], controls = t.controls, each = tinymce.each, settings = t.settings;\r
+\r
+               h.push('<div id="' + t.id + '" role="group" aria-labelledby="' + t.id + '_voice">');\r
+               //TODO: ACC test this out - adding a role = application for getting the landmarks working well.\r
+               h.push("<span role='application'>");\r
+               h.push('<span id="' + t.id + '_voice" class="mceVoiceLabel" style="display:none;">' + dom.encode(settings.name) + '</span>');\r
+               each(controls, function(toolbar) {\r
+                       h.push(toolbar.renderHTML());\r
+               });\r
+               h.push("</span>");\r
+               h.push('</div>');\r
 \r
-                               case "mceRemoveEditor":\r
-                               case "mceRemoveControl":\r
-                                       if (ed)\r
-                                               ed.remove();\r
+               return h.join('');\r
+       },\r
+       \r
+       focus : function() {\r
+               var t = this;\r
+               dom.get(t.id).focus();\r
+       },\r
+       \r
+       postRender : function() {\r
+               var t = this, items = [];\r
 \r
-                                       return true;\r
+               each(t.controls, function(toolbar) {\r
+                       each (toolbar.controls, function(control) {\r
+                               if (control.id) {\r
+                                       items.push(control);\r
+                               }\r
+                       });\r
+               });\r
 \r
-                               case 'mceToggleEditor':\r
-                                       if (!ed) {\r
-                                               t.execCommand('mceAddControl', 0, v);\r
-                                               return true;\r
-                                       }\r
+               t.keyNav = new tinymce.ui.KeyboardNavigation({\r
+                       root: t.id,\r
+                       items: items,\r
+                       onCancel: function() {\r
+                               //Move focus if webkit so that navigation back will read the item.\r
+                               if (tinymce.isWebKit) {\r
+                                       dom.get(t.editor.id+"_ifr").focus();\r
+                               }\r
+                               t.editor.focus();\r
+                       },\r
+                       excludeFromTabOrder: !t.settings.tab_focus_toolbar\r
+               });\r
+       },\r
+       \r
+       destroy : function() {\r
+               var self = this;\r
 \r
-                                       if (ed.isHidden())\r
-                                               ed.show();\r
-                                       else\r
-                                               ed.hide();\r
+               self.parent();\r
+               self.keyNav.destroy();\r
+               Event.clear(self.id);\r
+       }\r
+});\r
+})(tinymce);\r
 \r
-                                       return true;\r
-                       }\r
+(function(tinymce) {\r
+// Shorten class names\r
+var dom = tinymce.DOM, each = tinymce.each;\r
+tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {\r
+       renderHTML : function() {\r
+               var t = this, h = '', c, co, s = t.settings, i, pr, nx, cl;\r
 \r
-                       // Run command on active editor\r
-                       if (t.activeEditor)\r
-                               return t.activeEditor.execCommand(c, u, v);\r
+               cl = t.controls;\r
+               for (i=0; i<cl.length; i++) {\r
+                       // Get current control, prev control, next control and if the control is a list box or not\r
+                       co = cl[i];\r
+                       pr = cl[i - 1];\r
+                       nx = cl[i + 1];\r
 \r
-                       return false;\r
-               },\r
+                       // Add toolbar start\r
+                       if (i === 0) {\r
+                               c = 'mceToolbarStart';\r
 \r
-               execInstanceCommand : function(id, c, u, v) {\r
-                       var ed = this.get(id);\r
+                               if (co.Button)\r
+                                       c += ' mceToolbarStartButton';\r
+                               else if (co.SplitButton)\r
+                                       c += ' mceToolbarStartSplitButton';\r
+                               else if (co.ListBox)\r
+                                       c += ' mceToolbarStartListBox';\r
 \r
-                       if (ed)\r
-                               return ed.execCommand(c, u, v);\r
+                               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       }\r
 \r
-                       return false;\r
-               },\r
+                       // Add toolbar end before list box and after the previous button\r
+                       // This is to fix the o2k7 editor skins\r
+                       if (pr && co.ListBox) {\r
+                               if (pr.Button || pr.SplitButton)\r
+                                       h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));\r
+                       }\r
 \r
-               triggerSave : function() {\r
-                       each(this.editors, function(e) {\r
-                               e.save();\r
-                       });\r
-               },\r
+                       // Render control HTML\r
 \r
-               addI18n : function(p, o) {\r
-                       var lo, i18n = this.i18n;\r
+                       // IE 8 quick fix, needed to propertly generate a hit area for anchors\r
+                       if (dom.stdMode)\r
+                               h += '<td style="position: relative">' + co.renderHTML() + '</td>';\r
+                       else\r
+                               h += '<td>' + co.renderHTML() + '</td>';\r
 \r
-                       if (!tinymce.is(p, 'string')) {\r
-                               each(p, function(o, lc) {\r
-                                       each(o, function(o, g) {\r
-                                               each(o, function(o, k) {\r
-                                                       if (g === 'common')\r
-                                                               i18n[lc + '.' + k] = o;\r
-                                                       else\r
-                                                               i18n[lc + '.' + g + '.' + k] = o;\r
-                                               });\r
-                                       });\r
-                               });\r
-                       } else {\r
-                               each(o, function(o, k) {\r
-                                       i18n[p + '.' + k] = o;\r
-                               });\r
+                       // Add toolbar start after list box and before the next button\r
+                       // This is to fix the o2k7 editor skins\r
+                       if (nx && co.ListBox) {\r
+                               if (nx.Button || nx.SplitButton)\r
+                                       h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));\r
                        }\r
-               },\r
+               }\r
 \r
-               // Private methods\r
+               c = 'mceToolbarEnd';\r
 \r
-               _setActive : function(editor) {\r
-                       this.selectedInstance = this.activeEditor = editor;\r
-               }\r
-       });\r
-})(tinymce);\r
+               if (co.Button)\r
+                       c += ' mceToolbarEndButton';\r
+               else if (co.SplitButton)\r
+                       c += ' mceToolbarEndSplitButton';\r
+               else if (co.ListBox)\r
+                       c += ' mceToolbarEndListBox';\r
 \r
-(function(tinymce) {\r
-       // Shorten these names\r
-       var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,\r
-               Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko,\r
-               isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,\r
-               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
-               inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;\r
+               h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));\r
+\r
+               return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || '', role: 'presentation', tabindex: '-1'}, '<tbody><tr>' + h + '</tr></tbody>');\r
+       }\r
+});\r
+})(tinymce);\r
 \r
-       tinymce.create('tinymce.Editor', {\r
-               Editor : function(id, s) {\r
-                       var t = this;\r
+(function(tinymce) {\r
+       var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;\r
 \r
-                       t.id = t.editorId = id;\r
+       tinymce.create('tinymce.AddOnManager', {\r
+               AddOnManager : function() {\r
+                       var self = this;\r
 \r
-                       t.execCommands = {};\r
-                       t.queryStateCommands = {};\r
-                       t.queryValueCommands = {};\r
+                       self.items = [];\r
+                       self.urls = {};\r
+                       self.lookup = {};\r
+                       self.onAdd = new Dispatcher(self);\r
+               },\r
 \r
-                       t.isNotDirty = false;\r
+               get : function(n) {\r
+                       if (this.lookup[n]) {\r
+                               return this.lookup[n].instance;\r
+                       } else {\r
+                               return undefined;\r
+                       }\r
+               },\r
 \r
-                       t.plugins = {};\r
+               dependencies : function(n) {\r
+                       var result;\r
+                       if (this.lookup[n]) {\r
+                               result = this.lookup[n].dependencies;\r
+                       }\r
+                       return result || [];\r
+               },\r
 \r
-                       // Add events to the editor\r
-                       each([\r
-                               'onPreInit',\r
+               requireLangPack : function(n) {\r
+                       var s = tinymce.settings;\r
 \r
-                               'onBeforeRenderUI',\r
+                       if (s && s.language && s.language_load !== false)\r
+                               tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');\r
+               },\r
 \r
-                               'onPostRender',\r
+               add : function(id, o, dependencies) {\r
+                       this.items.push(o);\r
+                       this.lookup[id] = {instance:o, dependencies:dependencies};\r
+                       this.onAdd.dispatch(this, id, o);\r
 \r
-                               'onInit',\r
+                       return o;\r
+               },\r
+               createUrl: function(baseUrl, dep) {\r
+                       if (typeof dep === "object") {\r
+                               return dep\r
+                       } else {\r
+                               return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix};\r
+                       }\r
+               },\r
 \r
-                               'onRemove',\r
+               addComponents: function(pluginName, scripts) {\r
+                       var pluginUrl = this.urls[pluginName];\r
+                       tinymce.each(scripts, function(script){\r
+                               tinymce.ScriptLoader.add(pluginUrl+"/"+script); \r
+                       });\r
+               },\r
 \r
-                               'onActivate',\r
+               load : function(n, u, cb, s) {\r
+                       var t = this, url = u;\r
 \r
-                               'onDeactivate',\r
+                       function loadDependencies() {\r
+                               var dependencies = t.dependencies(n);\r
+                               tinymce.each(dependencies, function(dep) {\r
+                                       var newUrl = t.createUrl(u, dep);\r
+                                       t.load(newUrl.resource, newUrl, undefined, undefined);\r
+                               });\r
+                               if (cb) {\r
+                                       if (s) {\r
+                                               cb.call(s);\r
+                                       } else {\r
+                                               cb.call(tinymce.ScriptLoader);\r
+                                       }\r
+                               }\r
+                       }\r
 \r
-                               'onClick',\r
+                       if (t.urls[n])\r
+                               return;\r
+                       if (typeof u === "object")\r
+                               url = u.prefix + u.resource + u.suffix;\r
 \r
-                               'onEvent',\r
+                       if (url.indexOf('/') != 0 && url.indexOf('://') == -1)\r
+                               url = tinymce.baseURL + '/' + url;\r
 \r
-                               'onMouseUp',\r
+                       t.urls[n] = url.substring(0, url.lastIndexOf('/'));\r
 \r
-                               'onMouseDown',\r
+                       if (t.lookup[n]) {\r
+                               loadDependencies();\r
+                       } else {\r
+                               tinymce.ScriptLoader.add(url, loadDependencies, s);\r
+                       }\r
+               }\r
+       });\r
 \r
-                               'onDblClick',\r
+       // Create plugin and theme managers\r
+       tinymce.PluginManager = new tinymce.AddOnManager();\r
+       tinymce.ThemeManager = new tinymce.AddOnManager();\r
+}(tinymce));\r
 \r
-                               'onKeyDown',\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var each = tinymce.each, extend = tinymce.extend,\r
+               DOM = tinymce.DOM, Event = tinymce.dom.Event,\r
+               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
+               explode = tinymce.explode,\r
+               Dispatcher = tinymce.util.Dispatcher, undefined, instanceCounter = 0;\r
 \r
-                               'onKeyUp',\r
+       // Setup some URLs where the editor API is located and where the document is\r
+       tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');\r
+       if (!/[\/\\]$/.test(tinymce.documentBaseURL))\r
+               tinymce.documentBaseURL += '/';\r
 \r
-                               'onKeyPress',\r
+       tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);\r
 \r
-                               'onContextMenu',\r
+       tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);\r
 \r
-                               'onSubmit',\r
+       // Add before unload listener\r
+       // This was required since IE was leaking memory if you added and removed beforeunload listeners\r
+       // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event\r
+       tinymce.onBeforeUnload = new Dispatcher(tinymce);\r
 \r
-                               'onReset',\r
+       // Must be on window or IE will leak if the editor is placed in frame or iframe\r
+       Event.add(window, 'beforeunload', function(e) {\r
+               tinymce.onBeforeUnload.dispatch(tinymce, e);\r
+       });\r
 \r
-                               'onPaste',\r
+       tinymce.onAddEditor = new Dispatcher(tinymce);\r
 \r
-                               'onPreProcess',\r
+       tinymce.onRemoveEditor = new Dispatcher(tinymce);\r
 \r
-                               'onPostProcess',\r
+       tinymce.EditorManager = extend(tinymce, {\r
+               editors : [],\r
 \r
-                               'onBeforeSetContent',\r
+               i18n : {},\r
 \r
-                               'onBeforeGetContent',\r
+               activeEditor : null,\r
 \r
-                               'onSetContent',\r
+               init : function(s) {\r
+                       var t = this, pl, sl = tinymce.ScriptLoader, e, el = [], ed;\r
 \r
-                               'onGetContent',\r
+                       function createId(elm) {\r
+                               var id = elm.id;\r
+       \r
+                               // Use element id, or unique name or generate a unique id\r
+                               if (!id) {\r
+                                       id = elm.name;\r
+       \r
+                                       if (id && !DOM.get(id)) {\r
+                                               id = elm.name;\r
+                                       } else {\r
+                                               // Generate unique name\r
+                                               id = DOM.uniqueId();\r
+                                       }\r
 \r
-                               'onLoadContent',\r
+                                       elm.setAttribute('id', id);\r
+                               }\r
 \r
-                               'onSaveContent',\r
+                               return id;\r
+                       };\r
 \r
-                               'onNodeChange',\r
+                       function execCallback(se, n, s) {\r
+                               var f = se[n];\r
 \r
-                               'onChange',\r
+                               if (!f)\r
+                                       return;\r
 \r
-                               'onBeforeExecCommand',\r
+                               if (tinymce.is(f, 'string')) {\r
+                                       s = f.replace(/\.\w+$/, '');\r
+                                       s = s ? tinymce.resolve(s) : 0;\r
+                                       f = tinymce.resolve(f);\r
+                               }\r
 \r
-                               'onExecCommand',\r
+                               return f.apply(s || this, Array.prototype.slice.call(arguments, 2));\r
+                       };\r
 \r
-                               'onUndo',\r
+                       s = extend({\r
+                               theme : "simple",\r
+                               language : "en"\r
+                       }, s);\r
 \r
-                               'onRedo',\r
+                       t.settings = s;\r
 \r
-                               'onVisualAid',\r
+                       // Legacy call\r
+                       Event.bind(window, 'ready', function() {\r
+                               var l, co;\r
 \r
-                               'onSetProgressState'\r
-                       ], function(e) {\r
-                               t[e] = new Dispatcher(t);\r
-                       });\r
+                               execCallback(s, 'onpageload');\r
 \r
-                       t.settings = s = extend({\r
-                               id : id,\r
-                               language : 'en',\r
-                               docs_language : 'en',\r
-                               theme : 'simple',\r
-                               skin : 'default',\r
-                               delta_width : 0,\r
-                               delta_height : 0,\r
-                               popup_css : '',\r
-                               plugins : '',\r
-                               document_base_url : tinymce.documentBaseURL,\r
-                               add_form_submit_trigger : 1,\r
-                               submit_patch : 1,\r
-                               add_unload_trigger : 1,\r
-                               convert_urls : 1,\r
-                               relative_urls : 1,\r
-                               remove_script_host : 1,\r
-                               table_inline_editing : 0,\r
-                               object_resizing : 1,\r
-                               cleanup : 1,\r
-                               accessibility_focus : 1,\r
-                               custom_shortcuts : 1,\r
-                               custom_undo_redo_keyboard_shortcuts : 1,\r
-                               custom_undo_redo_restore_selection : 1,\r
-                               custom_undo_redo : 1,\r
-                               doctype : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll\r
-                               visual_table_class : 'mceItemTable',\r
-                               visual : 1,\r
-                               font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',\r
-                               apply_source_formatting : 1,\r
-                               directionality : 'ltr',\r
-                               forced_root_block : 'p',\r
-                               valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',\r
-                               hidden_input : 1,\r
-                               padd_empty_editor : 1,\r
-                               render_ui : 1,\r
-                               init_theme : 1,\r
-                               force_p_newlines : 1,\r
-                               indentation : '30px',\r
-                               keep_styles : 1,\r
-                               fix_table_elements : 1,\r
-                               inline_styles : 1,\r
-                               convert_fonts_to_spans : true\r
-                       }, s);\r
+                               switch (s.mode) {\r
+                                       case "exact":\r
+                                               l = s.elements || '';\r
 \r
-                       t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {\r
-                               base_uri : tinyMCE.baseURI\r
-                       });\r
+                                               if(l.length > 0) {\r
+                                                       each(explode(l), function(v) {\r
+                                                               if (DOM.get(v)) {\r
+                                                                       ed = new tinymce.Editor(v, s);\r
+                                                                       el.push(ed);\r
+                                                                       ed.render(1);\r
+                                                               } else {\r
+                                                                       each(document.forms, function(f) {\r
+                                                                               each(f.elements, function(e) {\r
+                                                                                       if (e.name === v) {\r
+                                                                                               v = 'mce_editor_' + instanceCounter++;\r
+                                                                                               DOM.setAttrib(e, 'id', v);\r
 \r
-                       t.baseURI = tinymce.baseURI;\r
+                                                                                               ed = new tinymce.Editor(v, s);\r
+                                                                                               el.push(ed);\r
+                                                                                               ed.render(1);\r
+                                                                                       }\r
+                                                                               });\r
+                                                                       });\r
+                                                               }\r
+                                                       });\r
+                                               }\r
+                                               break;\r
 \r
-                       // Call setup\r
-                       t.execCallback('setup', t);\r
-               },\r
+                                       case "textareas":\r
+                                       case "specific_textareas":\r
+                                               function hasClass(n, c) {\r
+                                                       return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);\r
+                                               };\r
 \r
-               render : function(nst) {\r
-                       var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;\r
+                                               each(DOM.select('textarea'), function(elm) {\r
+                                                       if (s.editor_deselector && hasClass(elm, s.editor_deselector))\r
+                                                               return;\r
 \r
-                       // Page is not loaded yet, wait for it\r
-                       if (!Event.domLoaded) {\r
-                               Event.add(document, 'init', function() {\r
-                                       t.render();\r
-                               });\r
-                               return;\r
-                       }\r
+                                                       if (!s.editor_selector || hasClass(elm, s.editor_selector)) {\r
+                                                               ed = new tinymce.Editor(createId(elm), s);\r
+                                                               el.push(ed);\r
+                                                               ed.render(1);\r
+                                                       }\r
+                                               });\r
+                                               break;\r
+                                       \r
+                                       default:\r
+                                               if (s.types) {\r
+                                                       // Process type specific selector\r
+                                                       each(s.types, function(type) {\r
+                                                               each(DOM.select(type.selector), function(elm) {\r
+                                                                       var editor = new tinymce.Editor(createId(elm), tinymce.extend({}, s, type));\r
+                                                                       el.push(editor);\r
+                                                                       editor.render(1);\r
+                                                               });\r
+                                                       });\r
+                                               } else if (s.selector) {\r
+                                                       // Process global selector\r
+                                                       each(DOM.select(s.selector), function(elm) {\r
+                                                               var editor = new tinymce.Editor(createId(elm), s);\r
+                                                               el.push(editor);\r
+                                                               editor.render(1);\r
+                                                       });\r
+                                               }\r
+                               }\r
 \r
-                       tinyMCE.settings = s;\r
+                               // Call onInit when all editors are initialized\r
+                               if (s.oninit) {\r
+                                       l = co = 0;\r
 \r
-                       // Element not found, then skip initialization\r
-                       if (!t.getElement())\r
-                               return;\r
+                                       each(el, function(ed) {\r
+                                               co++;\r
+\r
+                                               if (!ed.initialized) {\r
+                                                       // Wait for it\r
+                                                       ed.onInit.add(function() {\r
+                                                               l++;\r
 \r
-                       // Is a iPad/iPhone, then skip initialization. We need to sniff here since the\r
-                       // browser says it has contentEditable support but there is no visible caret\r
-                       // We will remove this check ones Apple implements full contentEditable support\r
-                       if (tinymce.isIDevice)\r
-                               return;\r
+                                                               // All done\r
+                                                               if (l == co)\r
+                                                                       execCallback(s, 'oninit');\r
+                                                       });\r
+                                               } else\r
+                                                       l++;\r
 \r
-                       // Add hidden input for non input elements inside form elements\r
-                       if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))\r
-                               DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);\r
+                                               // All done\r
+                                               if (l == co)\r
+                                                       execCallback(s, 'oninit');                                      \r
+                                       });\r
+                               }\r
+                       });\r
+               },\r
 \r
-                       if (tinymce.WindowManager)\r
-                               t.windowManager = new tinymce.WindowManager(t);\r
+               get : function(id) {\r
+                       if (id === undefined)\r
+                               return this.editors;\r
 \r
-                       if (s.encoding == 'xml') {\r
-                               t.onGetContent.add(function(ed, o) {\r
-                                       if (o.save)\r
-                                               o.content = DOM.encode(o.content);\r
-                               });\r
-                       }\r
+                       return this.editors[id];\r
+               },\r
 \r
-                       if (s.add_form_submit_trigger) {\r
-                               t.onSubmit.addToTop(function() {\r
-                                       if (t.initialized) {\r
-                                               t.save();\r
-                                               t.isNotDirty = 1;\r
-                                       }\r
-                               });\r
-                       }\r
+               getInstanceById : function(id) {\r
+                       return this.get(id);\r
+               },\r
 \r
-                       if (s.add_unload_trigger) {\r
-                               t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {\r
-                                       if (t.initialized && !t.destroyed && !t.isHidden())\r
-                                               t.save({format : 'raw', no_events : true});\r
-                               });\r
-                       }\r
+               add : function(editor) {\r
+                       var self = this, editors = self.editors;\r
 \r
-                       tinymce.addUnload(t.destroy, t);\r
+                       // Add named and index editor instance\r
+                       editors[editor.id] = editor;\r
+                       editors.push(editor);\r
 \r
-                       if (s.submit_patch) {\r
-                               t.onBeforeRenderUI.add(function() {\r
-                                       var n = t.getElement().form;\r
+                       self._setActive(editor);\r
+                       self.onAddEditor.dispatch(self, editor);\r
 \r
-                                       if (!n)\r
-                                               return;\r
 \r
-                                       // Already patched\r
-                                       if (n._mceOldSubmit)\r
-                                               return;\r
+                       return editor;\r
+               },\r
 \r
-                                       // Check page uses id="submit" or name="submit" for it's submit button\r
-                                       if (!n.submit.nodeType && !n.submit.length) {\r
-                                               t.formElement = n;\r
-                                               n._mceOldSubmit = n.submit;\r
-                                               n.submit = function() {\r
-                                                       // Save all instances\r
-                                                       tinymce.triggerSave();\r
-                                                       t.isNotDirty = 1;\r
+               remove : function(editor) {\r
+                       var t = this, i, editors = t.editors;\r
 \r
-                                                       return t.formElement._mceOldSubmit(t.formElement);\r
-                                               };\r
-                                       }\r
+                       // Not in the collection\r
+                       if (!editors[editor.id])\r
+                               return null;\r
 \r
-                                       n = null;\r
-                               });\r
+                       delete editors[editor.id];\r
+\r
+                       for (i = 0; i < editors.length; i++) {\r
+                               if (editors[i] == editor) {\r
+                                       editors.splice(i, 1);\r
+                                       break;\r
+                               }\r
                        }\r
 \r
-                       // Load scripts\r
-                       function loadScripts() {\r
-                               if (s.language)\r
-                                       sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');\r
+                       // Select another editor since the active one was removed\r
+                       if (t.activeEditor == editor)\r
+                               t._setActive(editors[0]);\r
 \r
-                               if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])\r
-                                       ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');\r
+                       editor.destroy();\r
+                       t.onRemoveEditor.dispatch(t, editor);\r
 \r
-                               each(explode(s.plugins), function(p) {\r
-                                       if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {\r
-                                               // Skip safari plugin, since it is removed as of 3.3b1\r
-                                               if (p == 'safari')\r
-                                                       return;\r
+                       return editor;\r
+               },\r
 \r
-                                               PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');\r
-                                       }\r
-                               });\r
+               execCommand : function(c, u, v) {\r
+                       var t = this, ed = t.get(v), w;\r
 \r
-                               // Init when que is loaded\r
-                               sl.loadQueue(function() {\r
-                                       if (!t.removed)\r
-                                               t.init();\r
-                               });\r
-                       };\r
+                       // Manager commands\r
+                       switch (c) {\r
+                               case "mceFocus":\r
+                                       ed.focus();\r
+                                       return true;\r
 \r
-                       loadScripts();\r
-               },\r
+                               case "mceAddEditor":\r
+                               case "mceAddControl":\r
+                                       if (!t.get(v))\r
+                                               new tinymce.Editor(v, t.settings).render();\r
 \r
-               init : function() {\r
-                       var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;\r
+                                       return true;\r
 \r
-                       tinymce.add(t);\r
+                               case "mceAddFrameControl":\r
+                                       w = v.window;\r
 \r
-                       if (s.theme) {\r
-                               s.theme = s.theme.replace(/-/, '');\r
-                               o = ThemeManager.get(s.theme);\r
-                               t.theme = new o();\r
+                                       // Add tinyMCE global instance and tinymce namespace to specified window\r
+                                       w.tinyMCE = tinyMCE;\r
+                                       w.tinymce = tinymce;\r
 \r
-                               if (t.theme.init && s.init_theme)\r
-                                       t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));\r
-                       }\r
+                                       tinymce.DOM.doc = w.document;\r
+                                       tinymce.DOM.win = w;\r
 \r
-                       // Create all plugins\r
-                       each(explode(s.plugins.replace(/\-/g, '')), function(p) {\r
-                               var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;\r
+                                       ed = new tinymce.Editor(v.element_id, v);\r
+                                       ed.render();\r
 \r
-                               if (c) {\r
-                                       po = new c(t, u);\r
+                                       // Fix IE memory leaks\r
+                                       if (tinymce.isIE) {\r
+                                               function clr() {\r
+                                                       ed.destroy();\r
+                                                       w.detachEvent('onunload', clr);\r
+                                                       w = w.tinyMCE = w.tinymce = null; // IE leak\r
+                                               };\r
 \r
-                                       t.plugins[p] = po;\r
+                                               w.attachEvent('onunload', clr);\r
+                                       }\r
 \r
-                                       if (po.init)\r
-                                               po.init(t, u);\r
-                               }\r
-                       });\r
+                                       v.page_window = null;\r
 \r
-                       // Setup popup CSS path(s)\r
-                       if (s.popup_css !== false) {\r
-                               if (s.popup_css)\r
-                                       s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);\r
-                               else\r
-                                       s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");\r
-                       }\r
+                                       return true;\r
 \r
-                       if (s.popup_css_add)\r
-                               s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);\r
+                               case "mceRemoveEditor":\r
+                               case "mceRemoveControl":\r
+                                       if (ed)\r
+                                               ed.remove();\r
 \r
-                       t.controlManager = new tinymce.ControlManager(t);\r
+                                       return true;\r
 \r
-                       if (s.custom_undo_redo) {\r
-                               // Add initial undo level\r
-                               t.onBeforeExecCommand.add(function(ed, cmd, ui, val, a) {\r
-                                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) {\r
-                                               if (!t.undoManager.hasUndo())\r
-                                                       t.undoManager.add();\r
+                               case 'mceToggleEditor':\r
+                                       if (!ed) {\r
+                                               t.execCommand('mceAddControl', 0, v);\r
+                                               return true;\r
                                        }\r
-                               });\r
 \r
-                               t.onExecCommand.add(function(ed, cmd, ui, val, a) {\r
-                                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))\r
-                                               t.undoManager.add();\r
-                               });\r
+                                       if (ed.isHidden())\r
+                                               ed.show();\r
+                                       else\r
+                                               ed.hide();\r
+\r
+                                       return true;\r
                        }\r
 \r
-                       t.onExecCommand.add(function(ed, c) {\r
-                               // Don't refresh the select lists until caret move\r
-                               if (!/^(FontName|FontSize)$/.test(c))\r
-                                       t.nodeChanged();\r
-                       });\r
+                       // Run command on active editor\r
+                       if (t.activeEditor)\r
+                               return t.activeEditor.execCommand(c, u, v);\r
 \r
-                       // Remove ghost selections on images and tables in Gecko\r
-                       if (isGecko) {\r
-                               function repaint(a, o) {\r
-                                       if (!o || !o.initial)\r
-                                               t.execCommand('mceRepaint');\r
-                               };\r
+                       return false;\r
+               },\r
 \r
-                               t.onUndo.add(repaint);\r
-                               t.onRedo.add(repaint);\r
-                               t.onSetContent.add(repaint);\r
-                       }\r
+               execInstanceCommand : function(id, c, u, v) {\r
+                       var ed = this.get(id);\r
 \r
-                       // Enables users to override the control factory\r
-                       t.onBeforeRenderUI.dispatch(t, t.controlManager);\r
+                       if (ed)\r
+                               return ed.execCommand(c, u, v);\r
 \r
-                       // Measure box\r
-                       if (s.render_ui) {\r
-                               w = s.width || e.style.width || e.offsetWidth;\r
-                               h = s.height || e.style.height || e.offsetHeight;\r
-                               t.orgDisplay = e.style.display;\r
-                               re = /^[0-9\.]+(|px)$/i;\r
+                       return false;\r
+               },\r
 \r
-                               if (re.test('' + w))\r
-                                       w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);\r
+               triggerSave : function() {\r
+                       each(this.editors, function(e) {\r
+                               e.save();\r
+                       });\r
+               },\r
 \r
-                               if (re.test('' + h))\r
-                                       h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);\r
+               addI18n : function(p, o) {\r
+                       var lo, i18n = this.i18n;\r
 \r
-                               // Render UI\r
-                               o = t.theme.renderUI({\r
-                                       targetNode : e,\r
-                                       width : w,\r
-                                       height : h,\r
-                                       deltaWidth : s.delta_width,\r
-                                       deltaHeight : s.delta_height\r
+                       if (!tinymce.is(p, 'string')) {\r
+                               each(p, function(o, lc) {\r
+                                       each(o, function(o, g) {\r
+                                               each(o, function(o, k) {\r
+                                                       if (g === 'common')\r
+                                                               i18n[lc + '.' + k] = o;\r
+                                                       else\r
+                                                               i18n[lc + '.' + g + '.' + k] = o;\r
+                                               });\r
+                                       });\r
+                               });\r
+                       } else {\r
+                               each(o, function(o, k) {\r
+                                       i18n[p + '.' + k] = o;\r
                                });\r
-\r
-                               t.editorContainer = o.editorContainer;\r
                        }\r
+               },\r
 \r
+               // Private methods\r
 \r
-                       // User specified a document.domain value\r
-                       if (document.domain && location.hostname != document.domain)\r
-                               tinymce.relaxedDomain = document.domain;\r
+               _setActive : function(editor) {\r
+                       this.selectedInstance = this.activeEditor = editor;\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                       // Resize editor\r
-                       DOM.setStyles(o.sizeContainer || o.editorContainer, {\r
-                               width : w,\r
-                               height : h\r
-                       });\r
+(function(tinymce) {\r
+       // Shorten these names\r
+       var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,\r
+               Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko,\r
+               isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,\r
+               ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,\r
+               inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode, VK = tinymce.VK;\r
 \r
-                       h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');\r
-                       if (h < 100)\r
-                               h = 100;\r
+       tinymce.create('tinymce.Editor', {\r
+               Editor : function(id, s) {\r
+                       var t = this;\r
 \r
-                       t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';\r
+                       t.id = t.editorId = id;\r
 \r
-                       // We only need to override paths if we have to\r
-                       // IE has a bug where it remove site absolute urls to relative ones if this is specified\r
-                       if (s.document_base_url != tinymce.documentBaseURL)\r
-                               t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';\r
+                       t.execCommands = {};\r
+                       t.queryStateCommands = {};\r
+                       t.queryValueCommands = {};\r
 \r
-                       t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';\r
+                       t.isNotDirty = false;\r
 \r
-                       if (tinymce.relaxedDomain)\r
-                               t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';\r
+                       t.plugins = {};\r
 \r
-                       bi = s.body_id || 'tinymce';\r
-                       if (bi.indexOf('=') != -1) {\r
-                               bi = t.getParam('body_id', '', 'hash');\r
-                               bi = bi[t.id] || bi;\r
-                       }\r
+                       // Add events to the editor\r
+                       each([\r
+                               'onPreInit',\r
 \r
-                       bc = s.body_class || '';\r
-                       if (bc.indexOf('=') != -1) {\r
-                               bc = t.getParam('body_class', '', 'hash');\r
-                               bc = bc[t.id] || '';\r
-                       }\r
+                               'onBeforeRenderUI',\r
 \r
-                       t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';\r
+                               'onPostRender',\r
 \r
-                       // Domain relaxing enabled, then set document domain\r
-                       if (tinymce.relaxedDomain) {\r
-                               // We need to write the contents here in IE since multiple writes messes up refresh button and back button\r
-                               if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5))\r
-                                       u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';\r
-                               else if (tinymce.isOpera)\r
-                                       u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';                                  \r
-                       }\r
+                               'onLoad',\r
 \r
-                       // Create iframe\r
-                       n = DOM.add(o.iframeContainer, 'iframe', {\r
-                               id : t.id + "_ifr",\r
-                               src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7\r
-                               frameBorder : '0',\r
-                               style : {\r
-                                       width : '100%',\r
-                                       height : h\r
-                               }\r
-                       });\r
+                               'onInit',\r
 \r
-                       t.contentAreaContainer = o.iframeContainer;\r
-                       DOM.get(o.editorContainer).style.display = t.orgDisplay;\r
-                       DOM.get(t.id).style.display = 'none';\r
+                               'onRemove',\r
 \r
-                       if (!isIE || !tinymce.relaxedDomain)\r
-                               t.setupIframe();\r
+                               'onActivate',\r
 \r
-                       e = n = o = null; // Cleanup\r
-               },\r
+                               'onDeactivate',\r
 \r
-               setupIframe : function() {\r
-                       var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;\r
+                               'onClick',\r
 \r
-                       // Setup iframe body\r
-                       if (!isIE || !tinymce.relaxedDomain) {\r
-                               d.open();\r
-                               d.write(t.iframeHTML);\r
-                               d.close();\r
-                       }\r
+                               'onEvent',\r
 \r
-                       // Design mode needs to be added here Ctrl+A will fail otherwise\r
-                       if (!isIE) {\r
-                               try {\r
-                                       if (!s.readonly)\r
-                                               d.designMode = 'On';\r
-                               } catch (ex) {\r
-                                       // Will fail on Gecko if the editor is placed in an hidden container element\r
-                                       // The design mode will be set ones the editor is focused\r
-                               }\r
-                       }\r
+                               'onMouseUp',\r
 \r
-                       // IE needs to use contentEditable or it will display non secure items for HTTPS\r
-                       if (isIE) {\r
-                               // It will not steal focus if we hide it while setting contentEditable\r
-                               b = t.getBody();\r
-                               DOM.hide(b);\r
+                               'onMouseDown',\r
 \r
-                               if (!s.readonly)\r
-                                       b.contentEditable = true;\r
+                               'onDblClick',\r
 \r
-                               DOM.show(b);\r
-                       }\r
+                               'onKeyDown',\r
 \r
-                       t.dom = new tinymce.dom.DOMUtils(t.getDoc(), {\r
-                               keep_values : true,\r
-                               url_converter : t.convertURL,\r
-                               url_converter_scope : t,\r
-                               hex_colors : s.force_hex_style_colors,\r
-                               class_filter : s.class_filter,\r
-                               update_styles : 1,\r
-                               fix_ie_paragraphs : 1,\r
-                               valid_styles : s.valid_styles\r
-                       });\r
+                               'onKeyUp',\r
 \r
-                       t.schema = new tinymce.dom.Schema();\r
+                               'onKeyPress',\r
 \r
-                       t.serializer = new tinymce.dom.Serializer(extend(s, {\r
-                               valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,\r
-                               dom : t.dom,\r
-                               schema : t.schema\r
-                       }));\r
+                               'onContextMenu',\r
 \r
-                       t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);\r
+                               'onSubmit',\r
 \r
-                       t.formatter = new tinymce.Formatter(this);\r
+                               'onReset',\r
 \r
-                       // Register default formats\r
-                       t.formatter.register({\r
-                               alignleft : [\r
-                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},\r
-                                       {selector : 'img,table', styles : {'float' : 'left'}}\r
-                               ],\r
+                               'onPaste',\r
 \r
-                               aligncenter : [\r
-                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},\r
-                                       {selector : 'img', styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},\r
-                                       {selector : 'table', styles : {marginLeft : 'auto', marginRight : 'auto'}}\r
-                               ],\r
+                               'onPreProcess',\r
 \r
-                               alignright : [\r
-                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},\r
-                                       {selector : 'img,table', styles : {'float' : 'right'}}\r
-                               ],\r
+                               'onPostProcess',\r
 \r
-                               alignfull : [\r
-                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}}\r
-                               ],\r
+                               'onBeforeSetContent',\r
 \r
-                               bold : [\r
-                                       {inline : 'strong'},\r
-                                       {inline : 'span', styles : {fontWeight : 'bold'}},\r
-                                       {inline : 'b'}\r
-                               ],\r
+                               'onBeforeGetContent',\r
 \r
-                               italic : [\r
-                                       {inline : 'em'},\r
-                                       {inline : 'span', styles : {fontStyle : 'italic'}},\r
-                                       {inline : 'i'}\r
-                               ],\r
+                               'onSetContent',\r
 \r
-                               underline : [\r
-                                       {inline : 'span', styles : {textDecoration : 'underline'}, exact : true},\r
-                                       {inline : 'u'}\r
-                               ],\r
+                               'onGetContent',\r
 \r
-                               strikethrough : [\r
-                                       {inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},\r
-                                       {inline : 'u'}\r
-                               ],\r
+                               'onLoadContent',\r
 \r
-                               forecolor : {inline : 'span', styles : {color : '%value'}},\r
-                               hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}},\r
-                               fontname : {inline : 'span', styles : {fontFamily : '%value'}},\r
-                               fontsize : {inline : 'span', styles : {fontSize : '%value'}},\r
-                               fontsize_class : {inline : 'span', attributes : {'class' : '%value'}},\r
-                               blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},\r
+                               'onSaveContent',\r
 \r
-                               removeformat : [\r
-                                       {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},\r
-                                       {selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},\r
-                                       {selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}\r
-                               ]\r
-                       });\r
+                               'onNodeChange',\r
 \r
-                       // Register default block formats\r
-                       each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {\r
-                               t.formatter.register(name, {block : name, remove : 'all'});\r
-                       });\r
+                               'onChange',\r
 \r
-                       // Register user defined formats\r
-                       t.formatter.register(t.settings.formats);\r
+                               'onBeforeExecCommand',\r
 \r
-                       t.undoManager = new tinymce.UndoManager(t);\r
+                               'onExecCommand',\r
 \r
-                       // Pass through\r
-                       t.undoManager.onAdd.add(function(um, l) {\r
-                               if (!l.initial)\r
-                                       return t.onChange.dispatch(t, l, um);\r
-                       });\r
+                               'onUndo',\r
 \r
-                       t.undoManager.onUndo.add(function(um, l) {\r
-                               return t.onUndo.dispatch(t, l, um);\r
-                       });\r
+                               'onRedo',\r
 \r
-                       t.undoManager.onRedo.add(function(um, l) {\r
-                               return t.onRedo.dispatch(t, l, um);\r
-                       });\r
+                               'onVisualAid',\r
+\r
+                               'onSetProgressState',\r
 \r
-                       t.forceBlocks = new tinymce.ForceBlocks(t, {\r
-                               forced_root_block : s.forced_root_block\r
+                               'onSetAttrib'\r
+                       ], function(e) {\r
+                               t[e] = new Dispatcher(t);\r
                        });\r
 \r
-                       t.editorCommands = new tinymce.EditorCommands(t);\r
+                       t.settings = s = extend({\r
+                               id : id,\r
+                               language : 'en',\r
+                               docs_language : 'en',\r
+                               theme : 'simple',\r
+                               skin : 'default',\r
+                               delta_width : 0,\r
+                               delta_height : 0,\r
+                               popup_css : '',\r
+                               plugins : '',\r
+                               document_base_url : tinymce.documentBaseURL,\r
+                               add_form_submit_trigger : 1,\r
+                               submit_patch : 1,\r
+                               add_unload_trigger : 1,\r
+                               convert_urls : 1,\r
+                               relative_urls : 1,\r
+                               remove_script_host : 1,\r
+                               table_inline_editing : 0,\r
+                               object_resizing : 1,\r
+                               cleanup : 1,\r
+                               accessibility_focus : 1,\r
+                               custom_shortcuts : 1,\r
+                               custom_undo_redo_keyboard_shortcuts : 1,\r
+                               custom_undo_redo_restore_selection : 1,\r
+                               custom_undo_redo : 1,\r
+                               doctype : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll\r
+                               visual_table_class : 'mceItemTable',\r
+                               visual : 1,\r
+                               font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',\r
+                               font_size_legacy_values : 'xx-small,small,medium,large,x-large,xx-large,300%', // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size\r
+                               apply_source_formatting : 1,\r
+                               directionality : 'ltr',\r
+                               forced_root_block : 'p',\r
+                               hidden_input : 1,\r
+                               padd_empty_editor : 1,\r
+                               render_ui : 1,\r
+                               init_theme : 1,\r
+                               force_p_newlines : 1,\r
+                               indentation : '30px',\r
+                               keep_styles : 1,\r
+                               fix_table_elements : 1,\r
+                               inline_styles : 1,\r
+                               convert_fonts_to_spans : true,\r
+                               indent : 'simple',\r
+                               indent_before : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside',\r
+                               indent_after : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside',\r
+                               validate : true,\r
+                               entity_encoding : 'named',\r
+                               url_converter : t.convertURL,\r
+                               url_converter_scope : t,\r
+                               ie7_compat : true\r
+                       }, s);\r
 \r
-                       // Pass through\r
-                       t.serializer.onPreProcess.add(function(se, o) {\r
-                               return t.onPreProcess.dispatch(t, o, se);\r
+                       t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {\r
+                               base_uri : tinyMCE.baseURI\r
                        });\r
 \r
-                       t.serializer.onPostProcess.add(function(se, o) {\r
-                               return t.onPostProcess.dispatch(t, o, se);\r
-                       });\r
+                       t.baseURI = tinymce.baseURI;\r
 \r
-                       t.onPreInit.dispatch(t);\r
+                       t.contentCSS = [];\r
 \r
-                       if (!s.gecko_spellcheck)\r
-                               t.getBody().spellcheck = 0;\r
+                       // Call setup\r
+                       t.execCallback('setup', t);\r
+               },\r
 \r
-                       if (!s.readonly)\r
-                               t._addEvents();\r
+               render : function(nst) {\r
+                       var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;\r
 \r
-                       t.controlManager.onPostRender.dispatch(t, t.controlManager);\r
-                       t.onPostRender.dispatch(t);\r
+                       // Page is not loaded yet, wait for it\r
+                       if (!Event.domLoaded) {\r
+                               Event.add(window, 'ready', function() {\r
+                                       t.render();\r
+                               });\r
+                               return;\r
+                       }\r
 \r
-                       if (s.directionality)\r
-                               t.getBody().dir = s.directionality;\r
+                       tinyMCE.settings = s;\r
 \r
-                       if (s.nowrap)\r
-                               t.getBody().style.whiteSpace = "nowrap";\r
+                       // Element not found, then skip initialization\r
+                       if (!t.getElement())\r
+                               return;\r
 \r
-                       if (s.custom_elements) {\r
-                               function handleCustom(ed, o) {\r
-                                       each(explode(s.custom_elements), function(v) {\r
-                                               var n;\r
+                       // Is a iPad/iPhone and not on iOS5, then skip initialization. We need to sniff \r
+                       // here since the browser says it has contentEditable support but there is no visible\r
+                       // caret We will remove this check ones Apple implements full contentEditable support\r
+                       if (tinymce.isIDevice && !tinymce.isIOS5)\r
+                               return;\r
 \r
-                                               if (v.indexOf('~') === 0) {\r
-                                                       v = v.substring(1);\r
-                                                       n = 'span';\r
-                                               } else\r
-                                                       n = 'div';\r
+                       // Add hidden input for non input elements inside form elements\r
+                       if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))\r
+                               DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);\r
 \r
-                                               o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' _mce_name="$1"$2>');\r
-                                               o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>');\r
-                                       });\r
-                               };\r
+                       if (tinymce.WindowManager)\r
+                               t.windowManager = new tinymce.WindowManager(t);\r
 \r
-                               t.onBeforeSetContent.add(handleCustom);\r
-                               t.onPostProcess.add(function(ed, o) {\r
-                                       if (o.set)\r
-                                               handleCustom(ed, o);\r
+                       if (s.encoding == 'xml') {\r
+                               t.onGetContent.add(function(ed, o) {\r
+                                       if (o.save)\r
+                                               o.content = DOM.encode(o.content);\r
                                });\r
                        }\r
 \r
-                       if (s.handle_node_change_callback) {\r
-                               t.onNodeChange.add(function(ed, cm, n) {\r
-                                       t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());\r
+                       if (s.add_form_submit_trigger) {\r
+                               t.onSubmit.addToTop(function() {\r
+                                       if (t.initialized) {\r
+                                               t.save();\r
+                                               t.isNotDirty = 1;\r
+                                       }\r
                                });\r
                        }\r
 \r
-                       if (s.save_callback) {\r
-                               t.onSaveContent.add(function(ed, o) {\r
-                                       var h = t.execCallback('save_callback', t.id, o.content, t.getBody());\r
-\r
-                                       if (h)\r
-                                               o.content = h;\r
+                       if (s.add_unload_trigger) {\r
+                               t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {\r
+                                       if (t.initialized && !t.destroyed && !t.isHidden())\r
+                                               t.save({format : 'raw', no_events : true});\r
                                });\r
                        }\r
 \r
-                       if (s.onchange_callback) {\r
-                               t.onChange.add(function(ed, l) {\r
-                                       t.execCallback('onchange_callback', t, l);\r
-                               });\r
-                       }\r
+                       tinymce.addUnload(t.destroy, t);\r
 \r
-                       if (s.convert_newlines_to_brs) {\r
-                               t.onBeforeSetContent.add(function(ed, o) {\r
-                                       if (o.initial)\r
-                                               o.content = o.content.replace(/\r?\n/g, '<br />');\r
-                               });\r
-                       }\r
+                       if (s.submit_patch) {\r
+                               t.onBeforeRenderUI.add(function() {\r
+                                       var n = t.getElement().form;\r
 \r
-                       if (s.fix_nesting && isIE) {\r
-                               t.onBeforeSetContent.add(function(ed, o) {\r
-                                       o.content = t._fixNesting(o.content);\r
+                                       if (!n)\r
+                                               return;\r
+\r
+                                       // Already patched\r
+                                       if (n._mceOldSubmit)\r
+                                               return;\r
+\r
+                                       // Check page uses id="submit" or name="submit" for it's submit button\r
+                                       if (!n.submit.nodeType && !n.submit.length) {\r
+                                               t.formElement = n;\r
+                                               n._mceOldSubmit = n.submit;\r
+                                               n.submit = function() {\r
+                                                       // Save all instances\r
+                                                       tinymce.triggerSave();\r
+                                                       t.isNotDirty = 1;\r
+\r
+                                                       return t.formElement._mceOldSubmit(t.formElement);\r
+                                               };\r
+                                       }\r
+\r
+                                       n = null;\r
                                });\r
                        }\r
 \r
-                       if (s.preformatted) {\r
-                               t.onPostProcess.add(function(ed, o) {\r
-                                       o.content = o.content.replace(/^\s*<pre.*?>/, '');\r
-                                       o.content = o.content.replace(/<\/pre>\s*$/, '');\r
+                       // Load scripts\r
+                       function loadScripts() {\r
+                               if (s.language && s.language_load !== false)\r
+                                       sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');\r
 \r
-                                       if (o.set)\r
-                                               o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';\r
+                               if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])\r
+                                       ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');\r
+\r
+                               each(explode(s.plugins), function(p) {\r
+                                       if (p &&!PluginManager.urls[p]) {\r
+                                               if (p.charAt(0) == '-') {\r
+                                                       p = p.substr(1, p.length);\r
+                                                       var dependencies = PluginManager.dependencies(p);\r
+                                                       each(dependencies, function(dep) {\r
+                                                               var defaultSettings = {prefix:'plugins/', resource: dep, suffix:'/editor_plugin' + tinymce.suffix + '.js'};\r
+                                                               var dep = PluginManager.createUrl(defaultSettings, dep);\r
+                                                               PluginManager.load(dep.resource, dep);\r
+                                                               \r
+                                                       });\r
+                                               } else {\r
+                                                       // Skip safari plugin, since it is removed as of 3.3b1\r
+                                                       if (p == 'safari') {\r
+                                                               return;\r
+                                                       }\r
+                                                       PluginManager.load(p, {prefix:'plugins/', resource: p, suffix:'/editor_plugin' + tinymce.suffix + '.js'});\r
+                                               }\r
+                                       }\r
                                });\r
-                       }\r
 \r
-                       if (s.verify_css_classes) {\r
-                               t.serializer.attribValueFilter = function(n, v) {\r
-                                       var s, cl;\r
+                               // Init when que is loaded\r
+                               sl.loadQueue(function() {\r
+                                       if (!t.removed)\r
+                                               t.init();\r
+                               });\r
+                       };\r
 \r
-                                       if (n == 'class') {\r
-                                               // Build regexp for classes\r
-                                               if (!t.classesRE) {\r
-                                                       cl = t.dom.getClasses();\r
+                       loadScripts();\r
+               },\r
 \r
-                                                       if (cl.length > 0) {\r
-                                                               s = '';\r
+               init : function() {\r
+                       var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re, i, initializedPlugins = [];\r
 \r
-                                                               each (cl, function(o) {\r
-                                                                       s += (s ? '|' : '') + o['class'];\r
-                                                               });\r
+                       tinymce.add(t);\r
 \r
-                                                               t.classesRE = new RegExp('(' + s + ')', 'gi');\r
-                                                       }\r
-                                               }\r
+                       s.aria_label = s.aria_label || DOM.getAttrib(e, 'aria-label', t.getLang('aria.rich_text_area'));\r
 \r
-                                               return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';\r
-                                       }\r
+                       if (s.theme) {\r
+                               s.theme = s.theme.replace(/-/, '');\r
+                               o = ThemeManager.get(s.theme);\r
+                               t.theme = new o();\r
 \r
-                                       return v;\r
-                               };\r
+                               if (t.theme.init && s.init_theme)\r
+                                       t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));\r
                        }\r
+                       function initPlugin(p) {\r
+                               var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;\r
+                               if (c && tinymce.inArray(initializedPlugins,p) === -1) {\r
+                                       each(PluginManager.dependencies(p), function(dep){\r
+                                               initPlugin(dep);\r
+                                       });\r
+                                       po = new c(t, u);\r
 \r
-                       if (s.cleanup_callback) {\r
-                               t.onBeforeSetContent.add(function(ed, o) {\r
-                                       o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
-                               });\r
+                                       t.plugins[p] = po;\r
 \r
-                               t.onPreProcess.add(function(ed, o) {\r
-                                       if (o.set)\r
-                                               t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);\r
+                                       if (po.init) {\r
+                                               po.init(t, u);\r
+                                               initializedPlugins.push(p);\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
+                       // Create all plugins\r
+                       each(explode(s.plugins.replace(/\-/g, '')), initPlugin);\r
 \r
-                                       if (o.get)\r
-                                               t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);\r
-                               });\r
+                       // Setup popup CSS path(s)\r
+                       if (s.popup_css !== false) {\r
+                               if (s.popup_css)\r
+                                       s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);\r
+                               else\r
+                                       s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");\r
+                       }\r
 \r
-                               t.onPostProcess.add(function(ed, o) {\r
-                                       if (o.set)\r
-                                               o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
+                       if (s.popup_css_add)\r
+                               s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);\r
 \r
-                                       if (o.get)                                              \r
-                                               o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);\r
-                               });\r
-                       }\r
+                       t.controlManager = new tinymce.ControlManager(t);\r
 \r
-                       if (s.save_callback) {\r
-                               t.onGetContent.add(function(ed, o) {\r
-                                       if (o.save)\r
-                                               o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());\r
+                       if (s.custom_undo_redo) {\r
+                               t.onBeforeExecCommand.add(function(ed, cmd, ui, val, a) {\r
+                                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))\r
+                                               t.undoManager.beforeChange();\r
                                });\r
-                       }\r
 \r
-                       if (s.handle_event_callback) {\r
-                               t.onEvent.add(function(ed, e, o) {\r
-                                       if (t.execCallback('handle_event_callback', e, ed, o) === false)\r
-                                               Event.cancel(e);\r
+                               t.onExecCommand.add(function(ed, cmd, ui, val, a) {\r
+                                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))\r
+                                               t.undoManager.add();\r
                                });\r
                        }\r
 \r
-                       // Add visual aids when new contents is added\r
-                       t.onSetContent.add(function() {\r
-                               t.addVisual(t.getBody());\r
+                       t.onExecCommand.add(function(ed, c) {\r
+                               // Don't refresh the select lists until caret move\r
+                               if (!/^(FontName|FontSize)$/.test(c))\r
+                                       t.nodeChanged();\r
                        });\r
 \r
-                       // Remove empty contents\r
-                       if (s.padd_empty_editor) {\r
-                               t.onPostProcess.add(function(ed, o) {\r
-                                       o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');\r
-                               });\r
+                       // Remove ghost selections on images and tables in Gecko\r
+                       if (isGecko) {\r
+                               function repaint(a, o) {\r
+                                       if (!o || !o.initial)\r
+                                               t.execCommand('mceRepaint');\r
+                               };\r
+\r
+                               t.onUndo.add(repaint);\r
+                               t.onRedo.add(repaint);\r
+                               t.onSetContent.add(repaint);\r
                        }\r
 \r
-                       if (isGecko) {\r
-                               // Fix gecko link bug, when a link is placed at the end of block elements there is\r
-                               // no way to move the caret behind the link. This fix adds a bogus br element after the link\r
-                               function fixLinks(ed, o) {\r
-                                       each(ed.dom.select('a'), function(n) {\r
-                                               var pn = n.parentNode;\r
+                       // Enables users to override the control factory\r
+                       t.onBeforeRenderUI.dispatch(t, t.controlManager);\r
 \r
-                                               if (ed.dom.isBlock(pn) && pn.lastChild === n)\r
-                                                       ed.dom.add(pn, 'br', {'_mce_bogus' : 1});\r
-                                       });\r
-                               };\r
+                       // Measure box\r
+                       if (s.render_ui) {\r
+                               w = s.width || e.style.width || e.offsetWidth;\r
+                               h = s.height || e.style.height || e.offsetHeight;\r
+                               t.orgDisplay = e.style.display;\r
+                               re = /^[0-9\.]+(|px)$/i;\r
 \r
-                               t.onExecCommand.add(function(ed, cmd) {\r
-                                       if (cmd === 'CreateLink')\r
-                                               fixLinks(ed);\r
+                               if (re.test('' + w))\r
+                                       w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);\r
+\r
+                               if (re.test('' + h))\r
+                                       h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);\r
+\r
+                               // Render UI\r
+                               o = t.theme.renderUI({\r
+                                       targetNode : e,\r
+                                       width : w,\r
+                                       height : h,\r
+                                       deltaWidth : s.delta_width,\r
+                                       deltaHeight : s.delta_height\r
                                });\r
 \r
-                               t.onSetContent.add(t.selection.onSetContent.add(fixLinks));\r
+                               t.editorContainer = o.editorContainer;\r
+                       }\r
+\r
+\r
+                       // User specified a document.domain value\r
+                       if (document.domain && location.hostname != document.domain)\r
+                               tinymce.relaxedDomain = document.domain;\r
+\r
+                       // Resize editor\r
+                       DOM.setStyles(o.sizeContainer || o.editorContainer, {\r
+                               width : w,\r
+                               height : h\r
+                       });\r
 \r
-                               if (!s.readonly) {\r
-                                       try {\r
-                                               // Design mode must be set here once again to fix a bug where\r
-                                               // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again\r
-                                               d.designMode = 'Off';\r
-                                               d.designMode = 'On';\r
-                                       } catch (ex) {\r
-                                               // Will fail on Gecko if the editor is placed in an hidden container element\r
-                                               // The design mode will be set ones the editor is focused\r
-                                       }\r
-                               }\r
+                       // Load specified content CSS last\r
+                       if (s.content_css) {\r
+                               tinymce.each(explode(s.content_css), function(u) {\r
+                                       t.contentCSS.push(t.documentBaseURI.toAbsolute(u));\r
+                               });\r
                        }\r
 \r
-                       // A small timeout was needed since firefox will remove. Bug: #1838304\r
-                       setTimeout(function () {\r
-                               if (t.removed)\r
-                                       return;\r
-\r
-                               t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});\r
-                               t.startContent = t.getContent({format : 'raw'});\r
-                               t.initialized = true;\r
+                       h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');\r
+                       if (h < 100)\r
+                               h = 100;\r
 \r
-                               t.onInit.dispatch(t);\r
-                               t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());\r
-                               t.execCallback('init_instance_callback', t);\r
-                               t.focus(true);\r
-                               t.nodeChanged({initial : 1});\r
+                       t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';\r
 \r
-                               // Load specified content CSS last\r
-                               if (s.content_css) {\r
-                                       tinymce.each(explode(s.content_css), function(u) {\r
-                                               t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));\r
-                                       });\r
-                               }\r
+                       // We only need to override paths if we have to\r
+                       // IE has a bug where it remove site absolute urls to relative ones if this is specified\r
+                       if (s.document_base_url != tinymce.documentBaseURL)\r
+                               t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';\r
 \r
-                               // Handle auto focus\r
-                               if (s.auto_focus) {\r
-                                       setTimeout(function () {\r
-                                               var ed = tinymce.get(s.auto_focus);\r
+                       // IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.\r
+                       if (s.ie7_compat)\r
+                               t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';\r
+                       else\r
+                               t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';\r
 \r
-                                               ed.selection.select(ed.getBody(), 1);\r
-                                               ed.selection.collapse(1);\r
-                                               ed.getWin().focus();\r
-                                       }, 100);\r
-                               }\r
-                       }, 1);\r
-       \r
-                       e = null;\r
-               },\r
+                       t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';\r
 \r
+                       // Load the CSS by injecting them into the HTML this will reduce "flicker"\r
+                       for (i = 0; i < t.contentCSS.length; i++) {\r
+                               t.iframeHTML += '<link type="text/css" rel="stylesheet" href="' + t.contentCSS[i] + '" />';\r
+                       }\r
 \r
-               focus : function(sf) {\r
-                       var oed, t = this, ce = t.settings.content_editable, ieRng, controlElm, doc = t.getDoc();\r
+                       t.contentCSS = [];\r
 \r
-                       if (!sf) {\r
-                               // Get selected control element\r
-                               ieRng = t.selection.getRng();\r
-                               if (ieRng.item) {\r
-                                       controlElm = ieRng.item(0);\r
-                               }\r
+                       bi = s.body_id || 'tinymce';\r
+                       if (bi.indexOf('=') != -1) {\r
+                               bi = t.getParam('body_id', '', 'hash');\r
+                               bi = bi[t.id] || bi;\r
+                       }\r
 \r
-                               // Is not content editable\r
-                               if (!ce)\r
-                                       t.getWin().focus();\r
+                       bc = s.body_class || '';\r
+                       if (bc.indexOf('=') != -1) {\r
+                               bc = t.getParam('body_class', '', 'hash');\r
+                               bc = bc[t.id] || '';\r
+                       }\r
 \r
-                               // Restore selected control element\r
-                               // This is needed when for example an image is selected within a\r
-                               // layer a call to focus will then remove the control selection\r
-                               if (controlElm && controlElm.ownerDocument == doc) {\r
-                                       ieRng = doc.body.createControlRange();\r
-                                       ieRng.addElement(controlElm);\r
-                                       ieRng.select();\r
-                               }\r
+                       t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '" onload="window.parent.tinyMCE.get(\'' + t.id + '\').onLoad.dispatch();"><br></body></html>';\r
 \r
+                       // Domain relaxing enabled, then set document domain\r
+                       if (tinymce.relaxedDomain && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) {\r
+                               // We need to write the contents here in IE since multiple writes messes up refresh button and back button\r
+                               u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';\r
                        }\r
 \r
-                       if (tinymce.activeEditor != t) {\r
-                               if ((oed = tinymce.activeEditor) != null)\r
-                                       oed.onDeactivate.dispatch(oed, t);\r
+                       // Create iframe\r
+                       // TODO: ACC add the appropriate description on this.\r
+                       n = DOM.add(o.iframeContainer, 'iframe', { \r
+                               id : t.id + "_ifr",\r
+                               src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7\r
+                               frameBorder : '0',\r
+                               allowTransparency : "true",\r
+                               title : s.aria_label,\r
+                               style : {\r
+                                       width : '100%',\r
+                                       height : h,\r
+                                       display : 'block' // Important for Gecko to render the iframe correctly\r
+                               }\r
+                       });\r
 \r
-                               t.onActivate.dispatch(t, oed);\r
-                       }\r
+                       t.contentAreaContainer = o.iframeContainer;\r
+                       DOM.get(o.editorContainer).style.display = t.orgDisplay;\r
+                       DOM.get(t.id).style.display = 'none';\r
+                       DOM.setAttrib(t.id, 'aria-hidden', true);\r
 \r
-                       tinymce._setActive(t);\r
+                       if (!tinymce.relaxedDomain || !u)\r
+                               t.setupIframe();\r
+\r
+                       e = n = o = null; // Cleanup\r
                },\r
 \r
-               execCallback : function(n) {\r
-                       var t = this, f = t.settings[n], s;\r
+               setupIframe : function() {\r
+                       var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;\r
 \r
-                       if (!f)\r
-                               return;\r
+                       // Setup iframe body\r
+                       if (!isIE || !tinymce.relaxedDomain) {\r
+                               d.open();\r
+                               d.write(t.iframeHTML);\r
+                               d.close();\r
 \r
-                       // Look through lookup\r
-                       if (t.callbackLookup && (s = t.callbackLookup[n])) {\r
-                               f = s.func;\r
-                               s = s.scope;\r
+                               if (tinymce.relaxedDomain)\r
+                                       d.domain = tinymce.relaxedDomain;\r
                        }\r
 \r
-                       if (is(f, 'string')) {\r
-                               s = f.replace(/\.\w+$/, '');\r
-                               s = s ? tinymce.resolve(s) : 0;\r
-                               f = tinymce.resolve(f);\r
-                               t.callbackLookup = t.callbackLookup || {};\r
-                               t.callbackLookup[n] = {func : f, scope : s};\r
-                       }\r
+                       // It will not steal focus while setting contentEditable\r
+                       b = t.getBody();\r
+                       b.disabled = true;\r
 \r
-                       return f.apply(s || t, Array.prototype.slice.call(arguments, 1));\r
-               },\r
+                       if (!s.readonly)\r
+                               b.contentEditable = true;\r
 \r
-               translate : function(s) {\r
-                       var c = this.settings.language || 'en', i18n = tinymce.i18n;\r
+                       b.disabled = false;\r
 \r
-                       if (!s)\r
-                               return '';\r
+                       t.schema = new tinymce.html.Schema(s);\r
 \r
-                       return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {\r
-                               return i18n[c + '.' + b] || '{#' + b + '}';\r
+                       t.dom = new tinymce.dom.DOMUtils(t.getDoc(), {\r
+                               keep_values : true,\r
+                               url_converter : t.convertURL,\r
+                               url_converter_scope : t,\r
+                               hex_colors : s.force_hex_style_colors,\r
+                               class_filter : s.class_filter,\r
+                               update_styles : 1,\r
+                               fix_ie_paragraphs : 1,\r
+                               schema : t.schema\r
                        });\r
-               },\r
 \r
-               getLang : function(n, dv) {\r
-                       return tinymce.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');\r
-               },\r
+                       t.parser = new tinymce.html.DomParser(s, t.schema);\r
 \r
-               getParam : function(n, dv, ty) {\r
-                       var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;\r
+                       // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included.\r
+                       if (!t.settings.allow_html_in_named_anchor) {\r
+                               t.parser.addAttributeFilter('name', function(nodes, name) {\r
+                                       var i = nodes.length, sibling, prevSibling, parent, node;\r
+       \r
+                                       while (i--) {\r
+                                               node = nodes[i];\r
+                                               if (node.name === 'a' && node.firstChild) {\r
+                                                       parent = node.parent;\r
+       \r
+                                                       // Move children after current node\r
+                                                       sibling = node.lastChild;\r
+                                                       do {\r
+                                                               prevSibling = sibling.prev;\r
+                                                               parent.insert(sibling, node);\r
+                                                               sibling = prevSibling;\r
+                                                       } while (sibling);\r
+                                               }\r
+                                       }\r
+                               });\r
+                       }\r
 \r
-                       if (ty === 'hash') {\r
-                               o = {};\r
+                       // Convert src and href into data-mce-src, data-mce-href and data-mce-style\r
+                       t.parser.addAttributeFilter('src,href,style', function(nodes, name) {\r
+                               var i = nodes.length, node, dom = t.dom, value, internalName;\r
 \r
-                               if (is(v, 'string')) {\r
-                                       each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {\r
-                                               v = v.split('=');\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       value = node.attr(name);\r
+                                       internalName = 'data-mce-' + name;\r
 \r
-                                               if (v.length > 1)\r
-                                                       o[tr(v[0])] = tr(v[1]);\r
+                                       // Add internal attribute if we need to we don't on a refresh of the document\r
+                                       if (!node.attributes.map[internalName]) {       \r
+                                               if (name === "style")\r
+                                                       node.attr(internalName, dom.serializeStyle(dom.parseStyle(value), node.name));\r
                                                else\r
-                                                       o[tr(v[0])] = tr(v);\r
-                                       });\r
-                               } else\r
-                                       o = v;\r
-\r
-                               return o;\r
-                       }\r
+                                                       node.attr(internalName, t.convertURL(value, name, node.name));\r
+                                       }\r
+                               }\r
+                       });\r
 \r
-                       return v;\r
-               },\r
+                       // Keep scripts from executing\r
+                       t.parser.addNodeFilter('script', function(nodes, name) {\r
+                               var i = nodes.length, node;\r
 \r
-               nodeChanged : function(o) {\r
-                       var t = this, s = t.selection, n = (isIE ? s.getNode() : s.getStart()) || t.getBody();\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.attr('type', 'mce-' + (node.attr('type') || 'text/javascript'));\r
+                               }\r
+                       });\r
 \r
-                       // Fix for bug #1896577 it seems that this can not be fired while the editor is loading\r
-                       if (t.initialized) {\r
-                               o = o || {};\r
-                               n = isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n; // Fix for IE initial state\r
+                       t.parser.addNodeFilter('#cdata', function(nodes, name) {\r
+                               var i = nodes.length, node;\r
 \r
-                               // Get parents and add them to object\r
-                               o.parents = [];\r
-                               t.dom.getParent(n, function(node) {\r
-                                       if (node.nodeName == 'BODY')\r
-                                               return true;\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       node.type = 8;\r
+                                       node.name = '#comment';\r
+                                       node.value = '[CDATA[' + node.value + ']]';\r
+                               }\r
+                       });\r
 \r
-                                       o.parents.push(node);\r
-                               });\r
+                       t.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function(nodes, name) {\r
+                               var i = nodes.length, node, nonEmptyElements = t.schema.getNonEmptyElements();\r
 \r
-                               t.onNodeChange.dispatch(\r
-                                       t,\r
-                                       o ? o.controlManager || t.controlManager : t.controlManager,\r
-                                       n,\r
-                                       s.isCollapsed(),\r
-                                       o\r
-                               );\r
-                       }\r
-               },\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
 \r
-               addButton : function(n, s) {\r
-                       var t = this;\r
+                                       if (node.isEmpty(nonEmptyElements))\r
+                                               node.empty().append(new tinymce.html.Node('br', 1)).shortEnded = true;\r
+                               }\r
+                       });\r
 \r
-                       t.buttons = t.buttons || {};\r
-                       t.buttons[n] = s;\r
-               },\r
+                       t.serializer = new tinymce.dom.Serializer(s, t.dom, t.schema);\r
 \r
-               addCommand : function(n, f, s) {\r
-                       this.execCommands[n] = {func : f, scope : s || this};\r
-               },\r
+                       t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);\r
 \r
-               addQueryStateHandler : function(n, f, s) {\r
-                       this.queryStateCommands[n] = {func : f, scope : s || this};\r
-               },\r
+                       t.formatter = new tinymce.Formatter(this);\r
 \r
-               addQueryValueHandler : function(n, f, s) {\r
-                       this.queryValueCommands[n] = {func : f, scope : s || this};\r
-               },\r
+                       // Register default formats\r
+                       t.formatter.register({\r
+                               alignleft : [\r
+                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}, defaultBlock: 'div'},\r
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}\r
+                               ],\r
 \r
-               addShortcut : function(pa, desc, cmd_func, sc) {\r
-                       var t = this, c;\r
+                               aligncenter : [\r
+                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}, defaultBlock: 'div'},\r
+                                       {selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},\r
+                                       {selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}\r
+                               ],\r
 \r
-                       if (!t.settings.custom_shortcuts)\r
-                               return false;\r
+                               alignright : [\r
+                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}, defaultBlock: 'div'},\r
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}\r
+                               ],\r
 \r
-                       t.shortcuts = t.shortcuts || {};\r
+                               alignfull : [\r
+                                       {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}, defaultBlock: 'div'}\r
+                               ],\r
 \r
-                       if (is(cmd_func, 'string')) {\r
-                               c = cmd_func;\r
+                               bold : [\r
+                                       {inline : 'strong', remove : 'all'},\r
+                                       {inline : 'span', styles : {fontWeight : 'bold'}},\r
+                                       {inline : 'b', remove : 'all'}\r
+                               ],\r
 \r
-                               cmd_func = function() {\r
-                                       t.execCommand(c, false, null);\r
-                               };\r
-                       }\r
+                               italic : [\r
+                                       {inline : 'em', remove : 'all'},\r
+                                       {inline : 'span', styles : {fontStyle : 'italic'}},\r
+                                       {inline : 'i', remove : 'all'}\r
+                               ],\r
 \r
-                       if (is(cmd_func, 'object')) {\r
-                               c = cmd_func;\r
+                               underline : [\r
+                                       {inline : 'span', styles : {textDecoration : 'underline'}, exact : true},\r
+                                       {inline : 'u', remove : 'all'}\r
+                               ],\r
 \r
-                               cmd_func = function() {\r
-                                       t.execCommand(c[0], c[1], c[2]);\r
-                               };\r
-                       }\r
+                               strikethrough : [\r
+                                       {inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},\r
+                                       {inline : 'strike', remove : 'all'}\r
+                               ],\r
 \r
-                       each(explode(pa), function(pa) {\r
-                               var o = {\r
-                                       func : cmd_func,\r
-                                       scope : sc || this,\r
-                                       desc : desc,\r
-                                       alt : false,\r
-                                       ctrl : false,\r
-                                       shift : false\r
-                               };\r
+                               forecolor : {inline : 'span', styles : {color : '%value'}, wrap_links : false},\r
+                               hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}, wrap_links : false},\r
+                               fontname : {inline : 'span', styles : {fontFamily : '%value'}},\r
+                               fontsize : {inline : 'span', styles : {fontSize : '%value'}},\r
+                               fontsize_class : {inline : 'span', attributes : {'class' : '%value'}},\r
+                               blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},\r
+                               subscript : {inline : 'sub'},\r
+                               superscript : {inline : 'sup'},\r
 \r
-                               each(explode(pa, '+'), function(v) {\r
-                                       switch (v) {\r
-                                               case 'alt':\r
-                                               case 'ctrl':\r
-                                               case 'shift':\r
-                                                       o[v] = true;\r
-                                                       break;\r
+                               link : {inline : 'a', selector : 'a', remove : 'all', split : true, deep : true,\r
+                                       onmatch : function(node) {\r
+                                               return true;\r
+                                       },\r
 \r
-                                               default:\r
-                                                       o.charCode = v.charCodeAt(0);\r
-                                                       o.keyCode = v.toUpperCase().charCodeAt(0);\r
+                                       onformat : function(elm, fmt, vars) {\r
+                                               each(vars, function(value, key) {\r
+                                                       t.dom.setAttrib(elm, key, value);\r
+                                               });\r
                                        }\r
-                               });\r
+                               },\r
+\r
+                               removeformat : [\r
+                                       {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},\r
+                                       {selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},\r
+                                       {selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}\r
+                               ]\r
+                       });\r
 \r
-                               t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;\r
+                       // Register default block formats\r
+                       each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {\r
+                               t.formatter.register(name, {block : name, remove : 'all'});\r
                        });\r
 \r
-                       return true;\r
-               },\r
+                       // Register user defined formats\r
+                       t.formatter.register(t.settings.formats);\r
 \r
-               execCommand : function(cmd, ui, val, a) {\r
-                       var t = this, s = 0, o, st;\r
+                       t.undoManager = new tinymce.UndoManager(t);\r
 \r
-                       if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))\r
-                               t.focus();\r
+                       // Pass through\r
+                       t.undoManager.onAdd.add(function(um, l) {\r
+                               if (um.hasUndo())\r
+                                       return t.onChange.dispatch(t, l, um);\r
+                       });\r
 \r
-                       o = {};\r
-                       t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);\r
-                       if (o.terminate)\r
-                               return false;\r
+                       t.undoManager.onUndo.add(function(um, l) {\r
+                               return t.onUndo.dispatch(t, l, um);\r
+                       });\r
 \r
-                       // Command callback\r
-                       if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {\r
-                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                               return true;\r
-                       }\r
+                       t.undoManager.onRedo.add(function(um, l) {\r
+                               return t.onRedo.dispatch(t, l, um);\r
+                       });\r
 \r
-                       // Registred commands\r
-                       if (o = t.execCommands[cmd]) {\r
-                               st = o.func.call(o.scope, ui, val);\r
+                       t.forceBlocks = new tinymce.ForceBlocks(t);\r
+                       t.enterKey = new tinymce.EnterKey(t);\r
 \r
-                               // Fall through on true\r
-                               if (st !== true) {\r
-                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                                       return st;\r
-                               }\r
-                       }\r
+                       t.editorCommands = new tinymce.EditorCommands(t);\r
 \r
-                       // Plugin commands\r
-                       each(t.plugins, function(p) {\r
-                               if (p.execCommand && p.execCommand(cmd, ui, val)) {\r
-                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                                       s = 1;\r
-                                       return false;\r
-                               }\r
+                       // Pass through\r
+                       t.serializer.onPreProcess.add(function(se, o) {\r
+                               return t.onPreProcess.dispatch(t, o, se);\r
                        });\r
 \r
-                       if (s)\r
-                               return true;\r
+                       t.serializer.onPostProcess.add(function(se, o) {\r
+                               return t.onPostProcess.dispatch(t, o, se);\r
+                       });\r
 \r
-                       // Theme commands\r
-                       if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {\r
-                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                               return true;\r
-                       }\r
+                       t.onPreInit.dispatch(t);\r
 \r
-                       // Execute global commands\r
-                       if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) {\r
-                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                               return true;\r
-                       }\r
+                       if (!s.gecko_spellcheck)\r
+                               t.getBody().spellcheck = 0;\r
 \r
-                       // Editor commands\r
-                       if (t.editorCommands.execCommand(cmd, ui, val)) {\r
-                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-                               return true;\r
-                       }\r
+                       if (!s.readonly)\r
+                               t._addEvents();\r
 \r
-                       // Browser commands\r
-                       t.getDoc().execCommand(cmd, ui, val);\r
-                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
-               },\r
+                       t.controlManager.onPostRender.dispatch(t, t.controlManager);\r
+                       t.onPostRender.dispatch(t);\r
 \r
-               queryCommandState : function(cmd) {\r
-                       var t = this, o, s;\r
+                       t.quirks = new tinymce.util.Quirks(this);\r
 \r
-                       // Is hidden then return undefined\r
-                       if (t._isHidden())\r
-                               return;\r
+                       if (s.directionality)\r
+                               t.getBody().dir = s.directionality;\r
 \r
-                       // Registred commands\r
-                       if (o = t.queryStateCommands[cmd]) {\r
-                               s = o.func.call(o.scope);\r
+                       if (s.nowrap)\r
+                               t.getBody().style.whiteSpace = "nowrap";\r
 \r
-                               // Fall though on true\r
-                               if (s !== true)\r
-                                       return s;\r
+                       if (s.handle_node_change_callback) {\r
+                               t.onNodeChange.add(function(ed, cm, n) {\r
+                                       t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());\r
+                               });\r
                        }\r
 \r
-                       // Registred commands\r
-                       o = t.editorCommands.queryCommandState(cmd);\r
-                       if (o !== -1)\r
-                               return o;\r
+                       if (s.save_callback) {\r
+                               t.onSaveContent.add(function(ed, o) {\r
+                                       var h = t.execCallback('save_callback', t.id, o.content, t.getBody());\r
 \r
-                       // Browser commands\r
-                       try {\r
-                               return this.getDoc().queryCommandState(cmd);\r
-                       } catch (ex) {\r
-                               // Fails sometimes see bug: 1896577\r
+                                       if (h)\r
+                                               o.content = h;\r
+                               });\r
                        }\r
-               },\r
 \r
-               queryCommandValue : function(c) {\r
-                       var t = this, o, s;\r
-\r
-                       // Is hidden then return undefined\r
-                       if (t._isHidden())\r
-                               return;\r
+                       if (s.onchange_callback) {\r
+                               t.onChange.add(function(ed, l) {\r
+                                       t.execCallback('onchange_callback', t, l);\r
+                               });\r
+                       }\r
 \r
-                       // Registred commands\r
-                       if (o = t.queryValueCommands[c]) {\r
-                               s = o.func.call(o.scope);\r
+                       if (s.protect) {\r
+                               t.onBeforeSetContent.add(function(ed, o) {\r
+                                       if (s.protect) {\r
+                                               each(s.protect, function(pattern) {\r
+                                                       o.content = o.content.replace(pattern, function(str) {\r
+                                                               return '<!--mce:protected ' + escape(str) + '-->';\r
+                                                       });\r
+                                               });\r
+                                       }\r
+                               });\r
+                       }\r
 \r
-                               // Fall though on true\r
-                               if (s !== true)\r
-                                       return s;\r
+                       if (s.convert_newlines_to_brs) {\r
+                               t.onBeforeSetContent.add(function(ed, o) {\r
+                                       if (o.initial)\r
+                                               o.content = o.content.replace(/\r?\n/g, '<br />');\r
+                               });\r
                        }\r
 \r
-                       // Registred commands\r
-                       o = t.editorCommands.queryCommandValue(c);\r
-                       if (is(o))\r
-                               return o;\r
+                       if (s.preformatted) {\r
+                               t.onPostProcess.add(function(ed, o) {\r
+                                       o.content = o.content.replace(/^\s*<pre.*?>/, '');\r
+                                       o.content = o.content.replace(/<\/pre>\s*$/, '');\r
 \r
-                       // Browser commands\r
-                       try {\r
-                               return this.getDoc().queryCommandValue(c);\r
-                       } catch (ex) {\r
-                               // Fails sometimes see bug: 1896577\r
+                                       if (o.set)\r
+                                               o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';\r
+                               });\r
                        }\r
-               },\r
 \r
-               show : function() {\r
-                       var t = this;\r
+                       if (s.verify_css_classes) {\r
+                               t.serializer.attribValueFilter = function(n, v) {\r
+                                       var s, cl;\r
 \r
-                       DOM.show(t.getContainer());\r
-                       DOM.hide(t.id);\r
-                       t.load();\r
-               },\r
+                                       if (n == 'class') {\r
+                                               // Build regexp for classes\r
+                                               if (!t.classesRE) {\r
+                                                       cl = t.dom.getClasses();\r
 \r
-               hide : function() {\r
-                       var t = this, d = t.getDoc();\r
+                                                       if (cl.length > 0) {\r
+                                                               s = '';\r
 \r
-                       // Fixed bug where IE has a blinking cursor left from the editor\r
-                       if (isIE && d)\r
-                               d.execCommand('SelectAll');\r
+                                                               each (cl, function(o) {\r
+                                                                       s += (s ? '|' : '') + o['class'];\r
+                                                               });\r
 \r
-                       // We must save before we hide so Safari doesn't crash\r
-                       t.save();\r
-                       DOM.hide(t.getContainer());\r
-                       DOM.setStyle(t.id, 'display', t.orgDisplay);\r
-               },\r
+                                                               t.classesRE = new RegExp('(' + s + ')', 'gi');\r
+                                                       }\r
+                                               }\r
 \r
-               isHidden : function() {\r
-                       return !DOM.isHidden(this.id);\r
-               },\r
+                                               return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';\r
+                                       }\r
 \r
-               setProgressState : function(b, ti, o) {\r
-                       this.onSetProgressState.dispatch(this, b, ti, o);\r
+                                       return v;\r
+                               };\r
+                       }\r
 \r
-                       return b;\r
-               },\r
+                       if (s.cleanup_callback) {\r
+                               t.onBeforeSetContent.add(function(ed, o) {\r
+                                       o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
+                               });\r
 \r
-               load : function(o) {\r
-                       var t = this, e = t.getElement(), h;\r
+                               t.onPreProcess.add(function(ed, o) {\r
+                                       if (o.set)\r
+                                               t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);\r
 \r
-                       if (e) {\r
-                               o = o || {};\r
-                               o.load = true;\r
+                                       if (o.get)\r
+                                               t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);\r
+                               });\r
 \r
-                               // Double encode existing entities in the value\r
-                               h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);\r
-                               o.element = e;\r
+                               t.onPostProcess.add(function(ed, o) {\r
+                                       if (o.set)\r
+                                               o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);\r
+\r
+                                       if (o.get)                                              \r
+                                               o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);\r
+                               });\r
+                       }\r
+\r
+                       if (s.save_callback) {\r
+                               t.onGetContent.add(function(ed, o) {\r
+                                       if (o.save)\r
+                                               o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());\r
+                               });\r
+                       }\r
+\r
+                       if (s.handle_event_callback) {\r
+                               t.onEvent.add(function(ed, e, o) {\r
+                                       if (t.execCallback('handle_event_callback', e, ed, o) === false)\r
+                                               Event.cancel(e);\r
+                               });\r
+                       }\r
+\r
+                       // Add visual aids when new contents is added\r
+                       t.onSetContent.add(function() {\r
+                               t.addVisual(t.getBody());\r
+                       });\r
+\r
+                       // Remove empty contents\r
+                       if (s.padd_empty_editor) {\r
+                               t.onPostProcess.add(function(ed, o) {\r
+                                       o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');\r
+                               });\r
+                       }\r
 \r
-                               if (!o.no_events)\r
-                                       t.onLoadContent.dispatch(t, o);\r
+                       if (isGecko) {\r
+                               // Fix gecko link bug, when a link is placed at the end of block elements there is\r
+                               // no way to move the caret behind the link. This fix adds a bogus br element after the link\r
+                               function fixLinks(ed, o) {\r
+                                       each(ed.dom.select('a'), function(n) {\r
+                                               var pn = n.parentNode;\r
 \r
-                               o.element = e = null;\r
+                                               if (ed.dom.isBlock(pn) && pn.lastChild === n)\r
+                                                       ed.dom.add(pn, 'br', {'data-mce-bogus' : 1});\r
+                                       });\r
+                               };\r
 \r
-                               return h;\r
+                               t.onExecCommand.add(function(ed, cmd) {\r
+                                       if (cmd === 'CreateLink')\r
+                                               fixLinks(ed);\r
+                               });\r
+\r
+                               t.onSetContent.add(t.selection.onSetContent.add(fixLinks));\r
                        }\r
-               },\r
 \r
-               save : function(o) {\r
-                       var t = this, e = t.getElement(), h, f;\r
+                       t.load({initial : true, format : 'html'});\r
+                       t.startContent = t.getContent({format : 'raw'});\r
+                       t.undoManager.add();\r
+                       t.initialized = true;\r
 \r
-                       if (!e || !t.initialized)\r
-                               return;\r
+                       t.onInit.dispatch(t);\r
+                       t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());\r
+                       t.execCallback('init_instance_callback', t);\r
+                       t.focus(true);\r
+                       t.nodeChanged({initial : 1});\r
 \r
-                       o = o || {};\r
-                       o.save = true;\r
+                       // Load specified content CSS last\r
+                       each(t.contentCSS, function(u) {\r
+                               t.dom.loadCSS(u);\r
+                       });\r
 \r
-                       // Add undo level will trigger onchange event\r
-                       if (!o.no_events) {\r
-                               t.undoManager.typing = 0;\r
-                               t.undoManager.add();\r
-                       }\r
+                       // Handle auto focus\r
+                       if (s.auto_focus) {\r
+                               setTimeout(function () {\r
+                                       var ed = tinymce.get(s.auto_focus);\r
 \r
-                       o.element = e;\r
-                       h = o.content = t.getContent(o);\r
+                                       ed.selection.select(ed.getBody(), 1);\r
+                                       ed.selection.collapse(1);\r
+                                       ed.getBody().focus();\r
+                                       ed.getWin().focus();\r
+                               }, 100);\r
+                       }\r
 \r
-                       if (!o.no_events)\r
-                               t.onSaveContent.dispatch(t, o);\r
+                       e = null;\r
+               },\r
 \r
-                       h = o.content;\r
 \r
-                       if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {\r
-                               e.innerHTML = h;\r
+               focus : function(sf) {\r
+                       var oed, t = this, selection = t.selection, ce = t.settings.content_editable, ieRng, controlElm, doc = t.getDoc();\r
 \r
-                               // Update hidden form element\r
-                               if (f = DOM.getParent(t.id, 'form')) {\r
-                                       each(f.elements, function(e) {\r
-                                               if (e.name == t.id) {\r
-                                                       e.value = h;\r
-                                                       return false;\r
-                                               }\r
-                                       });\r
+                       if (!sf) {\r
+                               // Get selected control element\r
+                               ieRng = selection.getRng();\r
+                               if (ieRng.item) {\r
+                                       controlElm = ieRng.item(0);\r
                                }\r
-                       } else\r
-                               e.value = h;\r
 \r
-                       o.element = e = null;\r
-\r
-                       return h;\r
-               },\r
+                               t._refreshContentEditable();\r
 \r
-               setContent : function(h, o) {\r
-                       var t = this;\r
+                               // Is not content editable\r
+                               if (!ce)\r
+                                       t.getWin().focus();\r
 \r
-                       o = o || {};\r
-                       o.format = o.format || 'html';\r
-                       o.set = true;\r
-                       o.content = h;\r
+                               // Focus the body as well since it's contentEditable\r
+                               if (tinymce.isGecko) {\r
+                                       t.getBody().focus();\r
+                               }\r
 \r
-                       if (!o.no_events)\r
-                               t.onBeforeSetContent.dispatch(t, o);\r
+                               // Restore selected control element\r
+                               // This is needed when for example an image is selected within a\r
+                               // layer a call to focus will then remove the control selection\r
+                               if (controlElm && controlElm.ownerDocument == doc) {\r
+                                       ieRng = doc.body.createControlRange();\r
+                                       ieRng.addElement(controlElm);\r
+                                       ieRng.select();\r
+                               }\r
 \r
-                       // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content\r
-                       // It will also be impossible to place the caret in the editor unless there is a BR element present\r
-                       if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {\r
-                               o.content = t.dom.setHTML(t.getBody(), '<br _mce_bogus="1" />');\r
-                               o.format = 'raw';\r
                        }\r
 \r
-                       o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content));\r
+                       if (tinymce.activeEditor != t) {\r
+                               if ((oed = tinymce.activeEditor) != null)\r
+                                       oed.onDeactivate.dispatch(oed, t);\r
 \r
-                       if (o.format != 'raw' && t.settings.cleanup) {\r
-                               o.getInner = true;\r
-                               o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));\r
+                               t.onActivate.dispatch(t, oed);\r
                        }\r
 \r
-                       if (!o.no_events)\r
-                               t.onSetContent.dispatch(t, o);\r
-\r
-                       return o.content;\r
+                       tinymce._setActive(t);\r
                },\r
 \r
-               getContent : function(o) {\r
-                       var t = this, h;\r
+               execCallback : function(n) {\r
+                       var t = this, f = t.settings[n], s;\r
 \r
-                       o = o || {};\r
-                       o.format = o.format || 'html';\r
-                       o.get = true;\r
+                       if (!f)\r
+                               return;\r
 \r
-                       if (!o.no_events)\r
-                               t.onBeforeGetContent.dispatch(t, o);\r
+                       // Look through lookup\r
+                       if (t.callbackLookup && (s = t.callbackLookup[n])) {\r
+                               f = s.func;\r
+                               s = s.scope;\r
+                       }\r
 \r
-                       if (o.format != 'raw' && t.settings.cleanup) {\r
-                               o.getInner = true;\r
-                               h = t.serializer.serialize(t.getBody(), o);\r
-                       } else\r
-                               h = t.getBody().innerHTML;\r
+                       if (is(f, 'string')) {\r
+                               s = f.replace(/\.\w+$/, '');\r
+                               s = s ? tinymce.resolve(s) : 0;\r
+                               f = tinymce.resolve(f);\r
+                               t.callbackLookup = t.callbackLookup || {};\r
+                               t.callbackLookup[n] = {func : f, scope : s};\r
+                       }\r
 \r
-                       h = h.replace(/^\s*|\s*$/g, '');\r
-                       o.content = h;\r
+                       return f.apply(s || t, Array.prototype.slice.call(arguments, 1));\r
+               },\r
 \r
-                       if (!o.no_events)\r
-                               t.onGetContent.dispatch(t, o);\r
+               translate : function(s) {\r
+                       var c = this.settings.language || 'en', i18n = tinymce.i18n;\r
 \r
-                       return o.content;\r
-               },\r
+                       if (!s)\r
+                               return '';\r
 \r
-               isDirty : function() {\r
-                       var t = this;\r
+                       return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {\r
+                               return i18n[c + '.' + b] || '{#' + b + '}';\r
+                       });\r
+               },\r
 \r
-                       return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;\r
+               getLang : function(n, dv) {\r
+                       return tinymce.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');\r
                },\r
 \r
-               getContainer : function() {\r
-                       var t = this;\r
+               getParam : function(n, dv, ty) {\r
+                       var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;\r
 \r
-                       if (!t.container)\r
-                               t.container = DOM.get(t.editorContainer || t.id + '_parent');\r
+                       if (ty === 'hash') {\r
+                               o = {};\r
 \r
-                       return t.container;\r
-               },\r
+                               if (is(v, 'string')) {\r
+                                       each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {\r
+                                               v = v.split('=');\r
 \r
-               getContentAreaContainer : function() {\r
-                       return this.contentAreaContainer;\r
-               },\r
+                                               if (v.length > 1)\r
+                                                       o[tr(v[0])] = tr(v[1]);\r
+                                               else\r
+                                                       o[tr(v[0])] = tr(v);\r
+                                       });\r
+                               } else\r
+                                       o = v;\r
 \r
-               getElement : function() {\r
-                       return DOM.get(this.settings.content_element || this.id);\r
+                               return o;\r
+                       }\r
+\r
+                       return v;\r
                },\r
 \r
-               getWin : function() {\r
-                       var t = this, e;\r
+               nodeChanged : function(o) {\r
+                       var t = this, s = t.selection, n = s.getStart() || t.getBody();\r
 \r
-                       if (!t.contentWindow) {\r
-                               e = DOM.get(t.id + "_ifr");\r
+                       // Fix for bug #1896577 it seems that this can not be fired while the editor is loading\r
+                       if (t.initialized) {\r
+                               o = o || {};\r
+                               n = isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n; // Fix for IE initial state\r
 \r
-                               if (e)\r
-                                       t.contentWindow = e.contentWindow;\r
-                       }\r
+                               // Get parents and add them to object\r
+                               o.parents = [];\r
+                               t.dom.getParent(n, function(node) {\r
+                                       if (node.nodeName == 'BODY')\r
+                                               return true;\r
 \r
-                       return t.contentWindow;\r
+                                       o.parents.push(node);\r
+                               });\r
+\r
+                               t.onNodeChange.dispatch(\r
+                                       t,\r
+                                       o ? o.controlManager || t.controlManager : t.controlManager,\r
+                                       n,\r
+                                       s.isCollapsed(),\r
+                                       o\r
+                               );\r
+                       }\r
                },\r
 \r
-               getDoc : function() {\r
-                       var t = this, w;\r
+               addButton : function(n, s) {\r
+                       var t = this;\r
 \r
-                       if (!t.contentDocument) {\r
-                               w = t.getWin();\r
+                       t.buttons = t.buttons || {};\r
+                       t.buttons[n] = s;\r
+               },\r
 \r
-                               if (w)\r
-                                       t.contentDocument = w.document;\r
-                       }\r
+               addCommand : function(name, callback, scope) {\r
+                       this.execCommands[name] = {func : callback, scope : scope || this};\r
+               },\r
 \r
-                       return t.contentDocument;\r
+               addQueryStateHandler : function(name, callback, scope) {\r
+                       this.queryStateCommands[name] = {func : callback, scope : scope || this};\r
                },\r
 \r
-               getBody : function() {\r
-                       return this.bodyElement || this.getDoc().body;\r
+               addQueryValueHandler : function(name, callback, scope) {\r
+                       this.queryValueCommands[name] = {func : callback, scope : scope || this};\r
                },\r
 \r
-               convertURL : function(u, n, e) {\r
-                       var t = this, s = t.settings;\r
+               addShortcut : function(pa, desc, cmd_func, sc) {\r
+                       var t = this, c;\r
 \r
-                       // Use callback instead\r
-                       if (s.urlconverter_callback)\r
-                               return t.execCallback('urlconverter_callback', u, e, true, n);\r
+                       if (!t.settings.custom_shortcuts)\r
+                               return false;\r
 \r
-                       // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs\r
-                       if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0)\r
-                               return u;\r
+                       t.shortcuts = t.shortcuts || {};\r
 \r
-                       // Convert to relative\r
-                       if (s.relative_urls)\r
-                               return t.documentBaseURI.toRelative(u);\r
+                       if (is(cmd_func, 'string')) {\r
+                               c = cmd_func;\r
 \r
-                       // Convert to absolute\r
-                       u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);\r
+                               cmd_func = function() {\r
+                                       t.execCommand(c, false, null);\r
+                               };\r
+                       }\r
 \r
-                       return u;\r
-               },\r
+                       if (is(cmd_func, 'object')) {\r
+                               c = cmd_func;\r
 \r
-               addVisual : function(e) {\r
-                       var t = this, s = t.settings;\r
+                               cmd_func = function() {\r
+                                       t.execCommand(c[0], c[1], c[2]);\r
+                               };\r
+                       }\r
 \r
-                       e = e || t.getBody();\r
+                       each(explode(pa), function(pa) {\r
+                               var o = {\r
+                                       func : cmd_func,\r
+                                       scope : sc || this,\r
+                                       desc : desc,\r
+                                       alt : false,\r
+                                       ctrl : false,\r
+                                       shift : false\r
+                               };\r
 \r
-                       if (!is(t.hasVisual))\r
-                               t.hasVisual = s.visual;\r
+                               each(explode(pa, '+'), function(v) {\r
+                                       switch (v) {\r
+                                               case 'alt':\r
+                                               case 'ctrl':\r
+                                               case 'shift':\r
+                                                       o[v] = true;\r
+                                                       break;\r
+\r
+                                               default:\r
+                                                       o.charCode = v.charCodeAt(0);\r
+                                                       o.keyCode = v.toUpperCase().charCodeAt(0);\r
+                                       }\r
+                               });\r
+\r
+                               t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;\r
+                       });\r
 \r
-                       each(t.dom.select('table,a', e), function(e) {\r
-                               var v;\r
+                       return true;\r
+               },\r
 \r
-                               switch (e.nodeName) {\r
-                                       case 'TABLE':\r
-                                               v = t.dom.getAttrib(e, 'border');\r
+               execCommand : function(cmd, ui, val, a) {\r
+                       var t = this, s = 0, o, st;\r
 \r
-                                               if (!v || v == '0') {\r
-                                                       if (t.hasVisual)\r
-                                                               t.dom.addClass(e, s.visual_table_class);\r
-                                                       else\r
-                                                               t.dom.removeClass(e, s.visual_table_class);\r
-                                               }\r
+                       if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))\r
+                               t.focus();\r
 \r
-                                               return;\r
+                       a = extend({}, a);\r
+                       t.onBeforeExecCommand.dispatch(t, cmd, ui, val, a);\r
+                       if (a.terminate)\r
+                               return false;\r
 \r
-                                       case 'A':\r
-                                               v = t.dom.getAttrib(e, 'name');\r
+                       // Command callback\r
+                       if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
 \r
-                                               if (v) {\r
-                                                       if (t.hasVisual)\r
-                                                               t.dom.addClass(e, 'mceItemAnchor');\r
-                                                       else\r
-                                                               t.dom.removeClass(e, 'mceItemAnchor');\r
-                                               }\r
+                       // Registred commands\r
+                       if (o = t.execCommands[cmd]) {\r
+                               st = o.func.call(o.scope, ui, val);\r
 \r
-                                               return;\r
+                               // Fall through on true\r
+                               if (st !== true) {\r
+                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                                       return st;\r
                                }\r
-                       });\r
-\r
-                       t.onVisualAid.dispatch(t, e, t.hasVisual);\r
-               },\r
+                       }\r
 \r
-               remove : function() {\r
-                       var t = this, e = t.getContainer();\r
+                       // Plugin commands\r
+                       each(t.plugins, function(p) {\r
+                               if (p.execCommand && p.execCommand(cmd, ui, val)) {\r
+                                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                                       s = 1;\r
+                                       return false;\r
+                               }\r
+                       });\r
 \r
-                       t.removed = 1; // Cancels post remove event execution\r
-                       t.hide();\r
+                       if (s)\r
+                               return true;\r
 \r
-                       t.execCallback('remove_instance_callback', t);\r
-                       t.onRemove.dispatch(t);\r
+                       // Theme commands\r
+                       if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
 \r
-                       // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command\r
-                       t.onExecCommand.listeners = [];\r
+                       // Editor commands\r
+                       if (t.editorCommands.execCommand(cmd, ui, val)) {\r
+                               t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
+                               return true;\r
+                       }\r
 \r
-                       tinymce.remove(t);\r
-                       DOM.remove(e);\r
+                       // Browser commands\r
+                       t.getDoc().execCommand(cmd, ui, val);\r
+                       t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
                },\r
 \r
-               destroy : function(s) {\r
-                       var t = this;\r
+               queryCommandState : function(cmd) {\r
+                       var t = this, o, s;\r
 \r
-                       // One time is enough\r
-                       if (t.destroyed)\r
+                       // Is hidden then return undefined\r
+                       if (t._isHidden())\r
                                return;\r
 \r
-                       if (!s) {\r
-                               tinymce.removeUnload(t.destroy);\r
-                               tinyMCE.onBeforeUnload.remove(t._beforeUnload);\r
+                       // Registred commands\r
+                       if (o = t.queryStateCommands[cmd]) {\r
+                               s = o.func.call(o.scope);\r
 \r
-                               // Manual destroy\r
-                               if (t.theme && t.theme.destroy)\r
-                                       t.theme.destroy();\r
+                               // Fall though on true\r
+                               if (s !== true)\r
+                                       return s;\r
+                       }\r
 \r
-                               // Destroy controls, selection and dom\r
-                               t.controlManager.destroy();\r
-                               t.selection.destroy();\r
-                               t.dom.destroy();\r
+                       // Registred commands\r
+                       o = t.editorCommands.queryCommandState(cmd);\r
+                       if (o !== -1)\r
+                               return o;\r
 \r
-                               // Remove all events\r
+                       // Browser commands\r
+                       try {\r
+                               return this.getDoc().queryCommandState(cmd);\r
+                       } catch (ex) {\r
+                               // Fails sometimes see bug: 1896577\r
+                       }\r
+               },\r
 \r
-                               // Don't clear the window or document if content editable\r
-                               // is enabled since other instances might still be present\r
-                               if (!t.settings.content_editable) {\r
-                                       Event.clear(t.getWin());\r
-                                       Event.clear(t.getDoc());\r
-                               }\r
+               queryCommandValue : function(c) {\r
+                       var t = this, o, s;\r
 \r
-                               Event.clear(t.getBody());\r
-                               Event.clear(t.formElement);\r
-                       }\r
+                       // Is hidden then return undefined\r
+                       if (t._isHidden())\r
+                               return;\r
 \r
-                       if (t.formElement) {\r
-                               t.formElement.submit = t.formElement._mceOldSubmit;\r
-                               t.formElement._mceOldSubmit = null;\r
+                       // Registred commands\r
+                       if (o = t.queryValueCommands[c]) {\r
+                               s = o.func.call(o.scope);\r
+\r
+                               // Fall though on true\r
+                               if (s !== true)\r
+                                       return s;\r
                        }\r
 \r
-                       t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;\r
+                       // Registred commands\r
+                       o = t.editorCommands.queryCommandValue(c);\r
+                       if (is(o))\r
+                               return o;\r
 \r
-                       if (t.selection)\r
-                               t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;\r
+                       // Browser commands\r
+                       try {\r
+                               return this.getDoc().queryCommandValue(c);\r
+                       } catch (ex) {\r
+                               // Fails sometimes see bug: 1896577\r
+                       }\r
+               },\r
 \r
-                       t.destroyed = 1;\r
+               show : function() {\r
+                       var t = this;\r
+\r
+                       DOM.show(t.getContainer());\r
+                       DOM.hide(t.id);\r
+                       t.load();\r
                },\r
 \r
-               // Internal functions\r
+               hide : function() {\r
+                       var t = this, d = t.getDoc();\r
 \r
-               _addEvents : function() {\r
-                       // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset\r
-                       var t = this, i, s = t.settings, lo = {\r
-                               mouseup : 'onMouseUp',\r
-                               mousedown : 'onMouseDown',\r
-                               click : 'onClick',\r
-                               keyup : 'onKeyUp',\r
-                               keydown : 'onKeyDown',\r
-                               keypress : 'onKeyPress',\r
-                               submit : 'onSubmit',\r
-                               reset : 'onReset',\r
-                               contextmenu : 'onContextMenu',\r
-                               dblclick : 'onDblClick',\r
-                               paste : 'onPaste' // Doesn't work in all browsers yet\r
-                       };\r
+                       // Fixed bug where IE has a blinking cursor left from the editor\r
+                       if (isIE && d)\r
+                               d.execCommand('SelectAll');\r
 \r
-                       function eventHandler(e, o) {\r
-                               var ty = e.type;\r
+                       // We must save before we hide so Safari doesn't crash\r
+                       t.save();\r
+                       DOM.hide(t.getContainer());\r
+                       DOM.setStyle(t.id, 'display', t.orgDisplay);\r
+               },\r
 \r
-                               // Don't fire events when it's removed\r
-                               if (t.removed)\r
-                                       return;\r
+               isHidden : function() {\r
+                       return !DOM.isHidden(this.id);\r
+               },\r
 \r
-                               // Generic event handler\r
-                               if (t.onEvent.dispatch(t, e, o) !== false) {\r
-                                       // Specific event handler\r
-                                       t[lo[e.fakeType || e.type]].dispatch(t, e, o);\r
-                               }\r
-                       };\r
+               setProgressState : function(b, ti, o) {\r
+                       this.onSetProgressState.dispatch(this, b, ti, o);\r
 \r
-                       // Add DOM events\r
-                       each(lo, function(v, k) {\r
-                               switch (k) {\r
-                                       case 'contextmenu':\r
-                                               if (tinymce.isOpera) {\r
-                                                       // Fake contextmenu on Opera\r
-                                                       t.dom.bind(t.getBody(), 'mousedown', function(e) {\r
-                                                               if (e.ctrlKey) {\r
-                                                                       e.fakeType = 'contextmenu';\r
-                                                                       eventHandler(e);\r
-                                                               }\r
-                                                       });\r
-                                               } else\r
-                                                       t.dom.bind(t.getBody(), k, eventHandler);\r
-                                               break;\r
+                       return b;\r
+               },\r
 \r
-                                       case 'paste':\r
-                                               t.dom.bind(t.getBody(), k, function(e) {\r
-                                                       eventHandler(e);\r
-                                               });\r
-                                               break;\r
+               load : function(o) {\r
+                       var t = this, e = t.getElement(), h;\r
 \r
-                                       case 'submit':\r
-                                       case 'reset':\r
-                                               t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);\r
-                                               break;\r
+                       if (e) {\r
+                               o = o || {};\r
+                               o.load = true;\r
 \r
-                                       default:\r
-                                               t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);\r
-                               }\r
-                       });\r
+                               // Double encode existing entities in the value\r
+                               h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);\r
+                               o.element = e;\r
 \r
-                       t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {\r
-                               t.focus(true);\r
-                       });\r
+                               if (!o.no_events)\r
+                                       t.onLoadContent.dispatch(t, o);\r
 \r
+                               o.element = e = null;\r
 \r
-                       // Fixes bug where a specified document_base_uri could result in broken images\r
-                       // This will also fix drag drop of images in Gecko\r
-                       if (tinymce.isGecko) {\r
-                               // Convert all images to absolute URLs\r
-/*                             t.onSetContent.add(function(ed, o) {\r
-                                       each(ed.dom.select('img'), function(e) {\r
-                                               var v;\r
+                               return h;\r
+                       }\r
+               },\r
 \r
-                                               if (v = e.getAttribute('_mce_src'))\r
-                                                       e.src = t.documentBaseURI.toAbsolute(v);\r
-                                       })\r
-                               });*/\r
+               save : function(o) {\r
+                       var t = this, e = t.getElement(), h, f;\r
 \r
-                               t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {\r
-                                       var v;\r
+                       if (!e || !t.initialized)\r
+                               return;\r
 \r
-                                       e = e.target;\r
+                       o = o || {};\r
+                       o.save = true;\r
 \r
-                                       if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('_mce_src')))\r
-                                               e.src = t.documentBaseURI.toAbsolute(v);\r
-                               });\r
+                       // Add undo level will trigger onchange event\r
+                       if (!o.no_events) {\r
+                               t.undoManager.typing = false;\r
+                               t.undoManager.add();\r
                        }\r
 \r
-                       // Set various midas options in Gecko\r
-                       if (isGecko) {\r
-                               function setOpts() {\r
-                                       var t = this, d = t.getDoc(), s = t.settings;\r
+                       o.element = e;\r
+                       h = o.content = t.getContent(o);\r
+\r
+                       if (!o.no_events)\r
+                               t.onSaveContent.dispatch(t, o);\r
+\r
+                       h = o.content;\r
 \r
-                                       if (isGecko && !s.readonly) {\r
-                                               if (t._isHidden()) {\r
-                                                       try {\r
-                                                               if (!s.content_editable)\r
-                                                                       d.designMode = 'On';\r
-                                                       } catch (ex) {\r
-                                                               // Fails if it's hidden\r
-                                                       }\r
-                                               }\r
+                       if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {\r
+                               e.innerHTML = h;\r
 \r
-                                               try {\r
-                                                       // Try new Gecko method\r
-                                                       d.execCommand("styleWithCSS", 0, false);\r
-                                               } catch (ex) {\r
-                                                       // Use old method\r
-                                                       if (!t._isHidden())\r
-                                                               try {d.execCommand("useCSS", 0, true);} catch (ex) {}\r
+                               // Update hidden form element\r
+                               if (f = DOM.getParent(t.id, 'form')) {\r
+                                       each(f.elements, function(e) {\r
+                                               if (e.name == t.id) {\r
+                                                       e.value = h;\r
+                                                       return false;\r
                                                }\r
+                                       });\r
+                               }\r
+                       } else\r
+                               e.value = h;\r
 \r
-                                               if (!s.table_inline_editing)\r
-                                                       try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}\r
+                       o.element = e = null;\r
 \r
-                                               if (!s.object_resizing)\r
-                                                       try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}\r
-                                       }\r
-                               };\r
+                       return h;\r
+               },\r
 \r
-                               t.onBeforeExecCommand.add(setOpts);\r
-                               t.onMouseDown.add(setOpts);\r
-                       }\r
+               setContent : function(content, args) {\r
+                       var self = this, rootNode, body = self.getBody(), forcedRootBlockName;\r
 \r
-                       // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250\r
-                       // WebKit can't even do simple things like selecting an image\r
-                       // This also fixes so it's possible to select mceItemAnchors\r
-                       if (tinymce.isWebKit) {\r
-                               t.onClick.add(function(ed, e) {\r
-                                       e = e.target;\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.set = true;\r
+                       args.content = content;\r
 \r
-                                       // Needs tobe the setBaseAndExtend or it will fail to select floated images\r
-                                       if (e.nodeName == 'IMG' || (e.nodeName == 'A' && t.dom.hasClass(e, 'mceItemAnchor')))\r
-                                               t.selection.getSel().setBaseAndExtent(e, 0, e, 1);\r
-                               });\r
-                       }\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
 \r
-                       // Add node change handlers\r
-                       t.onMouseUp.add(t.nodeChanged);\r
-                       //t.onClick.add(t.nodeChanged);\r
-                       t.onKeyUp.add(function(ed, e) {\r
-                               var c = e.keyCode;\r
+                       content = args.content;\r
 \r
-                               if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)\r
-                                       t.nodeChanged();\r
-                       });\r
+                       // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content\r
+                       // It will also be impossible to place the caret in the editor unless there is a BR element present\r
+                       if (!tinymce.isIE && (content.length === 0 || /^\s+$/.test(content))) {\r
+                               forcedRootBlockName = self.settings.forced_root_block;\r
+                               if (forcedRootBlockName)\r
+                                       content = '<' + forcedRootBlockName + '><br data-mce-bogus="1"></' + forcedRootBlockName + '>';\r
+                               else\r
+                                       content = '<br data-mce-bogus="1">';\r
 \r
-                       // Add reset handler\r
-                       t.onReset.add(function() {\r
-                               t.setContent(t.startContent, {format : 'raw'});\r
-                       });\r
+                               body.innerHTML = content;\r
+                               self.selection.select(body, true);\r
+                               self.selection.collapse(true);\r
+                               return;\r
+                       }\r
 \r
-                       // Add shortcuts\r
-                       if (s.custom_shortcuts) {\r
-                               if (s.custom_undo_redo_keyboard_shortcuts) {\r
-                                       t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');\r
-                                       t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');\r
-                               }\r
+                       // Parse and serialize the html\r
+                       if (args.format !== 'raw') {\r
+                               content = new tinymce.html.Serializer({}, self.schema).serialize(\r
+                                       self.parser.parse(content)\r
+                               );\r
+                       }\r
 \r
-                               // Add default shortcuts for gecko\r
-                               t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');\r
-                               t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');\r
-                               t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');\r
+                       // Set the new cleaned contents to the editor\r
+                       args.content = tinymce.trim(content);\r
+                       self.dom.setHTML(body, args.content);\r
 \r
-                               // BlockFormat shortcuts keys\r
-                               for (i=1; i<=6; i++)\r
-                                       t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
 \r
-                               t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);\r
-                               t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);\r
-                               t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);\r
+                       self.selection.normalize();\r
 \r
-                               function find(e) {\r
-                                       var v = null;\r
+                       return args.content;\r
+               },\r
 \r
-                                       if (!e.altKey && !e.ctrlKey && !e.metaKey)\r
-                                               return v;\r
+               getContent : function(args) {\r
+                       var self = this, content;\r
 \r
-                                       each(t.shortcuts, function(o) {\r
-                                               if (tinymce.isMac && o.ctrl != e.metaKey)\r
-                                                       return;\r
-                                               else if (!tinymce.isMac && o.ctrl != e.ctrlKey)\r
-                                                       return;\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.get = true;\r
 \r
-                                               if (o.alt != e.altKey)\r
-                                                       return;\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeGetContent.dispatch(self, args);\r
 \r
-                                               if (o.shift != e.shiftKey)\r
-                                                       return;\r
+                       // Get raw contents or by default the cleaned contents\r
+                       if (args.format == 'raw')\r
+                               content = self.getBody().innerHTML;\r
+                       else\r
+                               content = self.serializer.serialize(self.getBody(), args);\r
 \r
-                                               if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {\r
-                                                       v = o;\r
-                                                       return false;\r
-                                               }\r
-                                       });\r
+                       args.content = tinymce.trim(content);\r
 \r
-                                       return v;\r
-                               };\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onGetContent.dispatch(self, args);\r
 \r
-                               t.onKeyUp.add(function(ed, e) {\r
-                                       var o = find(e);\r
+                       return args.content;\r
+               },\r
 \r
-                                       if (o)\r
-                                               return Event.cancel(e);\r
-                               });\r
+               isDirty : function() {\r
+                       var self = this;\r
 \r
-                               t.onKeyPress.add(function(ed, e) {\r
-                                       var o = find(e);\r
+                       return tinymce.trim(self.startContent) != tinymce.trim(self.getContent({format : 'raw', no_events : 1})) && !self.isNotDirty;\r
+               },\r
 \r
-                                       if (o)\r
-                                               return Event.cancel(e);\r
-                               });\r
+               getContainer : function() {\r
+                       var t = this;\r
 \r
-                               t.onKeyDown.add(function(ed, e) {\r
-                                       var o = find(e);\r
+                       if (!t.container)\r
+                               t.container = DOM.get(t.editorContainer || t.id + '_parent');\r
 \r
-                                       if (o) {\r
-                                               o.func.call(o.scope);\r
-                                               return Event.cancel(e);\r
-                                       }\r
-                               });\r
-                       }\r
+                       return t.container;\r
+               },\r
 \r
-                       if (tinymce.isIE) {\r
-                               // Fix so resize will only update the width and height attributes not the styles of an image\r
-                               // It will also block mceItemNoResize items\r
-                               t.dom.bind(t.getDoc(), 'controlselect', function(e) {\r
-                                       var re = t.resizeInfo, cb;\r
+               getContentAreaContainer : function() {\r
+                       return this.contentAreaContainer;\r
+               },\r
 \r
-                                       e = e.target;\r
+               getElement : function() {\r
+                       return DOM.get(this.settings.content_element || this.id);\r
+               },\r
 \r
-                                       // Don't do this action for non image elements\r
-                                       if (e.nodeName !== 'IMG')\r
-                                               return;\r
+               getWin : function() {\r
+                       var t = this, e;\r
 \r
-                                       if (re)\r
-                                               t.dom.unbind(re.node, re.ev, re.cb);\r
+                       if (!t.contentWindow) {\r
+                               e = DOM.get(t.id + "_ifr");\r
 \r
-                                       if (!t.dom.hasClass(e, 'mceItemNoResize')) {\r
-                                               ev = 'resizeend';\r
-                                               cb = t.dom.bind(e, ev, function(e) {\r
-                                                       var v;\r
+                               if (e)\r
+                                       t.contentWindow = e.contentWindow;\r
+                       }\r
 \r
-                                                       e = e.target;\r
+                       return t.contentWindow;\r
+               },\r
 \r
-                                                       if (v = t.dom.getStyle(e, 'width')) {\r
-                                                               t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));\r
-                                                               t.dom.setStyle(e, 'width', '');\r
-                                                       }\r
+               getDoc : function() {\r
+                       var t = this, w;\r
 \r
-                                                       if (v = t.dom.getStyle(e, 'height')) {\r
-                                                               t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));\r
-                                                               t.dom.setStyle(e, 'height', '');\r
-                                                       }\r
-                                               });\r
-                                       } else {\r
-                                               ev = 'resizestart';\r
-                                               cb = t.dom.bind(e, 'resizestart', Event.cancel, Event);\r
-                                       }\r
+                       if (!t.contentDocument) {\r
+                               w = t.getWin();\r
 \r
-                                       re = t.resizeInfo = {\r
-                                               node : e,\r
-                                               ev : ev,\r
-                                               cb : cb\r
-                                       };\r
-                               });\r
+                               if (w)\r
+                                       t.contentDocument = w.document;\r
+                       }\r
 \r
-                               t.onKeyDown.add(function(ed, e) {\r
-                                       switch (e.keyCode) {\r
-                                               case 8:\r
-                                                       // Fix IE control + backspace browser bug\r
-                                                       if (t.selection.getRng().item) {\r
-                                                               ed.dom.remove(t.selection.getRng().item(0));\r
-                                                               return Event.cancel(e);\r
-                                                       }\r
-                                       }\r
-                               });\r
+                       return t.contentDocument;\r
+               },\r
 \r
-                               /*if (t.dom.boxModel) {\r
-                                       t.getBody().style.height = '100%';\r
+               getBody : function() {\r
+                       return this.bodyElement || this.getDoc().body;\r
+               },\r
 \r
-                                       Event.add(t.getWin(), 'resize', function(e) {\r
-                                               var docElm = t.getDoc().documentElement;\r
+               convertURL : function(u, n, e) {\r
+                       var t = this, s = t.settings;\r
 \r
-                                               docElm.style.height = (docElm.offsetHeight - 10) + 'px';\r
-                                       });\r
-                               }*/\r
-                       }\r
+                       // Use callback instead\r
+                       if (s.urlconverter_callback)\r
+                               return t.execCallback('urlconverter_callback', u, e, true, n);\r
 \r
-                       if (tinymce.isOpera) {\r
-                               t.onClick.add(function(ed, e) {\r
-                                       Event.prevent(e);\r
-                               });\r
-                       }\r
+                       // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs\r
+                       if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0)\r
+                               return u;\r
 \r
-                       // Add custom undo/redo handlers\r
-                       if (s.custom_undo_redo) {\r
-                               function addUndo() {\r
-                                       t.undoManager.typing = 0;\r
-                                       t.undoManager.add();\r
-                               };\r
+                       // Convert to relative\r
+                       if (s.relative_urls)\r
+                               return t.documentBaseURI.toRelative(u);\r
 \r
-                               t.dom.bind(t.getDoc(), 'focusout', function(e) {\r
-                                       if (!t.removed && t.undoManager.typing)\r
-                                               addUndo();\r
-                               });\r
+                       // Convert to absolute\r
+                       u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);\r
 \r
-                               t.onKeyUp.add(function(ed, e) {\r
-                                       if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey)\r
-                                               addUndo();\r
-                               });\r
+                       return u;\r
+               },\r
 \r
-                               t.onKeyDown.add(function(ed, e) {\r
-                                       var rng, tmpRng, parent, offset;\r
-\r
-                                       // IE has a really odd bug where the DOM might include an node that doesn't have\r
-                                       // a proper structure. If you try to access nodeValue it would throw an illegal value exception.\r
-                                       // This seems to only happen when you delete contents and it seems to be avoidable if you refresh the element\r
-                                       // after you delete contents from it. See: #3008923\r
-                                       if (isIE && e.keyCode == 46) {\r
-                                               rng = t.selection.getRng();\r
-\r
-                                               if (rng.parentElement) {\r
-                                                       parent = rng.parentElement();\r
-\r
-                                                       // Get the current caret position within the element\r
-                                                       tmpRng = rng.duplicate();\r
-                                                       tmpRng.moveToElementText(parent);\r
-                                                       tmpRng.setEndPoint('EndToEnd', rng);\r
-                                                       offset = tmpRng.text.length;\r
-\r
-                                                       // Select next word when ctrl key is used in combo with delete\r
-                                                       if (e.ctrlKey) {\r
-                                                               rng.moveEnd('word', 1);\r
-                                                               rng.select();\r
-                                                       }\r
+               addVisual : function(e) {\r
+                       var t = this, s = t.settings;\r
 \r
-                                                       // Delete contents\r
-                                                       t.selection.getSel().clear();\r
+                       e = e || t.getBody();\r
 \r
-                                                       // Check if we are within the same parent\r
-                                                       if (rng.parentElement() == parent) {\r
-                                                               try {\r
-                                                                       // Update the HTML and hopefully it will remove the artifacts\r
-                                                                       parent.innerHTML = parent.innerHTML;\r
-                                                               } catch (ex) {\r
-                                                                       // And since it's IE it can sometimes produce an unknown runtime error\r
-                                                               }\r
+                       if (!is(t.hasVisual))\r
+                               t.hasVisual = s.visual;\r
 \r
-                                                               // Restore the caret position\r
-                                                               tmpRng.moveToElementText(parent);\r
-                                                               tmpRng.collapse();\r
-                                                               tmpRng.move('character', offset);\r
-                                                               tmpRng.select();\r
-                                                       }\r
+                       each(t.dom.select('table,a', e), function(e) {\r
+                               var v;\r
 \r
-                                                       // Block the default delete behavior since it might be broken\r
-                                                       e.preventDefault();\r
-                                                       return;\r
-                                               }\r
-                                       }\r
+                               switch (e.nodeName) {\r
+                                       case 'TABLE':\r
+                                               v = t.dom.getAttrib(e, 'border');\r
 \r
-                                       // Is caracter positon keys\r
-                                       if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {\r
-                                               if (t.undoManager.typing)\r
-                                                       addUndo();\r
+                                               if (!v || v == '0') {\r
+                                                       if (t.hasVisual)\r
+                                                               t.dom.addClass(e, s.visual_table_class);\r
+                                                       else\r
+                                                               t.dom.removeClass(e, s.visual_table_class);\r
+                                               }\r
 \r
                                                return;\r
-                                       }\r
-\r
-                                       if (!t.undoManager.typing) {\r
-                                               t.undoManager.add();\r
-                                               t.undoManager.typing = 1;\r
-                                       }\r
-                               });\r
 \r
-                               t.onMouseDown.add(function() {\r
-                                       if (t.undoManager.typing)\r
-                                               addUndo();\r
-                               });\r
-                       }\r
-               },\r
+                                       case 'A':\r
+                                               v = t.dom.getAttrib(e, 'name');\r
 \r
-               _isHidden : function() {\r
-                       var s;\r
+                                               if (v) {\r
+                                                       if (t.hasVisual)\r
+                                                               t.dom.addClass(e, 'mceItemAnchor');\r
+                                                       else\r
+                                                               t.dom.removeClass(e, 'mceItemAnchor');\r
+                                               }\r
 \r
-                       if (!isGecko)\r
-                               return 0;\r
+                                               return;\r
+                               }\r
+                       });\r
 \r
-                       // Weird, wheres that cursor selection?\r
-                       s = this.selection.getSel();\r
-                       return (!s || !s.rangeCount || s.rangeCount == 0);\r
+                       t.onVisualAid.dispatch(t, e, t.hasVisual);\r
                },\r
 \r
-               // Fix for bug #1867292\r
-               _fixNesting : function(s) {\r
-                       var d = [], i;\r
-\r
-                       s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {\r
-                               var e;\r
+               remove : function() {\r
+                       var t = this, e = t.getContainer();\r
 \r
-                               // Handle end element\r
-                               if (b === '/') {\r
-                                       if (!d.length)\r
-                                               return '';\r
+                       if (!t.removed) {\r
+                               t.removed = 1; // Cancels post remove event execution\r
+                               t.hide();\r
 \r
-                                       if (c !== d[d.length - 1].tag) {\r
-                                               for (i=d.length - 1; i>=0; i--) {\r
-                                                       if (d[i].tag === c) {\r
-                                                               d[i].close = 1;\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
+                               // Remove all events\r
 \r
-                                               return '';\r
-                                       } else {\r
-                                               d.pop();\r
+                               // Don't clear the window or document if content editable\r
+                               // is enabled since other instances might still be present\r
+                               if (!t.settings.content_editable) {\r
+                                       Event.clear(t.getWin());\r
+                                       Event.clear(t.getDoc());\r
+                               }\r
 \r
-                                               if (d.length && d[d.length - 1].close) {\r
-                                                       a = a + '</' + d[d.length - 1].tag + '>';\r
-                                                       d.pop();\r
-                                               }\r
-                                       }\r
-                               } else {\r
-                                       // Ignore these\r
-                                       if (/^(br|hr|input|meta|img|link|param)$/i.test(c))\r
-                                               return a;\r
+                               Event.clear(t.getBody());\r
+                               Event.clear(t.formElement);\r
+                               Event.unbind(e);\r
 \r
-                                       // Ignore closed ones\r
-                                       if (/\/>$/.test(a))\r
-                                               return a;\r
+                               t.execCallback('remove_instance_callback', t);\r
+                               t.onRemove.dispatch(t);\r
 \r
-                                       d.push({tag : c}); // Push start element\r
-                               }\r
+                               // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command\r
+                               t.onExecCommand.listeners = [];\r
 \r
-                               return a;\r
-                       });\r
+                               tinymce.remove(t);\r
+                               DOM.remove(e);\r
+                       }\r
+               },\r
 \r
-                       // End all open tags\r
-                       for (i=d.length - 1; i>=0; i--)\r
-                               s += '</' + d[i].tag + '>';\r
+               destroy : function(s) {\r
+                       var t = this;\r
 \r
-                       return s;\r
-               }\r
-       });\r
-})(tinymce);\r
+                       // One time is enough\r
+                       if (t.destroyed)\r
+                               return;\r
 \r
-(function(tinymce) {\r
-       // Added for compression purposes\r
-       var each = tinymce.each, undefined, TRUE = true, FALSE = false;\r
+                       // We must unbind on Gecko since it would otherwise produce the pesky "attempt to run compile-and-go script on a cleared scope" message\r
+                       if (isGecko) {\r
+                               Event.unbind(t.getDoc());\r
+                               Event.unbind(t.getWin());\r
+                               Event.unbind(t.getBody());\r
+                       }\r
 \r
-       tinymce.EditorCommands = function(editor) {\r
-               var dom = editor.dom,\r
-                       selection = editor.selection,\r
-                       commands = {state: {}, exec : {}, value : {}},\r
-                       settings = editor.settings,\r
-                       bookmark;\r
+                       if (!s) {\r
+                               tinymce.removeUnload(t.destroy);\r
+                               tinyMCE.onBeforeUnload.remove(t._beforeUnload);\r
 \r
-               function execCommand(command, ui, value) {\r
-                       var func;\r
+                               // Manual destroy\r
+                               if (t.theme && t.theme.destroy)\r
+                                       t.theme.destroy();\r
 \r
-                       command = command.toLowerCase();\r
-                       if (func = commands.exec[command]) {\r
-                               func(command, ui, value);\r
-                               return TRUE;\r
+                               // Destroy controls, selection and dom\r
+                               t.controlManager.destroy();\r
+                               t.selection.destroy();\r
+                               t.dom.destroy();\r
                        }\r
 \r
-                       return FALSE;\r
-               };\r
+                       if (t.formElement) {\r
+                               t.formElement.submit = t.formElement._mceOldSubmit;\r
+                               t.formElement._mceOldSubmit = null;\r
+                       }\r
 \r
-               function queryCommandState(command) {\r
-                       var func;\r
+                       t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;\r
 \r
-                       command = command.toLowerCase();\r
-                       if (func = commands.state[command])\r
-                               return func(command);\r
+                       if (t.selection)\r
+                               t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;\r
 \r
-                       return -1;\r
-               };\r
+                       t.destroyed = 1;\r
+               },\r
 \r
-               function queryCommandValue(command) {\r
-                       var func;\r
+               // Internal functions\r
 \r
-                       command = command.toLowerCase();\r
-                       if (func = commands.value[command])\r
-                               return func(command);\r
+               _addEvents : function() {\r
+                       // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset\r
+                       var t = this, i, s = t.settings, dom = t.dom, lo = {\r
+                               mouseup : 'onMouseUp',\r
+                               mousedown : 'onMouseDown',\r
+                               click : 'onClick',\r
+                               keyup : 'onKeyUp',\r
+                               keydown : 'onKeyDown',\r
+                               keypress : 'onKeyPress',\r
+                               submit : 'onSubmit',\r
+                               reset : 'onReset',\r
+                               contextmenu : 'onContextMenu',\r
+                               dblclick : 'onDblClick',\r
+                               paste : 'onPaste' // Doesn't work in all browsers yet\r
+                       };\r
 \r
-                       return FALSE;\r
-               };\r
+                       function eventHandler(e, o) {\r
+                               var ty = e.type;\r
 \r
-               function addCommands(command_list, type) {\r
-                       type = type || 'exec';\r
+                               // Don't fire events when it's removed\r
+                               if (t.removed)\r
+                                       return;\r
 \r
-                       each(command_list, function(callback, command) {\r
-                               each(command.toLowerCase().split(','), function(command) {\r
-                                       commands[type][command] = callback;\r
-                               });\r
-                       });\r
-               };\r
+                               // Generic event handler\r
+                               if (t.onEvent.dispatch(t, e, o) !== false) {\r
+                                       // Specific event handler\r
+                                       t[lo[e.fakeType || e.type]].dispatch(t, e, o);\r
+                               }\r
+                       };\r
 \r
-               // Expose public methods\r
-               tinymce.extend(this, {\r
-                       execCommand : execCommand,\r
-                       queryCommandState : queryCommandState,\r
-                       queryCommandValue : queryCommandValue,\r
-                       addCommands : addCommands\r
-               });\r
+                       // Add DOM events\r
+                       each(lo, function(v, k) {\r
+                               switch (k) {\r
+                                       case 'contextmenu':\r
+                                               dom.bind(t.getDoc(), k, eventHandler);\r
+                                               break;\r
 \r
-               // Private methods\r
+                                       case 'paste':\r
+                                               dom.bind(t.getBody(), k, function(e) {\r
+                                                       eventHandler(e);\r
+                                               });\r
+                                               break;\r
 \r
-               function execNativeCommand(command, ui, value) {\r
-                       if (ui === undefined)\r
-                               ui = FALSE;\r
+                                       case 'submit':\r
+                                       case 'reset':\r
+                                               dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);\r
+                                               break;\r
 \r
-                       if (value === undefined)\r
-                               value = null;\r
+                                       default:\r
+                                               dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);\r
+                               }\r
+                       });\r
 \r
-                       return editor.getDoc().execCommand(command, ui, value);\r
-               };\r
+                       dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {\r
+                               t.focus(true);\r
+                       });\r
 \r
-               function isFormatMatch(name) {\r
-                       return editor.formatter.match(name);\r
-               };\r
 \r
-               function toggleFormat(name, value) {\r
-                       editor.formatter.toggle(name, value ? {value : value} : undefined);\r
-               };\r
+                       // Fixes bug where a specified document_base_uri could result in broken images\r
+                       // This will also fix drag drop of images in Gecko\r
+                       if (tinymce.isGecko) {\r
+                               dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {\r
+                                       var v;\r
 \r
-               function storeSelection(type) {\r
-                       bookmark = selection.getBookmark(type);\r
-               };\r
+                                       e = e.target;\r
 \r
-               function restoreSelection() {\r
-                       selection.moveToBookmark(bookmark);\r
-               };\r
+                                       if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('data-mce-src')))\r
+                                               e.src = t.documentBaseURI.toAbsolute(v);\r
+                               });\r
+                       }\r
 \r
-               // Add execCommand overrides\r
-               addCommands({\r
-                       // Ignore these, added for compatibility\r
-                       'mceResetDesignMode,mceBeginUndoLevel' : function() {},\r
+                       // Set various midas options in Gecko\r
+                       if (isGecko) {\r
+                               function setOpts() {\r
+                                       var t = this, d = t.getDoc(), s = t.settings;\r
 \r
-                       // Add undo manager logic\r
-                       'mceEndUndoLevel,mceAddUndoLevel' : function() {\r
-                               editor.undoManager.add();\r
-                       },\r
+                                       if (isGecko && !s.readonly) {\r
+                                               t._refreshContentEditable();\r
 \r
-                       'Cut,Copy,Paste' : function(command) {\r
-                               var doc = editor.getDoc(), failed;\r
+                                               try {\r
+                                                       // Try new Gecko method\r
+                                                       d.execCommand("styleWithCSS", 0, false);\r
+                                               } catch (ex) {\r
+                                                       // Use old method\r
+                                                       if (!t._isHidden())\r
+                                                               try {d.execCommand("useCSS", 0, true);} catch (ex) {}\r
+                                               }\r
 \r
-                               // Try executing the native command\r
-                               try {\r
-                                       execNativeCommand(command);\r
-                               } catch (ex) {\r
-                                       // Command failed\r
-                                       failed = TRUE;\r
-                               }\r
+                                               if (!s.table_inline_editing)\r
+                                                       try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}\r
 \r
-                               // Present alert message about clipboard access not being available\r
-                               if (failed || !doc.queryCommandSupported(command)) {\r
-                                       if (tinymce.isGecko) {\r
-                                               editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {\r
-                                                       if (state)\r
-                                                               open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');\r
-                                               });\r
-                                       } else\r
-                                               editor.windowManager.alert(editor.getLang('clipboard_no_support'));\r
-                               }\r
-                       },\r
+                                               if (!s.object_resizing)\r
+                                                       try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}\r
+                                       }\r
+                               };\r
 \r
-                       // Override unlink command\r
-                       unlink : function(command) {\r
-                               if (selection.isCollapsed())\r
-                                       selection.select(selection.getNode());\r
+                               t.onBeforeExecCommand.add(setOpts);\r
+                               t.onMouseDown.add(setOpts);\r
+                       }\r
 \r
-                               execNativeCommand(command);\r
-                               selection.collapse(FALSE);\r
-                       },\r
+                       // Add node change handlers\r
+                       t.onMouseUp.add(t.nodeChanged);\r
+                       //t.onClick.add(t.nodeChanged);\r
+                       t.onKeyUp.add(function(ed, e) {\r
+                               var c = e.keyCode;\r
 \r
-                       // Override justify commands to use the text formatter engine\r
-                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
-                               var align = command.substring(7);\r
+                               if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)\r
+                                       t.nodeChanged();\r
+                       });\r
 \r
-                               // Remove all other alignments first\r
-                               each('left,center,right,full'.split(','), function(name) {\r
-                                       if (align != name)\r
-                                               editor.formatter.remove('align' + name);\r
-                               });\r
 \r
-                               toggleFormat('align' + align);\r
-                       },\r
+                       // Add block quote deletion handler\r
+                       t.onKeyDown.add(function(ed, e) {\r
+                               if (e.keyCode != VK.BACKSPACE)\r
+                                       return;\r
 \r
-                       // Override list commands to fix WebKit bug\r
-                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
-                               var listElm, listParent;\r
+                               var rng = ed.selection.getRng();\r
+                               if (!rng.collapsed)\r
+                                       return;\r
 \r
-                               execNativeCommand(command);\r
+                               var n = rng.startContainer;\r
+                               var offset = rng.startOffset;\r
 \r
-                               // WebKit produces lists within block elements so we need to split them\r
-                               // we will replace the native list creation logic to custom logic later on\r
-                               // TODO: Remove this when the list creation logic is removed\r
-                               listElm = dom.getParent(selection.getNode(), 'ol,ul');\r
-                               if (listElm) {\r
-                                       listParent = listElm.parentNode;\r
+                               while (n && n.nodeType && n.nodeType != 1 && n.parentNode)\r
+                                       n = n.parentNode;\r
 \r
-                                       // If list is within a text block then split that block\r
-                                       if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {\r
-                                               storeSelection();\r
-                                               dom.split(listParent, listElm);\r
-                                               restoreSelection();\r
-                                       }\r
-                               }\r
-                       },\r
+                               // Is the cursor at the beginning of a blockquote?\r
+                               if (n && n.parentNode && n.parentNode.tagName === 'BLOCKQUOTE' && n.parentNode.firstChild == n && offset == 0) {\r
+                                       // Remove the blockquote\r
+                                       ed.formatter.toggle('blockquote', null, n.parentNode);\r
 \r
-                       // Override commands to use the text formatter engine\r
-                       'Bold,Italic,Underline,Strikethrough' : function(command) {\r
-                               toggleFormat(command);\r
-                       },\r
+                                       // Move the caret to the beginning of n\r
+                                       rng.setStart(n, 0);\r
+                                       rng.setEnd(n, 0);\r
+                                       ed.selection.setRng(rng);\r
+                                       ed.selection.collapse(false);\r
+                               }\r
+                       });\r
 \r
-                       // Override commands to use the text formatter engine\r
-                       'ForeColor,HiliteColor,FontName' : function(command, ui, value) {\r
-                               toggleFormat(command, value);\r
-                       },\r
 \r
-                       FontSize : function(command, ui, value) {\r
-                               var fontClasses, fontSizes;\r
 \r
-                               // Convert font size 1-7 to styles\r
-                               if (value >= 1 && value <= 7) {\r
-                                       fontSizes = tinymce.explode(settings.font_size_style_values);\r
-                                       fontClasses = tinymce.explode(settings.font_size_classes);\r
+                       // Add reset handler\r
+                       t.onReset.add(function() {\r
+                               t.setContent(t.startContent, {format : 'raw'});\r
+                       });\r
 \r
-                                       if (fontClasses)\r
-                                               value = fontClasses[value - 1] || value;\r
-                                       else\r
-                                               value = fontSizes[value - 1] || value;\r
+                       // Add shortcuts\r
+                       if (s.custom_shortcuts) {\r
+                               if (s.custom_undo_redo_keyboard_shortcuts) {\r
+                                       t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');\r
+                                       t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');\r
                                }\r
 \r
-                               toggleFormat(command, value);\r
-                       },\r
+                               // Add default shortcuts for gecko\r
+                               t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');\r
+                               t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');\r
+                               t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');\r
 \r
-                       RemoveFormat : function(command) {\r
-                               editor.formatter.remove(command);\r
-                       },\r
+                               // BlockFormat shortcuts keys\r
+                               for (i=1; i<=6; i++)\r
+                                       t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);\r
 \r
-                       mceBlockQuote : function(command) {\r
-                               toggleFormat('blockquote');\r
-                       },\r
+                               t.addShortcut('ctrl+7', '', ['FormatBlock', false, 'p']);\r
+                               t.addShortcut('ctrl+8', '', ['FormatBlock', false, 'div']);\r
+                               t.addShortcut('ctrl+9', '', ['FormatBlock', false, 'address']);\r
 \r
-                       FormatBlock : function(command, ui, value) {\r
-                               return toggleFormat(value);\r
-                       },\r
+                               function find(e) {\r
+                                       var v = null;\r
 \r
-                       mceCleanup : function() {\r
-                               var bookmark = selection.getBookmark();\r
+                                       if (!e.altKey && !e.ctrlKey && !e.metaKey)\r
+                                               return v;\r
 \r
-                               editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});\r
+                                       each(t.shortcuts, function(o) {\r
+                                               if (tinymce.isMac && o.ctrl != e.metaKey)\r
+                                                       return;\r
+                                               else if (!tinymce.isMac && o.ctrl != e.ctrlKey)\r
+                                                       return;\r
 \r
-                               selection.moveToBookmark(bookmark);\r
-                       },\r
+                                               if (o.alt != e.altKey)\r
+                                                       return;\r
 \r
-                       mceRemoveNode : function(command, ui, value) {\r
-                               var node = value || selection.getNode();\r
+                                               if (o.shift != e.shiftKey)\r
+                                                       return;\r
 \r
-                               // Make sure that the body node isn't removed\r
-                               if (node != editor.getBody()) {\r
-                                       storeSelection();\r
-                                       editor.dom.remove(node, TRUE);\r
-                                       restoreSelection();\r
-                               }\r
-                       },\r
+                                               if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {\r
+                                                       v = o;\r
+                                                       return false;\r
+                                               }\r
+                                       });\r
 \r
-                       mceSelectNodeDepth : function(command, ui, value) {\r
-                               var counter = 0;\r
+                                       return v;\r
+                               };\r
 \r
-                               dom.getParent(selection.getNode(), function(node) {\r
-                                       if (node.nodeType == 1 && counter++ == value) {\r
-                                               selection.select(node);\r
-                                               return FALSE;\r
-                                       }\r
-                               }, editor.getBody());\r
-                       },\r
+                               t.onKeyUp.add(function(ed, e) {\r
+                                       var o = find(e);\r
 \r
-                       mceSelectNode : function(command, ui, value) {\r
-                               selection.select(value);\r
-                       },\r
+                                       if (o)\r
+                                               return Event.cancel(e);\r
+                               });\r
 \r
-                       mceInsertContent : function(command, ui, value) {\r
-                               selection.setContent(value);\r
-                       },\r
+                               t.onKeyPress.add(function(ed, e) {\r
+                                       var o = find(e);\r
 \r
-                       mceInsertRawHTML : function(command, ui, value) {\r
-                               selection.setContent('tiny_mce_marker');\r
-                               editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, value));\r
-                       },\r
+                                       if (o)\r
+                                               return Event.cancel(e);\r
+                               });\r
 \r
-                       mceSetContent : function(command, ui, value) {\r
-                               editor.setContent(value);\r
-                       },\r
+                               t.onKeyDown.add(function(ed, e) {\r
+                                       var o = find(e);\r
 \r
-                       'Indent,Outdent' : function(command) {\r
-                               var intentValue, indentUnit, value;\r
+                                       if (o) {\r
+                                               o.func.call(o.scope);\r
+                                               return Event.cancel(e);\r
+                                       }\r
+                               });\r
+                       }\r
 \r
-                               // Setup indent level\r
-                               intentValue = settings.indentation;\r
-                               indentUnit = /[a-z%]+$/i.exec(intentValue);\r
-                               intentValue = parseInt(intentValue);\r
+                       if (tinymce.isIE) {\r
+                               // Fix so resize will only update the width and height attributes not the styles of an image\r
+                               // It will also block mceItemNoResize items\r
+                               dom.bind(t.getDoc(), 'controlselect', function(e) {\r
+                                       var re = t.resizeInfo, cb;\r
 \r
-                               if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {\r
-                                       each(selection.getSelectedBlocks(), function(element) {\r
-                                               if (command == 'outdent') {\r
-                                                       value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);\r
-                                                       dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');\r
-                                               } else\r
-                                                       dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);\r
-                                       });\r
-                               } else\r
-                                       execNativeCommand(command);\r
-                       },\r
+                                       e = e.target;\r
 \r
-                       mceRepaint : function() {\r
-                               var bookmark;\r
+                                       // Don't do this action for non image elements\r
+                                       if (e.nodeName !== 'IMG')\r
+                                               return;\r
 \r
-                               if (tinymce.isGecko) {\r
-                                       try {\r
-                                               storeSelection(TRUE);\r
+                                       if (re)\r
+                                               dom.unbind(re.node, re.ev, re.cb);\r
 \r
-                                               if (selection.getSel())\r
-                                                       selection.getSel().selectAllChildren(editor.getBody());\r
+                                       if (!dom.hasClass(e, 'mceItemNoResize')) {\r
+                                               ev = 'resizeend';\r
+                                               cb = dom.bind(e, ev, function(e) {\r
+                                                       var v;\r
 \r
-                                               selection.collapse(TRUE);\r
-                                               restoreSelection();\r
-                                       } catch (ex) {\r
-                                               // Ignore\r
+                                                       e = e.target;\r
+\r
+                                                       if (v = dom.getStyle(e, 'width')) {\r
+                                                               dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));\r
+                                                               dom.setStyle(e, 'width', '');\r
+                                                       }\r
+\r
+                                                       if (v = dom.getStyle(e, 'height')) {\r
+                                                               dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));\r
+                                                               dom.setStyle(e, 'height', '');\r
+                                                       }\r
+                                               });\r
+                                       } else {\r
+                                               ev = 'resizestart';\r
+                                               cb = dom.bind(e, 'resizestart', Event.cancel, Event);\r
                                        }\r
-                               }\r
-                       },\r
 \r
-                       mceToggleFormat : function(command, ui, value) {\r
-                               editor.formatter.toggle(value);\r
-                       },\r
+                                       re = t.resizeInfo = {\r
+                                               node : e,\r
+                                               ev : ev,\r
+                                               cb : cb\r
+                                       };\r
+                               });\r
+                       }\r
 \r
-                       InsertHorizontalRule : function() {\r
-                               selection.setContent('<hr />');\r
-                       },\r
+                       if (tinymce.isOpera) {\r
+                               t.onClick.add(function(ed, e) {\r
+                                       Event.prevent(e);\r
+                               });\r
+                       }\r
 \r
-                       mceToggleVisualAid : function() {\r
-                               editor.hasVisual = !editor.hasVisual;\r
-                               editor.addVisual();\r
-                       },\r
+                       // Add custom undo/redo handlers\r
+                       if (s.custom_undo_redo) {\r
+                               function addUndo() {\r
+                                       t.undoManager.typing = false;\r
+                                       t.undoManager.add();\r
+                               };\r
 \r
-                       mceReplaceContent : function(command, ui, value) {\r
-                               selection.setContent(value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));\r
-                       },\r
+                               var focusLostFunc = tinymce.isGecko ? 'blur' : 'focusout';\r
+                               dom.bind(t.getDoc(), focusLostFunc, function(e){\r
+                                       if (!t.removed && t.undoManager.typing)\r
+                                               addUndo();\r
+                               });\r
 \r
-                       mceInsertLink : function(command, ui, value) {\r
-                               var link = dom.getParent(selection.getNode(), 'a');\r
+                               // Add undo level when contents is drag/dropped within the editor\r
+                               t.dom.bind(t.dom.getRoot(), 'dragend', function(e) {\r
+                                       addUndo();\r
+                               });\r
 \r
-                               if (tinymce.is(value, 'string'))\r
-                                       value = {href : value};\r
+                               t.onKeyUp.add(function(ed, e) {\r
+                                       var keyCode = e.keyCode;\r
 \r
-                               if (!link) {\r
-                                       execNativeCommand('CreateLink', FALSE, 'javascript:mctmp(0);');\r
-                                       each(dom.select('a[href=javascript:mctmp(0);]'), function(link) {\r
-                                               dom.setAttribs(link, value);\r
-                                       });\r
-                               } else {\r
-                                       if (value.href)\r
-                                               dom.setAttribs(link, value);\r
-                                       else\r
-                                               editor.dom.remove(link, TRUE);\r
-                               }\r
-                       },\r
-                       \r
-                       selectAll : function() {\r
-                               var root = dom.getRoot();\r
-                               var rng = dom.createRng();\r
-                               rng.setStart(root, 0);\r
-                               rng.setEnd(root, root.childNodes.length);\r
-                               editor.selection.setRng(rng);\r
-                       }\r
-               });\r
+                                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 13 || keyCode == 45 || e.ctrlKey)\r
+                                               addUndo();\r
+                               });\r
 \r
-               // Add queryCommandState overrides\r
-               addCommands({\r
-                       // Override justify commands\r
-                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
-                               return isFormatMatch('align' + command.substring(7));\r
-                       },\r
+                               t.onKeyDown.add(function(ed, e) {\r
+                                       var keyCode = e.keyCode, sel;\r
 \r
-                       'Bold,Italic,Underline,Strikethrough' : function(command) {\r
-                               return isFormatMatch(command);\r
-                       },\r
+                                       if (keyCode == 8) {\r
+                                               sel = t.getDoc().selection;\r
 \r
-                       mceBlockQuote : function() {\r
-                               return isFormatMatch('blockquote');\r
-                       },\r
+                                               // Fix IE control + backspace browser bug\r
+                                               if (sel && sel.createRange && sel.createRange().item) {\r
+                                                       t.undoManager.beforeChange();\r
+                                                       ed.dom.remove(sel.createRange().item(0));\r
+                                                       addUndo();\r
 \r
-                       Outdent : function() {\r
-                               var node;\r
+                                                       return Event.cancel(e);\r
+                                               }\r
+                                       }\r
 \r
-                               if (settings.inline_styles) {\r
-                                       if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
-                                               return TRUE;\r
+                                       // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter\r
+                                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 13 || keyCode == 45) {\r
+                                               // Add position before enter key is pressed, used by IE since it still uses the default browser behavior\r
+                                               // Todo: Remove this once we normalize enter behavior on IE\r
+                                               if (tinymce.isIE && keyCode == 13)\r
+                                                       t.undoManager.beforeChange();\r
 \r
-                                       if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
-                                               return TRUE;\r
-                               }\r
+                                               if (t.undoManager.typing)\r
+                                                       addUndo();\r
+\r
+                                               return;\r
+                                       }\r
 \r
-                               return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));\r
-                       },\r
+                                       // If key isn't shift,ctrl,alt,capslock,metakey\r
+                                       if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !t.undoManager.typing) {\r
+                                               t.undoManager.beforeChange();\r
+                                               t.undoManager.typing = true;\r
+                                               t.undoManager.add();\r
+                                       }\r
+                               });\r
 \r
-                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
-                               return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');\r
+                               t.onMouseDown.add(function() {\r
+                                       if (t.undoManager.typing)\r
+                                               addUndo();\r
+                               });\r
                        }\r
-               }, 'state');\r
+               },\r
 \r
-               // Add queryCommandValue overrides\r
-               addCommands({\r
-                       'FontSize,FontName' : function(command) {\r
-                               var value = 0, parent;\r
+               _refreshContentEditable : function() {\r
+                       var self = this, body, parent;\r
 \r
-                               if (parent = dom.getParent(selection.getNode(), 'span')) {\r
-                                       if (command == 'fontsize')\r
-                                               value = parent.style.fontSize;\r
-                                       else\r
-                                               value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();\r
-                               }\r
+                       // Check if the editor was hidden and the re-initalize contentEditable mode by removing and adding the body again\r
+                       if (self._isHidden()) {\r
+                               body = self.getBody();\r
+                               parent = body.parentNode;\r
 \r
-                               return value;\r
+                               parent.removeChild(body);\r
+                               parent.appendChild(body);\r
+\r
+                               body.focus();\r
                        }\r
-               }, 'value');\r
+               },\r
 \r
-               // Add undo manager logic\r
-               if (settings.custom_undo_redo) {\r
-                       addCommands({\r
-                               Undo : function() {\r
-                                       editor.undoManager.undo();\r
-                               },\r
+               _isHidden : function() {\r
+                       var s;\r
 \r
-                               Redo : function() {\r
-                                       editor.undoManager.redo();\r
-                               }\r
-                       });\r
+                       if (!isGecko)\r
+                               return 0;\r
+\r
+                       // Weird, wheres that cursor selection?\r
+                       s = this.selection.getSel();\r
+                       return (!s || !s.rangeCount || s.rangeCount == 0);\r
                }\r
-       };\r
+       });\r
 })(tinymce);\r
+\r
 (function(tinymce) {\r
-       var Dispatcher = tinymce.util.Dispatcher;\r
+       // Added for compression purposes\r
+       var each = tinymce.each, undefined, TRUE = true, FALSE = false;\r
 \r
-       tinymce.UndoManager = function(editor) {\r
-               var self, index = 0, data = [];\r
+       tinymce.EditorCommands = function(editor) {\r
+               var dom = editor.dom,\r
+                       selection = editor.selection,\r
+                       commands = {state: {}, exec : {}, value : {}},\r
+                       settings = editor.settings,\r
+                       formatter = editor.formatter,\r
+                       bookmark;\r
 \r
-               function getContent() {\r
-                       return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}));\r
-               };\r
+               function execCommand(command, ui, value) {\r
+                       var func;\r
 \r
-               return self = {\r
-                       typing : 0,\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.exec[command]) {\r
+                               func(command, ui, value);\r
+                               return TRUE;\r
+                       }\r
 \r
-                       onAdd : new Dispatcher(self),\r
-                       onUndo : new Dispatcher(self),\r
-                       onRedo : new Dispatcher(self),\r
+                       return FALSE;\r
+               };\r
 \r
-                       add : function(level) {\r
-                               var i, settings = editor.settings, lastLevel;\r
+               function queryCommandState(command) {\r
+                       var func;\r
 \r
-                               level = level || {};\r
-                               level.content = getContent();\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.state[command])\r
+                               return func(command);\r
 \r
-                               // Add undo level if needed\r
-                               lastLevel = data[index];\r
-                               if (lastLevel && lastLevel.content == level.content) {\r
-                                       if (index > 0 || data.length == 1)\r
-                                               return null;\r
-                               }\r
+                       return -1;\r
+               };\r
 \r
-                               // Time to compress\r
-                               if (settings.custom_undo_redo_levels) {\r
-                                       if (data.length > settings.custom_undo_redo_levels) {\r
-                                               for (i = 0; i < data.length - 1; i++)\r
-                                                       data[i] = data[i + 1];\r
+               function queryCommandValue(command) {\r
+                       var func;\r
 \r
-                                               data.length--;\r
-                                               index = data.length;\r
-                                       }\r
-                               }\r
+                       command = command.toLowerCase();\r
+                       if (func = commands.value[command])\r
+                               return func(command);\r
 \r
-                               // Get a non intrusive normalized bookmark\r
-                               level.bookmark = editor.selection.getBookmark(2, true);\r
+                       return FALSE;\r
+               };\r
 \r
-                               // Crop array if needed\r
-                               if (index < data.length - 1) {\r
-                                       // Treat first level as initial\r
-                                       if (index == 0)\r
-                                               data = [];\r
-                                       else\r
-                                               data.length = index + 1;\r
-                               }\r
+               function addCommands(command_list, type) {\r
+                       type = type || 'exec';\r
 \r
-                               data.push(level);\r
-                               index = data.length - 1;\r
+                       each(command_list, function(callback, command) {\r
+                               each(command.toLowerCase().split(','), function(command) {\r
+                                       commands[type][command] = callback;\r
+                               });\r
+                       });\r
+               };\r
 \r
-                               self.onAdd.dispatch(self, level);\r
-                               editor.isNotDirty = 0;\r
+               // Expose public methods\r
+               tinymce.extend(this, {\r
+                       execCommand : execCommand,\r
+                       queryCommandState : queryCommandState,\r
+                       queryCommandValue : queryCommandValue,\r
+                       addCommands : addCommands\r
+               });\r
 \r
-                               return level;\r
-                       },\r
+               // Private methods\r
 \r
-                       undo : function() {\r
-                               var level, i;\r
+               function execNativeCommand(command, ui, value) {\r
+                       if (ui === undefined)\r
+                               ui = FALSE;\r
 \r
-                               if (self.typing) {\r
-                                       self.add();\r
-                                       self.typing = 0;\r
-                               }\r
+                       if (value === undefined)\r
+                               value = null;\r
 \r
-                               if (index > 0) {\r
-                                       level = data[--index];\r
+                       return editor.getDoc().execCommand(command, ui, value);\r
+               };\r
 \r
-                                       editor.setContent(level.content, {format : 'raw'});\r
-                                       editor.selection.moveToBookmark(level.bookmark);\r
+               function isFormatMatch(name) {\r
+                       return formatter.match(name);\r
+               };\r
 \r
-                                       self.onUndo.dispatch(self, level);\r
-                               }\r
+               function toggleFormat(name, value) {\r
+                       formatter.toggle(name, value ? {value : value} : undefined);\r
+               };\r
 \r
-                               return level;\r
-                       },\r
+               function storeSelection(type) {\r
+                       bookmark = selection.getBookmark(type);\r
+               };\r
 \r
-                       redo : function() {\r
-                               var level;\r
+               function restoreSelection() {\r
+                       selection.moveToBookmark(bookmark);\r
+               };\r
 \r
-                               if (index < data.length - 1) {\r
-                                       level = data[++index];\r
+               // Add execCommand overrides\r
+               addCommands({\r
+                       // Ignore these, added for compatibility\r
+                       'mceResetDesignMode,mceBeginUndoLevel' : function() {},\r
 \r
-                                       editor.setContent(level.content, {format : 'raw'});\r
-                                       editor.selection.moveToBookmark(level.bookmark);\r
+                       // Add undo manager logic\r
+                       'mceEndUndoLevel,mceAddUndoLevel' : function() {\r
+                               editor.undoManager.add();\r
+                       },\r
 \r
-                                       self.onRedo.dispatch(self, level);\r
+                       'Cut,Copy,Paste' : function(command) {\r
+                               var doc = editor.getDoc(), failed;\r
+\r
+                               // Try executing the native command\r
+                               try {\r
+                                       execNativeCommand(command);\r
+                               } catch (ex) {\r
+                                       // Command failed\r
+                                       failed = TRUE;\r
                                }\r
 \r
-                               return level;\r
+                               // Present alert message about clipboard access not being available\r
+                               if (failed || !doc.queryCommandSupported(command)) {\r
+                                       if (tinymce.isGecko) {\r
+                                               editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {\r
+                                                       if (state)\r
+                                                               open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');\r
+                                               });\r
+                                       } else\r
+                                               editor.windowManager.alert(editor.getLang('clipboard_no_support'));\r
+                               }\r
                        },\r
 \r
-                       clear : function() {\r
-                               data = [];\r
-                               index = self.typing = 0;\r
-                       },\r
+                       // Override unlink command\r
+                       unlink : function(command) {\r
+                               if (selection.isCollapsed())\r
+                                       selection.select(selection.getNode());\r
 \r
-                       hasUndo : function() {\r
-                               return index > 0 || self.typing;\r
+                               execNativeCommand(command);\r
+                               selection.collapse(FALSE);\r
                        },\r
 \r
-                       hasRedo : function() {\r
-                               return index < data.length - 1;\r
-                       }\r
-               };\r
-       };\r
-})(tinymce);\r
+                       // Override justify commands to use the text formatter engine\r
+                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
+                               var align = command.substring(7);\r
 \r
-(function(tinymce) {\r
-       // Shorten names\r
-       var Event = tinymce.dom.Event,\r
-               isIE = tinymce.isIE,\r
-               isGecko = tinymce.isGecko,\r
-               isOpera = tinymce.isOpera,\r
-               each = tinymce.each,\r
-               extend = tinymce.extend,\r
-               TRUE = true,\r
-               FALSE = false;\r
-\r
-       function cloneFormats(node) {\r
-               var clone, temp, inner;\r
-\r
-               do {\r
-                       if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {\r
-                               if (clone) {\r
-                                       temp = node.cloneNode(false);\r
-                                       temp.appendChild(clone);\r
-                                       clone = temp;\r
-                               } else {\r
-                                       clone = inner = node.cloneNode(false);\r
-                               }\r
+                               // Remove all other alignments first\r
+                               each('left,center,right,full'.split(','), function(name) {\r
+                                       if (align != name)\r
+                                               formatter.remove('align' + name);\r
+                               });\r
 \r
-                               clone.removeAttribute('id');\r
-                       }\r
-               } while (node = node.parentNode);\r
+                               toggleFormat('align' + align);\r
+                               execCommand('mceRepaint');\r
+                       },\r
 \r
-               if (clone)\r
-                       return {wrapper : clone, inner : inner};\r
-       };\r
+                       // Override list commands to fix WebKit bug\r
+                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
+                               var listElm, listParent;\r
 \r
-       // Checks if the selection/caret is at the end of the specified block element\r
-       function isAtEnd(rng, par) {\r
-               var rng2 = par.ownerDocument.createRange();\r
+                               execNativeCommand(command);\r
 \r
-               rng2.setStart(rng.endContainer, rng.endOffset);\r
-               rng2.setEndAfter(par);\r
+                               // WebKit produces lists within block elements so we need to split them\r
+                               // we will replace the native list creation logic to custom logic later on\r
+                               // TODO: Remove this when the list creation logic is removed\r
+                               listElm = dom.getParent(selection.getNode(), 'ol,ul');\r
+                               if (listElm) {\r
+                                       listParent = listElm.parentNode;\r
 \r
-               // Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element\r
-               return rng2.cloneContents().textContent.length == 0;\r
-       };\r
+                                       // If list is within a text block then split that block\r
+                                       if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {\r
+                                               storeSelection();\r
+                                               dom.split(listParent, listElm);\r
+                                               restoreSelection();\r
+                                       }\r
+                               }\r
+                       },\r
+\r
+                       // Override commands to use the text formatter engine\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
+                               toggleFormat(command);\r
+                       },\r
+\r
+                       // Override commands to use the text formatter engine\r
+                       'ForeColor,HiliteColor,FontName' : function(command, ui, value) {\r
+                               toggleFormat(command, value);\r
+                       },\r
 \r
-       function isEmpty(n) {\r
-               n = n.innerHTML;\r
+                       FontSize : function(command, ui, value) {\r
+                               var fontClasses, fontSizes;\r
 \r
-               n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars\r
-               n = n.replace(/<[^>]+>/g, ''); // Remove all tags\r
+                               // Convert font size 1-7 to styles\r
+                               if (value >= 1 && value <= 7) {\r
+                                       fontSizes = tinymce.explode(settings.font_size_style_values);\r
+                                       fontClasses = tinymce.explode(settings.font_size_classes);\r
 \r
-               return n.replace(/[ \u00a0\t\r\n]+/g, '') == '';\r
-       };\r
+                                       if (fontClasses)\r
+                                               value = fontClasses[value - 1] || value;\r
+                                       else\r
+                                               value = fontSizes[value - 1] || value;\r
+                               }\r
 \r
-       function splitList(selection, dom, li) {\r
-               var listBlock, block;\r
+                               toggleFormat(command, value);\r
+                       },\r
 \r
-               if (isEmpty(li)) {\r
-                       listBlock = dom.getParent(li, 'ul,ol');\r
+                       RemoveFormat : function(command) {\r
+                               formatter.remove(command);\r
+                       },\r
 \r
-                       if (!dom.getParent(listBlock.parentNode, 'ul,ol')) {\r
-                               dom.split(listBlock, li);\r
-                               block = dom.create('p', 0, '<br _mce_bogus="1" />');\r
-                               dom.replace(block, li);\r
-                               selection.select(block, 1);\r
-                       }\r
+                       mceBlockQuote : function(command) {\r
+                               toggleFormat('blockquote');\r
+                       },\r
 \r
-                       return FALSE;\r
-               }\r
+                       FormatBlock : function(command, ui, value) {\r
+                               return toggleFormat(value || 'p');\r
+                       },\r
 \r
-               return TRUE;\r
-       };\r
+                       mceCleanup : function() {\r
+                               var bookmark = selection.getBookmark();\r
 \r
-       tinymce.create('tinymce.ForceBlocks', {\r
-               ForceBlocks : function(ed) {\r
-                       var t = this, s = ed.settings, elm;\r
+                               editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});\r
 \r
-                       t.editor = ed;\r
-                       t.dom = ed.dom;\r
-                       elm = (s.forced_root_block || 'p').toLowerCase();\r
-                       s.element = elm.toUpperCase();\r
+                               selection.moveToBookmark(bookmark);\r
+                       },\r
 \r
-                       ed.onPreInit.add(t.setup, t);\r
+                       mceRemoveNode : function(command, ui, value) {\r
+                               var node = value || selection.getNode();\r
 \r
-                       t.reOpera = new RegExp('(\\u00a0|&#160;|&nbsp;)<\/' + elm + '>', 'gi');\r
-                       t.rePadd = new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g, elm), 'gi');\r
-                       t.reNbsp2BR1 = new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi');\r
-                       t.reNbsp2BR2 = new RegExp('<%p()([^>]+)>(&nbsp;|&#160;)<\\\/%p>|<%p>(&nbsp;|&#160;)<\\\/%p>'.replace(/%p/g, elm), 'gi');\r
-                       t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g, elm), 'gi');\r
+                               // Make sure that the body node isn't removed\r
+                               if (node != editor.getBody()) {\r
+                                       storeSelection();\r
+                                       editor.dom.remove(node, TRUE);\r
+                                       restoreSelection();\r
+                               }\r
+                       },\r
 \r
-                       function padd(ed, o) {\r
-                               if (isOpera)\r
-                                       o.content = o.content.replace(t.reOpera, '</' + elm + '>');\r
+                       mceSelectNodeDepth : function(command, ui, value) {\r
+                               var counter = 0;\r
 \r
-                               o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>');\r
+                               dom.getParent(selection.getNode(), function(node) {\r
+                                       if (node.nodeType == 1 && counter++ == value) {\r
+                                               selection.select(node);\r
+                                               return FALSE;\r
+                                       }\r
+                               }, editor.getBody());\r
+                       },\r
 \r
-                               if (!isIE && !isOpera && o.set) {\r
-                                       // Use &nbsp; instead of BR in padded paragraphs\r
-                                       o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2><br /></' + elm + '>');\r
-                                       o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2><br /></' + elm + '>');\r
-                               } else\r
-                                       o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>');\r
-                       };\r
+                       mceSelectNode : function(command, ui, value) {\r
+                               selection.select(value);\r
+                       },\r
 \r
-                       ed.onBeforeSetContent.add(padd);\r
-                       ed.onPostProcess.add(padd);\r
+                       mceInsertContent : function(command, ui, value) {\r
+                               var parser, serializer, parentNode, rootNode, fragment, args,\r
+                                       marker, nodeRect, viewPortRect, rng, node, node2, bookmarkHtml, viewportBodyElement;\r
 \r
-                       if (s.forced_root_block) {\r
-                               ed.onInit.add(t.forceRoots, t);\r
-                               ed.onSetContent.add(t.forceRoots, t);\r
-                               ed.onBeforeGetContent.add(t.forceRoots, t);\r
-                       }\r
-               },\r
+                               //selection.normalize();\r
 \r
-               setup : function() {\r
-                       var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection;\r
+                               // Setup parser and serializer\r
+                               parser = editor.parser;\r
+                               serializer = new tinymce.html.Serializer({}, editor.schema);\r
+                               bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';\r
 \r
-                       // Force root blocks when typing and when getting output\r
-                       if (s.forced_root_block) {\r
-                               ed.onBeforeExecCommand.add(t.forceRoots, t);\r
-                               ed.onKeyUp.add(t.forceRoots, t);\r
-                               ed.onPreProcess.add(t.forceRoots, t);\r
-                       }\r
+                               // Run beforeSetContent handlers on the HTML to be inserted\r
+                               args = {content: value, format: 'html'};\r
+                               selection.onBeforeSetContent.dispatch(selection, args);\r
+                               value = args.content;\r
 \r
-                       if (s.force_br_newlines) {\r
-                               // Force IE to produce BRs on enter\r
-                               if (isIE) {\r
-                                       ed.onKeyPress.add(function(ed, e) {\r
-                                               var n;\r
-\r
-                                               if (e.keyCode == 13 && selection.getNode().nodeName != 'LI') {\r
-                                                       selection.setContent('<br id="__" /> ', {format : 'raw'});\r
-                                                       n = dom.get('__');\r
-                                                       n.removeAttribute('id');\r
-                                                       selection.select(n);\r
-                                                       selection.collapse();\r
-                                                       return Event.cancel(e);\r
-                                               }\r
-                                       });\r
-                               }\r
-                       }\r
+                               // Add caret at end of contents if it's missing\r
+                               if (value.indexOf('{$caret}') == -1)\r
+                                       value += '{$caret}';\r
 \r
-                       if (s.force_p_newlines) {\r
-                               if (!isIE) {\r
-                                       ed.onKeyPress.add(function(ed, e) {\r
-                                               if (e.keyCode == 13 && !e.shiftKey && !t.insertPara(e))\r
-                                                       Event.cancel(e);\r
-                                       });\r
-                               } else {\r
-                                       // Ungly hack to for IE to preserve the formatting when you press\r
-                                       // enter at the end of a block element with formatted contents\r
-                                       // This logic overrides the browsers default logic with\r
-                                       // custom logic that enables us to control the output\r
-                                       tinymce.addUnload(function() {\r
-                                               t._previousFormats = 0; // Fix IE leak\r
-                                       });\r
+                               // Replace the caret marker with a span bookmark element\r
+                               value = value.replace(/\{\$caret\}/, bookmarkHtml);\r
 \r
-                                       ed.onKeyPress.add(function(ed, e) {\r
-                                               t._previousFormats = 0;\r
+                               // Insert node maker where we will insert the new HTML and get it's parent\r
+                               if (!selection.isCollapsed())\r
+                                       editor.getDoc().execCommand('Delete', false, null);\r
 \r
-                                               // Clone the current formats, this will later be applied to the new block contents\r
-                                               if (e.keyCode == 13 && !e.shiftKey && ed.selection.isCollapsed() && s.keep_styles)\r
-                                                       t._previousFormats = cloneFormats(ed.selection.getStart());\r
-                                       });\r
+                               parentNode = selection.getNode();\r
 \r
-                                       ed.onKeyUp.add(function(ed, e) {\r
-                                               // Let IE break the element and the wrap the new caret location in the previous formats\r
-                                               if (e.keyCode == 13 && !e.shiftKey) {\r
-                                                       var parent = ed.selection.getStart(), fmt = t._previousFormats;\r
+                               // Parse the fragment within the context of the parent node\r
+                               args = {context : parentNode.nodeName.toLowerCase()};\r
+                               fragment = parser.parse(value, args);\r
 \r
-                                                       // Parent is an empty block\r
-                                                       if (!parent.hasChildNodes()) {\r
-                                                               parent = dom.getParent(parent, dom.isBlock);\r
+                               // Move the caret to a more suitable location\r
+                               node = fragment.lastChild;\r
+                               if (node.attr('id') == 'mce_marker') {\r
+                                       marker = node;\r
 \r
-                                                               if (parent) {\r
-                                                                       parent.innerHTML = '';\r
-       \r
-                                                                       if (t._previousFormats) {\r
-                                                                               parent.appendChild(fmt.wrapper);\r
-                                                                               fmt.inner.innerHTML = '\uFEFF';\r
-                                                                       } else\r
-                                                                               parent.innerHTML = '\uFEFF';\r
-\r
-                                                                       selection.select(parent, 1);\r
-                                                                       ed.getDoc().execCommand('Delete', false, null);\r
-                                                               }\r
-                                                       }\r
+                                       for (node = node.prev; node; node = node.walk(true)) {\r
+                                               if (node.type == 3 || !dom.isBlock(node.name)) {\r
+                                                       node.parent.insert(marker, node, node.name === 'br');\r
+                                                       break;\r
                                                }\r
-                                       });\r
+                                       }\r
                                }\r
 \r
-                               if (isGecko) {\r
-                                       ed.onKeyDown.add(function(ed, e) {\r
-                                               if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)\r
-                                                       t.backspaceDelete(e, e.keyCode == 8);\r
-                                       });\r
-                               }\r
-                       }\r
+                               // If parser says valid we can insert the contents into that parent\r
+                               if (!args.invalid) {\r
+                                       value = serializer.serialize(fragment);\r
 \r
-                       // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973\r
-                       if (tinymce.isWebKit) {\r
-                               function insertBr(ed) {\r
-                                       var rng = selection.getRng(), br, div = dom.create('div', null, ' '), divYPos, vpHeight = dom.getViewPort(ed.getWin()).h;\r
+                                       // Check if parent is empty or only has one BR element then set the innerHTML of that parent\r
+                                       node = parentNode.firstChild;\r
+                                       node2 = parentNode.lastChild;\r
+                                       if (!node || (node === node2 && node.nodeName === 'BR'))\r
+                                               dom.setHTML(parentNode, value);\r
+                                       else\r
+                                               selection.setContent(value);\r
+                               } else {\r
+                                       // If the fragment was invalid within that context then we need\r
+                                       // to parse and process the parent it's inserted into\r
 \r
-                                       // Insert BR element\r
-                                       rng.insertNode(br = dom.create('br'));\r
+                                       // Insert bookmark node and get the parent\r
+                                       selection.setContent(bookmarkHtml);\r
+                                       parentNode = editor.selection.getNode();\r
+                                       rootNode = editor.getBody();\r
 \r
-                                       // Place caret after BR\r
-                                       rng.setStartAfter(br);\r
-                                       rng.setEndAfter(br);\r
-                                       selection.setRng(rng);\r
+                                       // Opera will return the document node when selection is in root\r
+                                       if (parentNode.nodeType == 9)\r
+                                               parentNode = node = rootNode;\r
+                                       else\r
+                                               node = parentNode;\r
 \r
-                                       // Could not place caret after BR then insert an nbsp entity and move the caret\r
-                                       if (selection.getSel().focusNode == br.previousSibling) {\r
-                                               selection.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));\r
-                                               selection.collapse(TRUE);\r
+                                       // Find the ancestor just before the root element\r
+                                       while (node !== rootNode) {\r
+                                               parentNode = node;\r
+                                               node = node.parentNode;\r
                                        }\r
 \r
-                                       // Create a temporary DIV after the BR and get the position as it\r
-                                       // seems like getPos() returns 0 for text nodes and BR elements.\r
-                                       dom.insertAfter(div, br);\r
-                                       divYPos = dom.getPos(div).y;\r
-                                       dom.remove(div);\r
+                                       // Get the outer/inner HTML depending on if we are in the root and parser and serialize that\r
+                                       value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);\r
+                                       value = serializer.serialize(\r
+                                               parser.parse(\r
+                                                       // Need to replace by using a function since $ in the contents would otherwise be a problem\r
+                                                       value.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i, function() {\r
+                                                               return serializer.serialize(fragment);\r
+                                                       })\r
+                                               )\r
+                                       );\r
+\r
+                                       // Set the inner/outer HTML depending on if we are in the root or not\r
+                                       if (parentNode == rootNode)\r
+                                               dom.setHTML(rootNode, value);\r
+                                       else\r
+                                               dom.setOuterHTML(parentNode, value);\r
+                               }\r
 \r
-                                       // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117\r
-                                       if (divYPos > vpHeight) // It is not necessary to scroll if the DIV is inside the view port.\r
-                                               ed.getWin().scrollTo(0, divYPos);\r
-                               };\r
+                               marker = dom.get('mce_marker');\r
 \r
-                               ed.onKeyPress.add(function(ed, e) {\r
-                                       if (e.keyCode == 13 && (e.shiftKey || (s.force_br_newlines && !dom.getParent(selection.getNode(), 'h1,h2,h3,h4,h5,h6,ol,ul')))) {\r
-                                               insertBr(ed);\r
-                                               Event.cancel(e);\r
-                                       }\r
-                               });\r
-                       }\r
+                               // Scroll range into view scrollIntoView on element can't be used since it will scroll the main view port as well\r
+                               nodeRect = dom.getRect(marker);\r
+                               viewPortRect = dom.getViewPort(editor.getWin());\r
 \r
-                       // Padd empty inline elements within block elements\r
-                       // For example: <p><strong><em></em></strong></p> becomes <p><strong><em>&nbsp;</em></strong></p>\r
-                       ed.onPreProcess.add(function(ed, o) {\r
-                               each(dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) {\r
-                                       if (isEmpty(p)) {\r
-                                               each(dom.select('span,em,strong,b,i', o.node), function(n) {\r
-                                                       if (!n.hasChildNodes()) {\r
-                                                               n.appendChild(ed.getDoc().createTextNode('\u00a0'));\r
-                                                               return FALSE; // Break the loop one padding is enough\r
-                                                       }\r
-                                               });\r
-                                       }\r
-                               });\r
-                       });\r
+                               // Check if node is out side the viewport if it is then scroll to it\r
+                               if ((nodeRect.y + nodeRect.h > viewPortRect.y + viewPortRect.h || nodeRect.y < viewPortRect.y) ||\r
+                                       (nodeRect.x > viewPortRect.x + viewPortRect.w || nodeRect.x < viewPortRect.x)) {\r
+                                       viewportBodyElement = tinymce.isIE ? editor.getDoc().documentElement : editor.getBody();\r
+                                       viewportBodyElement.scrollLeft = nodeRect.x;\r
+                                       viewportBodyElement.scrollTop = nodeRect.y - viewPortRect.h + 25;\r
+                               }\r
 \r
-                       // IE specific fixes\r
-                       if (isIE) {\r
-                               // Replaces IE:s auto generated paragraphs with the specified element name\r
-                               if (s.element != 'P') {\r
-                                       ed.onKeyPress.add(function(ed, e) {\r
-                                               t.lastElm = selection.getNode().nodeName;\r
-                                       });\r
+                               // Move selection before marker and remove it\r
+                               rng = dom.createRng();\r
 \r
-                                       ed.onKeyUp.add(function(ed, e) {\r
-                                               var bl, n = selection.getNode(), b = ed.getBody();\r
+                               // If previous sibling is a text node set the selection to the end of that node\r
+                               node = marker.previousSibling;\r
+                               if (node && node.nodeType == 3) {\r
+                                       rng.setStart(node, node.nodeValue.length);\r
+                               } else {\r
+                                       // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node\r
+                                       rng.setStartBefore(marker);\r
+                                       rng.setEndBefore(marker);\r
+                               }\r
 \r
-                                               if (b.childNodes.length === 1 && n.nodeName == 'P') {\r
-                                                       n = dom.rename(n, s.element);\r
-                                                       selection.select(n);\r
-                                                       selection.collapse();\r
-                                                       ed.nodeChanged();\r
-                                               } else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') {\r
-                                                       bl = dom.getParent(n, 'p');\r
+                               // Remove the marker node and set the new range\r
+                               dom.remove(marker);\r
+                               selection.setRng(rng);\r
 \r
-                                                       if (bl) {\r
-                                                               dom.rename(bl, s.element);\r
-                                                               ed.nodeChanged();\r
-                                                       }\r
-                                               }\r
-                                       });\r
-                               }\r
-                       }\r
-               },\r
+                               // Dispatch after event and add any visual elements needed\r
+                               selection.onSetContent.dispatch(selection, args);\r
+                               editor.addVisual();\r
+                       },\r
 \r
-               find : function(n, t, s) {\r
-                       var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, FALSE), c = -1;\r
+                       mceInsertRawHTML : function(command, ui, value) {\r
+                               selection.setContent('tiny_mce_marker');\r
+                               editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, function() { return value }));\r
+                       },\r
 \r
-                       while (n = w.nextNode()) {\r
-                               c++;\r
+                       mceSetContent : function(command, ui, value) {\r
+                               editor.setContent(value);\r
+                       },\r
 \r
-                               // Index by node\r
-                               if (t == 0 && n == s)\r
-                                       return c;\r
+                       'Indent,Outdent' : function(command) {\r
+                               var intentValue, indentUnit, value;\r
 \r
-                               // Node by index\r
-                               if (t == 1 && c == s)\r
-                                       return n;\r
-                       }\r
+                               // Setup indent level\r
+                               intentValue = settings.indentation;\r
+                               indentUnit = /[a-z%]+$/i.exec(intentValue);\r
+                               intentValue = parseInt(intentValue);\r
 \r
-                       return -1;\r
-               },\r
+                               if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {\r
+                                       // If forced_root_blocks is set to false we don't have a block to indent so lets create a div\r
+                                       if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {\r
+                                               formatter.apply('div');\r
+                                       }\r
+\r
+                                       each(selection.getSelectedBlocks(), function(element) {\r
+                                               if (command == 'outdent') {\r
+                                                       value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);\r
+                                                       dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');\r
+                                               } else\r
+                                                       dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);\r
+                                       });\r
+                               } else\r
+                                       execNativeCommand(command);\r
+                       },\r
 \r
-               forceRoots : function(ed, e) {\r
-                       var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;\r
-                       var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid;\r
+                       mceRepaint : function() {\r
+                               var bookmark;\r
 \r
-                       // Fix for bug #1863847\r
-                       //if (e && e.keyCode == 13)\r
-                       //      return TRUE;\r
+                               if (tinymce.isGecko) {\r
+                                       try {\r
+                                               storeSelection(TRUE);\r
 \r
-                       // Wrap non blocks into blocks\r
-                       for (i = nl.length - 1; i >= 0; i--) {\r
-                               nx = nl[i];\r
+                                               if (selection.getSel())\r
+                                                       selection.getSel().selectAllChildren(editor.getBody());\r
 \r
-                               // Ignore internal elements\r
-                               if (nx.nodeType === 1 && nx.getAttribute('_mce_type')) {\r
-                                       bl = null;\r
-                                       continue;\r
+                                               selection.collapse(TRUE);\r
+                                               restoreSelection();\r
+                                       } catch (ex) {\r
+                                               // Ignore\r
+                                       }\r
                                }\r
+                       },\r
 \r
-                               // Is text or non block element\r
-                               if (nx.nodeType === 3 || (!t.dom.isBlock(nx) && nx.nodeType !== 8 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) {\r
-                                       if (!bl) {\r
-                                               // Create new block but ignore whitespace\r
-                                               if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {\r
-                                                       // Store selection\r
-                                                       if (si == -2 && r) {\r
-                                                               if (!isIE) {\r
-                                                                       // If selection is element then mark it\r
-                                                                       if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) {\r
-                                                                               // Save the id of the selected element\r
-                                                                               eid = n.getAttribute("id");\r
-                                                                               n.setAttribute("id", "__mce");\r
-                                                                       } else {\r
-                                                                               // If element is inside body, might not be the case in contentEdiable mode\r
-                                                                               if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {\r
-                                                                                       so = r.startOffset;\r
-                                                                                       eo = r.endOffset;\r
-                                                                                       si = t.find(b, 0, r.startContainer);\r
-                                                                                       ei = t.find(b, 0, r.endContainer);\r
-                                                                               }\r
-                                                                       }\r
-                                                               } else {\r
-                                                                       // Force control range into text range\r
-                                                                       if (r.item) {\r
-                                                                               tr = d.body.createTextRange();\r
-                                                                               tr.moveToElementText(r.item(0));\r
-                                                                               r = tr;\r
-                                                                       }\r
+                       mceToggleFormat : function(command, ui, value) {\r
+                               formatter.toggle(value);\r
+                       },\r
 \r
-                                                                       tr = d.body.createTextRange();\r
-                                                                       tr.moveToElementText(b);\r
-                                                                       tr.collapse(1);\r
-                                                                       bp = tr.move('character', c) * -1;\r
+                       InsertHorizontalRule : function() {\r
+                               editor.execCommand('mceInsertContent', false, '<hr />');\r
+                       },\r
 \r
-                                                                       tr = r.duplicate();\r
-                                                                       tr.collapse(1);\r
-                                                                       sp = tr.move('character', c) * -1;\r
+                       mceToggleVisualAid : function() {\r
+                               editor.hasVisual = !editor.hasVisual;\r
+                               editor.addVisual();\r
+                       },\r
 \r
-                                                                       tr = r.duplicate();\r
-                                                                       tr.collapse(0);\r
-                                                                       le = (tr.move('character', c) * -1) - sp;\r
+                       mceReplaceContent : function(command, ui, value) {\r
+                               editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));\r
+                       },\r
 \r
-                                                                       si = sp - bp;\r
-                                                                       ei = le;\r
-                                                               }\r
-                                                       }\r
+                       mceInsertLink : function(command, ui, value) {\r
+                               var anchor;\r
 \r
-                                                       // Uses replaceChild instead of cloneNode since it removes selected attribute from option elements on IE\r
-                                                       // See: http://support.microsoft.com/kb/829907\r
-                                                       bl = ed.dom.create(ed.settings.forced_root_block);\r
-                                                       nx.parentNode.replaceChild(bl, nx);\r
-                                                       bl.appendChild(nx);\r
-                                               }\r
-                                       } else {\r
-                                               if (bl.hasChildNodes())\r
-                                                       bl.insertBefore(nx, bl.firstChild);\r
-                                               else\r
-                                                       bl.appendChild(nx);\r
-                                       }\r
-                               } else\r
-                                       bl = null; // Time to create new block\r
-                       }\r
+                               if (typeof(value) == 'string')\r
+                                       value = {href : value};\r
 \r
-                       // Restore selection\r
-                       if (si != -2) {\r
-                               if (!isIE) {\r
-                                       bl = b.getElementsByTagName(ed.settings.element)[0];\r
-                                       r = d.createRange();\r
+                               anchor = dom.getParent(selection.getNode(), 'a');\r
 \r
-                                       // Select last location or generated block\r
-                                       if (si != -1)\r
-                                               r.setStart(t.find(b, 1, si), so);\r
-                                       else\r
-                                               r.setStart(bl, 0);\r
+                               // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here.\r
+                               value.href = value.href.replace(' ', '%20');\r
 \r
-                                       // Select last location or generated block\r
-                                       if (ei != -1)\r
-                                               r.setEnd(t.find(b, 1, ei), eo);\r
-                                       else\r
-                                               r.setEnd(bl, 0);\r
+                               // Remove existing links if there could be child links or that the href isn't specified\r
+                               if (!anchor || !value.href) {\r
+                                       formatter.remove('link');\r
+                               }               \r
 \r
-                                       if (s) {\r
-                                               s.removeAllRanges();\r
-                                               s.addRange(r);\r
-                                       }\r
-                               } else {\r
-                                       try {\r
-                                               r = s.createRange();\r
-                                               r.moveToElementText(b);\r
-                                               r.collapse(1);\r
-                                               r.moveStart('character', si);\r
-                                               r.moveEnd('character', ei);\r
-                                               r.select();\r
-                                       } catch (ex) {\r
-                                               // Ignore\r
-                                       }\r
+                               // Apply new link to selection\r
+                               if (value.href) {\r
+                                       formatter.apply('link', value, anchor);\r
                                }\r
-                       } else if (!isIE && (n = ed.dom.get('__mce'))) {\r
-                               // Restore the id of the selected element\r
-                               if (eid)\r
-                                       n.setAttribute('id', eid);\r
-                               else\r
-                                       n.removeAttribute('id');\r
+                       },\r
 \r
-                               // Move caret before selected element\r
-                               r = d.createRange();\r
-                               r.setStartBefore(n);\r
-                               r.setEndBefore(n);\r
-                               se.setRng(r);\r
-                       }\r
-               },\r
+                       selectAll : function() {\r
+                               var root = dom.getRoot(), rng = dom.createRng();\r
 \r
-               getParentBlock : function(n) {\r
-                       var d = this.dom;\r
+                               rng.setStart(root, 0);\r
+                               rng.setEnd(root, root.childNodes.length);\r
 \r
-                       return d.getParent(n, d.isBlock);\r
-               },\r
+                               editor.selection.setRng(rng);\r
+                       }\r
+               });\r
 \r
-               insertPara : function(e) {\r
-                       var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;\r
-                       var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car;\r
+               // Add queryCommandState overrides\r
+               addCommands({\r
+                       // Override justify commands\r
+                       'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {\r
+                               var name = 'align' + command.substring(7);\r
+                               // Use Formatter.matchNode instead of Formatter.match so that we don't match on parent node. This fixes bug where for both left\r
+                               // and right align buttons can be active. This could occur when selected nodes have align right and the parent has align left.\r
+                               var nodes = selection.isCollapsed() ? [selection.getNode()] : selection.getSelectedBlocks();\r
+                               var matches = tinymce.map(nodes, function(node) {\r
+                                       return !!formatter.matchNode(node, name);\r
+                               });\r
+                               return tinymce.inArray(matches, TRUE) !== -1;\r
+                       },\r
+\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
+                               return isFormatMatch(command);\r
+                       },\r
 \r
-                       // If root blocks are forced then use Operas default behavior since it's really good\r
-// Removed due to bug: #1853816\r
-//                     if (se.forced_root_block && isOpera)\r
-//                             return TRUE;\r
+                       mceBlockQuote : function() {\r
+                               return isFormatMatch('blockquote');\r
+                       },\r
 \r
-                       // Setup before range\r
-                       rb = d.createRange();\r
+                       Outdent : function() {\r
+                               var node;\r
 \r
-                       // If is before the first block element and in body, then move it into first block element\r
-                       rb.setStart(s.anchorNode, s.anchorOffset);\r
-                       rb.collapse(TRUE);\r
+                               if (settings.inline_styles) {\r
+                                       if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
+                                               return TRUE;\r
 \r
-                       // Setup after range\r
-                       ra = d.createRange();\r
+                                       if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)\r
+                                               return TRUE;\r
+                               }\r
 \r
-                       // If is before the first block element and in body, then move it into first block element\r
-                       ra.setStart(s.focusNode, s.focusOffset);\r
-                       ra.collapse(TRUE);\r
+                               return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));\r
+                       },\r
 \r
-                       // Setup start/end points\r
-                       dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;\r
-                       sn = dir ? s.anchorNode : s.focusNode;\r
-                       so = dir ? s.anchorOffset : s.focusOffset;\r
-                       en = dir ? s.focusNode : s.anchorNode;\r
-                       eo = dir ? s.focusOffset : s.anchorOffset;\r
+                       'InsertUnorderedList,InsertOrderedList' : function(command) {\r
+                               return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');\r
+                       }\r
+               }, 'state');\r
 \r
-                       // If selection is in empty table cell\r
-                       if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) {\r
-                               if (sn.firstChild.nodeName == 'BR')\r
-                                       dom.remove(sn.firstChild); // Remove BR\r
+               // Add queryCommandValue overrides\r
+               addCommands({\r
+                       'FontSize,FontName' : function(command) {\r
+                               var value = 0, parent;\r
 \r
-                               // Create two new block elements\r
-                               if (sn.childNodes.length == 0) {\r
-                                       ed.dom.add(sn, se.element, null, '<br />');\r
-                                       aft = ed.dom.add(sn, se.element, null, '<br />');\r
-                               } else {\r
-                                       n = sn.innerHTML;\r
-                                       sn.innerHTML = '';\r
-                                       ed.dom.add(sn, se.element, null, n);\r
-                                       aft = ed.dom.add(sn, se.element, null, '<br />');\r
+                               if (parent = dom.getParent(selection.getNode(), 'span')) {\r
+                                       if (command == 'fontsize')\r
+                                               value = parent.style.fontSize;\r
+                                       else\r
+                                               value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();\r
                                }\r
 \r
-                               // Move caret into the last one\r
-                               r = d.createRange();\r
-                               r.selectNodeContents(aft);\r
-                               r.collapse(1);\r
-                               ed.selection.setRng(r);\r
-\r
-                               return FALSE;\r
+                               return value;\r
                        }\r
+               }, 'value');\r
 \r
-                       // If the caret is in an invalid location in FF we need to move it into the first block\r
-                       if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) {\r
-                               sn = en = sn.firstChild;\r
-                               so = eo = 0;\r
-                               rb = d.createRange();\r
-                               rb.setStart(sn, 0);\r
-                               ra = d.createRange();\r
-                               ra.setStart(en, 0);\r
-                       }\r
+               // Add undo manager logic\r
+               if (settings.custom_undo_redo) {\r
+                       addCommands({\r
+                               Undo : function() {\r
+                                       editor.undoManager.undo();\r
+                               },\r
+\r
+                               Redo : function() {\r
+                                       editor.undoManager.redo();\r
+                               }\r
+                       });\r
+               }\r
+       };\r
+})(tinymce);\r
+\r
+(function(tinymce) {\r
+       var Dispatcher = tinymce.util.Dispatcher;\r
 \r
-                       // Never use body as start or end node\r
-                       sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes\r
-                       sn = sn.nodeName == "BODY" ? sn.firstChild : sn;\r
-                       en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes\r
-                       en = en.nodeName == "BODY" ? en.firstChild : en;\r
+       tinymce.UndoManager = function(editor) {\r
+               var self, index = 0, data = [], beforeBookmark;\r
 \r
-                       // Get start and end blocks\r
-                       sb = t.getParentBlock(sn);\r
-                       eb = t.getParentBlock(en);\r
-                       bn = sb ? sb.nodeName : se.element; // Get block name to create\r
+               function getContent() {\r
+                       // Remove whitespace before/after and remove pure bogus nodes\r
+                       return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g, ''));\r
+               };\r
 \r
-                       // Return inside list use default browser behavior\r
-                       if (n = t.dom.getParent(sb, 'li,pre')) {\r
-                               if (n.nodeName == 'LI')\r
-                                       return splitList(ed.selection, t.dom, n);\r
+               return self = {\r
+                       typing : false,\r
 \r
-                               return TRUE;\r
-                       }\r
+                       onAdd : new Dispatcher(self),\r
 \r
-                       // If caption or absolute layers then always generate new blocks within\r
-                       if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {\r
-                               bn = se.element;\r
-                               sb = null;\r
-                       }\r
+                       onUndo : new Dispatcher(self),\r
 \r
-                       // If caption or absolute layers then always generate new blocks within\r
-                       if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {\r
-                               bn = se.element;\r
-                               eb = null;\r
-                       }\r
+                       onRedo : new Dispatcher(self),\r
 \r
-                       // Use P instead\r
-                       if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(dom.getStyle(sb, 'float', 1)))) {\r
-                               bn = se.element;\r
-                               sb = eb = null;\r
-                       }\r
+                       beforeChange : function() {\r
+                               beforeBookmark = editor.selection.getBookmark(2, true);\r
+                       },\r
 \r
-                       // Setup new before and after blocks\r
-                       bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn);\r
-                       aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn);\r
+                       add : function(level) {\r
+                               var i, settings = editor.settings, lastLevel;\r
 \r
-                       // Remove id from after clone\r
-                       aft.removeAttribute('id');\r
+                               level = level || {};\r
+                               level.content = getContent();\r
 \r
-                       // Is header and cursor is at the end, then force paragraph under\r
-                       if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb))\r
-                               aft = ed.dom.create(se.element);\r
+                               // Add undo level if needed\r
+                               lastLevel = data[index];\r
+                               if (lastLevel && lastLevel.content == level.content)\r
+                                       return null;\r
 \r
-                       // Find start chop node\r
-                       n = sc = sn;\r
-                       do {\r
-                               if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))\r
-                                       break;\r
+                               // Set before bookmark on previous level\r
+                               if (data[index])\r
+                                       data[index].beforeBookmark = beforeBookmark;\r
 \r
-                               sc = n;\r
-                       } while ((n = n.previousSibling ? n.previousSibling : n.parentNode));\r
+                               // Time to compress\r
+                               if (settings.custom_undo_redo_levels) {\r
+                                       if (data.length > settings.custom_undo_redo_levels) {\r
+                                               for (i = 0; i < data.length - 1; i++)\r
+                                                       data[i] = data[i + 1];\r
 \r
-                       // Find end chop node\r
-                       n = ec = en;\r
-                       do {\r
-                               if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))\r
-                                       break;\r
+                                               data.length--;\r
+                                               index = data.length;\r
+                                       }\r
+                               }\r
 \r
-                               ec = n;\r
-                       } while ((n = n.nextSibling ? n.nextSibling : n.parentNode));\r
+                               // Get a non intrusive normalized bookmark\r
+                               level.bookmark = editor.selection.getBookmark(2, true);\r
 \r
-                       // Place first chop part into before block element\r
-                       if (sc.nodeName == bn)\r
-                               rb.setStart(sc, 0);\r
-                       else\r
-                               rb.setStartBefore(sc);\r
+                               // Crop array if needed\r
+                               if (index < data.length - 1)\r
+                                       data.length = index + 1;\r
 \r
-                       rb.setEnd(sn, so);\r
-                       bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari\r
+                               data.push(level);\r
+                               index = data.length - 1;\r
 \r
-                       // Place secnd chop part within new block element\r
-                       try {\r
-                               ra.setEndAfter(ec);\r
-                       } catch(ex) {\r
-                               //console.debug(s.focusNode, s.focusOffset);\r
-                       }\r
+                               self.onAdd.dispatch(self, level);\r
+                               editor.isNotDirty = 0;\r
 \r
-                       ra.setStart(en, eo);\r
-                       aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari\r
+                               return level;\r
+                       },\r
 \r
-                       // Create range around everything\r
-                       r = d.createRange();\r
-                       if (!sc.previousSibling && sc.parentNode.nodeName == bn) {\r
-                               r.setStartBefore(sc.parentNode);\r
-                       } else {\r
-                               if (rb.startContainer.nodeName == bn && rb.startOffset == 0)\r
-                                       r.setStartBefore(rb.startContainer);\r
-                               else\r
-                                       r.setStart(rb.startContainer, rb.startOffset);\r
-                       }\r
+                       undo : function() {\r
+                               var level, i;\r
 \r
-                       if (!ec.nextSibling && ec.parentNode.nodeName == bn)\r
-                               r.setEndAfter(ec.parentNode);\r
-                       else\r
-                               r.setEnd(ra.endContainer, ra.endOffset);\r
+                               if (self.typing) {\r
+                                       self.add();\r
+                                       self.typing = false;\r
+                               }\r
 \r
-                       // Delete and replace it with new block elements\r
-                       r.deleteContents();\r
+                               if (index > 0) {\r
+                                       level = data[--index];\r
 \r
-                       if (isOpera)\r
-                               ed.getWin().scrollTo(0, vp.y);\r
+                                       editor.setContent(level.content, {format : 'raw'});\r
+                                       editor.selection.moveToBookmark(level.beforeBookmark);\r
 \r
-                       // Never wrap blocks in blocks\r
-                       if (bef.firstChild && bef.firstChild.nodeName == bn)\r
-                               bef.innerHTML = bef.firstChild.innerHTML;\r
+                                       self.onUndo.dispatch(self, level);\r
+                               }\r
 \r
-                       if (aft.firstChild && aft.firstChild.nodeName == bn)\r
-                               aft.innerHTML = aft.firstChild.innerHTML;\r
+                               return level;\r
+                       },\r
 \r
-                       // Padd empty blocks\r
-                       if (isEmpty(bef))\r
-                               bef.innerHTML = '<br />';\r
+                       redo : function() {\r
+                               var level;\r
 \r
-                       function appendStyles(e, en) {\r
-                               var nl = [], nn, n, i;\r
+                               if (index < data.length - 1) {\r
+                                       level = data[++index];\r
 \r
-                               e.innerHTML = '';\r
+                                       editor.setContent(level.content, {format : 'raw'});\r
+                                       editor.selection.moveToBookmark(level.bookmark);\r
 \r
-                               // Make clones of style elements\r
-                               if (se.keep_styles) {\r
-                                       n = en;\r
-                                       do {\r
-                                               // We only want style specific elements\r
-                                               if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) {\r
-                                                       nn = n.cloneNode(FALSE);\r
-                                                       dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique\r
-                                                       nl.push(nn);\r
-                                               }\r
-                                       } while (n = n.parentNode);\r
+                                       self.onRedo.dispatch(self, level);\r
                                }\r
 \r
-                               // Append style elements to aft\r
-                               if (nl.length > 0) {\r
-                                       for (i = nl.length - 1, nn = e; i >= 0; i--)\r
-                                               nn = nn.appendChild(nl[i]);\r
+                               return level;\r
+                       },\r
 \r
-                                       // Padd most inner style element\r
-                                       nl[0].innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there\r
-                                       return nl[0]; // Move caret to most inner element\r
-                               } else\r
-                                       e.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there\r
-                       };\r
+                       clear : function() {\r
+                               data = [];\r
+                               index = 0;\r
+                               self.typing = false;\r
+                       },\r
 \r
-                       // Fill empty afterblook with current style\r
-                       if (isEmpty(aft))\r
-                               car = appendStyles(aft, en);\r
+                       hasUndo : function() {\r
+                               return index > 0 || this.typing;\r
+                       },\r
 \r
-                       // Opera needs this one backwards for older versions\r
-                       if (isOpera && parseFloat(opera.version()) < 9.5) {\r
-                               r.insertNode(bef);\r
-                               r.insertNode(aft);\r
-                       } else {\r
-                               r.insertNode(aft);\r
-                               r.insertNode(bef);\r
+                       hasRedo : function() {\r
+                               return index < data.length - 1 && !this.typing;\r
                        }\r
+               };\r
+       };\r
+})(tinymce);\r
 \r
-                       // Normalize\r
-                       aft.normalize();\r
-                       bef.normalize();\r
+tinymce.ForceBlocks = function(editor) {\r
+       var settings = editor.settings, dom = editor.dom, selection = editor.selection, blockElements = editor.schema.getBlockElements();\r
 \r
-                       function first(n) {\r
-                               return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE).nextNode() || n;\r
-                       };\r
+       // Force root blocks\r
+       if (settings.forced_root_block) {\r
+               function addRootBlocks() {\r
+                       var node = selection.getStart(), rootNode = editor.getBody(), rng, startContainer, startOffset, endContainer, endOffset, rootBlockNode, tempNode, offset = -0xFFFFFF;\r
 \r
-                       // Move cursor and scroll into view\r
-                       r = d.createRange();\r
-                       r.selectNodeContents(isGecko ? first(car || aft) : car || aft);\r
-                       r.collapse(1);\r
-                       s.removeAllRanges();\r
-                       s.addRange(r);\r
+                       if (!node || node.nodeType !== 1 || !settings.forced_root_block)\r
+                               return;\r
 \r
-                       // scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs\r
-                       y = ed.dom.getPos(aft).y;\r
-                       ch = aft.clientHeight;\r
+                       // Check if node is wrapped in block\r
+                       while (node != rootNode) {\r
+                               if (blockElements[node.nodeName])\r
+                                       return;\r
 \r
-                       // Is element within viewport\r
-                       if (y < vp.y || y + ch > vp.y + vp.h) {\r
-                               ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks\r
-                               //console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight));\r
+                               node = node.parentNode;\r
                        }\r
 \r
-                       return FALSE;\r
-               },\r
-\r
-               backspaceDelete : function(e, bs) {\r
-                       var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn, walker;\r
+                       // Get current selection\r
+                       rng = selection.getRng();\r
+                       if (rng.setStart) {\r
+                               startContainer = rng.startContainer;\r
+                               startOffset = rng.startOffset;\r
+                               endContainer = rng.endContainer;\r
+                               endOffset = rng.endOffset;\r
+                       } else {\r
+                               // Force control range into text range\r
+                               if (rng.item) {\r
+                                       node = rng.item(0);\r
+                                       rng = editor.getDoc().body.createTextRange();\r
+                                       rng.moveToElementText(node);\r
+                               }\r
 \r
-                       // Delete when caret is behind a element doesn't work correctly on Gecko see #3011651\r
-                       if (!bs && r.collapsed && sc.nodeType == 1 && r.startOffset == sc.childNodes.length) {\r
-                               walker = new tinymce.dom.TreeWalker(sc.lastChild, sc);\r
+                               tmpRng = rng.duplicate();\r
+                               tmpRng.collapse(true);\r
+                               startOffset = tmpRng.move('character', offset) * -1;\r
 \r
-                               // Walk the dom backwards until we find a text node\r
-                               for (n = sc.lastChild; n; n = walker.prev()) {\r
-                                       if (n.nodeType == 3) {\r
-                                               r.setStart(n, n.nodeValue.length);\r
-                                               r.collapse(true);\r
-                                               se.setRng(r);\r
-                                               return;\r
-                                       }\r
+                               if (!tmpRng.collapsed) {\r
+                                       tmpRng = rng.duplicate();\r
+                                       tmpRng.collapse(false);\r
+                                       endOffset = (tmpRng.move('character', offset) * -1) - startOffset;\r
                                }\r
                        }\r
 \r
-                       // The caret sometimes gets stuck in Gecko if you delete empty paragraphs\r
-                       // This workaround removes the element by hand and moves the caret to the previous element\r
-                       if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) {\r
-                               if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) {\r
-                                       // Find previous block element\r
-                                       n = sc;\r
-                                       while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ;\r
+                       // Wrap non block elements and text nodes\r
+                       for (node = rootNode.firstChild; node; node) {\r
+                               if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {\r
+                                       if (!rootBlockNode) {\r
+                                               rootBlockNode = dom.create(settings.forced_root_block);\r
+                                               node.parentNode.insertBefore(rootBlockNode, node);\r
+                                       }\r
 \r
-                                       if (n) {\r
-                                               if (sc != b.firstChild) {\r
-                                                       // Find last text node\r
-                                                       w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE);\r
-                                                       while (tn = w.nextNode())\r
-                                                               n = tn;\r
+                                       tempNode = node;\r
+                                       node = node.nextSibling;\r
+                                       rootBlockNode.appendChild(tempNode);\r
+                               } else {\r
+                                       rootBlockNode = null;\r
+                                       node = node.nextSibling;\r
+                               }\r
+                       }\r
 \r
-                                                       // Place caret at the end of last text node\r
-                                                       r = ed.getDoc().createRange();\r
-                                                       r.setStart(n, n.nodeValue ? n.nodeValue.length : 0);\r
-                                                       r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0);\r
-                                                       se.setRng(r);\r
+                       if (rng.setStart) {\r
+                               rng.setStart(startContainer, startOffset);\r
+                               rng.setEnd(endContainer, endOffset);\r
+                               selection.setRng(rng);\r
+                       } else {\r
+                               try {\r
+                                       rng = editor.getDoc().body.createTextRange();\r
+                                       rng.moveToElementText(rootNode);\r
+                                       rng.collapse(true);\r
+                                       rng.moveStart('character', startOffset);\r
 \r
-                                                       // Remove the target container\r
-                                                       ed.dom.remove(sc);\r
-                                               }\r
+                                       if (endOffset > 0)\r
+                                               rng.moveEnd('character', endOffset);\r
 \r
-                                               return Event.cancel(e);\r
-                                       }\r
+                                       rng.select();\r
+                               } catch (ex) {\r
+                                       // Ignore\r
                                }\r
                        }\r
-               }\r
-       });\r
-})(tinymce);\r
+\r
+                       editor.nodeChanged();\r
+               };\r
+\r
+               editor.onKeyUp.add(addRootBlocks);\r
+               editor.onClick.add(addRootBlocks);\r
+       }\r
+};\r
 \r
 (function(tinymce) {\r
        // Shorten names\r
@@ -12484,11 +14767,16 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        id = t.prefix + id;\r
 \r
-                       if (ed.settings.use_native_selects)\r
+\r
+                       function useNativeListForAccessibility(ed) {\r
+                               return ed.settings.use_accessible_selects && !tinymce.isGecko\r
+                       }\r
+\r
+                       if (ed.settings.use_native_selects || useNativeListForAccessibility(ed))\r
                                c = new tinymce.ui.NativeListBox(id, s);\r
                        else {\r
                                cls = cc || t._cls.listbox || tinymce.ui.ListBox;\r
-                               c = new cls(id, s);\r
+                               c = new cls(id, s, ed);\r
                        }\r
 \r
                        t.controls[id] = c;\r
@@ -12543,11 +14831,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        if (s.menu_button) {\r
                                cls = cc || t._cls.menubutton || tinymce.ui.MenuButton;\r
-                               c = new cls(id, s);\r
+                               c = new cls(id, s, ed);\r
                                ed.onMouseDown.add(c.hideMenu, c);\r
                        } else {\r
                                cls = t._cls.button || tinymce.ui.Button;\r
-                               c = new cls(id, s);\r
+                               c = new cls(id, s, ed);\r
                        }\r
 \r
                        return t.add(c);\r
@@ -12590,7 +14878,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        id = t.prefix + id;\r
                        cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton;\r
-                       c = t.add(new cls(id, s));\r
+                       c = t.add(new cls(id, s, ed));\r
                        ed.onMouseDown.add(c.hideMenu, c);\r
 \r
                        return c;\r
@@ -12630,7 +14918,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        id = t.prefix + id;\r
                        cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton;\r
-                       c = new cls(id, s);\r
+                       c = new cls(id, s, ed);\r
                        ed.onMouseDown.add(c.hideMenu, c);\r
 \r
                        // Remove the menu element when the editor is removed\r
@@ -12662,13 +14950,25 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        id = t.prefix + id;\r
                        cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;\r
-                       c = new cls(id, s);\r
+                       c = new cls(id, s, t.editor);\r
 \r
                        if (t.get(id))\r
                                return null;\r
 \r
                        return t.add(c);\r
                },\r
+               \r
+               createToolbarGroup : function(id, s, cc) {\r
+                       var c, t = this, cls;\r
+                       id = t.prefix + id;\r
+                       cls = cc || this._cls.toolbarGroup || tinymce.ui.ToolbarGroup;\r
+                       c = new cls(id, s, t.editor);\r
+                       \r
+                       if (t.get(id))\r
+                               return null;\r
+                       \r
+                       return t.add(c);\r
+               },\r
 \r
                createSeparator : function(cc) {\r
                        var cls = cc || this._cls.separator || tinymce.ui.Separator;\r
@@ -12805,53 +15105,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                }\r
        });\r
 }(tinymce));\r
-(function(tinymce) {\r
-       function CommandManager() {\r
-               var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};\r
-\r
-               function add(collection, cmd, func, scope) {\r
-                       if (typeof(cmd) == 'string')\r
-                               cmd = [cmd];\r
-\r
-                       tinymce.each(cmd, function(cmd) {\r
-                               collection[cmd.toLowerCase()] = {func : func, scope : scope};\r
-                       });\r
-               };\r
-\r
-               tinymce.extend(this, {\r
-                       add : function(cmd, func, scope) {\r
-                               add(execCommands, cmd, func, scope);\r
-                       },\r
-\r
-                       addQueryStateHandler : function(cmd, func, scope) {\r
-                               add(queryStateCommands, cmd, func, scope);\r
-                       },\r
-\r
-                       addQueryValueHandler : function(cmd, func, scope) {\r
-                               add(queryValueCommands, cmd, func, scope);\r
-                       },\r
-\r
-                       execCommand : function(scope, cmd, ui, value, args) {\r
-                               if (cmd = execCommands[cmd.toLowerCase()]) {\r
-                                       if (cmd.func.call(scope || cmd.scope, ui, value, args) !== false)\r
-                                               return true;\r
-                               }\r
-                       },\r
-\r
-                       queryCommandValue : function() {\r
-                               if (cmd = queryValueCommands[cmd.toLowerCase()])\r
-                                       return cmd.func.call(scope || cmd.scope, ui, value, args);\r
-                       },\r
-\r
-                       queryCommandState : function() {\r
-                               if (cmd = queryStateCommands[cmd.toLowerCase()])\r
-                                       return cmd.func.call(scope || cmd.scope, ui, value, args);\r
-                       }\r
-               });\r
-       };\r
-\r
-       tinymce.GlobalCommands = new CommandManager();\r
-})(tinymce);\r
 (function(tinymce) {\r
        tinymce.Formatter = function(ed) {\r
                var formats = {},\r
@@ -12860,16 +15113,28 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        selection = ed.selection,\r
                        TreeWalker = tinymce.dom.TreeWalker,\r
                        rangeUtils = new tinymce.dom.RangeUtils(dom),\r
-                       isValid = ed.schema.isValid,\r
+                       isValid = ed.schema.isValidChild,\r
                        isBlock = dom.isBlock,\r
                        forcedRootBlock = ed.settings.forced_root_block,\r
                        nodeIndex = dom.nodeIndex,\r
-                       INVISIBLE_CHAR = '\uFEFF',\r
+                       INVISIBLE_CHAR = tinymce.isGecko ? '\u200B' : '\uFEFF',\r
                        MCE_ATTR_RE = /^(src|href|style)$/,\r
                        FALSE = false,\r
                        TRUE = true,\r
-                       undefined,\r
-                       pendingFormats = {apply : [], remove : []};\r
+                       undefined;\r
+\r
+               // Returns the content editable state of a node\r
+               function getContentEditable(node) {\r
+                       var contentEditable = node.getAttribute("data-mce-contenteditable");\r
+\r
+                       // Check for fake content editable\r
+                       if (contentEditable && contentEditable !== "inherit") {\r
+                               return contentEditable;\r
+                       }\r
+\r
+                       // Check for real content editable\r
+                       return node.contentEditable !== "inherit" ? node.contentEditable : null;\r
+               };\r
 \r
                function isArray(obj) {\r
                        return obj instanceof Array;\r
@@ -12880,7 +15145,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function isCaretNode(node) {\r
-                       return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline');\r
+                       return node.nodeType === 1 && node.id === '_mce_caret';\r
                };\r
 \r
                // Public functions\r
@@ -12929,37 +15194,40 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        }\r
                };\r
 \r
-               function apply(name, vars, node) {\r
-                       var formatList = get(name), format = formatList[0], bookmark, rng, i;\r
+               var getTextDecoration = function(node) {\r
+                       var decoration;\r
 \r
-                       function moveStart(rng) {\r
-                               var container = rng.startContainer,\r
-                                       offset = rng.startOffset,\r
-                                       walker, node;\r
-\r
-                               // Move startContainer/startOffset in to a suitable node\r
-                               if (container.nodeType == 1 || container.nodeValue === "") {\r
-                                       container = container.nodeType == 1 ? container.childNodes[offset] : container;\r
-\r
-                                       // Might fail if the offset is behind the last element in it's container\r
-                                       if (container) {\r
-                                               walker = new TreeWalker(container, container.parentNode);\r
-                                               for (node = walker.current(); node; node = walker.next()) {\r
-                                                       if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\r
-                                                               rng.setStart(node, 0);\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
-                                       }\r
+                       ed.dom.getParent(node, function(n) {\r
+                               decoration = ed.dom.getStyle(n, 'text-decoration');\r
+                               return decoration && decoration !== 'none';\r
+                       });\r
+\r
+                       return decoration;\r
+               };\r
+\r
+               var processUnderlineAndColor = function(node) {\r
+                       var textDecoration;\r
+                       if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {\r
+                               textDecoration = getTextDecoration(node.parentNode);\r
+                               if (ed.dom.getStyle(node, 'color') && textDecoration) {\r
+                                       ed.dom.setStyle(node, 'text-decoration', textDecoration);\r
+                               } else if (ed.dom.getStyle(node, 'textdecoration') === textDecoration) {\r
+                                       ed.dom.setStyle(node, 'text-decoration', null);\r
                                }\r
+                       }\r
+               };\r
 \r
-                               return rng;\r
-                       };\r
+               function apply(name, vars, node) {\r
+                       var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed();\r
 \r
                        function setElementFormat(elm, fmt) {\r
                                fmt = fmt || format;\r
 \r
                                if (elm) {\r
+                                       if (fmt.onformat) {\r
+                                               fmt.onformat(elm, fmt, vars, node);\r
+                                       }\r
+\r
                                        each(fmt.styles, function(value, name) {\r
                                                dom.setStyle(elm, name, replaceVars(value, vars));\r
                                        });\r
@@ -12976,9 +15244,90 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        });\r
                                }\r
                        };\r
+                       function adjustSelectionToVisibleSelection() {\r
+                               function findSelectionEnd(start, end) {\r
+                                       var walker = new TreeWalker(end);\r
+                                       for (node = walker.current(); node; node = walker.prev()) {\r
+                                               if (node.childNodes.length > 1 || node == start) {\r
+                                                       return node;\r
+                                               }\r
+                                       }\r
+                               };\r
+\r
+                               // Adjust selection so that a end container with a end offset of zero is not included in the selection\r
+                               // as this isn't visible to the user.\r
+                               var rng = ed.selection.getRng();\r
+                               var start = rng.startContainer;\r
+                               var end = rng.endContainer;\r
+\r
+                               if (start != end && rng.endOffset == 0) {\r
+                                       var newEnd = findSelectionEnd(start, end);\r
+                                       var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length;\r
+\r
+                                       rng.setEnd(newEnd, endOffset);\r
+                               }\r
+\r
+                               return rng;\r
+                       }\r
+                       \r
+                       function applyStyleToList(node, bookmark, wrapElm, newWrappers, process){\r
+                               var nodes = [], listIndex = -1, list, startIndex = -1, endIndex = -1, currentWrapElm;\r
+                               \r
+                               // find the index of the first child list.\r
+                               each(node.childNodes, function(n, index) {\r
+                                       if (n.nodeName === "UL" || n.nodeName === "OL") {\r
+                                               listIndex = index;\r
+                                               list = n;\r
+                                               return false;\r
+                                       }\r
+                               });\r
+                               \r
+                               // get the index of the bookmarks\r
+                               each(node.childNodes, function(n, index) {\r
+                                       if (n.nodeName === "SPAN" && dom.getAttrib(n, "data-mce-type") == "bookmark") {\r
+                                               if (n.id == bookmark.id + "_start") {\r
+                                                       startIndex = index;\r
+                                               } else if (n.id == bookmark.id + "_end") {\r
+                                                       endIndex = index;\r
+                                               }\r
+                                       }\r
+                               });\r
+                               \r
+                               // if the selection spans across an embedded list, or there isn't an embedded list - handle processing normally\r
+                               if (listIndex <= 0 || (startIndex < listIndex && endIndex > listIndex)) {\r
+                                       each(tinymce.grep(node.childNodes), process);\r
+                                       return 0;\r
+                               } else {\r
+                                       currentWrapElm = dom.clone(wrapElm, FALSE);\r
+\r
+                                       // create a list of the nodes on the same side of the list as the selection\r
+                                       each(tinymce.grep(node.childNodes), function(n, index) {\r
+                                               if ((startIndex < listIndex && index < listIndex) || (startIndex > listIndex && index > listIndex)) {\r
+                                                       nodes.push(n); \r
+                                                       n.parentNode.removeChild(n);\r
+                                               }\r
+                                       });\r
+\r
+                                       // insert the wrapping element either before or after the list.\r
+                                       if (startIndex < listIndex) {\r
+                                               node.insertBefore(currentWrapElm, list);\r
+                                       } else if (startIndex > listIndex) {\r
+                                               node.insertBefore(currentWrapElm, list.nextSibling);\r
+                                       }\r
+                                       \r
+                                       // add the new nodes to the list.\r
+                                       newWrappers.push(currentWrapElm);\r
+\r
+                                       each(nodes, function(node) {\r
+                                               currentWrapElm.appendChild(node);\r
+                                       });\r
+\r
+                                       return currentWrapElm;\r
+                               }\r
+                       };\r
 \r
-                       function applyRngStyle(rng) {\r
-                               var newWrappers = [], wrapName, wrapElm;\r
+                       function applyRngStyle(rng, bookmark, node_specific) {\r
+                               var newWrappers = [], wrapName, wrapElm, contentEditable = true;\r
 \r
                                // Setup wrapper element\r
                                wrapName = format.inline || format.block;\r
@@ -12989,7 +15338,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        var currentWrapElm;\r
 \r
                                        function process(node) {\r
-                                               var nodeName = node.nodeName.toLowerCase(), parentName = node.parentNode.nodeName.toLowerCase(), found;\r
+                                               var nodeName, parentName, found, hasContentEditableState, lastContentEditable;\r
+\r
+                                               lastContentEditable = contentEditable;\r
+                                               nodeName = node.nodeName.toLowerCase();\r
+                                               parentName = node.parentNode.nodeName.toLowerCase();\r
+\r
+                                               // Node has a contentEditable value\r
+                                               if (node.nodeType === 1 && getContentEditable(node)) {\r
+                                                       lastContentEditable = contentEditable;\r
+                                                       contentEditable = getContentEditable(node) === "true";\r
+                                                       hasContentEditableState = true; // We don't want to wrap the container only it's children\r
+                                               }\r
 \r
                                                // Stop wrapping on br elements\r
                                                if (isEq(nodeName, 'br')) {\r
@@ -13009,7 +15369,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                }\r
 \r
                                                // Can we rename the block\r
-                                               if (format.block && !format.wrapper && isTextBlock(nodeName)) {\r
+                                               if (contentEditable && !hasContentEditableState && format.block && !format.wrapper && isTextBlock(nodeName)) {\r
                                                        node = dom.rename(node, wrapName);\r
                                                        setElementFormat(node);\r
                                                        newWrappers.push(node);\r
@@ -13021,6 +15381,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                if (format.selector) {\r
                                                        // Look for matching formats\r
                                                        each(formatList, function(format) {\r
+                                                               // Check collapsed state if it exists\r
+                                                               if ('collapsed' in format && format.collapsed !== isCollapsed) {\r
+                                                                       return;\r
+                                                               }\r
+\r
                                                                if (dom.is(node, format.selector) && !isCaretNode(node)) {\r
                                                                        setElementFormat(node, format);\r
                                                                        found = true;\r
@@ -13035,22 +15400,30 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                }\r
 \r
                                                // Is it valid to wrap this item\r
-                                               if (isValid(wrapName, nodeName) && isValid(parentName, wrapName)) {\r
+                                               if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&\r
+                                                               !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) {\r
                                                        // Start wrapping\r
                                                        if (!currentWrapElm) {\r
                                                                // Wrap the node\r
-                                                               currentWrapElm = wrapElm.cloneNode(FALSE);\r
+                                                               currentWrapElm = dom.clone(wrapElm, FALSE);\r
                                                                node.parentNode.insertBefore(currentWrapElm, node);\r
                                                                newWrappers.push(currentWrapElm);\r
                                                        }\r
 \r
                                                        currentWrapElm.appendChild(node);\r
+                                               } else if (nodeName == 'li' && bookmark) {\r
+                                                       // Start wrapping - if we are in a list node and have a bookmark, then we will always begin by wrapping in a new element.\r
+                                                       currentWrapElm = applyStyleToList(node, bookmark, wrapElm, newWrappers, process);\r
                                                } else {\r
                                                        // Start a new wrapper for possible children\r
                                                        currentWrapElm = 0;\r
-\r
+                                                       \r
                                                        each(tinymce.grep(node.childNodes), process);\r
 \r
+                                                       if (hasContentEditableState) {\r
+                                                               contentEditable = lastContentEditable; // Restore last contentEditable state from stack\r
+                                                       }\r
+\r
                                                        // End the last wrapper\r
                                                        currentWrapElm = 0;\r
                                                }\r
@@ -13060,7 +15433,32 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        each(nodes, process);\r
                                });\r
 \r
+                               // Wrap links inside as well, for example color inside a link when the wrapper is around the link\r
+                               if (format.wrap_links === false) {\r
+                                       each(newWrappers, function(node) {\r
+                                               function process(node) {\r
+                                                       var i, currentWrapElm, children;\r
+\r
+                                                       if (node.nodeName === 'A') {\r
+                                                               currentWrapElm = dom.clone(wrapElm, FALSE);\r
+                                                               newWrappers.push(currentWrapElm);\r
+\r
+                                                               children = tinymce.grep(node.childNodes);\r
+                                                               for (i = 0; i < children.length; i++)\r
+                                                                       currentWrapElm.appendChild(children[i]);\r
+\r
+                                                               node.appendChild(currentWrapElm);\r
+                                                       }\r
+\r
+                                                       each(tinymce.grep(node.childNodes), process);\r
+                                               };\r
+\r
+                                               process(node);\r
+                                       });\r
+                               }\r
+\r
                                // Cleanup\r
+                               \r
                                each(newWrappers, function(node) {\r
                                        var childCount;\r
 \r
@@ -13087,7 +15485,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                                // If child was found and of the same type as the current node\r
                                                if (child && matchName(child, format)) {\r
-                                                       clone = child.cloneNode(FALSE);\r
+                                                       clone = dom.clone(child, FALSE);\r
                                                        setElementFormat(clone);\r
 \r
                                                        dom.replace(clone, node, TRUE);\r
@@ -13099,8 +15497,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                        childCount = getChildCount(node);\r
 \r
-                                       // Remove empty nodes\r
-                                       if (childCount === 0) {\r
+                                       // Remove empty nodes but only if there is multiple wrappers and they are not block\r
+                                       // elements so never remove single <h1></h1> since that would remove the currrent empty block element where the caret is at\r
+                                       if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) {\r
                                                dom.remove(node, 1);\r
                                                return;\r
                                        }\r
@@ -13116,6 +15515,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                        // this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>\r
                                                        // will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>\r
                                                        each(dom.select(format.inline, node), function(child) {\r
+                                                               var parent;\r
+\r
+                                                               // When wrap_links is set to false we don't want\r
+                                                               // to remove the format on children within links\r
+                                                               if (format.wrap_links === false) {\r
+                                                                       parent = child.parentNode;\r
+\r
+                                                                       do {\r
+                                                                               if (parent.nodeName === 'A')\r
+                                                                                       return;\r
+                                                                       } while (parent = parent.parentNode);\r
+                                                               }\r
+\r
                                                                removeFormat(format, vars, child, format.exact ? child : null);\r
                                                        });\r
                                                });\r
@@ -13139,7 +15551,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                }\r
 \r
                                                // Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>\r
-                                               if (node) {\r
+                                               if (node && format.merge_siblings !== false) {\r
                                                        node = mergeSiblings(getNonWhiteSpaceSibling(node), node);\r
                                                        node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));\r
                                                }\r
@@ -13149,20 +15561,38 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        if (format) {\r
                                if (node) {\r
-                                       rng = dom.createRng();\r
-\r
-                                       rng.setStartBefore(node);\r
-                                       rng.setEndAfter(node);\r
-\r
-                                       applyRngStyle(expandRng(rng, formatList));\r
+                                       if (node.nodeType) {\r
+                                               rng = dom.createRng();\r
+                                               rng.setStartBefore(node);\r
+                                               rng.setEndAfter(node);\r
+                                               applyRngStyle(expandRng(rng, formatList), null, true);\r
+                                       } else {\r
+                                               applyRngStyle(node, null, true);\r
+                                       }\r
                                } else {\r
-                                       if (!selection.isCollapsed() || !format.inline) {\r
+                                       if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {\r
+                                               // Obtain selection node before selection is unselected by applyRngStyle()\r
+                                               var curSelNode = ed.selection.getNode();\r
+\r
+                                               // If the formats have a default block and we can't find a parent block then start wrapping it with a DIV this is for forced_root_blocks: false\r
+                                               // It's kind of a hack but people should be using the default block type P since all desktop editors work that way\r
+                                               if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {\r
+                                                       apply(formatList[0].defaultBlock);\r
+                                               }\r
+\r
                                                // Apply formatting to selection\r
+                                               ed.selection.setRng(adjustSelectionToVisibleSelection());\r
                                                bookmark = selection.getBookmark();\r
-                                               applyRngStyle(expandRng(selection.getRng(TRUE), formatList));\r
+                                               applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark);\r
+\r
+                                               // Colored nodes should be underlined so that the color of the underline matches the text color.\r
+                                               if (format.styles && (format.styles.color || format.styles.textDecoration)) {\r
+                                                       tinymce.walk(curSelNode, processUnderlineAndColor, 'childNodes');\r
+                                                       processUnderlineAndColor(curSelNode);\r
+                                               }\r
 \r
                                                selection.moveToBookmark(bookmark);\r
-                                               selection.setRng(moveStart(selection.getRng(TRUE)));\r
+                                               moveStart(selection.getRng(TRUE));\r
                                                ed.nodeChanged();\r
                                        } else\r
                                                performCaretAction('apply', name, vars);\r
@@ -13171,25 +15601,40 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function remove(name, vars, node) {\r
-                       var formatList = get(name), format = formatList[0], bookmark, i, rng;\r
+                       var formatList = get(name), format = formatList[0], bookmark, i, rng, contentEditable = true;\r
 \r
                        // Merges the styles for each node\r
                        function process(node) {\r
-                               var children, i, l;\r
+                               var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;\r
+\r
+                               // Node has a contentEditable value\r
+                               if (node.nodeType === 1 && getContentEditable(node)) {\r
+                                       lastContentEditable = contentEditable;\r
+                                       contentEditable = getContentEditable(node) === "true";\r
+                                       hasContentEditableState = true; // We don't want to wrap the container only it's children\r
+                               }\r
 \r
                                // Grab the children first since the nodelist might be changed\r
                                children = tinymce.grep(node.childNodes);\r
 \r
                                // Process current node\r
-                               for (i = 0, l = formatList.length; i < l; i++) {\r
-                                       if (removeFormat(formatList[i], vars, node, node))\r
-                                               break;\r
+                               if (contentEditable && !hasContentEditableState) {\r
+                                       for (i = 0, l = formatList.length; i < l; i++) {\r
+                                               if (removeFormat(formatList[i], vars, node, node))\r
+                                                       break;\r
+                                       }\r
                                }\r
 \r
                                // Process the children\r
                                if (format.deep) {\r
-                                       for (i = 0, l = children.length; i < l; i++)\r
-                                               process(children[i]);\r
+                                       if (children.length) {                                  \r
+                                               for (i = 0, l = children.length; i < l; i++)\r
+                                                       process(children[i]);\r
+\r
+                                               if (hasContentEditableState) {\r
+                                                       contentEditable = lastContentEditable; // Restore last contentEditable state from stack\r
+                                               }\r
+                                       }\r
                                }\r
                        };\r
 \r
@@ -13220,7 +15665,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        formatRootParent = format_root.parentNode;\r
 \r
                                        for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {\r
-                                               clone = parent.cloneNode(FALSE);\r
+                                               clone = dom.clone(parent, FALSE);\r
 \r
                                                for (i = 0; i < formatList.length; i++) {\r
                                                        if (removeFormat(formatList[i], vars, clone, clone)) {\r
@@ -13285,8 +15730,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                        if (startContainer != endContainer) {\r
                                                // Wrap start/end nodes in span element since these might be cloned/moved\r
-                                               startContainer = wrap(startContainer, 'span', {id : '_start', _mce_type : 'bookmark'});\r
-                                               endContainer = wrap(endContainer, 'span', {id : '_end', _mce_type : 'bookmark'});\r
+                                               startContainer = wrap(startContainer, 'span', {id : '_start', 'data-mce-type' : 'bookmark'});\r
+                                               endContainer = wrap(endContainer, 'span', {id : '_end', 'data-mce-type' : 'bookmark'});\r
 \r
                                                // Split start/end\r
                                                splitToFormatRoot(startContainer);\r
@@ -13309,30 +15754,56 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                rangeUtils.walk(rng, function(nodes) {\r
                                        each(nodes, function(node) {\r
                                                process(node);\r
+\r
+                                               // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined.\r
+                                               if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && node.parentNode && getTextDecoration(node.parentNode) === 'underline') {\r
+                                                       removeFormat({'deep': false, 'exact': true, 'inline': 'span', 'styles': {'textDecoration' : 'underline'}}, null, node);\r
+                                               }\r
                                        });\r
                                });\r
                        };\r
 \r
                        // Handle node\r
                        if (node) {\r
-                               rng = dom.createRng();\r
-                               rng.setStartBefore(node);\r
-                               rng.setEndAfter(node);\r
-                               removeRngStyle(rng);\r
+                               if (node.nodeType) {\r
+                                       rng = dom.createRng();\r
+                                       rng.setStartBefore(node);\r
+                                       rng.setEndAfter(node);\r
+                                       removeRngStyle(rng);\r
+                               } else {\r
+                                       removeRngStyle(node);\r
+                               }\r
+\r
                                return;\r
                        }\r
 \r
-                       if (!selection.isCollapsed() || !format.inline) {\r
+                       if (!selection.isCollapsed() || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {\r
                                bookmark = selection.getBookmark();\r
                                removeRngStyle(selection.getRng(TRUE));\r
                                selection.moveToBookmark(bookmark);\r
+\r
+                               // Check if start element still has formatting then we are at: "<b>text|</b>text" and need to move the start into the next text node\r
+                               if (format.inline && match(name, vars, selection.getStart())) {\r
+                                       moveStart(selection.getRng(true));\r
+                               }\r
+\r
                                ed.nodeChanged();\r
                        } else\r
                                performCaretAction('remove', name, vars);\r
+\r
+                       // Removed this logic since it breaks unit tests and produces empty caret elements since they will be destroyed in the cleanup process\r
+                       // Also there must be a better way to rerender a table and I couldn't reproduce the case causing this might be some old WebKit\r
+                       /*\r
+                       // When you remove formatting from a table cell in WebKit (cell, not the contents of a cell) there is a rendering issue with column width\r
+                       if (tinymce.isWebKit) {\r
+                               ed.execCommand('mceCleanup');\r
+                       }*/\r
                };\r
 \r
                function toggle(name, vars, node) {\r
-                       if (match(name, vars, node))\r
+                       var fmt = get(name);\r
+\r
+                       if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0]['toggle']))\r
                                remove(name, vars, node);\r
                        else\r
                                apply(name, vars, node);\r
@@ -13344,6 +15815,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        function matchItems(node, format, item_name) {\r
                                var key, value, items = format[item_name], i;\r
 \r
+                               // Custom match\r
+                               if (format.onmatch) {\r
+                                       return format.onmatch(node, format, item_name);\r
+                               }\r
+\r
                                // Check all items\r
                                if (items) {\r
                                        // Non indexed object\r
@@ -13396,7 +15872,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function match(name, vars, node) {\r
-                       var startNode, i;\r
+                       var startNode;\r
 \r
                        function matchParents(node) {\r
                                // Find first node with similar format settings\r
@@ -13412,21 +15888,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (node)\r
                                return matchParents(node);\r
 \r
-                       // Check pending formats\r
-                       if (selection.isCollapsed()) {\r
-                               for (i = pendingFormats.apply.length - 1; i >= 0; i--) {\r
-                                       if (pendingFormats.apply[i].name == name)\r
-                                               return true;\r
-                               }\r
-\r
-                               for (i = pendingFormats.remove.length - 1; i >= 0; i--) {\r
-                                       if (pendingFormats.remove[i].name == name)\r
-                                               return false;\r
-                               }\r
-\r
-                               return matchParents(selection.getNode());\r
-                       }\r
-\r
                        // Check selected node\r
                        node = selection.getNode();\r
                        if (matchParents(node))\r
@@ -13445,33 +15906,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                function matchAll(names, vars) {\r
                        var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name;\r
 \r
-                       // If the selection is collapsed then check pending formats\r
-                       if (selection.isCollapsed()) {\r
-                               for (ni = 0; ni < names.length; ni++) {\r
-                                       // If the name is to be removed, then stop it from being added\r
-                                       for (i = pendingFormats.remove.length - 1; i >= 0; i--) {\r
-                                               name = names[ni];\r
-\r
-                                               if (pendingFormats.remove[i].name == name) {\r
-                                                       checkedMap[name] = true;\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // If the format is to be applied\r
-                               for (i = pendingFormats.apply.length - 1; i >= 0; i--) {\r
-                                       for (ni = 0; ni < names.length; ni++) {\r
-                                               name = names[ni];\r
-\r
-                                               if (!checkedMap[name] && pendingFormats.apply[i].name == name) {\r
-                                                       checkedMap[name] = true;\r
-                                                       matchedFormatNames.push(name);\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-\r
                        // Check start of selection for formats\r
                        startElement = selection.getStart();\r
                        dom.getParent(startElement, function(node) {\r
@@ -13580,7 +16014,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function isWhiteSpaceNode(node) {\r
-                       return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue);\r
+                       return node && node.nodeType === 3 && /^([\\r\n]+|)$/.test(node.nodeValue);\r
                };\r
 \r
                function wrap(node, name, attrs) {\r
@@ -13593,39 +16027,64 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function expandRng(rng, format, remove) {\r
-                       var startContainer = rng.startContainer,\r
+                       var sibling, lastIdx, leaf,\r
+                               startContainer = rng.startContainer,\r
                                startOffset = rng.startOffset,\r
                                endContainer = rng.endContainer,\r
-                               endOffset = rng.endOffset, sibling, lastIdx;\r
+                               endOffset = rng.endOffset, sibling, lastIdx, leaf, endPoint;\r
 \r
                        // This function walks up the tree if there is no siblings before/after the node\r
-                       function findParentContainer(container, child_name, sibling_name, root) {\r
-                               var parent, child;\r
-\r
-                               root = root || dom.getRoot();\r
+                       function findParentContainer(start) {\r
+                               var container, parent, child, sibling, siblingName;\r
 \r
-                               for (;;) {\r
-                                       // Check if we can move up are we at root level or body level\r
-                                       parent = container.parentNode;\r
+                               container = parent = start ? startContainer : endContainer;\r
+                               siblingName = start ? 'previousSibling' : 'nextSibling';\r
+                               root = dom.getRoot();\r
 \r
-                                       // Stop expanding on block elements or root depending on format\r
-                                       if (parent == root || (!format[0].block_expand && isBlock(parent)))\r
+                               // If it's a text node and the offset is inside the text\r
+                               if (container.nodeType == 3 && !isWhiteSpaceNode(container)) {\r
+                                       if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {\r
                                                return container;\r
+                                       }\r
+                               }\r
 \r
-                                       for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) {\r
-                                               if (sibling.nodeType == 1 && !isBookmarkNode(sibling))\r
-                                                       return container;\r
+                               for (;;) {\r
+                                       // Stop expanding on block elements\r
+                                       if (!format[0].block_expand && isBlock(parent))\r
+                                               return parent;\r
+\r
+                                       // Walk left/right\r
+                                       for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {\r
+                                               if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) {\r
+                                                       return parent;\r
+                                               }\r
+                                       }\r
 \r
-                                               if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))\r
-                                                       return container;\r
+                                       // Check if we can move up are we at root level or body level\r
+                                       if (parent.parentNode == root) {\r
+                                               container = parent;\r
+                                               break;\r
                                        }\r
 \r
-                                       container = container.parentNode;\r
+                                       parent = parent.parentNode;\r
                                }\r
 \r
                                return container;\r
                        };\r
 \r
+                       // This function walks down the tree to find the leaf at the selection.\r
+                       // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node.\r
+                       function findLeaf(node, offset) {\r
+                               if (offset === undefined)\r
+                                       offset = node.nodeType === 3 ? node.length : node.childNodes.length;\r
+                               while (node && node.hasChildNodes()) {\r
+                                       node = node.childNodes[offset];\r
+                                       if (node)\r
+                                               offset = node.nodeType === 3 ? node.length : node.childNodes.length;\r
+                               }\r
+                               return { node: node, offset: offset };\r
+                       }\r
+\r
                        // If index based start position then resolve it\r
                        if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {\r
                                lastIdx = startContainer.childNodes.length - 1;\r
@@ -13644,32 +16103,161 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        endOffset = endContainer.nodeValue.length;\r
                        }\r
 \r
-                       // Exclude bookmark nodes if possible\r
-                       if (isBookmarkNode(startContainer.parentNode))\r
-                               startContainer = startContainer.parentNode;\r
+                       // Expands the node to the closes contentEditable false element if it exists\r
+                       function findParentContentEditable(node) {\r
+                               var parent = node;\r
+\r
+                               while (parent) {\r
+                                       if (parent.nodeType === 1 && getContentEditable(parent)) {\r
+                                               return getContentEditable(parent) === "false" ? parent : node;\r
+                                       }\r
+\r
+                                       parent = parent.parentNode;\r
+                               }\r
+\r
+                               return node;\r
+                       };\r
 \r
-                       if (isBookmarkNode(startContainer))\r
+                       // Expand to closest contentEditable element\r
+                       startContainer = findParentContentEditable(startContainer);\r
+                       endContainer = findParentContentEditable(endContainer);\r
+\r
+                       // Exclude bookmark nodes if possible\r
+                       if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) {\r
+                               startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode;\r
                                startContainer = startContainer.nextSibling || startContainer;\r
 \r
-                       if (isBookmarkNode(endContainer.parentNode))\r
-                               endContainer = endContainer.parentNode;\r
+                               if (startContainer.nodeType == 3)\r
+                                       startOffset = 0;\r
+                       }\r
 \r
-                       if (isBookmarkNode(endContainer))\r
+                       if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) {\r
+                               endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode;\r
                                endContainer = endContainer.previousSibling || endContainer;\r
 \r
+                               if (endContainer.nodeType == 3)\r
+                                       endOffset = endContainer.length;\r
+                       }\r
+\r
+                       if (format[0].inline) {\r
+                               if (rng.collapsed) {\r
+                                       function findWordEndPoint(container, offset, start) {\r
+                                               var walker, node, pos, lastTextNode;\r
+\r
+                                               function findSpace(node, offset) {\r
+                                                       var pos, pos2, str = node.nodeValue;\r
+\r
+                                                       if (typeof(offset) == "undefined") {\r
+                                                               offset = start ? str.length : 0;\r
+                                                       }\r
+\r
+                                                       if (start) {\r
+                                                               pos = str.lastIndexOf(' ', offset);\r
+                                                               pos2 = str.lastIndexOf('\u00a0', offset);\r
+                                                               pos = pos > pos2 ? pos : pos2;\r
+\r
+                                                               // Include the space on remove to avoid tag soup\r
+                                                               if (pos !== -1 && !remove) {\r
+                                                                       pos++;\r
+                                                               }\r
+                                                       } else {\r
+                                                               pos = str.indexOf(' ', offset);\r
+                                                               pos2 = str.indexOf('\u00a0', offset);\r
+                                                               pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;\r
+                                                       }\r
+\r
+                                                       return pos;\r
+                                               };\r
+\r
+                                               if (container.nodeType === 3) {\r
+                                                       pos = findSpace(container, offset);\r
+\r
+                                                       if (pos !== -1) {\r
+                                                               return {container : container, offset : pos};\r
+                                                       }\r
+\r
+                                                       lastTextNode = container;\r
+                                               }\r
+\r
+                                               // Walk the nodes inside the block\r
+                                               walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody());\r
+                                               while (node = walker[start ? 'prev' : 'next']()) {\r
+                                                       if (node.nodeType === 3) {\r
+                                                               lastTextNode = node;\r
+                                                               pos = findSpace(node);\r
+\r
+                                                               if (pos !== -1) {\r
+                                                                       return {container : node, offset : pos};\r
+                                                               }\r
+                                                       } else if (isBlock(node)) {\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+\r
+                                               if (lastTextNode) {\r
+                                                       if (start) {\r
+                                                               offset = 0;\r
+                                                       } else {\r
+                                                               offset = lastTextNode.length;\r
+                                                       }\r
+\r
+                                                       return {container: lastTextNode, offset: offset};\r
+                                               }\r
+                                       }\r
+\r
+                                       // Expand left to closest word boundery\r
+                                       endPoint = findWordEndPoint(startContainer, startOffset, true);\r
+                                       if (endPoint) {\r
+                                               startContainer = endPoint.container;\r
+                                               startOffset = endPoint.offset;\r
+                                       }\r
+\r
+                                       // Expand right to closest word boundery\r
+                                       endPoint = findWordEndPoint(endContainer, endOffset);\r
+                                       if (endPoint) {\r
+                                               endContainer = endPoint.container;\r
+                                               endOffset = endPoint.offset;\r
+                                       }\r
+                               }\r
+\r
+                               // Avoid applying formatting to a trailing space.\r
+                               leaf = findLeaf(endContainer, endOffset);\r
+                               if (leaf.node) {\r
+                                       while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling)\r
+                                               leaf = findLeaf(leaf.node.previousSibling);\r
+\r
+                                       if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 &&\r
+                                                       leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {\r
+\r
+                                               if (leaf.offset > 1) {\r
+                                                       endContainer = leaf.node;\r
+                                                       endContainer.splitText(leaf.offset - 1);\r
+                                               } else if (leaf.node.previousSibling) {\r
+                                                       // TODO: Figure out why this is in here\r
+                                                       //endContainer = leaf.node.previousSibling;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
                        // Move start/end point up the tree if the leaves are sharp and if we are in different containers\r
                        // Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!\r
                        // This will reduce the number of wrapper elements that needs to be created\r
                        // Move start point up the tree\r
                        if (format[0].inline || format[0].block_expand) {\r
-                               startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');\r
-                               endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');\r
+                               if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) {\r
+                                       startContainer = findParentContainer(true);\r
+                               }\r
+\r
+                               if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) {\r
+                                       endContainer = findParentContainer();\r
+                               }\r
                        }\r
 \r
                        // Expand start/end container to matching selector\r
                        if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {\r
                                function findSelectorEndPoint(container, sibling_name) {\r
-                                       var parents, i, y;\r
+                                       var parents, i, y, curFormat;\r
 \r
                                        if (container.nodeType == 3 && container.nodeValue.length == 0 && container[sibling_name])\r
                                                container = container[sibling_name];\r
@@ -13677,7 +16265,13 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        parents = getParents(container);\r
                                        for (i = 0; i < parents.length; i++) {\r
                                                for (y = 0; y < format.length; y++) {\r
-                                                       if (dom.is(parents[i], format[y].selector))\r
+                                                       curFormat = format[y];\r
+\r
+                                                       // If collapsed state is set then skip formats that doesn't match that\r
+                                                       if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed)\r
+                                                               continue;\r
+\r
+                                                       if (dom.is(parents[i], curFormat.selector))\r
                                                                return parents[i];\r
                                                }\r
                                        }\r
@@ -13731,10 +16325,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                // Non block element then try to expand up the leaf\r
                                if (format[0].block) {\r
                                        if (!isBlock(startContainer))\r
-                                               startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');\r
+                                               startContainer = findParentContainer(true);\r
 \r
                                        if (!isBlock(endContainer))\r
-                                               endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');\r
+                                               endContainer = findParentContainer();\r
                                }\r
                        }\r
 \r
@@ -13787,7 +16381,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                // Remove style attribute if it's empty\r
                                if (stylesModified && dom.getAttrib(node, 'style') == '') {\r
                                        node.removeAttribute('style');\r
-                                       node.removeAttribute('_mce_style');\r
+                                       node.removeAttribute('data-mce-style');\r
                                }\r
 \r
                                // Remove attributes\r
@@ -13828,7 +16422,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                                // Remove mce prefixed attributes\r
                                                if (MCE_ATTR_RE.test(name))\r
-                                                       node.removeAttribute('_mce_' + name);\r
+                                                       node.removeAttribute('data-mce-' + name);\r
 \r
                                                node.removeAttribute(name);\r
                                        }\r
@@ -13913,7 +16507,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\r
 \r
                function isBookmarkNode(node) {\r
-                       return node && node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark';\r
+                       return node && node.nodeType == 1 && node.getAttribute('data-mce-type') == 'bookmark';\r
                };\r
 \r
                function mergeSiblings(prev, next) {\r
@@ -13959,184 +16553,394 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                }\r
                                        }\r
 \r
-                                       // Check if obj 2 has something obj 1 doesn't have\r
-                                       for (name in obj2) {\r
-                                               // Obj2 has item obj1 doesn't have\r
-                                               if (obj2.hasOwnProperty(name))\r
-                                                       return FALSE;\r
-                                       }\r
+                                       // Check if obj 2 has something obj 1 doesn't have\r
+                                       for (name in obj2) {\r
+                                               // Obj2 has item obj1 doesn't have\r
+                                               if (obj2.hasOwnProperty(name))\r
+                                                       return FALSE;\r
+                                       }\r
+\r
+                                       return TRUE;\r
+                               };\r
+\r
+                               // Attribs are not the same\r
+                               if (!compareObjects(getAttribs(node1), getAttribs(node2)))\r
+                                       return FALSE;\r
+\r
+                               // Styles are not the same\r
+                               if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))\r
+                                       return FALSE;\r
+\r
+                               return TRUE;\r
+                       };\r
+\r
+                       // Check if next/prev exists and that they are elements\r
+                       if (prev && next) {\r
+                               function findElementSibling(node, sibling_name) {\r
+                                       for (sibling = node; sibling; sibling = sibling[sibling_name]) {\r
+                                               if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0)\r
+                                                       return node;\r
+\r
+                                               if (sibling.nodeType == 1 && !isBookmarkNode(sibling))\r
+                                                       return sibling;\r
+                                       }\r
+\r
+                                       return node;\r
+                               };\r
+\r
+                               // If previous sibling is empty then jump over it\r
+                               prev = findElementSibling(prev, 'previousSibling');\r
+                               next = findElementSibling(next, 'nextSibling');\r
+\r
+                               // Compare next and previous nodes\r
+                               if (compareElements(prev, next)) {\r
+                                       // Append nodes between\r
+                                       for (sibling = prev.nextSibling; sibling && sibling != next;) {\r
+                                               tmpSibling = sibling;\r
+                                               sibling = sibling.nextSibling;\r
+                                               prev.appendChild(tmpSibling);\r
+                                       }\r
+\r
+                                       // Remove next node\r
+                                       dom.remove(next);\r
+\r
+                                       // Move children into prev node\r
+                                       each(tinymce.grep(next.childNodes), function(node) {\r
+                                               prev.appendChild(node);\r
+                                       });\r
+\r
+                                       return prev;\r
+                               }\r
+                       }\r
+\r
+                       return next;\r
+               };\r
+\r
+               function isTextBlock(name) {\r
+                       return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);\r
+               };\r
+\r
+               function getContainer(rng, start) {\r
+                       var container, offset, lastIdx, walker;\r
+\r
+                       container = rng[start ? 'startContainer' : 'endContainer'];\r
+                       offset = rng[start ? 'startOffset' : 'endOffset'];\r
+\r
+                       if (container.nodeType == 1) {\r
+                               lastIdx = container.childNodes.length - 1;\r
+\r
+                               if (!start && offset)\r
+                                       offset--;\r
+\r
+                               container = container.childNodes[offset > lastIdx ? lastIdx : offset];\r
+                       }\r
+\r
+                       // If start text node is excluded then walk to the next node\r
+                       if (container.nodeType === 3 && start && offset >= container.nodeValue.length) {\r
+                               container = new TreeWalker(container, ed.getBody()).next() || container;\r
+                       }\r
+\r
+                       // If end text node is excluded then walk to the previous node\r
+                       if (container.nodeType === 3 && !start && offset == 0) {\r
+                               container = new TreeWalker(container, ed.getBody()).prev() || container;\r
+                       }\r
+\r
+                       return container;\r
+               };\r
+\r
+               function performCaretAction(type, name, vars) {\r
+                       var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug;\r
+\r
+                       // Creates a caret container bogus element\r
+                       function createCaretContainer(fill) {\r
+                               var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''});\r
+\r
+                               if (fill) {\r
+                                       caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR));\r
+                               }\r
+\r
+                               return caretContainer;\r
+                       };\r
+\r
+                       function isCaretContainerEmpty(node, nodes) {\r
+                               while (node) {\r
+                                       if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) {\r
+                                               return false;\r
+                                       }\r
+\r
+                                       // Collect nodes\r
+                                       if (nodes && node.nodeType === 1) {\r
+                                               nodes.push(node);\r
+                                       }\r
+\r
+                                       node = node.firstChild;\r
+                               }\r
+\r
+                               return true;\r
+                       };\r
+                       \r
+                       // Returns any parent caret container element\r
+                       function getParentCaretContainer(node) {\r
+                               while (node) {\r
+                                       if (node.id === caretContainerId) {\r
+                                               return node;\r
+                                       }\r
+\r
+                                       node = node.parentNode;\r
+                               }\r
+                       };\r
+\r
+                       // Finds the first text node in the specified node\r
+                       function findFirstTextNode(node) {\r
+                               var walker;\r
+\r
+                               if (node) {\r
+                                       walker = new TreeWalker(node, node);\r
+\r
+                                       for (node = walker.current(); node; node = walker.next()) {\r
+                                               if (node.nodeType === 3) {\r
+                                                       return node;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       };\r
+\r
+                       // Removes the caret container for the specified node or all on the current document\r
+                       function removeCaretContainer(node, move_caret) {\r
+                               var child, rng;\r
+\r
+                               if (!node) {\r
+                                       node = getParentCaretContainer(selection.getStart());\r
+\r
+                                       if (!node) {\r
+                                               while (node = dom.get(caretContainerId)) {\r
+                                                       removeCaretContainer(node, false);\r
+                                               }\r
+                                       }\r
+                               } else {\r
+                                       rng = selection.getRng(true);\r
+\r
+                                       if (isCaretContainerEmpty(node)) {\r
+                                               if (move_caret !== false) {\r
+                                                       rng.setStartBefore(node);\r
+                                                       rng.setEndBefore(node);\r
+                                               }\r
+\r
+                                               dom.remove(node);\r
+                                       } else {\r
+                                               child = findFirstTextNode(node);\r
+\r
+                                               if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) {\r
+                                                       child = child.deleteData(0, 1);\r
+                                               }\r
+\r
+                                               dom.remove(node, 1);\r
+                                       }\r
+\r
+                                       selection.setRng(rng);\r
+                               }\r
+                       };\r
+                       \r
+                       // Applies formatting to the caret postion\r
+                       function applyCaretFormat() {\r
+                               var rng, caretContainer, textNode, offset, bookmark, container, text;\r
+\r
+                               rng = selection.getRng(true);\r
+                               offset = rng.startOffset;\r
+                               container = rng.startContainer;\r
+                               text = container.nodeValue;\r
+\r
+                               caretContainer = getParentCaretContainer(selection.getStart());\r
+                               if (caretContainer) {\r
+                                       textNode = findFirstTextNode(caretContainer);\r
+                               }\r
+\r
+                               // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character\r
+                               if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) {\r
+                                       // Get bookmark of caret position\r
+                                       bookmark = selection.getBookmark();\r
 \r
-                                       return TRUE;\r
-                               };\r
+                                       // Collapse bookmark range (WebKit)\r
+                                       rng.collapse(true);\r
 \r
-                               // Attribs are not the same\r
-                               if (!compareObjects(getAttribs(node1), getAttribs(node2)))\r
-                                       return FALSE;\r
+                                       // Expand the range to the closest word and split it at those points\r
+                                       rng = expandRng(rng, get(name));\r
+                                       rng = rangeUtils.split(rng);\r
 \r
-                               // Styles are not the same\r
-                               if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))\r
-                                       return FALSE;\r
+                                       // Apply the format to the range\r
+                                       apply(name, vars, rng);\r
 \r
-                               return TRUE;\r
-                       };\r
+                                       // Move selection back to caret position\r
+                                       selection.moveToBookmark(bookmark);\r
+                               } else {\r
+                                       if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) {\r
+                                               caretContainer = createCaretContainer(true);\r
+                                               textNode = caretContainer.firstChild;\r
 \r
-                       // Check if next/prev exists and that they are elements\r
-                       if (prev && next) {\r
-                               function findElementSibling(node, sibling_name) {\r
-                                       for (sibling = node; sibling; sibling = sibling[sibling_name]) {\r
-                                               if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))\r
-                                                       return node;\r
+                                               rng.insertNode(caretContainer);\r
+                                               offset = 1;\r
 \r
-                                               if (sibling.nodeType == 1 && !isBookmarkNode(sibling))\r
-                                                       return sibling;\r
+                                               apply(name, vars, caretContainer);\r
+                                       } else {\r
+                                               apply(name, vars, caretContainer);\r
                                        }\r
 \r
-                                       return node;\r
-                               };\r
+                                       // Move selection to text node\r
+                                       selection.setCursorLocation(textNode, offset);\r
+                               }\r
+                       };\r
 \r
-                               // If previous sibling is empty then jump over it\r
-                               prev = findElementSibling(prev, 'previousSibling');\r
-                               next = findElementSibling(next, 'nextSibling');\r
+                       function removeCaretFormat() {\r
+                               var rng = selection.getRng(true), container, offset, bookmark,\r
+                                       hasContentAfter, node, formatNode, parents = [], i, caretContainer;\r
 \r
-                               // Compare next and previous nodes\r
-                               if (compareElements(prev, next)) {\r
-                                       // Append nodes between\r
-                                       for (sibling = prev.nextSibling; sibling && sibling != next;) {\r
-                                               tmpSibling = sibling;\r
-                                               sibling = sibling.nextSibling;\r
-                                               prev.appendChild(tmpSibling);\r
+                               container = rng.startContainer;\r
+                               offset = rng.startOffset;\r
+                               node = container;\r
+\r
+                               if (container.nodeType == 3) {\r
+                                       if (offset != container.nodeValue.length || container.nodeValue === INVISIBLE_CHAR) {\r
+                                               hasContentAfter = true;\r
                                        }\r
 \r
-                                       // Remove next node\r
-                                       dom.remove(next);\r
+                                       node = node.parentNode;\r
+                               }\r
 \r
-                                       // Move children into prev node\r
-                                       each(tinymce.grep(next.childNodes), function(node) {\r
-                                               prev.appendChild(node);\r
-                                       });\r
+                               while (node) {\r
+                                       if (matchNode(node, name, vars)) {\r
+                                               formatNode = node;\r
+                                               break;\r
+                                       }\r
 \r
-                                       return prev;\r
+                                       if (node.nextSibling) {\r
+                                               hasContentAfter = true;\r
+                                       }\r
+\r
+                                       parents.push(node);\r
+                                       node = node.parentNode;\r
                                }\r
-                       }\r
 \r
-                       return next;\r
-               };\r
+                               // Node doesn't have the specified format\r
+                               if (!formatNode) {\r
+                                       return;\r
+                               }\r
 \r
-               function isTextBlock(name) {\r
-                       return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);\r
-               };\r
+                               // Is there contents after the caret then remove the format on the element\r
+                               if (hasContentAfter) {\r
+                                       // Get bookmark of caret position\r
+                                       bookmark = selection.getBookmark();\r
 \r
-               function getContainer(rng, start) {\r
-                       var container, offset, lastIdx;\r
+                                       // Collapse bookmark range (WebKit)\r
+                                       rng.collapse(true);\r
 \r
-                       container = rng[start ? 'startContainer' : 'endContainer'];\r
-                       offset = rng[start ? 'startOffset' : 'endOffset'];\r
+                                       // Expand the range to the closest word and split it at those points\r
+                                       rng = expandRng(rng, get(name), true);\r
+                                       rng = rangeUtils.split(rng);\r
 \r
-                       if (container.nodeType == 1) {\r
-                               lastIdx = container.childNodes.length - 1;\r
+                                       // Remove the format from the range\r
+                                       remove(name, vars, rng);\r
 \r
-                               if (!start && offset)\r
-                                       offset--;\r
+                                       // Move selection back to caret position\r
+                                       selection.moveToBookmark(bookmark);\r
+                               } else {\r
+                                       caretContainer = createCaretContainer();\r
 \r
-                               container = container.childNodes[offset > lastIdx ? lastIdx : offset];\r
-                       }\r
+                                       node = caretContainer;\r
+                                       for (i = parents.length - 1; i >= 0; i--) {\r
+                                               node.appendChild(dom.clone(parents[i], false));\r
+                                               node = node.firstChild;\r
+                                       }\r
 \r
-                       return container;\r
-               };\r
+                                       // Insert invisible character into inner most format element\r
+                                       node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR));\r
+                                       node = node.firstChild;\r
 \r
-               function performCaretAction(type, name, vars) {\r
-                       var i, currentPendingFormats = pendingFormats[type],\r
-                               otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply'];\r
+                                       // Insert caret container after the formated node\r
+                                       dom.insertAfter(caretContainer, formatNode);\r
 \r
-                       function hasPending() {\r
-                               return pendingFormats.apply.length || pendingFormats.remove.length;\r
+                                       // Move selection to text node\r
+                                       selection.setCursorLocation(node, 1);\r
+                               }\r
                        };\r
 \r
-                       function resetPending() {\r
-                               pendingFormats.apply = [];\r
-                               pendingFormats.remove = [];\r
-                       };\r
+                       // Only bind the caret events once\r
+                       if (!self._hasCaretEvents) {\r
+                               // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements\r
+                               ed.onBeforeGetContent.addToTop(function() {\r
+                                       var nodes = [], i;\r
+\r
+                                       if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) {\r
+                                               // Mark children\r
+                                               i = nodes.length;\r
+                                               while (i--) {\r
+                                                       dom.setAttrib(nodes[i], 'data-mce-bogus', '1');\r
+                                               }\r
+                                       }\r
+                               });\r
 \r
-                       function perform(caret_node) {\r
-                               // Apply pending formats\r
-                               each(pendingFormats.apply.reverse(), function(item) {\r
-                                       apply(item.name, item.vars, caret_node);\r
+                               // Remove caret container on mouse up and on key up\r
+                               tinymce.each('onMouseUp onKeyUp'.split(' '), function(name) {\r
+                                       ed[name].addToTop(function() {\r
+                                               removeCaretContainer();\r
+                                       });\r
                                });\r
 \r
-                               // Remove pending formats\r
-                               each(pendingFormats.remove.reverse(), function(item) {\r
-                                       remove(item.name, item.vars, caret_node);\r
+                               // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys\r
+                               ed.onKeyDown.addToTop(function(ed, e) {\r
+                                       var keyCode = e.keyCode;\r
+\r
+                                       if (keyCode == 8 || keyCode == 37 || keyCode == 39) {\r
+                                               removeCaretContainer(getParentCaretContainer(selection.getStart()));\r
+                                       }\r
                                });\r
 \r
-                               dom.remove(caret_node, 1);\r
-                               resetPending();\r
-                       };\r
+                               self._hasCaretEvents = true;\r
+                       }\r
 \r
-                       // Check if it already exists then ignore it\r
-                       for (i = currentPendingFormats.length - 1; i >= 0; i--) {\r
-                               if (currentPendingFormats[i].name == name)\r
-                                       return;\r
+                       // Do apply or remove caret format\r
+                       if (type == "apply") {\r
+                               applyCaretFormat();\r
+                       } else {\r
+                               removeCaretFormat();\r
                        }\r
+               };\r
 \r
-                       currentPendingFormats.push({name : name, vars : vars});\r
+               function moveStart(rng) {\r
+                       var container = rng.startContainer,\r
+                                       offset = rng.startOffset,\r
+                                       walker, node, nodes, tmpNode;\r
 \r
-                       // Check if it's in the other type, then remove it\r
-                       for (i = otherPendingFormats.length - 1; i >= 0; i--) {\r
-                               if (otherPendingFormats[i].name == name)\r
-                                       otherPendingFormats.splice(i, 1);\r
+                       // Convert text node into index if possible\r
+                       if (container.nodeType == 3 && offset >= container.nodeValue.length) {\r
+                               // Get the parent container location and walk from there\r
+                               container = container.parentNode;\r
+                               offset = nodeIndex(container) + 1;\r
                        }\r
 \r
-                       // Pending apply or remove formats\r
-                       if (hasPending()) {\r
-                               ed.getDoc().execCommand('FontName', false, 'mceinline');\r
-                               pendingFormats.lastRng = selection.getRng();\r
-\r
-                               // IE will convert the current word\r
-                               each(dom.select('font,span'), function(node) {\r
-                                       var bookmark;\r
+                       // Move startContainer/startOffset in to a suitable node\r
+                       if (container.nodeType == 1) {\r
+                               nodes = container.childNodes;\r
+                               container = nodes[Math.min(offset, nodes.length - 1)];\r
+                               walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\r
+\r
+                               // If offset is at end of the parent node walk to the next one\r
+                               if (offset > nodes.length - 1)\r
+                                       walker.next();\r
+\r
+                               for (node = walker.current(); node; node = walker.next()) {\r
+                                       if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\r
+                                               // IE has a "neat" feature where it moves the start node into the closest element\r
+                                               // we can avoid this by inserting an element before it and then remove it after we set the selection\r
+                                               tmpNode = dom.create('a', null, INVISIBLE_CHAR);\r
+                                               node.parentNode.insertBefore(tmpNode, node);\r
+\r
+                                               // Set selection and remove tmpNode\r
+                                               rng.setStart(node, 0);\r
+                                               selection.setRng(rng);\r
+                                               dom.remove(tmpNode);\r
 \r
-                                       if (isCaretNode(node)) {\r
-                                               bookmark = selection.getBookmark();\r
-                                               perform(node);\r
-                                               selection.moveToBookmark(bookmark);\r
-                                               ed.nodeChanged();\r
+                                               return;\r
                                        }\r
-                               });\r
-\r
-                               // Only register listeners once if we need to\r
-                               if (!pendingFormats.isListening && hasPending()) {\r
-                                       pendingFormats.isListening = true;\r
-\r
-                                       each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) {\r
-                                               ed[event].addToTop(function(ed, e) {\r
-                                                       // Do we have pending formats and is the selection moved has moved\r
-                                                       if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) {\r
-                                                               each(dom.select('font,span'), function(node) {\r
-                                                                       var textNode, rng;\r
-\r
-                                                                       // Look for marker\r
-                                                                       if (isCaretNode(node)) {\r
-                                                                               textNode = node.firstChild;\r
-\r
-                                                                               if (textNode) {\r
-                                                                                       perform(node);\r
-\r
-                                                                                       rng = dom.createRng();\r
-                                                                                       rng.setStart(textNode, textNode.nodeValue.length);\r
-                                                                                       rng.setEnd(textNode, textNode.nodeValue.length);\r
-                                                                                       selection.setRng(rng);\r
-                                                                                       ed.nodeChanged();\r
-                                                                               } else\r
-                                                                                       dom.remove(node);\r
-                                                                       }\r
-                                                               });\r
-\r
-                                                               // Always unbind and clear pending styles on keyup\r
-                                                               if (e.type == 'keyup' || e.type == 'mouseup')\r
-                                                                       resetPending();\r
-                                                       }\r
-                                               });\r
-                                       });\r
                                }\r
                        }\r
                };\r
@@ -14147,12 +16951,15 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
        var filters, fontSizes, dom, settings = ed.settings;\r
 \r
        if (settings.inline_styles) {\r
-               fontSizes = tinymce.explode(settings.font_size_style_values);\r
+               fontSizes = tinymce.explode(settings.font_size_legacy_values);\r
 \r
                function replaceWithSpan(node, styles) {\r
-                       dom.replace(dom.create('span', {\r
-                               style : styles\r
-                       }), node, 1);\r
+                       tinymce.each(styles, function(value, name) {\r
+                               if (value)\r
+                                       dom.setStyle(node, name, value);\r
+                       });\r
+\r
+                       dom.rename(node, 'span');\r
                };\r
 \r
                filters = {\r
@@ -14189,6 +16996,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
                };\r
 \r
                ed.onPreProcess.add(convert);\r
+               ed.onSetContent.add(convert);\r
 \r
                ed.onInit.add(function() {\r
                        ed.selection.onSetContent.add(convert);\r
@@ -14196,3 +17004,393 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
        }\r
 });\r
 \r
+(function(tinymce) {\r
+       var TreeWalker = tinymce.dom.TreeWalker;\r
+\r
+       tinymce.EnterKey = function(editor) {\r
+               var dom = editor.dom, selection = editor.selection, settings = editor.settings, undoManager = editor.undoManager;\r
+\r
+               function handleEnterKey(evt) {\r
+                       var rng = selection.getRng(true), tmpRng, container, offset, parentBlock, newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName;\r
+\r
+                       // Returns true if the block can be split into two blocks or not\r
+                       function canSplitBlock(node) {\r
+                               return node && dom.isBlock(node) && !/^(TD|TH|CAPTION)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position);\r
+                       };\r
+\r
+                       // Moves the caret to a suitable position within the root for example in the first non pure whitespace text node or before an image\r
+                       function moveToCaretPosition(root) {\r
+                               var walker, node, rng, y, viewPort, lastNode = root;\r
+\r
+                               rng = dom.createRng();\r
+\r
+                               if (root.hasChildNodes()) {\r
+                                       walker = new TreeWalker(root, root);\r
+\r
+                                       while (node = walker.current()) {\r
+                                               if (node.nodeType == 3) {\r
+                                                       rng.setStart(node, 0);\r
+                                                       rng.setEnd(node, 0);\r
+                                                       break;\r
+                                               }\r
+\r
+                                               if (/^(BR|IMG)$/.test(node.nodeName)) {\r
+                                                       rng.setStartBefore(node);\r
+                                                       rng.setEndBefore(node);\r
+                                                       break;\r
+                                               }\r
+\r
+                                               lastNode = node;\r
+                                               node = walker.next();\r
+                                       }\r
+\r
+                                       if (!node) {\r
+                                               rng.setStart(lastNode, 0);\r
+                                               rng.setEnd(lastNode, 0);\r
+                                       }\r
+                               } else {\r
+                                       if (root.nodeName == 'BR') {\r
+                                               rng.setStartAfter(root);\r
+                                               rng.setEndAfter(root);\r
+                                       } else {\r
+                                               rng.setStart(root, 0);\r
+                                               rng.setEnd(root, 0);\r
+                                       }\r
+                               }\r
+\r
+                               selection.setRng(rng);\r
+\r
+                               viewPort = dom.getViewPort(editor.getWin());\r
+\r
+                               // scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs\r
+                               y = dom.getPos(root).y;\r
+                               if (y < viewPort.y || y + 25 > viewPort.y + viewPort.h) {\r
+                                       editor.getWin().scrollTo(0, y < viewPort.y ? y : y - viewPort.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks\r
+                               }\r
+                       };\r
+\r
+                       // Creates a new block element by cloning the current one or creating a new one if the name is specified\r
+                       // This function will also copy any text formatting from the parent block and add it to the new one\r
+                       function createNewBlock(name) {\r
+                               var node = container, block, clonedNode, caretNode;\r
+\r
+                               block = name ? dom.create(name) : parentBlock.cloneNode(false);\r
+                               caretNode = block;\r
+\r
+                               // Clone any parent styles\r
+                               do {\r
+                                       if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {\r
+                                               clonedNode = node.cloneNode(false);\r
+                                               dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique\r
+\r
+                                               if (block.hasChildNodes()) {\r
+                                                       clonedNode.appendChild(block.firstChild);\r
+                                                       block.appendChild(clonedNode);\r
+                                               } else {\r
+                                                       caretNode = clonedNode;\r
+                                                       block.appendChild(clonedNode);\r
+                                               }\r
+                                       }\r
+                               } while (node = node.parentNode);\r
+\r
+                               // BR is needed in empty blocks on non IE browsers\r
+                               if (!tinymce.isIE) {\r
+                                       caretNode.innerHTML = '<br>';\r
+                               }\r
+\r
+                               return block;\r
+                       };\r
+\r
+                       // Returns true/false if the caret is at the start/end of the parent block element\r
+                       function isCaretAtStartOrEndOfBlock(start) {\r
+                               var walker, node;\r
+\r
+                               // Caret is in the middle of a text node like "a|b"\r
+                               if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) {\r
+                                       return false;\r
+                               }\r
+\r
+                               // Walk the DOM and look for text nodes or non empty elements\r
+                               walker = new TreeWalker(container, parentBlock);\r
+                               while (node = (start ? walker.prev() : walker.next())) {\r
+                                       if (node.nodeType === 1) {\r
+                                               // Ignore bogus elements\r
+                                               if (node.getAttribute('data-mce-bogus')) {\r
+                                                       continue;\r
+                                               }\r
+\r
+                                               // Keep empty elements like <img />\r
+                                               name = node.nodeName.toLowerCase();\r
+                                               if (name === 'IMG') {\r
+                                                       return false;\r
+                                               }\r
+                                       } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) {\r
+                                               return false;\r
+                                       }\r
+                               }\r
+\r
+                               return true;\r
+                       };\r
+\r
+                       // Wraps any text nodes or inline elements in the specified forced root block name\r
+                       function wrapSelfAndSiblingsInDefaultBlock(container, offset) {\r
+                               var newBlock, parentBlock, startNode, node, next;\r
+\r
+                               // Not in a block element or in a table cell or caption\r
+                               parentBlock = dom.getParent(container, dom.isBlock);\r
+                               if (newBlockName && !evt.shiftKey && (!parentBlock || !canSplitBlock(parentBlock))) {\r
+                                       parentBlock = parentBlock || dom.getRoot();\r
+\r
+                                       if (!parentBlock.hasChildNodes()) {\r
+                                               newBlock = dom.create(newBlockName);\r
+                                               parentBlock.appendChild(newBlock);\r
+                                               rng.setStart(newBlock, 0);\r
+                                               rng.setEnd(newBlock, 0);\r
+                                               return newBlock;\r
+                                       }\r
+\r
+                                       // Find parent that is the first child of parentBlock\r
+                                       node = container;\r
+                                       while (node.parentNode != parentBlock) {\r
+                                               node = node.parentNode;\r
+                                       }\r
+\r
+                                       // Loop left to find start node start wrapping at\r
+                                       while (node && !dom.isBlock(node)) {\r
+                                               startNode = node;\r
+                                               node = node.previousSibling;\r
+                                       }\r
+\r
+                                       if (startNode) {\r
+                                               newBlock = dom.create(newBlockName);\r
+                                               startNode.parentNode.insertBefore(newBlock, startNode);\r
+\r
+                                               // Start wrapping until we hit a block\r
+                                               node = startNode;\r
+                                               while (node && !dom.isBlock(node)) {\r
+                                                       next = node.nextSibling;\r
+                                                       newBlock.appendChild(node);\r
+                                                       node = next;\r
+                                               }\r
+\r
+                                               // Restore range to it's past location\r
+                                               rng.setStart(container, offset);\r
+                                               rng.setEnd(container, offset);\r
+                                       }\r
+                               }\r
+\r
+                               return container;\r
+                       };\r
+\r
+                       // Inserts a block or br before/after or in the middle of a split list of the LI is empty\r
+                       function handleEmptyListItem() {\r
+                               function isFirstOrLastLi(first) {\r
+                                       var node = containerBlock[first ? 'firstChild' : 'lastChild'];\r
+\r
+                                       // Find first/last element since there might be whitespace there\r
+                                       while (node) {\r
+                                               if (node.nodeType == 1) {\r
+                                                       break;\r
+                                               }\r
+\r
+                                               node = node[first ? 'nextSibling' : 'previousSibling'];\r
+                                       }\r
+\r
+                                       return node === parentBlock;\r
+                               };\r
+\r
+                               newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');\r
+\r
+                               if (isFirstOrLastLi(true) && isFirstOrLastLi()) {\r
+                                       // Is first and last list item then replace the OL/UL with a text block\r
+                                       dom.replace(newBlock, containerBlock);\r
+                               } else if (isFirstOrLastLi(true)) {\r
+                                       // First LI in list then remove LI and add text block before list\r
+                                       containerBlock.parentNode.insertBefore(newBlock, containerBlock);\r
+                               } else if (isFirstOrLastLi()) {\r
+                                       // Last LI in list then temove LI and add text block after list\r
+                                       dom.insertAfter(newBlock, containerBlock);\r
+                               } else {\r
+                                       // Middle LI in list the split the list and insert a text block in the middle\r
+                                       // Extract after fragment and insert it after the current block\r
+                                       tmpRng = rng.cloneRange();\r
+                                       tmpRng.setStartAfter(parentBlock);\r
+                                       tmpRng.setEndAfter(containerBlock);\r
+                                       fragment = tmpRng.extractContents();\r
+                                       dom.insertAfter(fragment, containerBlock);\r
+                                       dom.insertAfter(newBlock, containerBlock);\r
+                               }\r
+\r
+                               dom.remove(parentBlock);\r
+                               moveToCaretPosition(newBlock);\r
+                               undoManager.add();\r
+                       };\r
+\r
+                       // Walks the parent block to the right and look for BR elements\r
+                       function hasRightSideBr() {\r
+                               var walker = new TreeWalker(container, parentBlock), node;\r
+\r
+                               while (node = walker.current()) {\r
+                                       if (node.nodeName == 'BR') {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       node = walker.next();\r
+                               }\r
+                       }\r
+                       \r
+                       // Inserts a BR element if the forced_root_block option is set to false or empty string\r
+                       function insertBr() {\r
+                               var brElm, extraBr, documentMode;\r
+\r
+                               if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {\r
+                                       // Insert extra BR element at the end block elements\r
+                                       if (!tinymce.isIE && !hasRightSideBr()) {\r
+                                               brElm = dom.create('br')\r
+                                               rng.insertNode(brElm);\r
+                                               rng.setStartAfter(brElm);\r
+                                               rng.setEndAfter(brElm);\r
+                                               extraBr = true;\r
+                                       }\r
+                               }\r
+\r
+                               brElm = dom.create('br');\r
+                               rng.insertNode(brElm);\r
+\r
+                               // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it\r
+                               documentMode = dom.doc.documentMode;\r
+                               if (tinymce.isIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {\r
+                                       brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);\r
+                               }\r
+\r
+                               if (!extraBr) {\r
+                                       rng.setStartAfter(brElm);\r
+                                       rng.setEndAfter(brElm);\r
+                               } else {\r
+                                       rng.setStartBefore(brElm);\r
+                                       rng.setEndBefore(brElm);\r
+                               }\r
+\r
+                               selection.setRng(rng);\r
+                               undoManager.add();\r
+                       };\r
+\r
+                       // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element\r
+                       function trimLeadingLineBreaks(node) {\r
+                               do {\r
+                                       if (node.nodeType === 3) {\r
+                                               node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');\r
+                                       }\r
+\r
+                                       node = node.firstChild;\r
+                               } while (node);\r
+                       };\r
+               \r
+                       // Delete any selected contents\r
+                       if (!rng.collapsed) {\r
+                               editor.execCommand('Delete');\r
+                               return;\r
+                       }\r
+\r
+                       // Event is blocked by some other handler for example the lists plugin\r
+                       if (evt.isDefaultPrevented()) {\r
+                               return;\r
+                       }\r
+\r
+                       // Setup range items and newBlockName\r
+                       container = rng.startContainer;\r
+                       offset = rng.startOffset;\r
+                       newBlockName = settings.forced_root_block;\r
+                       newBlockName = newBlockName ? newBlockName.toUpperCase() : '';\r
+\r
+                       // Resolve node index\r
+                       if (container.nodeType == 1 && container.hasChildNodes()) {\r
+                               container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\r
+                               offset = 0;\r
+                       }\r
+\r
+                       undoManager.beforeChange();\r
+\r
+                       // Wrap the current node and it's sibling in a default block if it's needed.\r
+                       // for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>\r
+                       container = wrapSelfAndSiblingsInDefaultBlock(container, offset);\r
+\r
+                       // Find parent block and setup empty block paddings\r
+                       parentBlock = dom.getParent(container, dom.isBlock);\r
+                       containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\r
+\r
+                       // Setup block names\r
+                       parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5\r
+                       containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5\r
+\r
+                       // Handle enter inside an empty list item\r
+                       if (parentBlockName == 'LI' && dom.isEmpty(parentBlock)) {\r
+                               // Let the list plugin or browser handle nested lists for now\r
+                               if (/^(UL|OL|LI)$/.test(containerBlock.parentNode.nodeName)) {\r
+                                       return false;\r
+                               }\r
+\r
+                               handleEmptyListItem();\r
+                               return;\r
+                       }\r
+\r
+                       // Don't split PRE tags but insert a BR instead easier when writing code samples etc\r
+                       if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {\r
+                               if (!evt.shiftKey) {\r
+                                       insertBr();\r
+                                       return;\r
+                               }\r
+                       } else {\r
+                               // If no root block is configured then insert a BR by default or if the shiftKey is pressed\r
+                               if ((!newBlockName && !evt.shiftKey && parentBlockName != 'LI') || (newBlockName && evt.shiftKey)) {\r
+                                       insertBr();\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       // Default block name if it's not configured\r
+                       newBlockName = newBlockName || 'P';\r
+\r
+                       // Insert new block before/after the parent block depending on caret location\r
+                       if (isCaretAtStartOrEndOfBlock()) {\r
+                               // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup\r
+                               if (/^(H[1-6]|PRE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') {\r
+                                       newBlock = createNewBlock(newBlockName);\r
+                               } else {\r
+                                       newBlock = createNewBlock();\r
+                               }\r
+\r
+                               // Split the current container block element if enter is pressed inside an empty inner block element\r
+                               if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) {\r
+                                       // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P\r
+                                       newBlock = dom.split(containerBlock, parentBlock);\r
+                               } else {\r
+                                       dom.insertAfter(newBlock, parentBlock);\r
+                               }\r
+                       } else if (isCaretAtStartOrEndOfBlock(true)) {\r
+                               // Insert new block before\r
+                               newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);\r
+                       } else {\r
+                               // Extract after fragment and insert it after the current block\r
+                               tmpRng = rng.cloneRange();\r
+                               tmpRng.setEndAfter(parentBlock);\r
+                               fragment = tmpRng.extractContents();\r
+                               trimLeadingLineBreaks(fragment);\r
+                               newBlock = fragment.firstChild;\r
+                               dom.insertAfter(fragment, parentBlock);\r
+                       }\r
+\r
+                       dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique\r
+                       moveToCaretPosition(newBlock);\r
+                       undoManager.add();\r
+               }\r
+\r
+               editor.onKeyDown.add(function(ed, evt) {\r
+                       if (evt.keyCode == 13) {\r
+                               if (handleEnterKey(evt) !== false) {\r
+                                       evt.preventDefault();\r
+                               }\r
+                       }\r
+               });\r
+       };\r
+})(tinymce);\r
old mode 100755 (executable)
new mode 100644 (file)
index fd943c0..4b920f3
@@ -16,7 +16,7 @@ var TinyMCE_EditableSelects = {
 \r
                for (i=0; i<nl.length; i++) {\r
                        if (nl[i].className.indexOf('mceEditableSelect') != -1) {\r
-                               o = new Option('(value)', '__mce_add_custom__');\r
+                               o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');\r
 \r
                                o.className = 'mceAddSelectValue';\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 2617a26..59da013
 var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));\r
 \r
 function getColorPickerHTML(id, target_form_element) {\r
-       var h = "";\r
+       var h = "", dom = tinyMCEPopup.dom;\r
 \r
-       h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';\r
-       h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';\r
+       if (label = dom.select('label[for=' + target_form_element + ']')[0]) {\r
+               label.id = label.id || dom.uniqueId();\r
+       }\r
+\r
+       h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';\r
+       h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;<span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';\r
 \r
        return h;\r
 }\r
@@ -67,6 +71,9 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
        if (!form_obj || !form_obj.elements[field_name])\r
                return;\r
 \r
+       if (!value)\r
+               value = "";\r
+\r
        var sel = form_obj.elements[field_name];\r
 \r
        var found = false;\r
@@ -171,7 +178,7 @@ function convertHexToRGB(col) {
 }\r
 \r
 function trimSize(size) {\r
-       return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2');\r
+       return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');\r
 }\r
 \r
 function getCSSSize(size) {\r
@@ -183,6 +190,9 @@ function getCSSSize(size) {
        // Add px\r
        if (/^[0-9]+$/.test(size))\r
                size += 'px';\r
+       // Sanity check, IE doesn't like broken values\r
+       else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))\r
+               return "";\r
 \r
        return size;\r
 }\r
old mode 100755 (executable)
new mode 100644 (file)
index 825d4c1..458ec86
@@ -10,6 +10,7 @@
 \r
 function MCTabs() {\r
        this.settings = [];\r
+       this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');\r
 };\r
 \r
 MCTabs.prototype.init = function(settings) {\r
@@ -28,26 +29,62 @@ MCTabs.prototype.getParam = function(name, default_value) {
        return value;\r
 };\r
 \r
-MCTabs.prototype.displayTab = function(tab_id, panel_id) {\r
-       var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;\r
+MCTabs.prototype.showTab =function(tab){\r
+       tab.className = 'current';\r
+       tab.setAttribute("aria-selected", true);\r
+       tab.setAttribute("aria-expanded", true);\r
+       tab.tabIndex = 0;\r
+};\r
+\r
+MCTabs.prototype.hideTab =function(tab){\r
+       var t=this;\r
+\r
+       tab.className = '';\r
+       tab.setAttribute("aria-selected", false);\r
+       tab.setAttribute("aria-expanded", false);\r
+       tab.tabIndex = -1;\r
+};\r
+\r
+MCTabs.prototype.showPanel = function(panel) {\r
+       panel.className = 'current'; \r
+       panel.setAttribute("aria-hidden", false);\r
+};\r
+\r
+MCTabs.prototype.hidePanel = function(panel) {\r
+       panel.className = 'panel';\r
+       panel.setAttribute("aria-hidden", true);\r
+}; \r
+\r
+MCTabs.prototype.getPanelForTab = function(tabElm) {\r
+       return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");\r
+};\r
+\r
+MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {\r
+       var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;\r
+\r
+       tabElm = document.getElementById(tab_id);\r
+\r
+       if (panel_id === undefined) {\r
+               panel_id = t.getPanelForTab(tabElm);\r
+       }\r
 \r
        panelElm= document.getElementById(panel_id);\r
        panelContainerElm = panelElm ? panelElm.parentNode : null;\r
-       tabElm = document.getElementById(tab_id);\r
        tabContainerElm = tabElm ? tabElm.parentNode : null;\r
-       selectionClass = this.getParam('selection_class', 'current');\r
+       selectionClass = t.getParam('selection_class', 'current');\r
 \r
        if (tabElm && tabContainerElm) {\r
                nodes = tabContainerElm.childNodes;\r
 \r
                // Hide all other tabs\r
                for (i = 0; i < nodes.length; i++) {\r
-                       if (nodes[i].nodeName == "LI")\r
-                               nodes[i].className = '';\r
+                       if (nodes[i].nodeName == "LI") {\r
+                               t.hideTab(nodes[i]);\r
+                       }\r
                }\r
 \r
                // Show selected tab\r
-               tabElm.className = 'current';\r
+               t.showTab(tabElm);\r
        }\r
 \r
        if (panelElm && panelContainerElm) {\r
@@ -56,11 +93,15 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id) {
                // Hide all other panels\r
                for (i = 0; i < nodes.length; i++) {\r
                        if (nodes[i].nodeName == "DIV")\r
-                               nodes[i].className = 'panel';\r
+                               t.hidePanel(nodes[i]);\r
+               }\r
+\r
+               if (!avoid_focus) { \r
+                       tabElm.focus();\r
                }\r
 \r
                // Show selected panel\r
-               panelElm.className = 'current';\r
+               t.showPanel(panelElm);\r
        }\r
 };\r
 \r
@@ -73,5 +114,49 @@ MCTabs.prototype.getAnchor = function() {
        return "";\r
 };\r
 \r
-// Global instance\r
+\r
+//Global instance\r
 var mcTabs = new MCTabs();\r
+\r
+tinyMCEPopup.onInit.add(function() {\r
+       var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;\r
+\r
+       each(dom.select('div.tabs'), function(tabContainerElm) {\r
+               var keyNav;\r
+\r
+               dom.setAttrib(tabContainerElm, "role", "tablist"); \r
+\r
+               var items = tinyMCEPopup.dom.select('li', tabContainerElm);\r
+               var action = function(id) {\r
+                       mcTabs.displayTab(id, mcTabs.getPanelForTab(id));\r
+                       mcTabs.onChange.dispatch(id);\r
+               };\r
+\r
+               each(items, function(item) {\r
+                       dom.setAttrib(item, 'role', 'tab');\r
+                       dom.bind(item, 'click', function(evt) {\r
+                               action(item.id);\r
+                       });\r
+               });\r
+\r
+               dom.bind(dom.getRoot(), 'keydown', function(evt) {\r
+                       if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab\r
+                               keyNav.moveFocus(evt.shiftKey ? -1 : 1);\r
+                               tinymce.dom.Event.cancel(evt);\r
+                       }\r
+               });\r
+\r
+               each(dom.select('a', tabContainerElm), function(a) {\r
+                       dom.setAttrib(a, 'tabindex', '-1');\r
+               });\r
+\r
+               keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {\r
+                       root: tabContainerElm,\r
+                       items: items,\r
+                       onAction: action,\r
+                       actOnFocus: true,\r
+                       enableLeftRight: true,\r
+                       enableUpDown: true\r
+               }, tinyMCEPopup.dom);\r
+       });\r
+});
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index a6fcf97..27cbfab
@@ -32,7 +32,7 @@ var Validator = {
        },\r
 \r
        isSize : function(s) {\r
-               return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');\r
+               return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');\r
        },\r
 \r
        isId : function(s) {\r
@@ -96,8 +96,10 @@ var AutoValidator = {
                var i, nl, s = this.settings, c = 0;\r
 \r
                nl = this.tags(f, 'label');\r
-               for (i=0; i<nl.length; i++)\r
+               for (i=0; i<nl.length; i++) {\r
                        this.removeClass(nl[i], s.invalid_cls);\r
+                       nl[i].setAttribute('aria-invalid', false);\r
+               }\r
 \r
                c += this.validateElms(f, 'input');\r
                c += this.validateElms(f, 'select');\r
@@ -109,6 +111,33 @@ var AutoValidator = {
        invalidate : function(n) {\r
                this.mark(n.form, n);\r
        },\r
+       \r
+       getErrorMessages : function(f) {\r
+               var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;\r
+               nl = this.tags(f, "label");\r
+               for (i=0; i<nl.length; i++) {\r
+                       if (this.hasClass(nl[i], s.invalid_cls)) {\r
+                               field = document.getElementById(nl[i].getAttribute("for"));\r
+                               values = { field: nl[i].textContent };\r
+                               if (this.hasClass(field, s.min_cls, true)) {\r
+                                       message = ed.getLang('invalid_data_min');\r
+                                       values.min = this.getNum(field, s.min_cls);\r
+                               } else if (this.hasClass(field, s.number_cls)) {\r
+                                       message = ed.getLang('invalid_data_number');\r
+                               } else if (this.hasClass(field, s.size_cls)) {\r
+                                       message = ed.getLang('invalid_data_size');\r
+                               } else {\r
+                                       message = ed.getLang('invalid_data');\r
+                               }\r
+                               \r
+                               message = message.replace(/{\#([^}]+)\}/g, function(a, b) {\r
+                                       return values[b] || '{#' + b + '}';\r
+                               });\r
+                               messages.push(message);\r
+                       }\r
+               }\r
+               return messages;\r
+       },\r
 \r
        reset : function(e) {\r
                var t = ['label', 'input', 'select', 'textarea'];\r
@@ -119,8 +148,10 @@ var AutoValidator = {
 \r
                for (i=0; i<t.length; i++) {\r
                        nl = this.tags(e.form ? e.form : e, t[i]);\r
-                       for (j=0; j<nl.length; j++)\r
+                       for (j=0; j<nl.length; j++) {\r
                                this.removeClass(nl[j], s.invalid_cls);\r
+                               nl[j].setAttribute('aria-invalid', false);\r
+                       }\r
                }\r
        },\r
 \r
@@ -201,6 +232,7 @@ var AutoValidator = {
                var s = this.settings;\r
 \r
                this.addClass(n, s.invalid_cls);\r
+               n.setAttribute('aria-invalid', 'true');\r
                this.markLabels(f, n, s.invalid_cls);\r
 \r
                return false;\r