]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
upgrade TinyMCE to 3.4.x
authorEvan Prodromou <evan@status.net>
Mon, 20 Jun 2011 15:34:24 +0000 (11:34 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 20 Jun 2011 15:34:24 +0000 (11:34 -0400)
173 files changed:
plugins/TinyMCE/js/langs/en.js
plugins/TinyMCE/js/plugins/advhr/langs/en_dlg.js
plugins/TinyMCE/js/plugins/advhr/rule.htm
plugins/TinyMCE/js/plugins/advimage/image.htm
plugins/TinyMCE/js/plugins/advimage/js/image.js
plugins/TinyMCE/js/plugins/advimage/langs/en_dlg.js
plugins/TinyMCE/js/plugins/advlink/js/advlink.js
plugins/TinyMCE/js/plugins/advlink/langs/en_dlg.js
plugins/TinyMCE/js/plugins/advlink/link.htm
plugins/TinyMCE/js/plugins/advlist/editor_plugin.js
plugins/TinyMCE/js/plugins/advlist/editor_plugin_src.js
plugins/TinyMCE/js/plugins/autolink/editor_plugin.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/autolink/editor_plugin_src.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/autoresize/editor_plugin.js
plugins/TinyMCE/js/plugins/autoresize/editor_plugin_src.js
plugins/TinyMCE/js/plugins/autosave/editor_plugin.js
plugins/TinyMCE/js/plugins/autosave/editor_plugin_src.js
plugins/TinyMCE/js/plugins/bbcode/editor_plugin.js
plugins/TinyMCE/js/plugins/bbcode/editor_plugin_src.js
plugins/TinyMCE/js/plugins/contextmenu/editor_plugin.js
plugins/TinyMCE/js/plugins/contextmenu/editor_plugin_src.js
plugins/TinyMCE/js/plugins/emotions/emotions.htm
plugins/TinyMCE/js/plugins/emotions/img/smiley-foot-in-mouth.gif
plugins/TinyMCE/js/plugins/emotions/img/smiley-laughing.gif
plugins/TinyMCE/js/plugins/emotions/img/smiley-sealed.gif
plugins/TinyMCE/js/plugins/emotions/img/smiley-smile.gif
plugins/TinyMCE/js/plugins/emotions/img/smiley-surprised.gif
plugins/TinyMCE/js/plugins/emotions/img/smiley-wink.gif
plugins/TinyMCE/js/plugins/example_dependency/editor_plugin.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/example_dependency/editor_plugin_src.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/fullpage/css/fullpage.css
plugins/TinyMCE/js/plugins/fullpage/editor_plugin.js
plugins/TinyMCE/js/plugins/fullpage/editor_plugin_src.js
plugins/TinyMCE/js/plugins/fullpage/fullpage.htm
plugins/TinyMCE/js/plugins/fullpage/js/fullpage.js
plugins/TinyMCE/js/plugins/fullscreen/editor_plugin.js
plugins/TinyMCE/js/plugins/fullscreen/editor_plugin_src.js
plugins/TinyMCE/js/plugins/inlinepopups/editor_plugin.js
plugins/TinyMCE/js/plugins/inlinepopups/editor_plugin_src.js
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/alert.gif
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/button.gif
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/corners.gif
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif
plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/window.css
plugins/TinyMCE/js/plugins/layer/editor_plugin.js
plugins/TinyMCE/js/plugins/layer/editor_plugin_src.js
plugins/TinyMCE/js/plugins/legacyoutput/editor_plugin.js
plugins/TinyMCE/js/plugins/legacyoutput/editor_plugin_src.js
plugins/TinyMCE/js/plugins/linkautodetect/changelog.txt [deleted file]
plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin.js [deleted file]
plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin_src.js [deleted file]
plugins/TinyMCE/js/plugins/lists/editor_plugin.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/lists/editor_plugin_src.js [new file with mode: 0644]
plugins/TinyMCE/js/plugins/media/css/content.css [deleted file]
plugins/TinyMCE/js/plugins/media/css/media.css
plugins/TinyMCE/js/plugins/media/editor_plugin.js
plugins/TinyMCE/js/plugins/media/editor_plugin_src.js
plugins/TinyMCE/js/plugins/media/img/flash.gif [deleted file]
plugins/TinyMCE/js/plugins/media/img/flv_player.swf [deleted file]
plugins/TinyMCE/js/plugins/media/img/quicktime.gif [deleted file]
plugins/TinyMCE/js/plugins/media/img/realmedia.gif [deleted file]
plugins/TinyMCE/js/plugins/media/img/shockwave.gif [deleted file]
plugins/TinyMCE/js/plugins/media/img/trans.gif [deleted file]
plugins/TinyMCE/js/plugins/media/img/windowsmedia.gif [deleted file]
plugins/TinyMCE/js/plugins/media/js/media.js
plugins/TinyMCE/js/plugins/media/langs/en_dlg.js
plugins/TinyMCE/js/plugins/media/media.htm
plugins/TinyMCE/js/plugins/media/moxieplayer.swf [new file with mode: 0644]
plugins/TinyMCE/js/plugins/nonbreaking/editor_plugin.js
plugins/TinyMCE/js/plugins/nonbreaking/editor_plugin_src.js
plugins/TinyMCE/js/plugins/noneditable/editor_plugin.js
plugins/TinyMCE/js/plugins/noneditable/editor_plugin_src.js
plugins/TinyMCE/js/plugins/pagebreak/css/content.css [deleted file]
plugins/TinyMCE/js/plugins/pagebreak/editor_plugin.js
plugins/TinyMCE/js/plugins/pagebreak/editor_plugin_src.js
plugins/TinyMCE/js/plugins/pagebreak/img/pagebreak.gif [deleted file]
plugins/TinyMCE/js/plugins/pagebreak/img/trans.gif [deleted file]
plugins/TinyMCE/js/plugins/paste/editor_plugin.js
plugins/TinyMCE/js/plugins/paste/editor_plugin_src.js
plugins/TinyMCE/js/plugins/searchreplace/editor_plugin.js
plugins/TinyMCE/js/plugins/searchreplace/editor_plugin_src.js
plugins/TinyMCE/js/plugins/searchreplace/js/searchreplace.js
plugins/TinyMCE/js/plugins/searchreplace/searchreplace.htm
plugins/TinyMCE/js/plugins/spellchecker/editor_plugin.js
plugins/TinyMCE/js/plugins/spellchecker/editor_plugin_src.js
plugins/TinyMCE/js/plugins/style/js/props.js
plugins/TinyMCE/js/plugins/style/langs/en_dlg.js
plugins/TinyMCE/js/plugins/style/props.htm
plugins/TinyMCE/js/plugins/tabfocus/editor_plugin.js
plugins/TinyMCE/js/plugins/tabfocus/editor_plugin_src.js
plugins/TinyMCE/js/plugins/table/cell.htm
plugins/TinyMCE/js/plugins/table/editor_plugin.js
plugins/TinyMCE/js/plugins/table/editor_plugin_src.js
plugins/TinyMCE/js/plugins/table/js/cell.js
plugins/TinyMCE/js/plugins/table/js/row.js
plugins/TinyMCE/js/plugins/table/js/table.js
plugins/TinyMCE/js/plugins/table/langs/en_dlg.js
plugins/TinyMCE/js/plugins/table/merge_cells.htm
plugins/TinyMCE/js/plugins/table/row.htm
plugins/TinyMCE/js/plugins/table/table.htm
plugins/TinyMCE/js/plugins/template/js/template.js
plugins/TinyMCE/js/plugins/visualchars/editor_plugin.js
plugins/TinyMCE/js/plugins/visualchars/editor_plugin_src.js
plugins/TinyMCE/js/plugins/wordcount/editor_plugin.js
plugins/TinyMCE/js/plugins/wordcount/editor_plugin_src.js
plugins/TinyMCE/js/plugins/xhtmlxtras/abbr.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/acronym.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/attributes.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/cite.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/del.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/editor_plugin.js
plugins/TinyMCE/js/plugins/xhtmlxtras/editor_plugin_src.js
plugins/TinyMCE/js/plugins/xhtmlxtras/ins.htm
plugins/TinyMCE/js/plugins/xhtmlxtras/js/attributes.js
plugins/TinyMCE/js/plugins/xhtmlxtras/js/del.js
plugins/TinyMCE/js/plugins/xhtmlxtras/js/element_common.js
plugins/TinyMCE/js/plugins/xhtmlxtras/js/ins.js
plugins/TinyMCE/js/themes/advanced/about.htm
plugins/TinyMCE/js/themes/advanced/anchor.htm
plugins/TinyMCE/js/themes/advanced/charmap.htm
plugins/TinyMCE/js/themes/advanced/color_picker.htm
plugins/TinyMCE/js/themes/advanced/editor_template.js
plugins/TinyMCE/js/themes/advanced/editor_template_src.js
plugins/TinyMCE/js/themes/advanced/image.htm
plugins/TinyMCE/js/themes/advanced/img/colorpicker.jpg
plugins/TinyMCE/js/themes/advanced/img/flash.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/icons.gif
plugins/TinyMCE/js/themes/advanced/img/iframe.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/pagebreak.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/quicktime.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/realmedia.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/shockwave.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/trans.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/video.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/img/windowsmedia.gif [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/js/about.js
plugins/TinyMCE/js/themes/advanced/js/anchor.js
plugins/TinyMCE/js/themes/advanced/js/charmap.js
plugins/TinyMCE/js/themes/advanced/js/color_picker.js
plugins/TinyMCE/js/themes/advanced/js/image.js
plugins/TinyMCE/js/themes/advanced/js/link.js
plugins/TinyMCE/js/themes/advanced/js/source_editor.js
plugins/TinyMCE/js/themes/advanced/langs/en.js
plugins/TinyMCE/js/themes/advanced/langs/en_dlg.js
plugins/TinyMCE/js/themes/advanced/link.htm
plugins/TinyMCE/js/themes/advanced/shortcuts.htm [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/skins/default/content.css
plugins/TinyMCE/js/themes/advanced/skins/default/img/buttons.png
plugins/TinyMCE/js/themes/advanced/skins/default/img/items.gif
plugins/TinyMCE/js/themes/advanced/skins/default/img/tabs.gif
plugins/TinyMCE/js/themes/advanced/skins/default/ui.css
plugins/TinyMCE/js/themes/advanced/skins/highcontrast/content.css [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/skins/highcontrast/dialog.css [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/skins/highcontrast/ui.css [new file with mode: 0644]
plugins/TinyMCE/js/themes/advanced/skins/o2k7/content.css
plugins/TinyMCE/js/themes/advanced/skins/o2k7/dialog.css
plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg.png
plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_black.png
plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_silver.png
plugins/TinyMCE/js/themes/advanced/skins/o2k7/ui.css
plugins/TinyMCE/js/themes/advanced/skins/o2k7/ui_black.css
plugins/TinyMCE/js/themes/advanced/skins/o2k7/ui_silver.css
plugins/TinyMCE/js/themes/advanced/source_editor.htm
plugins/TinyMCE/js/themes/simple/editor_template.js
plugins/TinyMCE/js/themes/simple/editor_template_src.js
plugins/TinyMCE/js/themes/simple/img/icons.gif
plugins/TinyMCE/js/tiny_mce.js
plugins/TinyMCE/js/tiny_mce_popup.js
plugins/TinyMCE/js/tiny_mce_src.js
plugins/TinyMCE/js/utils/form_utils.js
plugins/TinyMCE/js/utils/mctabs.js
plugins/TinyMCE/js/utils/validate.js

index ea4a1b0e1426134d417c66db72fa180635c79ef4..8a80d46b1ae369c481c8c6fea4b4c1cc86f891b1 100644 (file)
@@ -12,9 +12,54 @@ not_set:"-- Not set --",
 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
+invalid_data:"{#field} is invalid",\r
+invalid_data_number:"{#field} must be a number",\r
+invalid_data_min:"{#field} must be a number greater than {#min}",\r
+invalid_data_size:"{#field} must be a number or percentage",\r
 more_colors:"More colors"\r
 },\r
+colors:{\r
+'000000':'Black',\r
+'993300':'Burnt orange',\r
+'333300':'Dark olive',\r
+'003300':'Dark green',\r
+'003366':'Dark azure',\r
+'000080':'Navy Blue',\r
+'333399':'Indigo',\r
+'333333':'Very dark gray',\r
+'800000':'Maroon',\r
+'FF6600':'Orange',\r
+'808000':'Olive',\r
+'008000':'Green',\r
+'008080':'Teal',\r
+'0000FF':'Blue',\r
+'666699':'Grayish blue',\r
+'808080':'Gray',\r
+'FF0000':'Red',\r
+'FF9900':'Amber',\r
+'99CC00':'Yellow green',\r
+'339966':'Sea green',\r
+'33CCCC':'Turquoise',\r
+'3366FF':'Royal blue',\r
+'800080':'Purple',\r
+'999999':'Medium gray',\r
+'FF00FF':'Magenta',\r
+'FFCC00':'Gold',\r
+'FFFF00':'Yellow',\r
+'00FF00':'Lime',\r
+'00FFFF':'Aqua',\r
+'00CCFF':'Sky blue',\r
+'993366':'Brown',\r
+'C0C0C0':'Silver',\r
+'FF99CC':'Pink',\r
+'FFCC99':'Peach',\r
+'FFFF99':'Light yellow',\r
+'CCFFCC':'Pale green',\r
+'CCFFFF':'Pale cyan',\r
+'99CCFF':'Light sky blue',\r
+'CC99FF':'Plum',\r
+'FFFFFF':'White'\r
+},\r
 contextmenu:{\r
 align:"Alignment",\r
 left:"Left",\r
@@ -151,7 +196,8 @@ langs:"Languages",
 wait:"Please wait...",\r
 sug:"Suggestions",\r
 no_sug:"No suggestions",\r
-no_mpell:"No misspellings found."\r
+no_mpell:"No misspellings found.",\r
+learn_word:"Learn word" \r
 },\r
 pagebreak:{\r
 desc:"Insert page break."\r
@@ -167,4 +213,11 @@ upper_roman:"Upper roman",
 circle:"Circle",\r
 disc:"Disc",\r
 square:"Square"\r
-}}});
\ No newline at end of file
+},\r
+aria:{\r
+rich_text_area:"Rich Text Area"\r
+},\r
+wordcount:{\r
+words: 'Words: '\r
+}\r
+}});
\ No newline at end of file
index 873bfd8d38c2bb20615cd632df47617a002a709c..ad6a7b69889f436946c099b634ec2bfe06fe1015 100644 (file)
@@ -1,5 +1,7 @@
 tinyMCE.addI18n('en.advhr_dlg',{\r
+normal:"Normal",\r
 width:"Width",\r
+widthunits:"Units",\r
 size:"Height",\r
 noshade:"No shadow"\r
 });
\ No newline at end of file
index fc37b2aecdeaeb22bc89e28c6acf728e3158c3c9..843e1f8f0b4cd78c79b9e8887c74ec54da7d11af 100644 (file)
@@ -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
index 79cff3f19f7bc1e57c555a4b50c7ca266864f513..ed16b3d4a9d6ed17943f8349e2a670b68e46bda0 100644 (file)
        <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
index 3bda86a2d38e378d31074be4ec621765b207c90e..f222486131e8645db48a1589c447fb372e2d09f0 100644 (file)
@@ -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
@@ -177,6 +177,8 @@ var ImageDialog = {
                        ed.undoManager.add();\r
                }\r
 \r
+               tinyMCEPopup.editor.execCommand('mceRepaint');\r
+               tinyMCEPopup.editor.focus();\r
                tinyMCEPopup.close();\r
        },\r
 \r
@@ -285,7 +287,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 +361,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 +380,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
index f493d196fae5ba43d1a738e781d7f0f7f24c9acf..d8f11e0303727e1f65c58837901fec6aac008b2a 100644 (file)
@@ -28,6 +28,8 @@ alt:"Image description",
 list:"Image list",\r
 border:"Border",\r
 dimensions:"Dimensions",\r
+width:"Width",\r
+height:"Height",\r
 vspace:"Vertical space",\r
 hspace:"Horizontal space",\r
 align:"Alignment",\r
index b78e82f76bca113193546ea8bc142c4c62528a35..837c937c6606f8476b66cfa21e6fd8e509fc0c7c 100644 (file)
@@ -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
@@ -360,20 +365,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 +396,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 +404,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 +429,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
index c71ffbd0f1646355d9a0d28b739de11b96b29bdf..19dff293637fe17d7325be06e5bc34dfc04b6b3e 100644 (file)
@@ -3,8 +3,8 @@ title:"Insert/edit link",
 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
+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 be an external link. Do you want to add the required http:// prefix?",\r
 list:"Link list",\r
 general_tab:"General",\r
 popup_tab:"Popup",\r
@@ -32,6 +32,8 @@ popup_location:"Show location bar",
 popup_resizable:"Make window resizable",\r
 popup_dependent:"Dependent (Mozilla/Firefox only)",\r
 popup_size:"Size",\r
+width:"Width",\r
+height:"Height",\r
 popup_position:"Position (X/Y)",\r
 id:"Id",\r
 style:"Style",\r
index 876669c6b3bb913defeaf84dc8ceef33cee5e9b9..8ab7c2a95c1151b60048f76c458797174a569f59 100644 (file)
@@ -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
index 02d16971a1c362ee0755e3aa1339d0b16de30a8c..8895112b5fcca8dba653e63466817720d65c625c 100644 (file)
@@ -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,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("data-mce-style")}}i.focus()}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",titleItem:true}).setDisabled(1);a(f[d],function(k){if(f.isIE7&&k.styles.listStyleType=="lower-greek"){return}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
index a61887a9220678c7f62f630a47a16abbf2dd80a4..13ef02ddd5f98d80ca5c1cbe189b52abe0ca282e 100644 (file)
@@ -35,6 +35,9 @@
                        // 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
                                        // 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
+                                       ed.focus();\r
                                };\r
 \r
                                btn = cm.createSplitButton(name, {\r
                                                }\r
                                        });\r
 \r
-                                       menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1);\r
+                                       menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);\r
 \r
                                        each(t[name], function(item) {\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 = t.editor.dom.uniqueId();\r
 \r
                                                menu.add({id : item.id, title : item.title, onclick : function() {\r
diff --git a/plugins/TinyMCE/js/plugins/autolink/editor_plugin.js b/plugins/TinyMCE/js/plugins/autolink/editor_plugin.js
new file mode 100644 (file)
index 0000000..c0f683a
--- /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\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("mceInsertLink",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/plugins/TinyMCE/js/plugins/autolink/editor_plugin_src.js b/plugins/TinyMCE/js/plugins/autolink/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..ddfe049
--- /dev/null
@@ -0,0 +1,172 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2011, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       tinymce.create('tinymce.plugins.AutolinkPlugin', {
+       /**
+       * 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) {
+               var t = this;
+
+               // Internet Explorer has built-in automatic linking
+               if (tinyMCE.isIE)
+                       return;
+
+               // Add a key down handler
+               ed.onKeyDown.add(function(ed, e) {
+                       if (e.keyCode == 13)
+                               return t.handleEnter(ed);
+                       });
+
+               ed.onKeyPress.add(function(ed, e) {
+                       if (e.which == 41)
+                               return t.handleEclipse(ed);
+               });
+
+               // Add a key up handler
+               ed.onKeyUp.add(function(ed, e) {
+                       if (e.keyCode == 32)
+                               return t.handleSpacebar(ed);
+                       });
+              },
+
+               handleEclipse : function(ed) {
+                       this.parseCurrentLine(ed, -1, '(', true);
+               },
+
+               handleSpacebar : function(ed) {
+                        this.parseCurrentLine(ed, 0, '', true);
+                },
+
+               handleEnter : function(ed) {
+                       this.parseCurrentLine(ed, -1, '', false);
+               },
+
+               parseCurrentLine : function(ed, end_offset, delimiter, goback) {
+                       var r, end, start, endContainer, bookmark, text, matches, prev, len;
+
+                       // We need at least five characters to form a URL,
+                       // hence, at minimum, five characters from the beginning of the line.
+                       r = ed.selection.getRng().cloneRange();
+                       if (r.startOffset < 5) {
+                               // During testing, the caret is placed inbetween two text nodes. 
+                               // The previous text node contains the URL.
+                               prev = r.endContainer.previousSibling;
+                               if (prev == null) {
+                                       if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
+                                               return;
+
+                                       prev = r.endContainer.firstChild.nextSibling;
+                               }
+                               len = prev.length;
+                               r.setStart(prev, len);
+                               r.setEnd(prev, len);
+
+                               if (r.endOffset < 5)
+                                       return;
+
+                               end = r.endOffset;
+                               endContainer = prev;
+                       } else {
+                               endContainer = r.endContainer;
+
+                               // Get a text node
+                               if (endContainer.nodeType != 3 && endContainer.firstChild) {
+                                       while (endContainer.nodeType != 3 && endContainer.firstChild)
+                                               endContainer = endContainer.firstChild;
+
+                                       r.setStart(endContainer, 0);
+                                       r.setEnd(endContainer, endContainer.nodeValue.length);
+                               }
+
+                               if (r.endOffset == 1)
+                                       end = 2;
+                               else
+                                       end = r.endOffset - 1 - end_offset;
+                       }
+
+                       start = end;
+
+                       do
+                       {
+                               // Move the selection one character backwards.
+                               r.setStart(endContainer, end - 2);
+                               r.setEnd(endContainer, end - 1);
+                               end -= 1;
+
+                               // Loop until one of the following is found: a blank space, &nbsp;, delimeter, (end-2) >= 0
+                       } while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
+
+                       if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
+                               r.setStart(endContainer, end);
+                               r.setEnd(endContainer, start);
+                               end += 1;
+                       } else if (r.startOffset == 0) {
+                               r.setStart(endContainer, 0);
+                               r.setEnd(endContainer, start);
+                       }
+                       else {
+                               r.setStart(endContainer, end);
+                               r.setEnd(endContainer, start);
+                       }
+
+                       text = r.toString();
+                       matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);
+
+                       if (matches) {
+                               if (matches[1] == 'www.') {
+                                       matches[1] = 'http://www.';
+                               }
+
+                               bookmark = ed.selection.getBookmark();
+
+                               ed.selection.setRng(r);
+                               tinyMCE.execCommand('mceInsertLink',false, matches[1] + matches[2]);
+                               ed.selection.moveToBookmark(bookmark);
+
+                               // TODO: Determine if this is still needed.
+                               if (tinyMCE.isWebKit) {
+                                       // move the caret to its original position
+                                       ed.selection.collapse(false);
+                                       var max = Math.min(endContainer.length, start + 1);
+                                       r.setStart(endContainer, max);
+                                       r.setEnd(endContainer, max);
+                                       ed.selection.setRng(r);
+                               }
+                       }
+               },
+
+               /**
+               * 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 : '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
+                       };
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
+})();
index 1676b154a88aa0f3f8ba34eacca2efb32ad3c33a..6c4ff0d5dfc3a3d59a412c0e34529c3165a3cb22 100644 (file)
@@ -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 i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:i.body.offsetHeight;if(g>d.autoresize_min_height){j=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){j=d.autoresize_max_height;a.getBody().style.overflowY="auto"}else{a.getBody().style.overflowY="hidden"}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}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.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.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
index c260b7a24f542784832d3b7e09a81152451848af..7d113419d98a17ff03a0b8d2b1738110d5895996 100644 (file)
@@ -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;
                                var d = ed.getDoc(), b = 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 ? b.scrollHeight : d.body.offsetHeight;
 
                                // Don't make it smaller than the minimum height
                                if (myHeight > t.autoresize_min_height)
                                        resizeHeight = myHeight;
 
+                               // 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;
+                                       ed.getBody().style.overflowY = "auto";
+                               } else
+                                       ed.getBody().style.overflowY = "hidden";
+
                                // Resize content element
-                               DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+                               if (resizeHeight !== oldSize) {
+                                       DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+                                       oldSize = resizeHeight;
+                               }
 
                                // if we're throbbing, we'll re-throb to match the new size
                                if (t.throbbing) {
                        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);
 
        // Register plugin
        tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
-})();
\ No newline at end of file
+})();
index 6e485400b337ff548b1be3a2970fabdf58083d80..7f49107e658986087ad6325fda8d513118d07c6c 100644 (file)
@@ -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({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();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({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,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,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
index 581e8f6d2c3f88aadf197b7a2b24229042400f9b..061cf13519653d9ec4bd5bb30ae07ab479cd46b5 100644 (file)
 \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
index 930fdff0afcff943ffef53b2b81f8b7d4c74bc83..8f8821fd64f76d016a67846b597f70d1da72565d 100644 (file)
@@ -1 +1 @@
-(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;/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
+(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
index 5586637f3335bee2ccf92d003d90dbfc7666a546..4e7eb3377ff1fa4e01aae2f8f4b5a60bb4d9da0b 100644 (file)
@@ -79,7 +79,7 @@
                        rep(/<br>/gi,"\n");\r
                        rep(/<p>/gi,"");\r
                        rep(/<\/p>/gi,"\n");\r
-                       rep(/&nbsp;/gi," ");\r
+                       rep(/&nbsp;|\u00a0/gi," ");\r
                        rep(/&quot;/gi,"\"");\r
                        rep(/&lt;/gi,"<");\r
                        rep(/&gt;/gi,">");\r
index 9749e5164cf1ac14bf24d2360dcc00e5f5033fb5..af7ae54453bf24e3a28b38825673df1e5b2fc085 100644 (file)
@@ -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)}}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
index 13813a64e4630df01ed620a1d04554c00c4ad939..956fbea99880c9825a5cf24e025170314615474b 100644 (file)
                 * @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
 \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
index 55a1d72fa7f87cf051eaf6e45e4a00af8578a609..2c91002e4e0d3c40bd74e7e4e0e8625aecbff6a1 100644 (file)
@@ -5,36 +5,37 @@
        <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
+       <table role="presentation" 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
+               </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
+               </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
+               </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
+               </tr>\r
+       </table>\r
+</div>\r
 </body>\r
 </html>\r
index 16f68cc1e91a9b8ec6cfa0ba4e0c86f94b177f1a..c7cf1011dad0e7500e29a278b0d395b253871109 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-foot-in-mouth.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-foot-in-mouth.gif differ
index 1606c119e75678c4031f384e0d50849906e8f533..82c5b182e61d32bd394acae551eff180f1eebd26 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-laughing.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-laughing.gif differ
index b33d3cca1e7b8e62dc689880074d5c61f619520d..fe66220c24b4da4526818a5d68f75a06d9985a29 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-sealed.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-sealed.gif differ
index e6a9e60d5ddd1243fbbf2197b4dc6cd9c1b58b93..fd27edfaaa29a70a8c4563c0eab9f18c74d374fd 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-smile.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-smile.gif differ
index cb99cdd9136fa30462a9f57aa6a0adeb7e4124e7..0cc9bb71cca4cdeafbb248ce7e07c3708c1cbd64 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-surprised.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-surprised.gif differ
index 9faf1aff8f4b28e02f4f414975fe1859c43b6b54..0631c7616ec8624ddeee02b633326f697ee72f80 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/emotions/img/smiley-wink.gif and b/plugins/TinyMCE/js/plugins/emotions/img/smiley-wink.gif differ
diff --git a/plugins/TinyMCE/js/plugins/example_dependency/editor_plugin.js b/plugins/TinyMCE/js/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/plugins/TinyMCE/js/plugins/example_dependency/editor_plugin_src.js b/plugins/TinyMCE/js/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']);
+})();
index 7a3334f08d0bdc7da68f0368ce183661dde6f468..2675cec155e4ce10cc2323ccd243bd00b5256177 100644 (file)
        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
index aeaa66979471fff1061f0fcc922ec3f8c6573760..eb0ec33120fb0c82830b4682a79483daa76338b1 100644 (file)
@@ -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")||""})}if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l)}else{e.remove("fullpage_styles")}},_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
index a2c9df898708b3b160ee1582761c3c79e397aa24..5725b56152567e6b3bcff196354718bed9616ef3 100644 (file)
@@ -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
+                       if (styles)\r
+                               dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);\r
+                       else\r
+                               dom.remove('fullpage_styles');\r
+               },\r
 \r
-                               if (v = ed.getParam('fullpage_default_encoding'))\r
-                                       t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';\r
+               _getDefaultHeader : function() {\r
+                       var header = '', editor = this.editor, value, styles = '';\r
 \r
-                               if (v = ed.getParam('fullpage_default_font_family'))\r
-                                       st += 'font-family: ' + 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
-                               if (v = ed.getParam('fullpage_default_font_size'))\r
-                                       st += 'font-size: ' + v + ';';\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 (v = ed.getParam('fullpage_default_text_color'))\r
-                                       st += 'color: ' + v + ';';\r
+                       if (value = editor.getParam('fullpage_default_title'))\r
+                               header += '<title>' + value + '</title>\n';\r
 \r
-                               t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';\r
-                               t.foot = '\n</body>\n</html>';\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
index c32afaf2d9702024da5a7dc834ff00e1e4dc12c8..14ab8652eae4abbe69fe3c55a2c04ed1ceee514a 100644 (file)
@@ -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
index a1bb719a383e61708aaccd6a9e237bfbc55a870c..3f672ad3ba334b2aa62b991ca31164e5e44b5bfa 100644 (file)
  * 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
index 4437bd266c75b25b09c9788beef44f5d63a8c184..6eae3ec84a1a577ad65494723cf6b452c4ddff9d 100644 (file)
@@ -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({format:"raw"}),{format:"raw"});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({format:"raw"}),{format:"raw"});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
index 0efd9bbe57e4148d7ff8cae7205956b2ef082513..3477c86c9bcc191b78838ac87c315d54dab21ec4 100644 (file)
@@ -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
                                        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
index 07ea477b7cab9f7c32a25bb51e8f2b9306b14e4c..ef648174f062c2af47271b5f94126ad9d1d69cf7 100644 (file)
@@ -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=="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
index e991683de49c2992f5acdb3f121369e866bebf13..ac6fb1cb9819355be4106c97ace54fdfbb42ce80 100644 (file)
@@ -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
                                        }\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
index 94abd08763fffdaa0dd5c5afb470a97294f2b94d..219139857ead162c6c83fa92e4a36eb978359b70 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/alert.gif and b/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ
index e671094cb0eb210b756117f992cf5ca2caa698fd..f957e49a3dda34867982d54bdbbf46e5b6c11298 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/button.gif and b/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ
index 497307a85ad32e00b67c5f27d6f3b46ac566d89b..20acbbf7aec8a3fccbffbbb894f973241a045732 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif and b/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ
index c894b2e83522ae29d32e0ed57007d1285c715a7f..d5de1cc236c9e44b2bcce92b4444f9cc7c43c551 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/corners.gif and b/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ
index 43a735f22c81d6d7d99c1ba9f034f38bfdd1a92b..0b4cc3682a1c62b3583d83ad83b84fce14461ec3 100644 (file)
Binary files a/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif and b/plugins/TinyMCE/js/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ
index 5e6fd7d3cfff5bdbe30cc8c63e05d82e061ab3ab..a50d4fc573055958412ce7ccab45c76a579d89b1 100644 (file)
@@ -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)}
index f88a6dd28d0a89fd9f565934fe9db62d576e3bf3..d610f7e9de894fc2729b2ee4164ac0f22ef73400 100644 (file)
@@ -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(){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.dom.setAttrib(b,"data-mce-style","");a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
\ No newline at end of file
index d5aa86548cb456c24a1fef760eace4873085b157..a8ac5a72fcbc01f9eefa40d732564085d01d882a 100644 (file)
                                                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
index 29d43c52443e9b63f3f818af73ad0cf29ae58a10..b3a4ce31c5e76bf61a840e714054cb60980fa83f 100644 (file)
@@ -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
index e852da15eac05b5853b267c9066c9f97f39c7c56..e627ec76e4bbc53445834d299dfe31bf6261f5b6 100644 (file)
@@ -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/plugins/TinyMCE/js/plugins/linkautodetect/changelog.txt b/plugins/TinyMCE/js/plugins/linkautodetect/changelog.txt
deleted file mode 100644 (file)
index ecab340..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-0.1     2009-04-15 - initial version\r
-0.11    2009-05-10 - Fix for email addresses with two periods in the domain\r
-                        were incorrectly converted to http links.  Fix submitted\r
-                        by Ralph Slooten.\r
-                     Fix for tinyMCE.isIE that needed to be tinymce.isIE.\r
-0.12    2009-06-23 - Fix for URLs that have an HTML anchor identifier in them, such as\r
-                     http://www.palmpre.org/forums/palm-pre/85-copy-and-paste.html#post457\r
-                     Previously, it would create a link to only\r
-                     http://www.palmpre.org/forums/palm-pre/85-copy-and-paste.html
\ No newline at end of file
diff --git a/plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin.js b/plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin.js
deleted file mode 100644 (file)
index 7e97a78..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-(function(){tinymce.create('tinymce.plugins.LinkAutoDetect',{init:function(ed,url){var t=this;t.RE_email=/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i;t.RE_url=/^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-z][a-z0-9_]*)?$/i;ed.onKeyPress.add(t.onKeyPress,t);ed.onKeyUp.add(t.onKeyUp,t);},getInfo:function(){return{longname:'Link Auto Detect',author:'Ubernote/Shane Tomlinson',authorurl:'http://www.ubernote.com',infourl:'http://www.ubernote.com',version:'0.2'};},onKeyPress:function(ed,ev,o){if(tinymce.isIE){return;}
-var s=ed.selection.getSel();var textNode=s.anchorNode;var createLink=function(searchfor,hlink,midStart){var leftText=textNode;var rightText=leftText.splitText(s.anchorOffset);var midText=leftText.splitText(midStart);var midEnd=midText.data.search(searchfor);if(midEnd!=-1){rightText=midText.splitText(midEnd);}
-var tag=ed.dom.create('a',{href:hlink},midText.data);var a=midText.parentNode.insertBefore(tag,rightText);s.collapse(rightText,0);ed.dom.remove(midText);};if((ev.which==13||ev.which==32)&&textNode.nodeType==3&&textNode.data.length>3&&textNode.data.indexOf('.')>=0&&!ed.dom.getParent(textNode,'a')){var midStart=textNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);if(midStart!=-1){var matchData=textNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,'$1');var matchURL=matchData.match(this.RE_url);var matchEmail=matchData.match(this.RE_email);if(matchEmail){createLink(/[^a-zA-Z0-9\.@_\-]/,'mailto:'+matchEmail[0],midStart);}
-else if(matchURL){createLink(/[^a-zA-Z0-9\._\-\/\&\?#=:@]/,(matchURL[1]?'':'http://')+matchURL[0],midStart);}}}},onKeyUp:function(ed,ev,o){if(tinymce.isIE){return;}
-var s=ed.selection.getSel();var textNode=s.anchorNode;var a=ed.dom.getParent(textNode,'a');if(!(ev.which&&(ev.which==13||ev.which==32))&&(ev.which||ev.keyCode==8||ev.keyCode==46)&&(textNode.nodeType==3)&&(a)){var matchEmail=s.anchorNode.data.match(this.RE_email);var matchURL=textNode.data.match(this.RE_url);if(matchEmail){ed.dom.setAttrib(a,'href','mailto:'+textNode.data);}
-if(matchURL){ed.dom.setAttrib(a,'href',(matchURL[1]?'':'http://')+matchURL[0]);}}}});tinymce.PluginManager.add('linkautodetect',tinymce.plugins.LinkAutoDetect);})();
\ No newline at end of file
diff --git a/plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin_src.js b/plugins/TinyMCE/js/plugins/linkautodetect/editor_plugin_src.js
deleted file mode 100644 (file)
index d269392..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/**\r
- * $Id: editor_plugin_src.js 2009-05-10\r
- *\r
- * @author Ubernote/Shane Tomlinson\r
- * http://www.ubernote.com\r
- * set117@gmail.com\r
- *\r
- * Detect emails and urls as they are typed in Mozilla/Safari/Chrome and Opera\r
- * Borrowed from both Typo3 http://typo3.org/ and Xinha http://xinha.gogo.co.nz/\r
- * Heavily modified and cleaned up.\r
- * \r
- * Original license info from Xinha at the bottom.\r
- */\r
-\r
-(function() {\r
-       tinymce.create('tinymce.plugins.LinkAutoDetect', {\r
-               init : function(ed, url) {\r
-                       var t = this;\r
-                       t.RE_email = /^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i;\r
-                       t.RE_url   = /^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-z][a-z0-9_]*)?$/i;\r
-                       ed.onKeyPress.add( t.onKeyPress, t );\r
-                       ed.onKeyUp.add( t.onKeyUp, t );\r
-               },\r
-               \r
-               getInfo : function() {\r
-                       return {\r
-                               longname : 'Link Auto Detect',\r
-                               author : 'Ubernote/Shane Tomlinson',\r
-                               authorurl : 'http://www.ubernote.com',\r
-                               infourl : 'http://www.ubernote.com',\r
-                               version : '0.2'\r
-                       };\r
-               },\r
-               \r
-               onKeyPress : function(ed, ev, o) {\r
-                       if(tinymce.isIE) {   \r
-                               // IE already does auto-detect, so no worries.\r
-                               return;\r
-                       } // end if\r
-                       \r
-                       var s = ed.selection.getSel();\r
-                       var textNode = s.anchorNode;\r
-                       \r
-                       var createLink = function (searchfor, hlink, midStart) {\r
-                               var leftText  = textNode;\r
-                               var rightText = leftText.splitText(s.anchorOffset);\r
-                               var midText   = leftText.splitText(midStart);\r
-                               var midEnd = midText.data.search(searchfor);\r
-                               if (midEnd != -1) {\r
-                                       rightText = midText.splitText(midEnd);\r
-                               } // end if\r
-                               var tag = ed.dom.create('a', { href: hlink }, midText.data);\r
-                               var a = midText.parentNode.insertBefore(tag, rightText);\r
-                               \r
-                               // We are going to put the cursor into the first position after\r
-                               //  the anchor and let the browser take care of inserting the space/enter.\r
-                               s.collapse(rightText, 0);\r
-                               ed.dom.remove(midText);\r
-                       };\r
-                       \r
-                       // Space or Enter, see if the text just typed looks like a URL, or email address and link it accordingly\r
-                       if((ev.which == 13 || ev.which == 32) \r
-                               && textNode.nodeType == 3 && textNode.data.length > 3 \r
-                               && textNode.data.indexOf('.') >= 0 && !ed.dom.getParent(textNode, 'a')) {\r
-                               var midStart = textNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);\r
-                               if(midStart != -1) {\r
-                                       var matchData = textNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/, '$1');\r
-                                       var matchURL = matchData.match(this.RE_url);\r
-                                       var matchEmail = matchData.match(this.RE_email);\r
-                                       if(matchEmail) {\r
-                                               createLink(/[^a-zA-Z0-9\.@_\-]/, 'mailto:' + matchEmail[0], midStart);\r
-                                       }\r
-                                       else if(matchURL) {\r
-                                               createLink( /[^a-zA-Z0-9\._\-\/\&\?#=:@]/, (matchURL[1] ? '' : 'http://') + matchURL[0], midStart);\r
-                                       }\r
-                               } // end if\r
-                       }\r
-               },\r
-               \r
-               onKeyUp : function(ed, ev, o) {\r
-                       if(tinymce.isIE) {   \r
-                               // IE already does auto-detect, so no worries.\r
-                               return;\r
-                       } // end if\r
-                       \r
-                       var s = ed.selection.getSel();\r
-                       var textNode = s.anchorNode;\r
-                               var a = ed.dom.getParent(textNode, 'a');\r
-                               \r
-                               if( ! (ev.which && ( ev.which == 13 || ev.which == 32)) \r
-                                       && (ev.which || ev.keyCode == 8 || ev.keyCode == 46)\r
-                                       && (textNode.nodeType == 3) && (a)) {\r
-                                       // See if we might be changing a link\r
-                                       var matchEmail = s.anchorNode.data.match(this.RE_email);\r
-                                       var matchURL = textNode.data.match(this.RE_url);\r
-                                       if(matchEmail) {\r
-                                               ed.dom.setAttrib(a, 'href', 'mailto:' + textNode.data);\r
-                                       } // end if\r
-                                       if(matchURL) {\r
-                                               ed.dom.setAttrib(a, 'href', (matchURL[1] ? '' : 'http://') + matchURL[0]);\r
-                                       } // end if\r
-                               } // end if\r
-                       }\r
-       });\r
-\r
-       // Register plugin\r
-       tinymce.PluginManager.add('linkautodetect', tinymce.plugins.LinkAutoDetect);\r
-})();\r
-\r
-/*\r
-htmlArea License (based on BSD license)\r
-Copyright (c) 2002-2004, interactivetools.com, inc.\r
-Copyright (c) 2003-2004 dynarch.com\r
-All rights reserved.\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are met:\r
-\r
-1) Redistributions of source code must retain the above copyright notice,\r
-   this list of conditions and the following disclaimer.\r
-\r
-2) Redistributions in binary form must reproduce the above copyright notice,\r
-   this list of conditions and the following disclaimer in the documentation\r
-   and/or other materials provided with the distribution.\r
-\r
-3) Neither the name of interactivetools.com, inc. nor the names of its\r
-   contributors may be used to endorse or promote products derived from this\r
-   software without specific prior written permission.\r
-\r
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
-POSSIBILITY OF SUCH DAMAGE.\r
-*/
\ No newline at end of file
diff --git a/plugins/TinyMCE/js/plugins/lists/editor_plugin.js b/plugins/TinyMCE/js/plugins/lists/editor_plugin.js
new file mode 100644 (file)
index 0000000..0fb8263
--- /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{if(v&&u.tagName==="P"&&t.tagName==="P"){return true}else{return false}}}}}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(u,v){var s=false;function y(z){return z.keyCode===9&&(u.queryCommandState("InsertUnorderedList")||u.queryCommandState("InsertOrderedList"))}function w(z,B){var A=z.selection,C;if(B.keyCode===13){C=A.getStart();if(C.tagName=="BR"&&C.parentNode.tagName=="LI"){C=C.parentNode}s=A.isCollapsed()&&C&&C.tagName==="LI"&&(C.childNodes.length===0||(C.firstChild.nodeName=="BR"&&C.childNodes.length===1));return s}}function t(z,A){if(y(A)||w(z,A)){return r.cancel(A)}}function x(C,E){if(!tinymce.isGecko){return}var A=C.selection.getStart();if(E.keyCode!=8||A.tagName!=="IMG"){return}function B(K){var L=K.firstChild;var J=null;do{if(!L){break}if(L.tagName==="LI"){J=L}}while(L=L.nextSibling);return J}function I(K,J){while(K.childNodes.length>0){J.appendChild(K.childNodes[0])}}var F;if(A.parentNode.previousSibling.tagName==="UL"||A.parentNode.previousSibling.tagName==="OL"){F=A.parentNode.previousSibling}else{if(A.parentNode.previousSibling.previousSibling.tagName==="UL"||A.parentNode.previousSibling.previousSibling.tagName==="OL"){F=A.parentNode.previousSibling.previousSibling}else{return}}var H=B(F);var z=C.dom.createRng();z.setStart(H,1);z.setEnd(H,1);C.selection.setRng(z);C.selection.collapse(true);var D=C.selection.getBookmark();var G=A.parentNode.cloneNode(true);if(G.tagName==="P"||G.tagName==="DIV"){I(G,H)}else{H.appendChild(G)}A.parentNode.parentNode.removeChild(A.parentNode);C.selection.moveToBookmark(D)}this.ed=u;u.addCommand("Indent",this.indent,this);u.addCommand("Outdent",this.outdent,this);u.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);u.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);u.onInit.add(function(){u.editorCommands.addCommands({outdent:function(){var A=u.selection,B=u.dom;function z(C){C=B.getParent(C,B.isBlock);return C&&(parseInt(u.dom.getStyle(C,"margin-left")||0,10)+parseInt(u.dom.getStyle(C,"padding-left")||0,10))>0}return z(A.getStart())||z(A.getEnd())||u.queryCommandState("InsertOrderedList")||u.queryCommandState("InsertUnorderedList")}},"state")});u.onKeyUp.add(function(A,B){var C,z;if(y(B)){A.execCommand(B.shiftKey?"Outdent":"Indent",true,null);return r.cancel(B)}else{if(s&&w(A,B)){if(A.queryCommandState("InsertOrderedList")){A.execCommand("InsertOrderedList")}else{A.execCommand("InsertUnorderedList")}C=A.selection.getStart();if(C&&C.tagName==="LI"){C=A.dom.getParent(C,"ol,ul").nextSibling;if(C&&C.tagName==="P"){if(!C.firstChild){C.appendChild(A.getDoc().createTextNode(""))}z=A.dom.createRng();z.setStart(C.firstChild,1);z.setEnd(C.firstChild,1);A.selection.setRng(z)}}return r.cancel(B)}}});u.onKeyPress.add(t);u.onKeyDown.add(t);u.onKeyDown.add(x)},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,Q){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(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(Q,L,O){var t,P=Q,N,M;while(!I.isBlock(Q.parentNode)&&Q.parentNode!==I.getRoot()){Q=I.split(Q.parentNode,Q.previousSibling);Q=Q.nextSibling;P=Q}if(O){t=O.cloneNode(true);Q.parentNode.insertBefore(t,Q);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");Q.parentNode.insertBefore(t,Q)}while(P&&P!=L){N=P.nextSibling;t.appendChild(P);P=N}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(V){var U;if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(P(N,V)){I.addClass(V,"_mce_tagged_br");N=S(V)}});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||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}}else{B={defaultAction:x}}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)})},outdent:function(){var v=this,u=v.ed,w=u.dom,s=[];function x(t){var z,y,A;if(!d(u,t,s)){if(w.getStyle(t,"margin-left")!==""||w.getStyle(t,"padding-left")!==""){return v.adjustPaddingFunction(false)(t)}A=w.getStyle(t,"text-align",true);if(A==="center"||A==="right"){w.setStyle(t,"text-align","left");return}t=c(t,w);z=t.parentNode;y=t.parentNode.parentNode;if(y.tagName==="P"){w.split(y,t.parentNode)}else{w.split(z,t);if(y.tagName==="LI"){w.split(y,t)}else{if(!w.is(y,"ol,ul")){w.rename(t,"p")}}}s.push(t)}}this.process({LI:x,defaultAction:this.adjustPaddingFunction(false)});e(s,m)},process:function(x){var B=this,v=B.ed.selection,y=B.ed.dom,A,s;function w(t){y.removeClass(t,"_mce_act_on");if(!t||t.nodeType!==1){return}t=k(t,y);var C=x[t.tagName];if(!C){C=x.defaultAction}C(t)}function u(t){B.splitSafeEach(t.childNodes,w)}function z(t,C){return C>=0&&t.hasChildNodes()&&C<t.childNodes.length&&t.childNodes[C].tagName==="BR"}A=v.getSelectedBlocks();if(A.length===0){A=[y.getRoot()]}s=v.getRng(true);if(!s.collapsed){if(z(s.endContainer,s.endOffset-1)){s.setEnd(s.endContainer,s.endOffset-1);v.setRng(s)}if(z(s.startContainer,s.startOffset)){s.setStart(s.startContainer,s.startOffset+1);v.setRng(s)}}g=v.getBookmark();x.OL=x.UL=u;B.splitSafeEach(A,w);v.moveToBookmark(g);g=null;B.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:"")}},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/plugins/TinyMCE/js/plugins/lists/editor_plugin_src.js b/plugins/TinyMCE/js/plugins/lists/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..3952cff
--- /dev/null
@@ -0,0 +1,688 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2011, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+       var each = tinymce.each, Event = tinymce.dom.Event, bookmark;
+
+       // Skips text nodes that only contain whitespace since they aren't semantically important.
+       function skipWhitespaceNodes(e, next) {
+               while (e && (e.nodeType === 8 || (e.nodeType === 3 && /^[ \t\n\r]*$/.test(e.nodeValue)))) {
+                       e = next(e);
+               }
+               return e;
+       }
+       
+       function skipWhitespaceNodesBackwards(e) {
+               return skipWhitespaceNodes(e, function(e) { return e.previousSibling; });
+       }
+       
+       function skipWhitespaceNodesForwards(e) {
+               return skipWhitespaceNodes(e, function(e) { return e.nextSibling; });
+       }
+       
+       function hasParentInList(ed, e, list) {
+               return ed.dom.getParent(e, function(p) {
+                       return tinymce.inArray(list, p) !== -1;
+               });
+       }
+       
+       function isList(e) {
+               return e && (e.tagName === 'OL' || e.tagName === 'UL');
+       }
+       
+       function splitNestedLists(element, dom) {
+               var tmp, nested, wrapItem;
+               tmp = skipWhitespaceNodesBackwards(element.lastChild);
+               while (isList(tmp)) {
+                       nested = tmp;
+                       tmp = skipWhitespaceNodesBackwards(nested.previousSibling);
+               }
+               if (nested) {
+                       wrapItem = dom.create('li', { style: 'list-style-type: none;'});
+                       dom.split(element, nested);
+                       dom.insertAfter(wrapItem, nested);
+                       wrapItem.appendChild(nested);
+                       wrapItem.appendChild(nested);
+                       element = wrapItem.previousSibling;
+               }
+               return element;
+       }
+       
+       function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
+               e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
+               return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
+       }
+       
+       function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
+               var prev = skipWhitespaceNodesBackwards(e.previousSibling);
+               if (prev) {
+                       return attemptMerge(prev, e, allowDifferentListStyles ? prev : false, mergeParagraphs);
+               } else {
+                       return e;
+               }
+       }
+       
+       function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
+               var next = skipWhitespaceNodesForwards(e.nextSibling);
+               if (next) {
+                       return attemptMerge(e, next, allowDifferentListStyles ? next : false, mergeParagraphs);
+               } else {
+                       return e;
+               }
+       }
+       
+       function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
+               if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
+                       return merge(e1, e2, differentStylesMasterElement);
+               } else if (e1 && e1.tagName === 'LI' && isList(e2)) {
+                       // Fix invalidly nested lists.
+                       e1.appendChild(e2);
+               }
+               return e2;
+       }
+       
+       function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
+               if (!e1 || !e2) {
+                       return false;
+               } else if (e1.tagName === 'LI' && e2.tagName === 'LI') {
+                       return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
+               } else if (isList(e1)) {
+                       return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
+               } else if (mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P') {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+       
+       function isListForIndent(e) {
+               var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
+               return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none'  || containsOnlyAList(firstLI));
+       }
+       
+       function containsOnlyAList(e) {
+               var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
+               return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
+       }
+       
+       function merge(e1, e2, masterElement) {
+               var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
+               if (e1.tagName === 'P') {
+                       e1.appendChild(e1.ownerDocument.createElement('br'));
+               }
+               while (e2.firstChild) {
+                       e1.appendChild(e2.firstChild);
+               }
+               if (masterElement) {
+                       e1.style.listStyleType = masterElement.style.listStyleType;
+               }
+               e2.parentNode.removeChild(e2);
+               attemptMerge(lastOriginal, firstNew, false);
+               return e1;
+       }
+       
+       function findItemToOperateOn(e, dom) {
+               var item;
+               if (!dom.is(e, 'li,ol,ul')) {
+                       item = dom.getParent(e, 'li');
+                       if (item) {
+                               e = item;
+                       }
+               }
+               return e;
+       }
+       
+       tinymce.create('tinymce.plugins.Lists', {
+               init: function(ed, url) {
+                       var enterDownInEmptyList = false;
+
+                       function isTriggerKey(e) {
+                               return e.keyCode === 9 && (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
+                       };
+
+                       function isEnterInEmptyListItem(ed, e) {
+                               var sel = ed.selection, n;
+                               if (e.keyCode === 13) {
+                                       n = sel.getStart();
+
+                                       // Get start will return BR if the LI only contains a BR
+                                       if (n.tagName == 'BR' && n.parentNode.tagName == 'LI')
+                                               n = n.parentNode;
+
+                                       // Check for empty LI or a LI with just one BR since Gecko and WebKit uses BR elements to place the caret
+                                       enterDownInEmptyList = sel.isCollapsed() && n && n.tagName === 'LI' && (n.childNodes.length === 0 || (n.firstChild.nodeName == 'BR' && n.childNodes.length === 1));
+                                       return enterDownInEmptyList;
+                               }
+                       };
+
+                       function cancelKeys(ed, e) {
+                               if (isTriggerKey(e) || isEnterInEmptyListItem(ed, e)) {
+                                       return Event.cancel(e);
+                               }
+                       };
+
+                       function imageJoiningListItem(ed, e) {
+                               if (!tinymce.isGecko)
+                                       return;
+
+                               var n = ed.selection.getStart();
+                               if (e.keyCode != 8 || n.tagName !== 'IMG') 
+                                       return;
+
+                               function lastLI(node) {
+                                       var child = node.firstChild;
+                                       var li = null;
+                                       do {
+                                               if (!child)
+                                                       break;
+
+                                               if (child.tagName === 'LI')
+                                                       li = child;
+                                       } while (child = child.nextSibling);
+
+                                       return li;
+                               }
+
+                               function addChildren(parentNode, destination) {
+                                       while (parentNode.childNodes.length > 0)
+                                               destination.appendChild(parentNode.childNodes[0]);
+                               }
+
+                               var ul;
+                               if (n.parentNode.previousSibling.tagName === 'UL' || n.parentNode.previousSibling.tagName === 'OL')
+                                       ul = n.parentNode.previousSibling;
+                               else if (n.parentNode.previousSibling.previousSibling.tagName === 'UL' || n.parentNode.previousSibling.previousSibling.tagName === 'OL')
+                                       ul = n.parentNode.previousSibling.previousSibling;
+                               else
+                                       return;
+
+                               var li = lastLI(ul);
+
+                               // move the caret to the end of the list item
+                               var rng = ed.dom.createRng();
+                               rng.setStart(li, 1);
+                               rng.setEnd(li, 1);
+                               ed.selection.setRng(rng);
+                               ed.selection.collapse(true);
+
+                               // save a bookmark at the end of the list item
+                               var bookmark = ed.selection.getBookmark();
+
+                               // copy the image an its text to the list item
+                               var clone = n.parentNode.cloneNode(true);
+                               if (clone.tagName === 'P' || clone.tagName === 'DIV')
+                                       addChildren(clone, li);
+                               else
+                                       li.appendChild(clone);
+                                       
+                               // remove the old copy of the image
+                               n.parentNode.parentNode.removeChild(n.parentNode);
+
+                               // move the caret where we saved the bookmark
+                               ed.selection.moveToBookmark(bookmark);
+                       }
+
+                       this.ed = ed;
+                       ed.addCommand('Indent', this.indent, this);
+                       ed.addCommand('Outdent', this.outdent, this);
+                       ed.addCommand('InsertUnorderedList', function() {
+                               this.applyList('UL', 'OL');
+                       }, this);
+                       ed.addCommand('InsertOrderedList', function() {
+                               this.applyList('OL', 'UL');
+                       }, this);
+                       
+                       ed.onInit.add(function() {
+                               ed.editorCommands.addCommands({
+                                       'outdent': function() {
+                                               var sel = ed.selection, dom = ed.dom;
+                                               function hasStyleIndent(n) {
+                                                       n = dom.getParent(n, dom.isBlock);
+                                                       return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
+                                               }
+                                               return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
+                                       }
+                               }, 'state');
+                       });
+                       
+                       ed.onKeyUp.add(function(ed, e) {
+                               var n, rng;
+                               if (isTriggerKey(e)) {
+                                       ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
+                                       return Event.cancel(e);
+                               } else if (enterDownInEmptyList && isEnterInEmptyListItem(ed, e)) {
+                                       if (ed.queryCommandState('InsertOrderedList')) {
+                                               ed.execCommand('InsertOrderedList');
+                                       } else {
+                                               ed.execCommand('InsertUnorderedList');
+                                       }
+                                       n = ed.selection.getStart();
+                                       if (n && n.tagName === 'LI') {
+                                               // Fix the caret position on IE since it jumps back up to the previous list item.
+                                               n = ed.dom.getParent(n, 'ol,ul').nextSibling;
+                                               if (n && n.tagName === 'P') {
+                                                       if (!n.firstChild) {
+                                                               n.appendChild(ed.getDoc().createTextNode(''));
+                                                       }
+                                                       rng = ed.dom.createRng();
+                                                       rng.setStart(n.firstChild, 1);
+                                                       rng.setEnd(n.firstChild, 1);
+                                                       ed.selection.setRng(rng);
+                                               }
+                                       }
+                                       return Event.cancel(e);
+                               }
+                       });
+                       ed.onKeyPress.add(cancelKeys);
+                       ed.onKeyDown.add(cancelKeys);
+                       ed.onKeyDown.add(imageJoiningListItem);
+               },
+               
+               applyList: function(targetListType, oppositeListType) {
+                       var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
+                               selectedBlocks = ed.selection.getSelectedBlocks();
+                       
+                       function cleanupBr(e) {
+                               if (e && e.tagName === 'BR') {
+                                       dom.remove(e);
+                               }
+                       }
+                       
+                       function makeList(element) {
+                               var list = dom.create(targetListType), li;
+                               function adjustIndentForNewList(element) {
+                                       // If there's a margin-left, outdent one level to account for the extra list margin.
+                                       if (element.style.marginLeft || element.style.paddingLeft) {
+                                               t.adjustPaddingFunction(false)(element);
+                                       }
+                               }
+                               
+                               if (element.tagName === 'LI') {
+                                       // No change required.
+                               } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
+                                       processBrs(element, function(startSection, br, previousBR) {
+                                               doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
+                                               li = startSection.parentNode;
+                                               adjustIndentForNewList(li);
+                                               cleanupBr(br);
+                                       });
+                                       if (element.tagName === 'P' || selectedBlocks.length > 1) {
+                                               dom.split(li.parentNode.parentNode, li.parentNode);
+                                       }
+                                       attemptMergeWithAdjacent(li.parentNode, true);
+                                       return;
+                               } else {
+                                       // Put the list around the element.
+                                       li = dom.create('li');
+                                       dom.insertAfter(li, element);
+                                       li.appendChild(element);
+                                       adjustIndentForNewList(element);
+                                       element = li;
+                               }
+                               dom.insertAfter(list, element);
+                               list.appendChild(element);
+                               attemptMergeWithAdjacent(list, true);
+                               applied.push(element);
+                       }
+                       
+                       function doWrapList(start, end, template) {
+                               var li, n = start, tmp, i;
+                               while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
+                                       start = dom.split(start.parentNode, start.previousSibling);
+                                       start = start.nextSibling;
+                                       n = start;
+                               }
+                               if (template) {
+                                       li = template.cloneNode(true);
+                                       start.parentNode.insertBefore(li, start);
+                                       while (li.firstChild) dom.remove(li.firstChild);
+                                       li = dom.rename(li, 'li');
+                               } else {
+                                       li = dom.create('li');
+                                       start.parentNode.insertBefore(li, start);
+                               }
+                               while (n && n != end) {
+                                       tmp = n.nextSibling;
+                                       li.appendChild(n);
+                                       n = tmp;
+                               }
+                               if (li.childNodes.length === 0) {
+                                       li.innerHTML = '<br _mce_bogus="1" />';
+                               }
+                               makeList(li);
+                       }
+                       
+                       function processBrs(element, callback) {
+                               var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
+                                       breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
+                               function isAnyPartSelected(start, end) {
+                                       var r = dom.createRng(), sel;
+                                       bookmark.keep = true;
+                                       ed.selection.moveToBookmark(bookmark);
+                                       bookmark.keep = false;
+                                       sel = ed.selection.getRng(true);
+                                       if (!end) {
+                                               end = start.parentNode.lastChild;
+                                       }
+                                       r.setStartBefore(start);
+                                       r.setEndAfter(end);
+                                       return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
+                               }
+                               function nextLeaf(br) {
+                                       if (br.nextSibling)
+                                               return br.nextSibling;
+                                       if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
+                                               return nextLeaf(br.parentNode);
+                               }
+                               // Split on BRs within the range and process those.
+                               startSection = element.firstChild;
+                               // First mark the BRs that have any part of the previous section selected.
+                               var trailingContentSelected = false;
+                               each(dom.select(breakElements, element), function(br) {
+                                       var b;
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
+                                       }
+                                       if (isAnyPartSelected(startSection, br)) {
+                                               dom.addClass(br, '_mce_tagged_br');
+                                               startSection = nextLeaf(br);
+                                       }
+                               });
+                               trailingContentSelected = (startSection && isAnyPartSelected(startSection, undefined));
+                               startSection = element.firstChild;
+                               each(dom.select(breakElements, element), function(br) {
+                                       // Got a section from start to br.
+                                       var tmp = nextLeaf(br);
+                                       if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
+                                               return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
+                                       }
+                                       if (dom.hasClass(br, '_mce_tagged_br')) {
+                                               callback(startSection, br, previousBR);
+                                               previousBR = null;
+                                       } else {
+                                               previousBR = br;
+                                       }
+                                       startSection = tmp;
+                               });
+                               if (trailingContentSelected) {
+                                       callback(startSection, undefined, previousBR);
+                               }
+                       }
+                       
+                       function wrapList(element) {
+                               processBrs(element, function(startSection, br, previousBR) {
+                                       // Need to indent this part
+                                       doWrapList(startSection, br);
+                                       cleanupBr(br);
+                                       cleanupBr(previousBR);
+                               });
+                       }
+                       
+                       function changeList(element) {
+                               if (tinymce.inArray(applied, element) !== -1) {
+                                       return;
+                               }
+                               if (element.parentNode.tagName === oppositeListType) {
+                                       dom.split(element.parentNode, element);
+                                       makeList(element);
+                                       attemptMergeWithNext(element.parentNode, false);
+                               }
+                               applied.push(element);
+                       }
+                       
+                       function convertListItemToParagraph(element) {
+                               var child, nextChild, mergedElement, splitLast;
+                               if (tinymce.inArray(applied, element) !== -1) {
+                                       return;
+                               }
+                               element = splitNestedLists(element, dom);
+                               while (dom.is(element.parentNode, 'ol,ul,li')) {
+                                       dom.split(element.parentNode, element);
+                               }
+                               // Push the original element we have from the selection, not the renamed one.
+                               applied.push(element);
+                               element = dom.rename(element, 'p');
+                               mergedElement = attemptMergeWithAdjacent(element, false, ed.settings.force_br_newlines);
+                               if (mergedElement === element) {
+                                       // Now split out any block elements that can't be contained within a P.
+                                       // Manually iterate to ensure we handle modifications correctly (doesn't work with tinymce.each)
+                                       child = element.firstChild;
+                                       while (child) {
+                                               if (dom.isBlock(child)) {
+                                                       child = dom.split(child.parentNode, child);
+                                                       splitLast = true;
+                                                       nextChild = child.nextSibling && child.nextSibling.firstChild; 
+                                               } else {
+                                                       nextChild = child.nextSibling;
+                                                       if (splitLast && child.tagName === 'BR') {
+                                                               dom.remove(child);
+                                                       }
+                                                       splitLast = false;
+                                               }
+                                               child = nextChild;
+                                       }
+                               }
+                       }
+                       
+                       each(selectedBlocks, function(e) {
+                               e = findItemToOperateOn(e, dom);
+                               if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
+                                       hasOppositeType = true;
+                               } else if (e.tagName === targetListType || (e.tagName === 'LI' && e.parentNode.tagName === targetListType)) {
+                                       hasSameType = true;
+                               } else {
+                                       hasNonList = true;
+                               }
+                       });
+
+                       if (hasNonList || hasOppositeType || selectedBlocks.length === 0) {
+                               actions = {
+                                       'LI': changeList,
+                                       'H1': makeList,
+                                       'H2': makeList,
+                                       'H3': makeList,
+                                       'H4': makeList,
+                                       'H5': makeList,
+                                       'H6': makeList,
+                                       'P': makeList,
+                                       'BODY': makeList,
+                                       'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
+                                       defaultAction: wrapList
+                               };
+                       } else {
+                               actions = {
+                                       defaultAction: convertListItemToParagraph
+                               };
+                       }
+                       this.process(actions);
+               },
+               
+               indent: function() {
+                       var ed = this.ed, dom = ed.dom, indented = [];
+                       
+                       function createWrapItem(element) {
+                               var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
+                               dom.insertAfter(wrapItem, element);
+                               return wrapItem;
+                       }
+                       
+                       function createWrapList(element) {
+                               var wrapItem = createWrapItem(element),
+                                       list = dom.getParent(element, 'ol,ul'),
+                                       listType = list.tagName,
+                                       listStyle = dom.getStyle(list, 'list-style-type'),
+                                       attrs = {},
+                                       wrapList;
+                               if (listStyle !== '') {
+                                       attrs.style = 'list-style-type: ' + listStyle + ';';
+                               }
+                               wrapList = dom.create(listType, attrs);
+                               wrapItem.appendChild(wrapList);
+                               return wrapList;
+                       }
+                       
+                       function indentLI(element) {
+                               if (!hasParentInList(ed, element, indented)) {
+                                       element = splitNestedLists(element, dom);
+                                       var wrapList = createWrapList(element);
+                                       wrapList.appendChild(element);
+                                       attemptMergeWithAdjacent(wrapList.parentNode, false);
+                                       attemptMergeWithAdjacent(wrapList, false);
+                                       indented.push(element);
+                               }
+                       }
+                       
+                       this.process({
+                               'LI': indentLI,
+                               defaultAction: this.adjustPaddingFunction(true)
+                       });
+                       
+               },
+               
+               outdent: function() {
+                       var t = this, ed = t.ed, dom = ed.dom, outdented = [];
+                       
+                       function outdentLI(element) {
+                               var listElement, targetParent, align;
+                               if (!hasParentInList(ed, element, outdented)) {
+                                       if (dom.getStyle(element, 'margin-left') !== '' || dom.getStyle(element, 'padding-left') !== '') {
+                                               return t.adjustPaddingFunction(false)(element);
+                                       }
+                                       align = dom.getStyle(element, 'text-align', true);
+                                       if (align === 'center' || align === 'right') {
+                                               dom.setStyle(element, 'text-align', 'left');
+                                               return;
+                                       }
+                                       element = splitNestedLists(element, dom);
+                                       listElement = element.parentNode;
+                                       targetParent = element.parentNode.parentNode;
+                                       if (targetParent.tagName === 'P') {
+                                               dom.split(targetParent, element.parentNode);
+                                       } else {
+                                               dom.split(listElement, element);
+                                               if (targetParent.tagName === 'LI') {
+                                                       // Nested list, need to split the LI and go back out to the OL/UL element.
+                                                       dom.split(targetParent, element);
+                                               } else if (!dom.is(targetParent, 'ol,ul')) {
+                                                       dom.rename(element, 'p');
+                                               }
+                                       }
+                                       outdented.push(element);
+                               }
+                       }
+                       
+                       this.process({
+                               'LI': outdentLI,
+                               defaultAction: this.adjustPaddingFunction(false)
+                       });
+                       
+                       each(outdented, attemptMergeWithAdjacent);
+               },
+               
+               process: function(actions) {
+                       var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
+                       function processElement(element) {
+                               dom.removeClass(element, '_mce_act_on');
+                               if (!element || element.nodeType !== 1) {
+                                       return;
+                               }
+                               element = findItemToOperateOn(element, dom);
+                               var action = actions[element.tagName];
+                               if (!action) {
+                                       action = actions.defaultAction;
+                               }
+                               action(element);
+                       }
+                       function recurse(element) {
+                               t.splitSafeEach(element.childNodes, processElement);
+                       }
+                       function brAtEdgeOfSelection(container, offset) {
+                               return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
+                                               container.childNodes[offset].tagName === 'BR';
+                       }
+                       selectedBlocks = sel.getSelectedBlocks();
+                       if (selectedBlocks.length === 0) {
+                               selectedBlocks = [ dom.getRoot() ];
+                       }
+
+                       r = sel.getRng(true);
+                       if (!r.collapsed) {
+                               if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
+                                       r.setEnd(r.endContainer, r.endOffset - 1);
+                                       sel.setRng(r);
+                               }
+                               if (brAtEdgeOfSelection(r.startContainer, r.startOffset)) {
+                                       r.setStart(r.startContainer, r.startOffset + 1);
+                                       sel.setRng(r);
+                               }
+                       }
+                       bookmark = sel.getBookmark();
+                       actions.OL = actions.UL = recurse;
+                       t.splitSafeEach(selectedBlocks, processElement);
+                       sel.moveToBookmark(bookmark);
+                       bookmark = null;
+                       // Avoids table or image handles being left behind in Firefox.
+                       t.ed.execCommand('mceRepaint');
+               },
+               
+               splitSafeEach: function(elements, f) {
+                       if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
+                                       /Firefox\/3\.[0-4]/.test(navigator.userAgent))) {
+                               this.classBasedEach(elements, f);
+                       } else {
+                               each(elements, f);
+                       }
+               },
+               
+               classBasedEach: function(elements, f) {
+                       var dom = this.ed.dom, nodes, element;
+                       // Mark nodes
+                       each(elements, function(element) {
+                               dom.addClass(element, '_mce_act_on');
+                       });
+                       nodes = dom.select('._mce_act_on');
+                       while (nodes.length > 0) {
+                               element = nodes.shift();
+                               dom.removeClass(element, '_mce_act_on');
+                               f(element);
+                               nodes = dom.select('._mce_act_on');
+                       }
+               },
+               
+               adjustPaddingFunction: function(isIndent) {
+                       var indentAmount, indentUnits, ed = this.ed;
+                       indentAmount = ed.settings.indentation;
+                       indentUnits = /[a-z%]+/i.exec(indentAmount);
+                       indentAmount = parseInt(indentAmount, 10);
+                       return function(element) {
+                               var currentIndent, newIndentAmount;
+                               currentIndent = parseInt(ed.dom.getStyle(element, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(element, 'padding-left') || 0, 10);
+                               if (isIndent) {
+                                       newIndentAmount = currentIndent + indentAmount;
+                               } else {
+                                       newIndentAmount = currentIndent - indentAmount;
+                               }
+                               ed.dom.setStyle(element, 'padding-left', '');
+                               ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
+                       };
+               },
+               
+               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);
+}());
diff --git a/plugins/TinyMCE/js/plugins/media/css/content.css b/plugins/TinyMCE/js/plugins/media/css/content.css
deleted file mode 100644 (file)
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
index 2d087944dece9120429389d57ca27d894de5ee1f..0c45c7ff6de9e0ab4ffc4d09bc03616e750b4da3 100644 (file)
@@ -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
index 4bbe367e36c3a9548a7f7a7e30d7cf8cf6535573..edba2aff088acb76784f318236b6127b51c3681b 100644 (file)
@@ -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"]];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,mp3,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar").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,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||"320";n.height=m.height||"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(x,n){var t=this,o=t.editor,A,E,j,s,F,w,D,u,k,C,r,p,y,B,m,v,l,z;function q(i,G){var K,J,L,I,H;H=o.getParam("flash_video_player_url",t.convertUrl(t.url+"/moxieplayer.swf"));if(H){K=o.documentBaseURI;D.params.src=H;if(o.getParam("flash_video_player_absvideourl",true)){i=K.toAbsolute(i||"",true);G=K.toAbsolute(G||"",true)}L="";J=o.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(J,function(N,M){N=N.replace(/\$url/,i||"");N=N.replace(/\$poster/,G||"");if(N.length>0){L+=(L?"&":"")+M+"="+escape(N)}});if(L.length){D.params.flashvars=L}I=o.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(I,function(N,M){D.params[M]=""+N})}}D=x.attr("data-mce-json");if(!D){return}D=g.parse(D);p=this.getType(x.attr("class"));z=x.attr("data-mce-style");if(!z){z=x.attr("style");if(z){z=o.dom.serializeStyle(o.dom.parseStyle(z,"img"))}}if(p.name==="Iframe"){v=new b("iframe",1);tinymce.each(d,function(i){var G=x.attr(i);if(i=="class"&&G){G=G.replace(/mceItem.+ ?/g,"")}if(G&&G.length>0){v.attr(i,G)}});for(F in D.params){v.attr(F,D.params[F])}v.attr({style:z,src:D.params.src});x.replace(v);return}if(this.editor.settings.media_use_script){v=new b("script",1).attr("type","text/javascript");w=new b("#text",3);w.value="write"+p.name+"("+g.serialize(tinymce.extend(D.params,{width:x.attr("width"),height:x.attr("height")}))+");";v.append(w);x.replace(v);return}if(p.name==="Video"&&D.video.sources[0]){A=new b("video",1).attr(tinymce.extend({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z},D.video.attrs));if(D.video.attrs){l=D.video.attrs.poster}k=D.video.sources=c(D.video.sources);for(y=0;y<k.length;y++){if(/\.mp4$/.test(k[y].src)){m=k[y].src}}if(!k[0].type){A.attr("src",k[0].src);k.splice(0,1)}for(y=0;y<k.length;y++){u=new b("source",1).attr(k[y]);u.shortEnded=true;A.append(u)}if(m){q(m,l);p=t.getType("flash")}else{D.params.src=""}}if(D.params.src){if(/\.flv$/i.test(D.params.src)){q(D.params.src,"")}if(n&&n.force_absolute){D.params.src=o.documentBaseURI.toAbsolute(D.params.src)}E=new b("object",1).attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z});tinymce.each(d,function(i){if(D[i]&&i!="type"){E.attr(i,D[i])}});for(F in D.params){r=new b("param",1);r.shortEnded=true;w=D.params[F];if(F==="src"&&p.name==="WindowsMedia"){F="url"}r.attr({name:F,value:w});E.append(r)}if(this.editor.getParam("media_strict",true)){E.attr({data:D.params.src,type:p.mimes[0]})}else{E.attr({classid:"clsid:"+p.clsids[0],codebase:p.codebase});j=new b("embed",1);j.shortEnded=true;j.attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z,type:p.mimes[0]});for(F in D.params){j.attr(F,D.params[F])}tinymce.each(d,function(i){if(D[i]&&i!="type"){j.attr(i,D[i])}});E.append(j)}if(D.object_html){w=new b("#text",3);w.raw=true;w.value=D.object_html;E.append(w)}if(A){A.append(E)}}if(A){if(D.video_html){w=new b("#text",3);w.raw=true;w.value=D.video_html;A.append(w)}}if(A||E){x.replace(A||E)}else{x.remove()}},objectToImg:function(y){var F,j,A,p,G,H,u,w,t,B,z,q,o,D,x,k,E,n,C=this.lookup,l,v,s=this.editor.settings.url_converter,m=this.editor.settings.url_converter_scope;function r(i){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(i)}if(!y.parent){return}if(y.name==="script"){if(y.firstChild){l=a.exec(y.firstChild.value)}if(!l){return}n=l[1];E={video:{},params:g.parse(l[2])};w=E.params.width;t=E.params.height}E=E||{video:{},params:{}};G=new b("img",1);G.attr({src:this.editor.theme.url+"/img/trans.gif"});H=y.name;if(H==="video"){A=y;F=y.getAll("object")[0];j=y.getAll("embed")[0];w=A.attr("width");t=A.attr("height");u=A.attr("id");E.video={attrs:{},sources:[]};v=E.video.attrs;for(H in A.attributes.map){v[H]=A.attributes.map[H]}x=y.attr("src");if(x){E.video.sources.push({src:s.call(m,x,"src","video")})}k=A.getAll("source");for(z=0;z<k.length;z++){x=k[z].remove();E.video.sources.push({src:s.call(m,x.attr("src"),"src","source"),type:x.attr("type"),media:x.attr("media")})}if(v.poster){v.poster=s.call(m,v.poster,"poster","video")}}if(y.name==="object"){F=y;j=y.getAll("embed")[0]}if(y.name==="embed"){j=y}if(y.name==="iframe"){p=y;n="Iframe"}if(F){w=w||F.attr("width");t=t||F.attr("height");B=B||F.attr("style");u=u||F.attr("id");D=F.getAll("param");for(z=0;z<D.length;z++){o=D[z];H=o.remove().attr("name");if(!h[H]){E.params[H]=o.attr("value")}}E.params.src=E.params.src||F.attr("data")}if(j){w=w||j.attr("width");t=t||j.attr("height");B=B||j.attr("style");u=u||j.attr("id");for(H in j.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=j.attributes.map[H]}}}if(p){w=p.attr("width");t=p.attr("height");B=B||p.attr("style");u=p.attr("id");tinymce.each(d,function(i){G.attr(i,p.attr(i))});for(H in p.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=p.attributes.map[H]}}}if(E.params.movie){E.params.src=E.params.src||E.params.movie;delete E.params.movie}if(E.params.src){E.params.src=s.call(m,E.params.src,"src","object")}if(A){n=C.video.name}if(F&&!n){n=(C[(F.attr("clsid")||"").toLowerCase()]||C[(F.attr("type")||"").toLowerCase()]||{}).name}if(j&&!n){n=(C[(j.attr("type")||"").toLowerCase()]||{}).name}y.replace(G);if(j){j.remove()}if(F){q=r(F.remove());if(q){E.object_html=q}}if(A){q=r(A.remove());if(q){E.video_html=q}}G.attr({id:u,"class":"mceItemMedia mceItem"+(n||"Flash"),style:B,width:w||"320",height:t||"240","data-mce-json":g.serialize(E,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
index fc84e5b6c5bfcd31ab44a21f3e541b4836b000a5..483db1da56bc8734d8a1c0f333629bd6a05fdf2f 100644 (file)
  */\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
+       ];\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
+                               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
-                       ed.onNodeChange.add(function(ed, cm, n) {\r
-                               cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));\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,mp3,mpeg;" +\r
+                               "shockwave=dcr;" +\r
+                               "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +\r
+                               "realmedia=rm,ra,ram;" +\r
+                               "java=jar"\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.selection.onSetContent.add(function() {\r
-                                       t._spansToImgs(ed.getBody());\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
+                                       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
+                       data.params.src = self.convertUrl(data.params.src, force_absolute);\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
+                       attrs = data.video.attrs;\r
+                       if (attrs)\r
+                               attrs.src = self.convertUrl(attrs.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
+                       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
+                               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 || "320";\r
+                       img.height = data.height || "240";\r
 \r
-                       o.content = h;\r
+                       return img;\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
-                       } 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
+                * 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
+                                       if (value)\r
+                                               data[name] = value;\r
                                });\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
+                       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
+               /**\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;\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
-                                       if (v)\r
-                                               dom.add(ob, 'span', {_mce_name : 'param', name : k, '_mce_value' : v});\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
 \r
-                       if (!stc)\r
-                               dom.add(ob, 'span', tinymce.extend({_mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));\r
+                       data = node.attr('data-mce-json');\r
+                       if (!data)\r
+                               return;\r
 \r
-                       return ob;\r
-               },\r
+                       data = JSON.parse(data);\r
+                       typeItem = this.getType(node.attr('class'));\r
 \r
-               _spansToImgs : function(p) {\r
-                       var t = this, dom = t.editor.dom, im, ci;\r
+                       style = node.attr('data-mce-style')\r
+                       if (!style) {\r
+                               style = node.attr('style');\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
+                               if (style)\r
+                                       style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));\r
+                       }\r
 \r
-                                       switch (ci) {\r
-                                               case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                                       break;\r
+                       // Handle iframe\r
+                       if (typeItem.name === 'Iframe') {\r
+                               replacement = new Node('iframe', 1);\r
 \r
-                                               case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':\r
-                                                       dom.replace(t._createImg('mceItemShockWave', n), n);\r
-                                                       break;\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       var value = node.attr(name);\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 (name == 'class' && value)\r
+                                               value = value.replace(/mceItem.+ ?/g, '');\r
 \r
-                                               case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':\r
-                                                       dom.replace(t._createImg('mceItemQuickTime', n), n);\r
-                                                       break;\r
+                                       if (value && value.length > 0)\r
+                                               replacement.attr(name, value);\r
+                               });\r
 \r
-                                               case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':\r
-                                                       dom.replace(t._createImg('mceItemRealMedia', n), n);\r
-                                                       break;\r
+                               for (name in data.params)\r
+                                       replacement.attr(name, data.params[name]);\r
 \r
-                                               default:\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                       }\r
-                                       \r
-                                       return;\r
+                               replacement.attr({\r
+                                       style: style,\r
+                                       src: data.params.src\r
+                               });\r
+\r
+                               node.replace(replacement);\r
+\r
+                               return;\r
+                       }\r
+\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
+                               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
-                               // 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
+                               if (!sources[0].type) {\r
+                                       video.attr('src', sources[0].src);\r
+                                       sources.splice(0, 1);\r
+                               }\r
 \r
-                                               case 'application/x-director':\r
-                                                       dom.replace(t._createImg('mceItemShockWave', 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
+                                       video.append(source);\r
+                               }\r
 \r
-                                               case 'application/x-mplayer2':\r
-                                                       dom.replace(t._createImg('mceItemWindowsMedia', n), n);\r
-                                                       break;\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
-                                               case 'video/quicktime':\r
-                                                       dom.replace(t._createImg('mceItemQuickTime', n), n);\r
-                                                       break;\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
-                                               case 'audio/x-pn-realaudio-plugin':\r
-                                                       dom.replace(t._createImg('mceItemRealMedia', n), n);\r
-                                                       break;\r
+                               tinymce.each(rootAttributes, function(name) {\r
+                                       if (data[name] && name != 'type')\r
+                                               object.attr(name, data[name]);\r
+                               });\r
 \r
-                                               default:\r
-                                                       dom.replace(t._createImg('mceItemFlash', n), n);\r
-                                       }\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
+                               // 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
+                                       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
+                                       for (name in data.params)\r
+                                               embed.attr(name, data.params[name]);\r
+\r
+                                       tinymce.each(rootAttributes, function(name) {\r
+                                               if (data[name] && name != 'type')\r
+                                                       embed.attr(name, data[name]);\r
+                                       });\r
+\r
+                                       object.append(embed);\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 (video || object)\r
+                               node.replace(video || object);\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
+\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
+                       // If node isn't in document\r
+                       if (!node.parent)\r
+                               return;\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
+                       // Handle media scripts\r
+                       if (node.name === 'script') {\r
+                               if (node.firstChild)\r
+                                       matches = scriptRegExp.exec(node.firstChild.value);\r
 \r
-                       // Setup base parameters\r
-                       each(args, function(na) {\r
-                               var v = dom.getAttrib(n, na);\r
+                               if (!matches)\r
+                                       return;\r
 \r
-                               if (v)\r
-                                       pa[na] = v;\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
+                       // Setup data objects\r
+                       data = data || {\r
+                               video : {},\r
+                               params : {}\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 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') {\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', 'video')});\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', 'video');\r
+                       }\r
+\r
+                       // Object element\r
+                       if (node.name === 'object') {\r
+                               object = node;\r
+                               embed = node.getAll('embed')[0];\r
                        }\r
 \r
-                       // No src try data\r
-                       if (!pa.src) {\r
-                               pa.src = pa.data;\r
-                               delete pa.data;\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
-                       // 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 (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
+\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
-                                       if (v && !pa[na])\r
-                                               pa[na] = v;\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
+\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 (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
+\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
+                               type = lookup.video.name;\r
 \r
-               _parse : function(s) {\r
-                       return tinymce.util.JSON.parse('{' + s + '}');\r
-               },\r
+                       if (object && !type)\r
+                               type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name;\r
 \r
-               _serialize : function(o) {\r
-                       return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');\r
+                       if (embed && !type)\r
+                               type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name;\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
+                       // Set width/height of placeholder\r
+                       img.attr({\r
+                               id : id,\r
+                               'class' : 'mceItemMedia mceItem' + (type || 'Flash'),\r
+                               style : style,\r
+                               width : width || "320",\r
+                               height : height || "240",\r
+                               "data-mce-json" : JSON.serialize(data, "'")\r
+                       });\r
                }\r
        });\r
 \r
diff --git a/plugins/TinyMCE/js/plugins/media/img/flash.gif b/plugins/TinyMCE/js/plugins/media/img/flash.gif
deleted file mode 100644 (file)
index cb192e6..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/flash.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/flv_player.swf b/plugins/TinyMCE/js/plugins/media/img/flv_player.swf
deleted file mode 100644 (file)
index 042c2ab..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/flv_player.swf and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/quicktime.gif b/plugins/TinyMCE/js/plugins/media/img/quicktime.gif
deleted file mode 100644 (file)
index 3b04991..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/quicktime.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/realmedia.gif b/plugins/TinyMCE/js/plugins/media/img/realmedia.gif
deleted file mode 100644 (file)
index fdfe0b9..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/realmedia.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/shockwave.gif b/plugins/TinyMCE/js/plugins/media/img/shockwave.gif
deleted file mode 100644 (file)
index 5f235df..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/shockwave.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/trans.gif b/plugins/TinyMCE/js/plugins/media/img/trans.gif
deleted file mode 100644 (file)
index 3884865..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/trans.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/media/img/windowsmedia.gif b/plugins/TinyMCE/js/plugins/media/img/windowsmedia.gif
deleted file mode 100644 (file)
index ab50f2d..0000000
Binary files a/plugins/TinyMCE/js/plugins/media/img/windowsmedia.gif and /dev/null differ
index 86cfa98563d829fed029f6bc164bc4bc6493b0ef..a8acdd12d14415aad2f62327266d9271740ea13e 100644 (file)
-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
+       function get(id) {\r
+               return document.getElementById(id);\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
+       function getVal(id) {\r
+               var elm = get(id);\r
 \r
-       TinyMCE_EditableSelects.init();\r
-       generatePreview();\r
-}\r
+               if (elm.nodeName == "SELECT")\r
+                       return elm.options[elm.selectedIndex].value;\r
 \r
-function insertMedia() {\r
-       var fe, f = document.forms[0], h;\r
+               if (elm.type == "checkbox")\r
+                       return elm.checked;\r
 \r
-       tinyMCEPopup.restoreSelection();\r
-\r
-       if (!AutoValidator.validate(f)) {\r
-               tinyMCEPopup.alert(ed.getLang('invalid_data'));\r
-               return false;\r
+               return elm.value;\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
-\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
-\r
-                       case "flv":\r
-                               fe.className = "mceItemFlashVideo";\r
-                               break;\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
-\r
-                       case "rmp":\r
-                               fe.className = "mceItemRealMedia";\r
-                               break;\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
+       function setVal(id, value, name) {\r
+               if (typeof(value) != 'undefined') {\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
-               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
        }\r
 \r
-       tinyMCEPopup.close();\r
-}\r
-\r
-function updatePreview() {\r
-       var f = document.forms[0], type;\r
-\r
-       f.width.value = f.width.value || '320';\r
-       f.height.value = f.height.value || '240';\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
-       }\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
-       }\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
-\r
-       if (e.type == "text")\r
-               e.value = pl[n];\r
-       else\r
-               selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);\r
-}\r
-\r
-function getBool(p, n, d, tv, fv) {\r
-       var v = document.forms[0].elements[p + "_" + n].checked;\r
-\r
-       tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";\r
-       fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";\r
-\r
-       return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',");\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
-\r
-       if (n == 'src')\r
-               v = tinyMCEPopup.editor.convertURL(v, 'src', null);\r
-\r
-       return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");\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
-\r
-       return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");\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
+       window.Media = {\r
+               init : function() {\r
+                       var html, editor;\r
+\r
+                       this.editor = editor = tinyMCEPopup.editor;\r
+\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('filebrowser_altsource1','video_altsource1','media','media');\r
+                       get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media');\r
+                       get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');\r
+\r
+                       html = this.getMediaListHTML('medialist', 'src', 'media', 'media');\r
+                       if (html == "")\r
+                               get("linklistrow").style.display = 'none';\r
+                       else\r
+                               get("linklistcontainer").innerHTML = html;\r
+\r
+                       if (isVisible('filebrowser'))\r
+                               get('src').style.width = '230px';\r
+\r
+                       if (isVisible('filebrowser_altsource1'))\r
+                               get('video_altsource1').style.width = '220px';\r
+\r
+                       if (isVisible('filebrowser_altsource2'))\r
+                               get('video_altsource2').style.width = '220px';\r
+\r
+                       if (isVisible('filebrowser_poster'))\r
+                               get('video_poster').style.width = '220px';\r
+\r
+                       this.data = tinyMCEPopup.getWindowArg('data');\r
+                       this.dataToForm();\r
+                       this.preview();\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, data = this.data,\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') {\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' ? name : '');\r
+                                                       } else {\r
+                                                               delete list[name];\r
+\r
+                                                               value = getVal(formItemName);\r
+                                                               if (type == 'video' && 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
-       return s;\r
-}\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
-function generatePreview(c) {\r
-       var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;\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
-       p.innerHTML = '<!-- x --->';\r
+                                       setVal('media_type', data.type);\r
+                               }\r
 \r
-       nw = parseInt(f.width.value);\r
-       nh = parseInt(f.height.value);\r
+                               if (data.type == "video") {\r
+                                       if (!data.video.sources)\r
+                                               data.video.sources = [];\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
+                                       data.video.sources[0] = {src: getVal('src')};\r
+                               }\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
-\r
-       if (pl == '') {\r
-               p.innerHTML = '';\r
-               return;\r
-       }\r
+                       // Hide all fieldsets and show the one active\r
+                       get('video_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
+\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,preload,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 {\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\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\r
+                                       data.params.src = src;\r
+\r
+                               // Set default size\r
+                               setVal('width', data.width || 320);\r
+                               setVal('height', data.height || 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 = 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') || "320", 10);\r
+                       this.height = parseInt(getVal('height') || "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') || "320", 10);\r
+                               height = parseInt(getVal('height') || "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
-       pl = tinyMCEPopup.editor.plugins.media._parse(pl);\r
+               getMediaListHTML : function() {\r
+                       if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {\r
+                               var html = "";\r
 \r
-       if (!pl.src) {\r
-               p.innerHTML = '';\r
-               return;\r
-       }\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
-       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
+                               for (var i=0; i<tinyMCEMediaList.length; i++)\r
+                                       html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';\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
+                               html += '</select>';\r
 \r
-               for (n in pl) {\r
-                       h += '<param name="' + n + '" value="' + pl[n] + '">';\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
+                       return "";\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
+})();
\ No newline at end of file
index 6d0a996f7d923076e2068f7f751d79b295e5bce4..29d26a0d41673a4771cc39821caf619eccdad7e4 100644 (file)
@@ -91,7 +91,6 @@ align_bottom_right:"Bottom right",
 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
@@ -99,5 +98,12 @@ flv_autostart:"Auto start",
 flv_loop:"Loop",\r
 flv_showscalemodes:"Show scale modes",\r
 flv_smoothvideo:"Smooth video",\r
-flv_jscallback:"JS Callback"\r
+flv_jscallback:"JS Callback",\r
+html5_video_options:"HTML5 Video Options",\r
+altsource1:"Alternative source 1",\r
+altsource2:"Alternative source 2",\r
+preload:"Preload",\r
+poster:"Poster",\r
+\r
+source:"Source"\r
 });
\ No newline at end of file
index 73a903f7c3afb6d66fe12ef4bec9d8d2cc59c627..807a537dc4c02027838f60817ee5f9216d6a44e5 100644 (file)
        <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
+                                                                       <select id="media_type" name="media_type" onchange="Media.formToData('type');">\r
+                                                                               <option value="video">HTML5 Video</option>\r
                                                                                <option value="flash">Flash</option>\r
-                                                                               <!-- <option value="flv">Flash video (FLV)</option> -->\r
-                                                                               <option value="qt">Quicktime</option>\r
+                                                                               <option value="quicktime">QuickTime</option>\r
                                                                                <option value="shockwave">Shockwave</option>\r
-                                                                               <option value="wmp">Windows Media</option>\r
-                                                                               <option value="rmp">Real Media</option>\r
+                                                                               <option value="windowsmedia">Windows Media</option>\r
+                                                                               <option value="realmedia">Real Media</option>\r
+                                                                               <option value="iframe">Iframe</option>\r
                                                                        </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="video_options">\r
+                                       <legend>{#media_dlg.html5_video_options}</legend>\r
+\r
+                                       <table role="presentation">\r
+                                               <tr>\r
+                                                       <td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>\r
+                                                       <td>\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
+                                               <tr>\r
+                                                       <td><label for="video_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="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="video_poster">{#media_dlg.poster}</label></td>\r
+                                                       <td>\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
+                                       </table>\r
+\r
+                                       <table role="presentation" border="0" cellpadding="4" cellspacing="0">\r
+                                               <tr>\r
+                                                       <td>\r
+                                                               <table role="presentation" border="0" cellpadding="0" cellspacing="0">\r
+                                                                       <tr>\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>\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_preload" name="video_preload" onchange="Media.formToData();" /></td>\r
+                                                                               <td><label for="video_preload">{#media_dlg.preload}</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
                                <fieldset id="flash_options">\r
                                        <legend>{#media_dlg.flash_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="flash_quality">{#media_dlg.quality}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_quality" name="flash_quality" onchange="generatePreview();">\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
 \r
                                                        <td><label for="flash_scale">{#media_dlg.scale}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_scale" name="flash_scale" onchange="generatePreview();">\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
                                                <tr>\r
                                                        <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">\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
 \r
                                                        <td><label for="flash_salign">{#media_dlg.salign}</label></td>\r
                                                        <td>\r
-                                                               <select id="flash_salign" name="flash_salign" onchange="generatePreview();">\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
 \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="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></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="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></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
 \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="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></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="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></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
                                                </tr>\r
                                        </table>\r
 \r
-                                       <table>\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="generatePreview();" /></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="generatePreview();" /></td>\r
-                                               </tr>\r
-                                       </table>\r
-                               </fieldset>\r
-\r
-                               <fieldset id="flv_options">\r
-                                       <legend>{#media_dlg.flv_options}</legend>\r
-\r
-                                       <table border="0" cellpadding="4" cellspacing="0">\r
-                                               <tr>\r
-                                                       <td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</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
-                                                       </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
-                                               </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
-                                               </tr>\r
-\r
-                                               <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td>\r
-\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td>\r
-                                               </tr>\r
-\r
-                                               <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td>\r
-\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td>\r
-                                               </tr>\r
-\r
-                                               <tr>\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </td>\r
-\r
-                                                       <td colspan="2">\r
-                                                               <table 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
-                                                                       </tr>\r
-                                                               </table>\r
-                                                       </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: 100%; height: 390px"></textarea>\r
+                               </fieldset>\r
+                       </div>\r
                </div>\r
 \r
                <div class="mceActionPanel">\r
diff --git a/plugins/TinyMCE/js/plugins/media/moxieplayer.swf b/plugins/TinyMCE/js/plugins/media/moxieplayer.swf
new file mode 100644 (file)
index 0000000..2a04035
Binary files /dev/null and b/plugins/TinyMCE/js/plugins/media/moxieplayer.swf differ
index eb40a6a39ce1aace1ebab7bbfd749b8ee97d8ad1..73947355f014523794f540cb294f88b3390b4219 100644 (file)
@@ -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 _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(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(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
index ca83ee26e5418216f5eccbb09885521595c3c32a..b3ea82ee03737a0ac3a6b922b76d3cf445ee29cb 100644 (file)
@@ -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 _mce_bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</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
index 9945cd85802b0e5bf2a124150e7daded16af1e41..cc7de784667a084ac2a00169ee5af6a30826da0f 100644 (file)
@@ -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 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);b.onContextMenu.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block);b.onContextMenu.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
\ No newline at end of file
index 656c971b8cee3921dc7e5e0fd240353be677e6f9..b6cf15430b82bf0663a4d80b96f4fa53e3464fba 100644 (file)
                                        ed.onKeyPress.addToTop(t._block);\r
                                        ed.onKeyUp.addToTop(t._block);\r
                                        ed.onPaste.addToTop(t._block);\r
+                                       ed.onContextMenu.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
+                                       ed.onContextMenu.remove(t._block);\r
                                }\r
 \r
                                t.disabled = s;\r
diff --git a/plugins/TinyMCE/js/plugins/pagebreak/css/content.css b/plugins/TinyMCE/js/plugins/pagebreak/css/content.css
deleted file mode 100644 (file)
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;}
index a212f696334f9bd4cdfb830b45240b9353cd01d8..35085e8adca221072d813eca1264b2eafdea2488 100644 (file)
@@ -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
index 4e1eb0a7aa26b31f9c80f4aedff6f515d448efd5..a094c1916232c255df50247092aaa006c0ecea8f 100644 (file)
@@ -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/plugins/TinyMCE/js/plugins/pagebreak/img/pagebreak.gif b/plugins/TinyMCE/js/plugins/pagebreak/img/pagebreak.gif
deleted file mode 100644 (file)
index acdf408..0000000
Binary files a/plugins/TinyMCE/js/plugins/pagebreak/img/pagebreak.gif and /dev/null differ
diff --git a/plugins/TinyMCE/js/plugins/pagebreak/img/trans.gif b/plugins/TinyMCE/js/plugins/pagebreak/img/trans.gif
deleted file mode 100644 (file)
index 3884865..0000000
Binary files a/plugins/TinyMCE/js/plugins/pagebreak/img/trans.gif and /dev/null differ
index 3785ab2d099c05f627cab37ea247aa5364b6cc5f..22149cc6a3b62a0ee4d5547cb2c2f92af00e44cb 100644 (file)
@@ -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<br _mce_bogus="1">');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(v){var u=v.firstChild;if(u&&u.nodeName=="DIV"&&u.style.marginTop&&u.style.backgroundColor){p.remove(u,1)}c(p.select("div.mcePaste",v),function(w){p.remove(w,1)});c(p.select("span.Apple-style-span",v),function(w){p.remove(w,1)});c(p.select("br[_mce_bogus]",v),function(w){p.remove(w)});t+=v.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+'"></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:"p",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(d,k,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_sticky"))}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: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="<pre>"+o.encode(r).replace(/\r?\n/g,"<br />")+"</pre>"}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(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(d){c(d,function(h){if(h.constructor==RegExp){v=v.replace(h,"")}else{v=v.replace(h[0],h[1])}})}if((typeof(v)==="string")&&(v.length>0)){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," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.decode(tinymce.html.Entities.encodeRaw(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 d=x.get("_plain_text_marker"),A,h,w,i;s.select(d,false);z.execCommand("Delete",false,null);d=null;A=s.getStart();h=x.getViewPort(n);w=x.getPos(A).y;i=A.clientHeight;if((w<h.y)||(w+i>h.y+h.h)){z.body.scrollTop=w<h.y?w:w-h.h+25}},0)}},_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
index ad9740f3fe1c82ee967594fccf73e5af1dc44546..9f8d39f73016efcff74133f1606f1d0e53a24257 100644 (file)
@@ -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,6 +25,7 @@
                        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_replacements : [\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
                                                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
                        // 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 : 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<br _mce_bogus="1">');\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
-                                                       var child = n.firstChild;\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
-                                                       // 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
+                                                       // 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
-                                                       // 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
+                                                               // 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
+                                                               // 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[_mce_bogus]', n), function(n) {\r
-                                                               dom.remove(n);\r
-                                                       });\r
+                                                               // Remove bogus br elements\r
+                                                               each(dom.select('br[data-mce-bogus]', n), function(n) {\r
+                                                                       dom.remove(n);\r
+                                                               });\r
 \r
-                                                       h += n.innerHTML;\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 plain text mode\r
+                                                       h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>';\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 + '"></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
                        };\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 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
                                        process([\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
                                ]);\r
 \r
-                               h = dom.encode(h);\r
+                               h = dom.decode(tinymce.html.Entities.encodeRaw(h));\r
 \r
                                // Delete any highlighted text before pasting\r
                                if (!sel.isCollapsed()) {\r
index cd9c985b7a414df3215d7d7a3c1e9d2fc393bafe..165bc12df59988ec355c95be4931ab2b3d2df673 100644 (file)
@@ -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
index 1433a06a4aef1b25ce965360a9cc3e102b61685e..4c87e8fa79d0fdd12b5f577094f74c549db70266 100644 (file)
        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
index c0a62432978dd4cda1343ce7a2d376692a44a886..80284b9f3ff0b33d7348de16cbdf0a162bb89419 100644 (file)
@@ -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
index d0424cfc9bcc1b857f5a1cabb2ed33b2f1dd7204..5a22d8aa4dcc977e547e07a93f20df0ea84524a0 100644 (file)
@@ -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
index a9ec3b9cf0f777ec381ffe77cf0ec6dd98780f8e..0c42739c6f33f6377ca7de3b752b6eeb50a8897d 100644 (file)
@@ -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(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(l){var g=this.editor,f=g.dom,j=g.getDoc(),h=g.selection,i=h.getBookmark(),d=[],k=l.join("|"),m=this._getSeparators(),e=new RegExp("(^|["+m+"])("+k+")(?=["+m+"]|$)","g");this._walk(g.getBody(),function(o){if(o.nodeType==3){d.push(o)}});c(d,function(t){var r,q,o,s,p=t.nodeValue;if(e.test(p)){p=f.encode(p);q=f.create("span",{"class":"mceItemHidden"});if(tinymce.isIE){p=p.replace(e,"$1<mcespell>$2</mcespell>");while((s=p.indexOf("<mcespell>"))!=-1){o=p.substring(0,s);if(o.length){r=j.createTextNode(f.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(f.create("span",{"class":"mceItemHiddenSpellWord"},o))}if(p.length){r=j.createTextNode(f.decode(p));q.appendChild(r)}}else{q.innerHTML=p.replace(e,'$1<span class="mceItemHiddenSpellWord">$2</span>')}f.replace(q,t)}});h.moveToBookmark(i)},_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)}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
index d8680baf2cdfac60b4dc0e8624713aebdf7401f6..ee4df887c9953883e33a56039c175b997c037772 100644 (file)
                                        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
                _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, b = se.getBookmark(), 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
                        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
                                                }\r
                                        });\r
 \r
-\r
                                        if (t.editor.getParam("spellchecker_enable_learn_rpc")) {\r
                                                m.add({\r
                                                        title : 'spellchecker.learn_word',\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
index a8dd93dec5945263bb0faa5caef3f7696e5e2400..6800a9a9aa67dff1d750e9f10f0f337bc821f649 100644 (file)
@@ -177,11 +177,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
@@ -376,7 +372,7 @@ function applyAction() {
        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
+       ed.dom.setAttrib(ed.selection.getSelectedBlocks(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText)));\r
 }\r
 \r
 function updateAction() {\r
@@ -440,9 +436,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
index 5026313e2e0b170a4807c56986abb078ad1ce786..df0a173c77df1348f4581c0393e27da9a5fb42fa 100644 (file)
@@ -59,5 +59,12 @@ visibility:"Visibility",
 zindex:"Z-index",\r
 overflow:"Overflow",\r
 placement:"Placement",\r
-clip:"Clip"\r
+clip:"Clip",\r
+text:"Text",\r
+background:"Background",\r
+block:"Block",\r
+box:"Box",\r
+border:"Border",\r
+list:"List",\r
+position:"Position"\r
 });
\ No newline at end of file
index 549ed0408e4c683eb5b7c50b84b155d845ca4004..b5a3d15d9ed79e53aadfc6d3e8f559a2466eda60 100644 (file)
        <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" /></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 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>
+                       <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>
 <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>
        <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>
 <br style="clear: both" />
 </div>
+</fieldset>
 </div>
 
 <div class="mceActionPanel">
index 27d2440222d233a3c1d784aa1e94022f8caa62a6..d18689ddb9a9753d4d73d9a93bb79d8704a2e871 100644 (file)
@@ -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(r){n=c.select(":input:enabled,*[tabindex]");function i(s){return s.type!="hidden"&&s.tabIndex!="-1"&&!(n[m].style.display=="none")&&!(n[m].style.visibility=="hidden")}d(n,function(t,s){if(t.id==l.id){j=s;return false}});if(r>0){for(m=j+1;m<n.length;m++){if(i(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(i(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
index c2be2f40a6b2a9aa4f3c34e80b3947349b52040b..f4545e16703546db8e08a1c1a03e94cb23eb8314 100644 (file)
                                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
+                                       el = DOM.select(':input:enabled,*[tabindex]');\r
+                                       function canSelect(e) {\r
+                                               return e.type != 'hidden' && \r
+                                               e.tabIndex != '-1' && \r
+                                                       !(el[i].style.display == "none") && \r
+                                                       !(el[i].style.visibility == "hidden");\r
+                                   }\r
+\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 (canSelect(el[i]))\r
+                                                               return el[i];\r
+                                               }\r
+                                       } else {\r
+                                               for (i = x - 1; i >= 0; i--) {\r
+                                                       if (canSelect(el[i]))\r
+                                                               return el[i];\r
                                                }\r
                                        }\r
 \r
                                        }\r
 \r
                                        if (el) {\r
-                                               if (ed = tinymce.get(el.id || el.name))\r
+                                               if (el.id && (ed = tinymce.get(el.id || el.name)))\r
                                                        ed.focus();\r
                                                else\r
-                                                       window.setTimeout(function() {window.focus();el.focus();}, 10);\r
+                                                       window.setTimeout(function() {\r
+                                                               if (!tinymce.isWebKit)\r
+                                                                       window.focus();\r
+                                                               el.focus();\r
+                                                       }, 10);\r
 \r
                                                return Event.cancel(e);\r
                                        }\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
index d243e1d833541b6a29e2600cbcd031f68ef01a3a..a72a8d69736074abb03cdd051056cdcdb9ab5af4 100644 (file)
@@ -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
index 266d7d5371de3b9b773b7a162c0a36eeef04a89e..f0100315b4a0a92c8d4464a52e8857457451bf44 100644 (file)
@@ -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(c){var d=c.each;function b(f,g){var h=g.ownerDocument,e=h.createRange(),j;e.setStartBefore(g);e.setEnd(f.endContainer,f.endOffset);j=h.createElement("body");j.appendChild(e.cloneContents());return j.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(H,G,K){var f,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;f=[];d(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);d(O,function(P,Q){Q+=M;d(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(f[Q]){while(f[Q][R]){R++}}U=h(W,"rowspan");V=h(W,"colspan");for(T=Q;T<Q+U;T++){if(!f[T]){f[T]=[]}for(S=R;S<R+V;S++){f[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=f[O];if(N){return N[M]}}function h(N,M){return parseInt(N.getAttribute(M)||1)}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=[];d(H.rows,function(N){d(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 e(M){var N;c.walk(M,function(P){var O;if(P.nodeType==3){d(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=c.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(!c.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();d(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}d(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=f[Math.min(f.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=f[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=f[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(e(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(e(P.cells[0]),P.cells[0])}}}}}function C(){d(f,function(M,N){d(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=h(P,"colspan");R=h(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(e(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(!f[R]||!f[R][U]){continue}V=f[R][U].elm;if(V!=T){N=c.grep(V.childNodes);d(N,function(Z){T.appendChild(Z)});if(N.length){N=c.grep(T.childNodes);Q=0;d(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;d(f,function(W,X){d(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<f[0].length;R++){if(!f[M][R]){continue}S=f[M][R].elm;if(S!=P){if(!Q){O=h(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&f[M-1][R]){V=f[M-1][R].elm;O=h(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=e(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 g(N){var O,M;d(f,function(P,Q){d(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});d(f,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=h(P,"colspan");Q=h(P,"rowspan");if(R==1){if(!N){G.insertAfter(e(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(e(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];d(f,function(N,O){d(N,function(Q,P){if(j(Q)&&c.inArray(M,P)===-1){d(f,function(T){var R=T[P].elm,S;S=h(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");d(Q.cells,function(S){var T=h(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]);d(f[R.y],function(S){var T;S=S.elm;if(S!=O){T=h(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();d(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();d(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;d(f,function(S){var R;Q=0;d(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()}d(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(e(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;d(f,function(O,P){d(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;d(f,function(P,Q){d(P,function(S,R){var U,T;if(j(S)){S=f[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=f[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=f[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=f[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(f[y][x]){G.addClass(f[y][x].elm,"mceSelected")}}}}}c.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}c.create("tinymce.plugins.TablePlugin",{init:function(f,g){var e,l,h=true;function k(o){var n=f.selection,m=f.dom.getParent(o||n.getNode(),"table");if(m){return new a(m,f.dom,n)}}function j(){f.getBody().style.webkitUserSelect="";if(h){f.dom.removeClass(f.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");h=false}}d([["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(m){f.addButton(m[0],{title:m[1],cmd:m[2],ui:m[3]})});if(!c.isIE){f.onClick.add(function(m,n){n=n.target;if(n.nodeName==="TABLE"){m.selection.select(n);m.nodeChanged()}})}f.onPreProcess.add(function(n,o){var m,p,q,s=n.dom,r;m=s.select("table",o.node);p=m.length;while(p--){q=m[p];s.setAttrib(q,"data-mce-style","");if((r=s.getAttrib(q,"width"))){s.setStyle(q,"width",r);s.setAttrib(q,"width","")}if((r=s.getAttrib(q,"height"))){s.setStyle(q,"height",r);s.setAttrib(q,"height","")}}});f.onNodeChange.add(function(o,m,r){var q;r=o.selection.getStart();q=o.dom.getParent(r,"td,th,caption");m.setActive("table",r.nodeName==="TABLE"||!!q);if(q&&q.nodeName==="CAPTION"){q=0}m.setDisabled("delete_table",!q);m.setDisabled("delete_col",!q);m.setDisabled("delete_table",!q);m.setDisabled("delete_row",!q);m.setDisabled("col_after",!q);m.setDisabled("col_before",!q);m.setDisabled("row_after",!q);m.setDisabled("row_before",!q);m.setDisabled("row_props",!q);m.setDisabled("cell_props",!q);m.setDisabled("split_cells",!q);m.setDisabled("merge_cells",!q)});f.onInit.add(function(n){var m,q,r=n.dom,o;e=n.windowManager;n.onMouseDown.add(function(s,t){if(t.button!=2){j();q=r.getParent(t.target,"td,th");m=r.getParent(q,"table")}});r.bind(n.getDoc(),"mouseover",function(w){var u,t,v=w.target;if(q&&(o||v!=q)&&(v.nodeName=="TD"||v.nodeName=="TH")){t=r.getParent(v,"table");if(t==m){if(!o){o=k(t);o.setStartCell(q);n.getBody().style.webkitUserSelect="none"}o.setEndCell(v);h=true}u=n.selection.getSel();try{if(u.removeAllRanges){u.removeAllRanges()}else{u.empty()}}catch(s){}w.preventDefault()}});n.onMouseUp.add(function(B,C){var t,v=B.selection,D,E=v.getSel(),s,w,u,A;if(q){if(o){B.getBody().style.webkitUserSelect=""}function z(F,H){var G=new c.dom.TreeWalker(F,F);do{if(F.nodeType==3&&c.trim(F.nodeValue).length!=0){if(H){t.setStart(F,0)}else{t.setEnd(F,F.nodeValue.length)}return}if(F.nodeName=="BR"){if(H){t.setStartBefore(F)}else{t.setEndBefore(F)}return}}while(F=(H?G.next():G.prev()))}D=r.select("td.mceSelected,th.mceSelected");if(D.length>0){t=r.createRng();w=D[0];A=D[D.length-1];t.setStart(w);t.setEnd(w);z(w,1);s=new c.dom.TreeWalker(w,r.getParent(D[0],"table"));do{if(w.nodeName=="TD"||w.nodeName=="TH"){if(!r.hasClass(w,"mceSelected")){break}u=w}}while(w=s.next());z(u);v.setRng(t)}B.nodeChanged();q=o=m=null}});n.onKeyUp.add(function(s,t){j()});if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(u,s,w){var z,v=n.selection,t=v.getNode()||n.getBody();if(n.dom.getParent(w,"td")||n.dom.getParent(w,"th")||n.dom.select("td.mceSelected,th.mceSelected").length){s.removeAll();if(t.nodeName=="A"&&!n.dom.getAttrib(t,"name")){s.add({title:"advanced.link_desc",icon:"link",cmd:n.plugins.advlink?"mceAdvLink":"mceLink",ui:true});s.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});s.addSeparator()}if(t.nodeName=="IMG"&&t.className.indexOf("mceItem")==-1){s.add({title:"advanced.image_desc",icon:"image",cmd:n.plugins.advimage?"mceAdvImage":"mceImage",ui:true});s.addSeparator()}s.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});s.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});s.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});s.addSeparator();z=s.addMenu({title:"table.cell"});z.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});z.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});z.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});z=s.addMenu({title:"table.row"});z.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});z.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});z.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});z.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});z.addSeparator();z.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});z.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});z.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!l);z.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!l);z=s.addMenu({title:"table.col"});z.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});z.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});z.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{s.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!c.isIE){function p(){var s;for(s=n.getBody().lastChild;s&&s.nodeType==3&&!s.nodeValue.length;s=s.previousSibling){}if(s&&s.nodeName=="TABLE"){n.dom.add(n.getBody(),"p",null,'<br mce_bogus="1" />')}}if(c.isGecko){n.onKeyDown.add(function(t,v){var s,u,w=t.dom;if(v.keyCode==37||v.keyCode==38){s=t.selection.getRng();u=w.getParent(s.startContainer,"table");if(u&&t.getBody().firstChild==u){if(b(s,u)){s=w.createRng();s.setStartBefore(u);s.setEndBefore(u);t.selection.setRng(s);v.preventDefault()}}}})}n.onKeyUp.add(p);n.onSetContent.add(p);n.onVisualAid.add(p);n.onPreProcess.add(function(s,u){var t=u.node.lastChild;if(t&&t.childNodes.length==1&&t.firstChild.nodeName=="BR"){s.dom.remove(t)}});p()}});d({mceTableSplitCells:function(m){m.split()},mceTableMergeCells:function(n){var o,p,m;m=f.dom.getParent(f.selection.getNode(),"th,td");if(m){o=m.rowSpan;p=m.colSpan}if(!f.dom.select("td.mceSelected,th.mceSelected").length){e.open({url:g+"/merge_cells.htm",width:240+parseInt(f.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(f.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:o,cols:p,onaction:function(q){n.merge(m,q.cols,q.rows)},plugin_url:g})}else{n.merge()}},mceTableInsertRowBefore:function(m){m.insertRow(true)},mceTableInsertRowAfter:function(m){m.insertRow()},mceTableInsertColBefore:function(m){m.insertCol(true)},mceTableInsertColAfter:function(m){m.insertCol()},mceTableDeleteCol:function(m){m.deleteCols()},mceTableDeleteRow:function(m){m.deleteRows()},mceTableCutRow:function(m){l=m.cutRows()},mceTableCopyRow:function(m){l=m.copyRows()},mceTablePasteRowBefore:function(m){m.pasteRows(l,true)},mceTablePasteRowAfter:function(m){m.pasteRows(l)},mceTableDelete:function(m){m.deleteTable()}},function(n,m){f.addCommand(m,function(){var o=k();if(o){n(o);f.execCommand("mceRepaint");j()}})});d({mceInsertTable:function(m){e.open({url:g+"/table.htm",width:400+parseInt(f.getLang("table.table_delta_width",0)),height:320+parseInt(f.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:m?m.action:0})},mceTableRowProps:function(){e.open({url:g+"/row.htm",width:400+parseInt(f.getLang("table.rowprops_delta_width",0)),height:295+parseInt(f.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})},mceTableCellProps:function(){e.open({url:g+"/cell.htm",width:400+parseInt(f.getLang("table.cellprops_delta_width",0)),height:295+parseInt(f.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}},function(n,m){f.addCommand(m,function(o,p){n(p)})})}});c.PluginManager.add("table",c.plugins.TablePlugin)})(tinymce);
\ No newline at end of file
index c2f307f045c2a4c3c5befb0176db93a3ce40c6b1..5b9b53d8e65264da061942f2b6e090b0272f6053 100644 (file)
 (function(tinymce) {\r
        var each = tinymce.each;\r
 \r
+       // Checks if the selection/caret is at the start of the specified block element\r
+       function isAtStart(rng, par) {\r
+               var doc = par.ownerDocument, rng2 = doc.createRange(), elm;\r
+\r
+               rng2.setStartBefore(par);\r
+               rng2.setEnd(rng.endContainer, rng.endOffset);\r
+\r
+               elm = doc.createElement('body');\r
+               elm.appendChild(rng2.cloneContents());\r
+\r
+               // Check for text characters of other elements that should be treated as content\r
+               return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;\r
+       };\r
+\r
        /**\r
         * Table Grid class.\r
         */\r
                        grid = [];\r
 \r
                        each(['thead', 'tbody', 'tfoot'], function(part) {\r
-                               var rows = dom.select(part + ' tr', table);\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
+                                       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
                        return parseInt(td.getAttribute(name) || 1);\r
                };\r
 \r
+               function setSpanVal(td, name, val) {\r
+                       if (td) {\r
+                               val = parseInt(val);\r
+\r
+                               if (val === 1)\r
+                                       td.removeAttribute(name, 1);\r
+                               else\r
+                                       td.setAttribute(name, val, 1);\r
+                       }\r
+               }\r
+\r
                function isCellSelected(cell) {\r
-                       return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;\r
+                       return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);\r
                };\r
 \r
                function getSelectedRows() {\r
 \r
                                        // Add something to the inner node\r
                                        if (curNode)\r
-                                               curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br _mce_bogus="1" />';\r
+                                               curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />';\r
 \r
                                        return false;\r
                                }\r
                        }, 'childNodes');\r
 \r
                        cell = cloneNode(cell, false);\r
-                       cell.rowSpan = cell.colSpan = 1;\r
+                       setSpanVal(cell, 'rowSpan', 1);\r
+                       setSpanVal(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
+                                       cell.innerHTML = '<br data-mce-bogus="1" />';\r
                        }\r
 \r
                        return cell;\r
                                                rowSpan = getSpanVal(cell, 'rowspan');\r
 \r
                                                if (colSpan > 1 || rowSpan > 1) {\r
-                                                       cell.colSpan = cell.rowSpan = 1;\r
+                                                       setSpanVal(cell, 'rowSpan', 1);\r
+                                                       setSpanVal(cell, 'colSpan', 1);\r
 \r
                                                        // Insert cells right\r
                                                        for (i = 0; i < colSpan - 1; i++)\r
                };\r
 \r
                function merge(cell, cols, rows) {\r
-                       var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;\r
+                       var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;\r
 \r
                        // Use specified cell and cols/rows\r
                        if (cell) {\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
+                               setSpanVal(startCell, 'colSpan', (endX - startX) + 1);\r
+                               setSpanVal(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
+                                               if (!grid[y] || !grid[y][x])\r
+                                                       continue;\r
+\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
+                                                       each(children, function(node) {\r
+                                                               startCell.appendChild(node);\r
                                                        });\r
 \r
+                                                       // Remove bogus nodes if there is children in the target cell\r
+                                                       if (children.length) {\r
+                                                               children = tinymce.grep(startCell.childNodes);\r
+                                                               count = 0;\r
+                                                               each(children, function(node) {\r
+                                                                       if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)\r
+                                                                               startCell.removeChild(node);\r
+                                                               });\r
+                                                       }\r
+                                                       \r
                                                        // Remove cell\r
                                                        dom.remove(cell);\r
                                                }\r
                };\r
 \r
                function insertRow(before) {\r
-                       var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;\r
+                       var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;\r
 \r
                        // Find first/last row\r
                        each(grid, function(row, y) {\r
                        });\r
 \r
                        for (x = 0; x < grid[0].length; x++) {\r
+                               // Cell not found could be because of an invalid table structure\r
+                               if (!grid[posY][x])\r
+                                       continue;\r
+\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
+                                                       setSpanVal(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
+                                                       rowSpan = getSpanVal(otherCell, 'rowSpan');\r
                                                        if (rowSpan > 1) {\r
-                                                               otherCell.rowSpan = rowSpan + 1;\r
+                                                               setSpanVal(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
+                                       newCell = cloneCell(cell);\r
+                                       setSpanVal(newCell, 'colSpan', cell.colSpan);\r
+\r
                                        newRow.appendChild(newCell);\r
 \r
                                        lastCell = cell;\r
                        });\r
 \r
                        each(grid, function(row, y) {\r
-                               var cell = row[posX].elm, rowSpan, colSpan;\r
+                               var cell, rowSpan, colSpan;\r
 \r
+                               if (!row[posX])\r
+                                       return;\r
+\r
+                               cell = row[posX].elm;\r
                                if (cell != lastCell) {\r
                                        colSpan = getSpanVal(cell, 'colspan');\r
                                        rowSpan = getSpanVal(cell, 'rowspan');\r
                                                        fillLeftDown(posX, y, rowSpan - 1, colSpan);\r
                                                }\r
                                        } else\r
-                                               cell.colSpan++;\r
+                                               setSpanVal(cell, 'colSpan', cell.colSpan + 1);\r
 \r
                                        lastCell = cell;\r
                                }\r
                                                each(grid, function(row) {\r
                                                        var cell = row[x].elm, colSpan;\r
 \r
-                                                       colSpan = getSpanVal(cell, 'colspan');\r
+                                                       colSpan = getSpanVal(cell, 'colSpan');\r
 \r
                                                        if (colSpan > 1)\r
-                                                               cell.colSpan = colSpan - 1;\r
+                                                               setSpanVal(cell, 'colSpan', colSpan - 1);\r
                                                        else\r
                                                                dom.remove(cell);\r
                                                });\r
 \r
                                // Move down row spanned cells\r
                                each(tr.cells, function(cell) {\r
-                                       var rowSpan = getSpanVal(cell, 'rowspan');\r
+                                       var rowSpan = getSpanVal(cell, 'rowSpan');\r
 \r
                                        if (rowSpan > 1) {\r
-                                               cell.rowSpan = rowSpan - 1;\r
+                                               setSpanVal(cell, 'rowSpan', rowSpan - 1);\r
                                                pos = getPos(cell);\r
                                                fillLeftDown(pos.x, pos.y, 1, 1);\r
                                        }\r
                                        cell = cell.elm;\r
 \r
                                        if (cell != lastCell) {\r
-                                               rowSpan = getSpanVal(cell, 'rowspan');\r
+                                               rowSpan = getSpanVal(cell, 'rowSpan');\r
 \r
                                                if (rowSpan <= 1)\r
                                                        dom.remove(cell);\r
                                                else\r
-                                                       cell.rowSpan = rowSpan - 1;\r
+                                                       setSpanVal(cell, 'rowSpan', rowSpan - 1);\r
 \r
                                                lastCell = 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
+                                       setSpanVal(cell, 'colSpan', 1);\r
+                                       setSpanVal(cell, 'rowSpan', 1);\r
                                }\r
 \r
                                // Needs more cells\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
+                                       for (x = startX; x <= maxX; x++) {\r
+                                               if (grid[y][x])\r
+                                                       dom.addClass(grid[y][x].elm, 'mceSelected');\r
+                                       }\r
                                }\r
                        }\r
                };\r
 \r
        tinymce.create('tinymce.plugins.TablePlugin', {\r
                init : function(ed, url) {\r
-                       var winMan, clipboardRows;\r
+                       var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload\r
 \r
                        function createTableGrid(node) {\r
                                var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');\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
+                               if (hasCellSelection) {\r
+                                       ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');\r
+                                       hasCellSelection = false;\r
+                               }\r
                        };\r
 \r
                        // Register buttons\r
                                ed.onClick.add(function(ed, e) {\r
                                        e = e.target;\r
 \r
-                                       if (e.nodeName === 'TABLE')\r
+                                       if (e.nodeName === 'TABLE') {\r
                                                ed.selection.select(e);\r
+                                               ed.nodeChanged();\r
+                                       }\r
                                });\r
                        }\r
 \r
+                       ed.onPreProcess.add(function(ed, args) {\r
+                               var nodes, i, node, dom = ed.dom, value;\r
+\r
+                               nodes = dom.select('table', args.node);\r
+                               i = nodes.length;\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       dom.setAttrib(node, 'data-mce-style', '');\r
+\r
+                                       if ((value = dom.getAttrib(node, 'width'))) {\r
+                                               dom.setStyle(node, 'width', value);\r
+                                               dom.setAttrib(node, 'width', '');\r
+                                       }\r
+\r
+                                       if ((value = dom.getAttrib(node, 'height'))) {\r
+                                               dom.setStyle(node, 'height', value);\r
+                                               dom.setAttrib(node, 'height', '');\r
+                                       }\r
+                               }\r
+                       });\r
+\r
                        // Handle node change updates\r
                        ed.onNodeChange.add(function(ed, cm, n) {\r
                                var p;\r
                                                        }\r
 \r
                                                        tableGrid.setEndCell(target);\r
+                                                       hasCellSelection = true;\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
+                                               try {\r
+                                                       if (sel.removeAllRanges)\r
+                                                               sel.removeAllRanges();\r
+                                                       else\r
+                                                               sel.empty();\r
+                                               } catch (ex) {\r
+                                                       // IE9 might throw errors here\r
+                                               }\r
 \r
                                                e.preventDefault();\r
                                        }\r
                                                        rng = dom.createRng();\r
                                                        node = selectedCells[0];\r
                                                        endNode = selectedCells[selectedCells.length - 1];\r
+                                                       rng.setStart(node);
+                                                       rng.setEnd(node);
 \r
                                                        setPoint(node, 1);\r
                                                        walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));\r
index b5fc1fda3d701ab6399793ec530e1379c73db445..d6f32905997164364d956f9cb34350249ef26f21 100644 (file)
@@ -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
index 70d95b6729d78b16c9934f8fac9462e9bddb6aec..a13d69592d5af7467eee68259b930ab110975ed8 100644 (file)
@@ -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
index d1b42c2af0dc43596c3576f0499253337d3ede14..520d857fcee05a41563523e7b2836f7708070ede 100644 (file)
@@ -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,8 +58,6 @@ 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
@@ -82,7 +80,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
@@ -151,7 +149,7 @@ function insertTable() {
        html += makeAttrib('border', border);\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 +185,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 +195,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 +205,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,13 +227,18 @@ function insertTable() {
        } else\r
                inst.execCommand('mceInsertContent', false, html);\r
 \r
-       tinymce.each(dom.select('table[_mce_new]'), function(node) {\r
+       tinymce.each(dom.select('table[data-mce-new]'), function(node) {\r
                var td = dom.select('td', node);\r
 \r
-               inst.selection.select(td[0], true);\r
-               inst.selection.collapse();\r
+               try {\r
+                       // IE9 might fail to do this selection\r
+                       inst.selection.select(td[0], true);\r
+                       inst.selection.collapse();\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
@@ -279,7 +280,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
index 000332a35da4924d5764b00991d93fb1eb4269a1..0816efb9c605e42773075979c364eecf62e16546 100644 (file)
@@ -7,7 +7,7 @@ rowtype:"Row in table part",
 title:"Insert/Modify table",\r
 width:"Width",\r
 height:"Height",\r
-cols:"Cols",\r
+cols:"Columns",\r
 rows:"Rows",\r
 cellspacing:"Cellspacing",\r
 cellpadding:"Cellpadding",\r
@@ -39,6 +39,7 @@ td:"Data",
 th:"Header",\r
 cell_cell:"Update current cell",\r
 cell_row:"Update all cells in row",\r
+cell_col:"Update all cells in column",\r
 cell_all:"Update all cells in table",\r
 row_row:"Update current row",\r
 row_odd:"Update odd rows in table",\r
index 9736ed8c03f09248ed515235d963d0fb05d57567..d231090e7988149d0bd087828c4fdbdd4c3f3b51 100644 (file)
@@ -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
index 092e6c8270e23825ce47634d98ca6847e83d37dd..1885401f6bc00dbcbf77d7beeedd82c77f06fa7f 100644 (file)
@@ -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
index f269039228dbe343035e21544b92378aa230fe11..09d3700f77729e99d0a40d04455aa0f92a972283 100644 (file)
        <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="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="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
index 24045d7311a891e57c5e35d1c9c3848487a6e7ab..bc3045d2446d748c2f6e55e99b3aedbde055bfff 100644 (file)
@@ -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
index 94719f93a10ca9a67ca833d2cc5c5f555f14e8d3..1a148e8b4fc57cf41baf0f72bb4c0744ef4780ff 100644 (file)
@@ -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&&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 _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
+(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
index 35856e26a0f54d7b055a78f787a51bc454b27948..df985905b6a1b26eb775f38783b24926be73b3d9 100644 (file)
@@ -59,7 +59,7 @@
 \r
                                for (i = 0; i < nl.length; i++) {\r
                                        nv = nl[i].nodeValue;\r
-                                       nv = nv.replace(/(\u00a0)/g, '<span _mce_bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');\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
index a099e6a8c57d2a192eed03efbd02b3330430fa57..e769d09f6d8fae41a08f66d74d8ae1e1d21eac44 100644 (file)
@@ -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(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/[\w\u2019\'-]+/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})},_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(){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.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
index 5cb92fa0f08f406a1f0ff9a29bc12fa27c371f84..6c9a3ead270ff1fffdc68e897536c5fefd4b406f 100644 (file)
@@ -9,7 +9,7 @@
  */\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
@@ -18,8 +18,8 @@
                init : function(ed, url) {\r
                        var t = this, last = 0;\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.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
                        });\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
-                               }\r
+                                       var tc = t._getCount(ed);\r
 \r
-                               tinymce.DOM.setHTML(t.id, tc.toString());\r
+                                       tinymce.DOM.setHTML(t.id, tc.toString());\r
 \r
-                               setTimeout(function() {t.block = 0;}, 2000);\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
index 3aeac0deba01c84baf14c8f394d592fddbe7aecf..30a894f7c3b7cd4ffd4a99a9c9f55fc0af03c6f5 100644 (file)
        <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
index 31ee7b70f3e3ba4a7c1b370cd98196d8810444b8..c10934592884008d75513c9352110b428c85a80f 100644 (file)
        <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
index 17054da3edcc83fe6edb2ee26ea922ee1c59c5eb..e8d606a340ec77b0029089146f5211372ace50b4 100644 (file)
@@ -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
index d0a3e3a8e5b617176ec39c74c6374e106cd7e1b8..0ac6bdb66718b996bf6c930ec745a4cb74ff1654 100644 (file)
        <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
index 8b07fa8429b55932f451106a6fc3d76775b6e785..5f667510f521d66d8e60d98be13561ca4423ee06 100644 (file)
        <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
index a9393ad6dbb8826ace894efe426d07e0817bcaa0..9b98a5154b047395f8617273309044af4426e116 100644 (file)
@@ -1 +1 @@
-(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_width",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_width",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_width",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_width",0)),inline:1},{plugin_url:b})});a.addCommand("mceAttributes",function(){a.windowManager.open({file:b+"/attributes.htm",width:380,height:370,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
+(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
index 5f9d9bd50b8dc3d855f08d1a233eff3c43780ac9..f24057211c4ce2059912fec74c80bd3835914349 100644 (file)
@@ -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
index 6c5470cfcce58d78c55d2332a56e4d8e81741174..d001ac7c4d2db88f9ce25ad3db2a752b4f40d9c7 100644 (file)
        <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
index d62a219e6b255af55e402373e3618cf4a0ebeee6..9c99995adb90306124d406cad6e78e310459acdd 100644 (file)
@@ -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
index 9e5d8c5717a629e1d18e62db5c53d4709a101e7d..1f957dc786044d69ecf9c2349f4f128a9ecb7c72 100644 (file)
@@ -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
index 5b494a56601b5f8829cd2f4f1aa98044d92acd6d..4e5d9c3bbd81e61a49d2b0927a4eec38e0a56c7f 100644 (file)
@@ -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
index 3774f0a184f241c61250a6af96658596b59d8d64..c4addfb01dadf0d68c3dd49eb2e0008477739e78 100644 (file)
@@ -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
index 267f837eb171711e11e39b06443a703ea137993e..7a97cb71543913cc020b8fc84dadee3dcf83db5c 100644 (file)
@@ -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
index 2bc63fcfdc6a5c9e520793e723fa4da22d8bfcdf..75c93b799b87bb53b0675116e0bffb6d732b4b7f 100644 (file)
@@ -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
index 3991b8141b34a0bb3c6b5151c4134c5c445b4a69..2c3b3f27bde8c158d8ba2bc797e9afeaf4fcc392 100644 (file)
@@ -6,47 +6,46 @@
        <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
+<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
 </table>\r
-\r
 </body>\r
 </html>\r
index 096e7550c33f00fc4cc6c0216f3831674fa42b31..ad1bb0f6ccfaee3762641f44044e39d2fbae4d8a 100644 (file)
@@ -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
index 4c433127f9102a27c21701be1239f47502df2ff9..57e7184a83a03ae47921ef63fd62308e331de1d8 100644 (file)
@@ -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(!o||p[0]==o){i.formatter.remove(p[0])}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){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});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){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}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(p){return i==p});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(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);j.forcedHighContrastMode=j.settings.detect_highcontrast&&l._isHighContrast();j.settings.skin=j.forcedHighContrastMode?"highcontrast":j.settings.skin;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",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,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}if(j.settings.content_css!==false){j.contentCSS.push(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l);j.onKeyUp.add(l._updateUndoStatus,l);j.onMouseUp.add(l._updateUndoStatus,l);j.dom.bind(j.dom.getRoot(),"dragend",function(){l._updateUndoStatus(j)})}});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")}},_isHighContrast:function(){var i,j=d.add(d.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});i=(d.getStyle(j,"background-color",true)+"").toLowerCase().replace(/ /g,"");d.remove(j);return i!="rgb(171,239,86)"&&i!="#abef56"},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(!o||p[0]==o){if(p[0]){i.formatter.remove(p[0])}}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){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});if(m&&m.value==l){k.select(null)}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){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}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(p){return i==p});if(o&&(o.value.fontSize==i.fontSize||o.value["class"]==i["class"])){n.select(null)}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",onselect:function(l){j.editor.execCommand("FormatBlock",false,l);return false}});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;if(r.settings){r.settings.aria_label=w.aria_label+r.getLang("advanced.help_shortcut")}m=j=d.create("span",{role:"application","aria-labelledby":r.id+"_voice",id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});d.add(m,"span",{"class":"mceVoiceLabel",style:"display:none;",id:r.id+"_voice"},w.aria_label);if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{role:"presentation",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=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;r.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){window.focus();v.toolbarGroup.focus();return b.cancel(n)}else{if(n.keyCode===o){d.get(p.id+"_path_row").focus();return b.cancel(n)}}}});r.addShortcut("alt+0","","mceShortcuts",v);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+"_ifr");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i<n.clientWidth){i=n.clientWidth;d.setStyle(o,"width",n.clientWidth)}}if(k&&l.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+j.id+"_size",{cw:i,ch:m})}},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(s.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(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=d.add(d.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(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",role:"group","aria-labelledby":p.id+"_path_voice"});if(w.theme_advanced_path){d.add(k,"span",{id:p.id+"_path_voice"},p.translate("advanced.path"));d.add(k,"span",{},": ")}else{d.add(k,"span",{},"&#160;")}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","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();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);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}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},_updateUndoStatus:function(j){var i=j.controlManager,k=j.undoManager;i.setDisabled("undo",!k.hasUndo()&&!k.typing);i.setDisabled("redo",!k.hasRedo())},_nodeChanged:function(m,r,D,q,E){var y=this,C,F=0,x,G,z=y.settings,w,k,u,B,l,j,i;e.each(y.stateControls,function(n){r.setActive(n,m.queryCommandState(y.controls[n][1]))});function o(p){var s,n=E.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]}}}r.setActive("visualaid",m.hasVisual);y._updateUndoStatus(m);r.setDisabled("outdent",!m.queryCommandState("Outdent"));C=o("A");if(G=r.get("link")){if(!C||!C.name){G.setDisabled(!C&&q);G.setActive(!!C)}}if(G=r.get("unlink")){G.setDisabled(!C&&q);G.setActive(!!C&&!C.name)}if(G=r.get("anchor")){G.setActive(!q&&!!C&&C.name)}C=o("IMG");if(G=r.get("image")){G.setActive(!q&&!!C&&D.className.indexOf("mceItem")==-1)}if(G=r.get("styleselect")){y._importClasses();j=[];f(G.items,function(n){j.push(n.value)});i=m.formatter.matchAll(j);G.select(i[0])}if(G=r.get("formatselect")){C=o(d.isBlock);if(C){G.select(C.nodeName.toLowerCase())}}o(function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}}if(m.dom.is(p,z.theme_advanced_font_selector)){if(!k&&p.style.fontSize){k=p.style.fontSize}if(!u&&p.style.fontFamily){u=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}if(!B&&p.style.color){B=p.style.color}if(!l&&p.style.backgroundColor){l=p.style.backgroundColor}}return false});if(G=r.get("fontselect")){G.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==u})}if(G=r.get("fontsizeselect")){if(z.theme_advanced_runtime_fontsize&&!k&&!w){k=m.dom.getStyle(D,"fontSize",true)}G.select(function(n){if(n.fontSize&&n.fontSize===k){return true}if(n["class"]&&n["class"]===w){return true}})}if(z.theme_advanced_show_current_color){function A(p,n){if(G=r.get(p)){if(!n){n=G.settings.default_color}if(n!==G.value){G.displayColor(n)}}}A("forecolor",B);A("backcolor",l)}if(z.theme_advanced_show_current_color){function A(p,n){if(G=r.get(p)){if(!n){n=G.settings.default_color}if(n!==G.value){G.displayColor(n)}}}A("forecolor",B);A("backcolor",l)}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){C=d.get(m.id+"_path")||d.add(m.id+"_path_row","span",{id:m.id+"_path"});if(y.statusKeyboardNavigation){y.statusKeyboardNavigation.destroy();y.statusKeyboardNavigation=null}d.setHTML(C,"");o(function(H){var p=H.nodeName.toLowerCase(),s,v,t="";if(H.nodeType!=1||p==="br"||H.getAttribute("data-mce-bogus")||d.hasClass(H,"mceItemHidden")||d.hasClass(H,"mceItemRemoved")){return}if(e.isIE&&H.scopeName!=="HTML"){p=H.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(H,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(H,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(H,"href")){t+="href: "+x+" "}break;case"font":if(x=d.getAttrib(H,"face")){t+="font: "+x+" "}if(x=d.getAttrib(H,"size")){t+="size: "+x+" "}if(x=d.getAttrib(H,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(H,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(H,"id")){t+="id: "+x+" "}if(x=H.className){x=x.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(x){t+="class: "+x+" ";if(d.isBlock(H)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:H,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",role:"button",onmousedown:"return false;",title:t,"class":"mcePath_"+(F++)},p);if(C.hasChildNodes()){C.insertBefore(d.create("span",{"aria-hidden":"true"},"\u00a0\u00bb "),C.firstChild);C.insertBefore(v,C.firstChild)}else{C.appendChild(v)}},m.getBody());if(d.select("a",C).length>0){y.statusKeyboardNavigation=new e.ui.KeyboardNavigation({root:m.id+"_path_row",items:d.select("a",C),excludeFromTabOrder:true,onCancel:function(){m.focus()}},d)}}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:this.url+"/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:this.url+"/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:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var i=this.editor;i.windowManager.open({url:this.url+"/shortcuts.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:this.url+"/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:this.url+"/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:this.url+"/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:this.url+"/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
index e0d4dacc0c0adc6ac6ca503f39c0771a5906961a..d62f497e6193130509dbaafab1ade6b9ad63dfba 100644 (file)
@@ -66,6 +66,9 @@
                        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
@@ -81,6 +84,8 @@
                                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
                                        // Toggle off the current format\r
                                        matches = ed.formatter.matchAll(formatNames);\r
-                                       if (!name || matches[0] == name)\r
-                                               ed.formatter.remove(matches[0]);\r
-                                       else\r
+                                       if (!name || matches[0] == name) {\r
+                                               if (matches[0]) \r
+                                                       ed.formatter.remove(matches[0]);\r
+                                       } else\r
                                                ed.formatter.apply(name);\r
 \r
                                        ed.undoManager.add();\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
                                        return v == sv;\r
                                });\r
 \r
+                               if (cur && (cur.value.fontSize == v.fontSize || 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
                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
                        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
+                                               window.focus();\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
                                }\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
                                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
                                inline : true\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
                                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
index f30d670641afcb284105b7bbc79afcbd102b2aa4..b8ba729f6f24776226b23388afa170d3d32a5308 100644 (file)
 \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
index b4c542d107b25f68a9d4f9d7a109d0565d1f1437..b1a377aba7784d3a0a0fabb4d22b8114cde25ace 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/img/colorpicker.jpg and b/plugins/TinyMCE/js/themes/advanced/img/colorpicker.jpg differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/flash.gif b/plugins/TinyMCE/js/themes/advanced/img/flash.gif
new file mode 100644 (file)
index 0000000..dec3f7c
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/flash.gif differ
index e46de5333082869b9bdab2576a554a2f9d01a966..641a9e3d314f4ea051692a2274aeb281456f5df9 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/img/icons.gif and b/plugins/TinyMCE/js/themes/advanced/img/icons.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/iframe.gif b/plugins/TinyMCE/js/themes/advanced/img/iframe.gif
new file mode 100644 (file)
index 0000000..410c7ad
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/iframe.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/pagebreak.gif b/plugins/TinyMCE/js/themes/advanced/img/pagebreak.gif
new file mode 100644 (file)
index 0000000..acdf408
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/pagebreak.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/quicktime.gif b/plugins/TinyMCE/js/themes/advanced/img/quicktime.gif
new file mode 100644 (file)
index 0000000..8f10e7a
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/quicktime.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/realmedia.gif b/plugins/TinyMCE/js/themes/advanced/img/realmedia.gif
new file mode 100644 (file)
index 0000000..fdfe0b9
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/realmedia.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/shockwave.gif b/plugins/TinyMCE/js/themes/advanced/img/shockwave.gif
new file mode 100644 (file)
index 0000000..9314d04
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/shockwave.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/trans.gif b/plugins/TinyMCE/js/themes/advanced/img/trans.gif
new file mode 100644 (file)
index 0000000..3884865
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/trans.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/video.gif b/plugins/TinyMCE/js/themes/advanced/img/video.gif
new file mode 100644 (file)
index 0000000..3570104
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/video.gif differ
diff --git a/plugins/TinyMCE/js/themes/advanced/img/windowsmedia.gif b/plugins/TinyMCE/js/themes/advanced/img/windowsmedia.gif
new file mode 100644 (file)
index 0000000..ab50f2d
Binary files /dev/null and b/plugins/TinyMCE/js/themes/advanced/img/windowsmedia.gif differ
index 5cee9ed863cdb6ffaf6cc44979375c1beb9cd920..5b358457617adaba1ebc51fbb70f77930065fcea 100644 (file)
@@ -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
index 7fe7810558e74edefb59a63da1c14cfc9689b139..e528e4f42f78a571657b6abe88f429a1d57400dd 100644 (file)
@@ -19,6 +19,11 @@ 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
index 8c5aea1721f56c80391a174cbc1c719ef9d124a1..1cead6dfe87c50cc7dc2d9a889131ee5e45eb2df 100644 (file)
@@ -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,38 @@ 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(".charmaplink", "charmapgroup");\r
+\r
+       settings ={\r
+               root: "charmapgroup",\r
+               items: cells\r
+       };\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] + '">'\r
                                + charmap[i][1]\r
                                + '</a></td>';\r
                        if ((cols+1) % charsPerRow == 0)\r
@@ -301,7 +320,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
index fd9700f2224320b9ab6a252c19e6c54fa018fee6..7decac5b43c3c431867eb07a13f70e7dbebf76f5 100644 (file)
@@ -1,6 +1,6 @@
 tinyMCEPopup.requireLangPack();\r
 \r
-var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;\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
@@ -33,37 +33,41 @@ var colors = [
 ];\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
+       '#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',\r
+       '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',\r
+       '#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',\r
+       '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',\r
+       '#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',\r
+       '#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',\r
+       '#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',\r
+       '#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',\r
+       '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',\r
+       '#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',\r
+       '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',\r
+       '#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',\r
+       '#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',\r
+       '#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',\r
+       '#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',\r
+       '#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',\r
+       '#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',\r
+       '#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',\r
+       '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',\r
+       '#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',\r
+       '#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',\r
+       '#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',\r
+       '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'\r
 };\r
 \r
+var namedLookup = {};\r
+\r
 function init() {\r
-       var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));\r
+       var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;\r
 \r
        tinyMCEPopup.resizeToInnerSize();\r
 \r
        generatePicker();\r
+       generateWebColors();\r
+       generateNamedColors();\r
 \r
        if (inputColor) {\r
                changeFinalColor(inputColor);\r
@@ -73,6 +77,45 @@ function init() {
                if (col)\r
                        updateLight(col.r, col.g, col.b);\r
        }\r
+       \r
+       for (key in named) {\r
+               value = named[key];\r
+               namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();\r
+       }\r
+}\r
+\r
+function toHexColor(color) {\r
+       var matches, red, green, blue, toInt = parseInt;\r
+\r
+       function hex(value) {\r
+               value = parseInt(value).toString(16);\r
+\r
+               return value.length > 1 ? value : '0' + value; // Padd with leading zero\r
+       };\r
+\r
+       color = color.replace(/[\s#]+/g, '').toLowerCase();\r
+       color = namedLookup[color] || color;\r
+       matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color);\r
+\r
+       if (matches) {\r
+               if (matches[1]) {\r
+                       red = toInt(matches[1]);\r
+                       green = toInt(matches[2]);\r
+                       blue = toInt(matches[3]);\r
+               } else if (matches[4]) {\r
+                       red = toInt(matches[4], 16);\r
+                       green = toInt(matches[5], 16);\r
+                       blue = toInt(matches[6], 16);\r
+               } else if (matches[7]) {\r
+                       red = toInt(matches[7] + matches[7], 16);\r
+                       green = toInt(matches[8] + matches[8], 16);\r
+                       blue = toInt(matches[9] + matches[9], 16);\r
+               }\r
+\r
+               return '#' + hex(red) + hex(green) + hex(blue);\r
+       }\r
+\r
+       return '';\r
 }\r
 \r
 function insertAction() {\r
@@ -81,7 +124,7 @@ function insertAction() {
        tinyMCEPopup.restoreSelection();\r
 \r
        if (f)\r
-               f(color);\r
+               f(toHexColor(color));\r
 \r
        tinyMCEPopup.close();\r
 }\r
@@ -91,7 +134,7 @@ function showColor(color, name) {
                document.getElementById("colorname").innerHTML = name;\r
 \r
        document.getElementById("preview").style.backgroundColor = color;\r
-       document.getElementById("color").value = color.toLowerCase();\r
+       document.getElementById("color").value = color.toUpperCase();\r
 }\r
 \r
 function convertRGBToHex(col) {\r
@@ -153,23 +196,40 @@ function generateWebColors() {
        if (el.className == 'generated')\r
                return;\r
 \r
-       h += '<table border="0" cellspacing="1" cellpadding="0">'\r
+       // TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.\r
+       h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" 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
+                       + '<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;">';\r
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {\r
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';\r
+               }\r
+               h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';\r
+               h += '</a></td>';\r
                if ((i+1) % 18 == 0)\r
                        h += '</tr><tr>';\r
        }\r
 \r
-       h += '</table>';\r
+       h += '</table></div>';\r
 \r
        el.innerHTML = h;\r
        el.className = 'generated';\r
+\r
+       paintCanvas(el);\r
+       enableKeyboardNavigation(el.firstChild);\r
 }\r
 \r
+function paintCanvas(el) {\r
+       tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {\r
+               var context;\r
+               if (canvas.getContext && (context = canvas.getContext("2d"))) {\r
+                       context.fillStyle = canvas.getAttribute('data-color');\r
+                       context.fillRect(0, 0, 10, 10);\r
+               }\r
+       });\r
+}\r
 function generateNamedColors() {\r
        var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;\r
 \r
@@ -178,11 +238,27 @@ function generateNamedColors() {
 \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
+               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 + '">';\r
+               if (tinyMCEPopup.editor.forcedHighContrastMode) {\r
+                       h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';\r
+               }\r
+               h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';\r
+               h += '</a>';\r
+               i++;\r
        }\r
 \r
        el.innerHTML = h;\r
        el.className = 'generated';\r
+\r
+       paintCanvas(el);\r
+       enableKeyboardNavigation(el);\r
+}\r
+\r
+function enableKeyboardNavigation(el) {\r
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {\r
+               root: el,\r
+               items: tinyMCEPopup.dom.select('a', el)\r
+       }, tinyMCEPopup.dom);\r
 }\r
 \r
 function dechex(n) {\r
index 6423d908095f0f1a221c9dcecde7ca281137b665..2bccc97b92c8a9254f5506628c192343553cbbc9 100644 (file)
@@ -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,6 +87,8 @@ 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
index f67a5bc82810d5cd57d3b6a05fdf4bee9e199b2c..53ff409e7962f0d4f2d686922e33eff2ae53714b 100644 (file)
@@ -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
index 279328614c5ee8a0077295a0ff7814a24d723922..84546ad52ebc461ccdebb02e1762e8c9ea760744 100644 (file)
@@ -44,19 +44,13 @@ function toggleWordWrap(elm) {
                setWrap('off');\r
 }\r
 \r
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;\r
-\r
 function resizeInputs() {\r
-       var el = document.getElementById('htmlSource');\r
+       var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
 \r
-       if (!tinymce.isIE) {\r
-                wHeight = self.innerHeight - 65;\r
-                wWidth = self.innerWidth - 16;\r
-       } else {\r
-                wHeight = document.body.clientHeight - 70;\r
-                wWidth = document.body.clientWidth - 16;\r
-       }\r
+       el = document.getElementById('htmlSource');\r
 \r
-       el.style.height = Math.abs(wHeight) + 'px';\r
-       el.style.width  = Math.abs(wWidth) + 'px';\r
+       if (el) {\r
+               el.style.width = (vp.w - 20) + 'px';\r
+               el.style.height = (vp.h - 65) + 'px';\r
+       }\r
 }\r
index 69694b1f9f8cd4ecfe36a64b7ccb80014458a5fa..fbf29893fe02656ab99c9771769f544215ad966b 100644 (file)
@@ -58,5 +58,11 @@ clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you
 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
+more_colors:"More colors",\r
+\r
+// Accessibility Strings\r
+shortcuts_desc:'Accessibility Help',\r
+help_shortcut:'. Press ALT F10 for toolbar. Press ALT 0 for help.',\r
+rich_text_area:"Rich Text Area",\r
+toolbar:"Toolbar"\r
+});\r
index 9d124d7db69b022cdca56f02bc4d418e1f4b25c3..0a459beb5ca3e31ba7d1ae00dce8a0b0915ff2a6 100644 (file)
@@ -10,6 +10,7 @@ about_version:"Version",
 about_loaded:"Loaded plugins",\r
 anchor_title:"Insert/edit anchor",\r
 anchor_name:"Anchor name",\r
+anchor_invalid:"Please specify a valid anchor name.",\r
 code_title:"HTML Source Editor",\r
 code_wordwrap:"Word wrap",\r
 colorpicker_title:"Select a color",\r
@@ -45,7 +46,9 @@ link_target:"Target",
 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
+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 be an external link. Do you want to add the required http:// prefix?",\r
+link_list:"Link list",\r
+accessibility_help:"Accessibility Help",\r
+accessibility_usage_title:"General Usage"\r
 });
\ No newline at end of file
index 7565b9ae8b23f0c01cd868e59a69bbaa1f0dbadc..5d9dea9b8c2a91dd1fc00a5839cf91da3ea31425 100644 (file)
 \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/plugins/TinyMCE/js/themes/advanced/shortcuts.htm b/plugins/TinyMCE/js/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
index 9fba0431daa6add15e5d7ac45f9c6b6409746c23..569a3ae8c7a341dd18cd0eb38e877dbc6ddd31c5 100644 (file)
@@ -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,7 +9,7 @@ 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
@@ -34,3 +35,13 @@ 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
+\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
+.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
index 7dd58418ba7cfe58ae7efdf174e0b223fe3aa6a0..1e53560e0aa7bb1b9a0373fc2f330acab7d1d51f 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/default/img/buttons.png and b/plugins/TinyMCE/js/themes/advanced/skins/default/img/buttons.png differ
index 2eafd7954e6ebf24204b01db94b39299426d09da..d2f93671ca3090b277e16a67b1aa6cfb6ac4915f 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/default/img/items.gif and b/plugins/TinyMCE/js/themes/advanced/skins/default/img/items.gif differ
index ce4be63558b02e9837b995d2b9dd540ce6d61a6f..06812cb4109b0b236b9659c570458842e39c6416 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/default/img/tabs.gif and b/plugins/TinyMCE/js/themes/advanced/skins/default/img/tabs.gif differ
index 0049c7b3d0f1789c800954edc95986a5886acbca..2b7c2a59a90aef8ed64f461f5e0fc95ae3e282a2 100644 (file)
@@ -4,8 +4,8 @@
 .defaultSkin table td {vertical-align:middle}\r
 \r
 /* Containers */\r
-.defaultSkin table {direction:ltr; background:#F0F0EE}\r
-.defaultSkin iframe {display:block; background:#FFF}\r
+.defaultSkin table {direction:ltr;background:transparent}\r
+.defaultSkin iframe {display:block;}\r
 .defaultSkin .mceToolbar {height:26px}\r
 .defaultSkin .mceLeft {text-align:left}\r
 .defaultSkin .mceRight {text-align:right}\r
@@ -20,9 +20,9 @@
 .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 td.mceToolbar {background:#F0F0EE; padding-top:1px; vertical-align:top}\r
 .defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}\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 {background:#F0F0EE; 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 .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
+.defaultSkin .mceMenuItem td, .defaultSkin .mceMenuItem th {line-height: normal}\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
diff --git a/plugins/TinyMCE/js/themes/advanced/skins/highcontrast/content.css b/plugins/TinyMCE/js/themes/advanced/skins/highcontrast/content.css
new file mode 100644 (file)
index 0000000..c2e30c7
--- /dev/null
@@ -0,0 +1,23 @@
+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 {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
diff --git a/plugins/TinyMCE/js/themes/advanced/skins/highcontrast/dialog.css b/plugins/TinyMCE/js/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/plugins/TinyMCE/js/themes/advanced/skins/highcontrast/ui.css b/plugins/TinyMCE/js/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
index 3b833d94510fe4a3a20d4e0565d91d3e0c0627aa..4ac4e4dfb3d16f4aba0b6f1c6595127dc3e27978 100644 (file)
@@ -34,3 +34,13 @@ 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
+\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
+.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
index e3af1396e4c29259bb12be1cb0c3dd3e82f7b2da..ec087722481db858c53b6cf7a637988e254a76b5 100644 (file)
@@ -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
index 12cfb419bbf2fb87f845731aa0fceb653d0dbf88..13a5cb03097c004f7b37658654a9250748cf073c 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg.png and b/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg.png differ
index 8996c7493e8a58c9c40845cbe8abdc3e6730716d..7fc57f2bc2d63a3ad6fbf98b663f336539f011ec 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_black.png and b/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_black.png differ
index bd5d2550c06d83c1141b78c5af7217e89559fc32..c0dcc6cac2003f7405fff3ea5df7bcf276243596 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_silver.png and b/plugins/TinyMCE/js/themes/advanced/skins/o2k7/img/button_bg_silver.png differ
index a6253976afc3755ed06a2cbe6b40353f67a8b3f6..29e35e5ef256839faad24f311bee927c977a5bf7 100644 (file)
@@ -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
@@ -50,7 +51,7 @@
 .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  {display: inline-block; margin-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
@@ -62,7 +63,7 @@
 .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
index 153f0c38a6c69b897b9d7dbb5fd66a75991048bc..50c9b76a2d4da3ebdebba7cf52a027a212929555 100644 (file)
@@ -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
index 7fe3b45e1264ad10f89c696ecc3b0e0801a96653..960a8e475554f8100b5419042a270984ec99103b 100644 (file)
@@ -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
index 5957bbd1782e4a9727f0b708b05b0b2b419cea4f..3c6d65808a854b73e184ba7ec9a67a0790e501ff 100644 (file)
@@ -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
index ed89abc067613b25c124f6e39af8b7d498ad0714..4b3209cc921bae7fd4ca101ccf55b0c617b890a1 100644 (file)
@@ -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
index 4b862d49d62afec995fffba2a7ddb4fa904a5ee3..01ce87c58a9e25eb6cb8b3a0d331e8416099c5ee 100644 (file)
@@ -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
index 16af141ff0eea376a889b1e8d28e9c1cacaaab16..6fcbcb5dedf16a5fa1d15c2aa127bceb612f1e71 100644 (file)
Binary files a/plugins/TinyMCE/js/themes/simple/img/icons.gif and b/plugins/TinyMCE/js/themes/simple/img/icons.gif differ
index 782f7f40ba110ac46b2888e2892131b643876188..6463ba05c1d9b127be90a3fd7f7756209d863949 100644 (file)
@@ -1 +1 @@
-(function(c){var a=/^\s*|\s*$/g,d;var b={majorVersion:"3",minorVersion:"3.8",releaseDate:"2010-06-30",_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},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);(function(e,d){var c=d.is,b=/^(href|src|style)$/i,f;if(!e){return alert("Load jQuery first!")}d.$=e;d.adapter={patchEditor:function(j){var i=e.fn;function h(n,o){var m=this;if(o){m.removeAttr("_mce_style")}return i.css.apply(m,arguments)}function g(n,o){var m=this;if(b.test(n)){if(o!==f){m.each(function(p,q){j.dom.setAttrib(q,n,o)});return m}else{return m.attr("_mce_"+n)}}return i.attr.apply(m,arguments)}function k(m){return function(n){if(n){n=j.dom.processHTML(n)}return m.call(this,n)}}function l(m){if(m.css!==h){m.css=h;m.attr=g;m.html=k(i.html);m.append=k(i.append);m.prepend=k(i.prepend);m.after=k(i.after);m.before=k(i.before);m.replaceWith=k(i.replaceWith);m.tinymce=j;m.pushStack=function(){return l(i.pushStack.apply(this,arguments))}}return m}j.$=function(m,n){var o=j.getDoc();return l(e(m||o,o||n))}}};d.extend=e.extend;d.extend(d,{map:e.map,grep:function(g,h){return e.grep(g,h||function(){return 1})},inArray:function(g,h){return e.inArray(h,g||[])}});var a={"tinymce.dom.DOMUtils":{select:function(i,h){var g=this;return e.find(i,g.get(h)||g.get(g.settings.root_element)||g.doc,[])},is:function(h,g){return e(this.get(h)).is(g)}}};d.onCreate=function(g,i,h){d.extend(h,a[i])}})(window.jQuery,tinymce);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")},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;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(k){var p,n,m,r,u,s,t=g.dom.doc,o=t.body;function l(B){var x,A,v,z,y;v=d.create("a");x=B?m:u;A=B?r:s;z=p.duplicate();if(x==t){x=o;A=0}if(x.nodeType==3){x.parentNode.insertBefore(v,x);z.moveToElementText(v);z.moveStart("character",A);d.remove(v);p.setEndPoint(B?"StartToStart":"EndToEnd",z)}else{y=x.childNodes;if(y.length){if(A>=y.length){d.insertAfter(v,y[y.length-1])}else{x.insertBefore(v,y[A])}z.moveToElementText(v)}else{v=t.createTextNode(j);x.appendChild(v);z.moveToElementText(v.parentNode);z.collapse(c)}p.setEndPoint(B?"StartToStart":"EndToEnd",z);d.remove(v)}}this.destroy();m=k.startContainer;r=k.startOffset;u=k.endContainer;s=k.endOffset;p=o.createTextRange();if(m==u&&m.nodeType==1&&r==s-1){if(r==s-1){try{n=o.createControlRange();n.addElement(m.childNodes[r]);n.select();n.scrollIntoView();return}catch(q){}}}l(true);l();p.select();p.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(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(E,J){var A=this,B=A.settings,y=A.writer,q,j,u,G,F,I,C,h,z,k,r,D,p,m,H,o,x;if(!B.node_filter||B.node_filter(E)){switch(E.nodeType){case 1:if(E.hasAttribute?E.hasAttribute("_mce_bogus"):E.getAttribute("_mce_bogus")){return}p=H=false;q=E.hasChildNodes();k=E.getAttribute("_mce_name")||E.nodeName.toLowerCase();o=E.getAttribute("_mce_type");if(o){if(!A._info.cleanup){p=true;return}else{H=1}}if(d){x=E.scopeName;if(x&&x!=="HTML"&&x!=="html"){k=x+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!H){if(!A.validElementsRE||!A.validElementsRE.test(k)||(A.invalidElementsRE&&A.invalidElementsRE.test(k))||J){p=true;break}}if(d){if(B.fix_content_duplication){if(E._mce_serialized==A.key){return}E._mce_serialized=A.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(E.nodeName==="BR"&&E.getAttribute("type")=="_moz"){return}}}if(B.validate_children){if(A.elementName&&!A.schema.isValid(A.elementName,k)){p=true;break}A.elementName=k}r=A.findRule(k);if(!r){p=true;break}k=r.name||k;m=B.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){I=r.requiredAttribs;for(G=I.length-1;G>=0;G--){if(this.dom.getAttrib(E,I[G])!==""){break}}if(G==-1){p=true;break}}y.writeStartElement(k);if(r.attribs){for(G=0,C=r.attribs,F=C.length;G<F;G++){I=C[G];z=A._getAttrib(E,I);if(z!==null){y.writeAttribute(I.name,z)}}}if(r.validAttribsRE){C=A.dom.getAttribs(E);for(G=C.length-1;G>-1;G--){h=C[G];if(h.specified){I=h.nodeName.toLowerCase();if(B.invalid_attrs.test(I)||!r.validAttribsRE.test(I)){continue}D=A.findAttribRule(r,I);z=A._getAttrib(E,D,I);if(z!==null){y.writeAttribute(I,z)}}}}if(o&&H){y.writeAttribute("_mce_type",o)}if(k==="script"&&e.trim(E.innerHTML)){y.writeText("// ");y.writeCDATA(E.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=E.firstChild)&&u.nodeType===1&&E.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("_mce_bogus"):u.getAttribute("_mce_bogus")){y.writeText("\u00a0")}}else{if(!q){y.writeText("\u00a0")}}}break;case 3:if(B.validate_children&&A.elementName&&!A.schema.isValid(A.elementName,"#text")){return}return y.writeText(E.nodeValue);case 4:return y.writeCDATA(E.nodeValue);case 8:return y.writeComment(E.nodeValue)}}else{if(E.nodeType==1){q=E.hasChildNodes()}}if(q&&!m){u=E.firstChild;while(u){A._serializeNode(u);A.elementName=k;u=u.nextSibling}}if(!p){if(!m){y.writeFullEndElement()}else{y.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);if(j.adapter){j.adapter.patchEditor(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,C,B;if(b&&D.keyCode==46){s=v.selection.getRng();if(s.parentElement){C=s.parentElement();if(D.ctrlKey){s.moveEnd("word",1);s.select()}v.selection.getSel().clear();if(s.parentElement()==C){B=v.selection.getBookmark();try{C.innerHTML=C.innerHTML}catch(A){}v.selection.moveToBookmark(B)}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||"p")},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(),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,af,Z){var aa=P(W),ah=aa[0],ae,ad,V;function Y(ak){var aj=ak.startContainer,ap=ak.startOffset,ao,an,al,am;if(aj.nodeType==3&&ap>=aj.nodeValue.length-1){aj=aj.parentNode;ap=r(aj)+1}if(aj.nodeType==1){al=aj.childNodes;aj=al[Math.min(ap,al.length-1)];ao=new s(aj);if(ap>al.length-1){ao.next()}for(an=ao.current();an;an=ao.next()){if(an.nodeType==3&&!f(an)){am=c.create("a",null,D);an.parentNode.insertBefore(am,an);ak.setStart(an,0);p.setRng(ak);c.remove(am);return}}}}function X(am){var al,ak,aj;al=a.grep(am.childNodes);for(ak=0,aj=aa.length;ak<aj;ak++){if(S(aa[ak],af,am,am)){break}}if(ah.deep){for(ak=0,aj=al.length;ak<aj;ak++){X(al[ak])}}}function ab(aj){var ak;M(l(aj.parentNode).reverse(),function(al){var am;if(!ak&&al.id!="_start"&&al.id!="_end"){am=v(al,W,af);if(am&&am.split!==false){ak=al}}});return ak}function U(am,aj,ao,ar){var at,aq,ap,al,an,ak;if(am){ak=am.parentNode;for(at=aj.parentNode;at&&at!=ak;at=at.parentNode){aq=at.cloneNode(Q);for(an=0;an<aa.length;an++){if(S(aa[an],af,aq,aq)){aq=0;break}}if(aq){if(ap){aq.appendChild(ap)}if(!al){al=aq}ap=aq}}if(ar&&(!ah.mixed||!E(am))){aj=c.split(am,aj)}if(ap){ao.parentNode.insertBefore(ap,ao);al.appendChild(ao)}}return aj}function ag(aj){return U(ab(aj),aj,aj,true)}function ac(al){var ak=c.get(al?"_start":"_end"),aj=ak[al?"firstChild":"lastChild"];if(G(aj)){aj=aj[al?"firstChild":"lastChild"]}c.remove(ak,true);return aj}function ai(aj){var ak,al;aj=n(aj,aa,A);if(ah.split){ak=H(aj,A);al=H(aj);if(ak!=al){ak=L(ak,"span",{id:"_start",_mce_type:"bookmark"});al=L(al,"span",{id:"_end",_mce_type:"bookmark"});ag(ak);ag(al);ak=ac(A);al=ac()}else{ak=al=ag(ak)}aj.startContainer=ak.parentNode;aj.startOffset=r(ak);aj.endContainer=al.parentNode;aj.endOffset=r(al)+1}I.walk(aj,function(am){M(am,function(an){X(an)})})}if(Z){V=c.createRng();V.setStartBefore(Z);V.setEndAfter(Z);ai(V);return}if(!p.isCollapsed()||!ah.inline){ae=p.getBookmark();ai(p.getRng(A));p.moveToBookmark(ae);if(i(W,af,p.getStart())){Y(p.getRng(true))}T.nodeChanged()}else{O("remove",W,af)}}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:"4.3.1",releaseDate:"2011-06-16",_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.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);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(/^(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)){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){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(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\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(m){var h={},j,l,g,f,c={},b,e,d=m.makeMap,k=m.each;function i(o,n){return o.split(n||",")}function a(r,q){var o,p={};function n(s){return s.replace(/[A-Z]+/g,function(t){return n(r[t])})}for(o in r){if(r.hasOwnProperty(o)){r[o]=n(r[o])}}n(q).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(v,t,s,u){s=i(s,"|");p[t]={attributes:d(s),attributesOrder:s,children:d(u,"|",{"#comment":{}})}});return p}l="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";l=d(l,",",d(l.toUpperCase()));h=a({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]");j=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,preload,autoplay,loop,controls");g=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");f=m.extend(d("td,th,iframe,video,object"),g);b=d("pre,script,style");e=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");m.html.Schema=function(q){var y=this,n={},o={},v=[],p;q=q||{};if(q.verify_html===false){q.valid_elements="*[*]"}if(q.valid_styles){p={};k(q.valid_styles,function(A,z){p[z]=m.explode(A)})}function x(z){return new RegExp("^"+z.replace(/([?+*])/g,".$1")+"$")}function s(G){var F,B,U,Q,V,A,D,P,S,L,T,X,J,E,R,z,N,C,W,Y,K,O,I=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,M=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,H=/[*?+]/;if(G){G=i(G);if(n["@"]){N=n["@"].attributes;C=n["@"].attributesOrder}for(F=0,B=G.length;F<B;F++){A=I.exec(G[F]);if(A){R=A[1];L=A[2];z=A[3];S=A[4];J={};E=[];D={attributes:J,attributesOrder:E};if(R==="#"){D.paddEmpty=true}if(R==="-"){D.removeEmpty=true}if(N){for(Y in N){J[Y]=N[Y]}E.push.apply(E,C)}if(S){S=i(S,"|");for(U=0,Q=S.length;U<Q;U++){A=M.exec(S[U]);if(A){P={};X=A[1];T=A[2].replace(/::/g,":");R=A[3];O=A[4];if(X==="!"){D.attributesRequired=D.attributesRequired||[];D.attributesRequired.push(T);P.required=true}if(X==="-"){delete J[T];E.splice(m.inArray(E,T),1);continue}if(R){if(R==="="){D.attributesDefault=D.attributesDefault||[];D.attributesDefault.push({name:T,value:O});P.defaultValue=O}if(R===":"){D.attributesForced=D.attributesForced||[];D.attributesForced.push({name:T,value:O});P.forcedValue=O}if(R==="<"){P.validValues=d(O,"?")}}if(H.test(T)){D.attributePatterns=D.attributePatterns||[];P.pattern=x(T);D.attributePatterns.push(P)}else{if(!J[T]){E.push(T)}J[T]=P}}}}if(!N&&L=="@"){N=J;C=E}if(z){D.outputName=L;n[z]=D}if(H.test(L)){D.pattern=x(L);v.push(D)}else{n[L]=D}}}}}function u(z){n={};v=[];s(z);k(h,function(B,A){o[A]=B.children})}function r(A){var z=/^(~)?(.+)$/;if(A){k(i(A),function(E){var C=z.exec(E),D=C[1]==="~",F=D?"span":"div",B=C[2];o[B]=o[F];c[B]=F;if(!D){l[B]={}}k(o,function(G,H){if(G[F]){G[B]=G[F]}})})}}function t(A){var z=/^([+\-]?)(\w+)\[([^\]]+)\]$/;if(A){k(i(A),function(E){var D=z.exec(E),B,C;if(D){C=D[1];if(C){B=o[D[2]]}else{B=o[D[2]]={"#comment":{}}}B=o[D[2]];k(i(D[3],"|"),function(F){if(C==="-"){delete B[F]}else{B[F]={}}})}})}}if(!q.valid_elements){k(h,function(A,z){n[z]={attributes:A.attributes,attributesOrder:A.attributesOrder};o[z]=A.children});k(i("strong/b,em/i"),function(z){z=i(z,"/");n[z[1]].outputName=z[0]});n.img.attributesDefault=[{name:"alt",value:""}];k(i("ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr"),function(z){n[z].removeEmpty=true});k(i("p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption"),function(z){n[z].paddEmpty=true})}else{u(q.valid_elements)}r(q.custom_elements);t(q.valid_children);s(q.extended_valid_elements);t("+ol[ul|ol],+ul[ul|ol]");if(q.invalid_elements){m.each(m.explode(q.invalid_elements),function(z){if(n[z]){delete n[z]}})}y.children=o;y.styles=p;y.getBoolAttrs=function(){return j};y.getBlockElements=function(){return l};y.getShortEndedElements=function(){return g};y.getSelfClosingElements=function(){return e};y.getNonEmptyElements=function(){return f};y.getWhiteSpaceElements=function(){return b};y.isValidChild=function(z,B){var A=o[z];return !!(A&&A[B])};y.getElementRule=function(z){var B=n[z],A;if(B){return B}A=v.length;while(A--){B=v[A];if(B.pattern.test(z)){return B}}};y.getCustomElements=function(){return c};y.addValidElements=s;y.setValidElements=u;y.addCustomElements=r;y.addValidChildren=t};m.html.Schema.boolAttrMap=j;m.html.Schema.blockElementsMap=l})(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(q){var A=this,f,m=0,G,j,l=[],B,K,t,N,F,k,p,x,I,r,E,o,J,n,H,M,L,z,D,h,g,u,s=0,v=a.html.Entities.decode,y;function C(O){var Q,P;Q=l.length;while(Q--){if(l[Q].name===O){break}}if(Q>=0){for(P=l.length-1;P>=Q;P--){O=l[P];if(O.valid){A.end(O.name)}}l.length=Q}}D=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");h=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;g={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};F=e.getShortEndedElements();z=e.getSelfClosingElements();k=e.getBoolAttrs();x=c.validate;y=c.fix_self_closing;while(f=D.exec(q)){if(m<f.index){A.text(v(q.substr(m,f.index-m)))}if(G=f[6]){C(G.toLowerCase())}else{if(G=f[7]){G=G.toLowerCase();p=G in F;if(y&&z[G]&&l.length>0&&l[l.length-1].name===G){C(G)}if(!x||(I=e.getElementRule(G))){r=true;if(x){J=I.attributes;n=I.attributePatterns}if(o=f[8]){B=[];B.map={};o.replace(h,function(P,O,T,S,R){var U,Q;O=O.toLowerCase();T=O in k?O:v(T||S||R||"");if(x&&O.indexOf("data-")!==0){U=J[O];if(!U&&n){Q=n.length;while(Q--){U=n[Q];if(U.pattern.test(O)){break}}if(Q===-1){U=null}}if(!U){return}if(U.validValues&&!(T in U.validValues)){return}}B.map[O]=T;B.push({name:O,value:T})})}else{B=[];B.map={}}if(x){H=I.attributesRequired;M=I.attributesDefault;L=I.attributesForced;if(L){K=L.length;while(K--){E=L[K];N=E.name;u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}if(M){K=M.length;while(K--){E=M[K];N=E.name;if(!(N in B.map)){u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}}if(H){K=H.length;while(K--){if(H[K] in B.map){break}}if(K===-1){r=false}}if(B.map["data-mce-bogus"]){r=false}}if(r){A.start(G,B,p)}}else{r=false}if(j=g[G]){j.lastIndex=m=f.index+f[0].length;if(f=j.exec(q)){if(r){t=q.substr(m,f.index-m)}m=f.index+f[0].length}else{t=q.substr(m);m=q.length}if(r&&t.length>0){A.text(t,true)}if(r){A.end(G)}D.lastIndex=m;continue}if(!p){if(!o||o.indexOf("/")!=o.length-1){l.push({name:G,valid:r})}else{if(r){A.end(G)}}}}else{if(G=f[1]){A.comment(G)}else{if(G=f[2]){A.cdata(G)}else{if(G=f[3]){A.doctype(G)}else{if(G=f[4]){A.pi(G,f[5])}}}}}}m=f.index+f[0].length}if(m<q.length){A.text(v(q.substr(m)))}for(K=l.length-1;K>=0;K--){G=l[K];if(G.valid){A.end(G.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===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,K,y,o,D,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 L=H.firstChild,l,M;while(L){l=L.next;if(L.type==3||(L.type==1&&L.name!=="p"&&!o[L.name]&&!L.attr("data-mce-type"))){if(!M){M=I(q,1);H.insert(M,L);M.append(L)}else{M.append(L)}}else{M=null}L=l}}function I(l,L){var M=new a(l,L),N;if(l in e){N=i[l];if(N){N.push(M)}else{i[l]=[M]}}return M}function G(M){var N,l,L;for(N=M.prev;N&&N.type===3;){l=N.value.replace(t,"");if(l.length>0){N.value=l;N=N.prev}else{L=N.prev;N.remove();N=L}}}n=new b.html.SaxParser({validate:y,fix_self_closing:!y,cdata:function(l){A.append(I("#cdata",4)).value=l},text:function(M,l){var L;if(!s[A.name]){M=M.replace(k," ");if(A.lastChild&&o[A.lastChild.name]){M=M.replace(D,"")}}if(M.length!==0){L=I("#text",3);L.raw=!!l;A.append(L).value=M}},comment:function(l){A.append(I("#comment",8)).value=l},pi:function(l,L){A.append(I(l,7)).value=L;G(A)},doctype:function(L){var l;l=A.append(I("#doctype",10));l.value=L;G(A)},start:function(l,T,M){var R,O,N,L,P,U,S,Q;N=y?h.getElementRule(l):{};if(N){R=I(N.outputName||l,1);R.attributes=T;R.shortEnded=M;A.append(R);Q=p[A.name];if(Q&&p[R.name]&&!Q[R.name]){J.push(R)}O=d.length;while(O--){P=d[O].name;if(P in T.map){E=c[P];if(E){E.push(R)}else{c[P]=[R]}}}if(o[l]){G(R)}if(!M){A=R}}},end:function(l){var P,M,O,L,N;M=y?h.getElementRule(l):{};if(M){if(o[l]){if(!s[A.name]){for(P=A.firstChild;P&&P.type===3;){O=P.value.replace(D,"");if(O.length>0){P.value=O;P=P.next}else{L=P.next;P.remove();P=L}}for(P=A.lastChild;P&&P.type===3;){O=P.value.replace(t,"");if(O.length>0){P.value=O;P=P.prev}else{L=P.prev;P.remove();P=L}}}P=A.prev;if(P&&P.type===3){O=P.value.replace(D,"");if(O.length>0){P.value=O}else{P.remove()}}}if(M.removeEmpty||M.paddEmpty){if(A.isEmpty(u)){if(M.paddEmpty){A.empty().append(new a("#text","3")).value="\u00a0"}else{if(!A.attributes.map.name){N=A.parent;A.empty().remove();A=N;return}}}}A=A.parent}}},h);H=A=new a(m.context||g.root_name,11);n.parse(v);if(y&&J.length){if(!m.context){j(J)}else{m.invalid=true}}if(q&&H.name=="body"){F()}if(!m.invalid){for(K in i){E=e[K];z=i[K];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,K,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.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);(function(h){var f=h.each,e=h.is,d=h.isWebKit,b=h.isIE,c=h.html.Entities,a=/^([a-z0-9],?)+$/i,g=h.html.Schema.blockElementsMap,i=/^[ \t\r\n]*$/;h.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,m){var l=this,j,k;l.doc=o;l.win=window;l.files={};l.cssFlicker=false;l.counter=0;l.stdMode=!h.isIE||o.documentMode>=8;l.boxModel=!h.isIE||o.compatMode=="CSS1Compat"||l.stdMode;l.hasOuterHTML="outerHTML" in o.createElement("a");l.settings=m=h.extend({keep_values:false,hex_colors:1},m);l.schema=m.schema;l.styles=new h.html.Styles({url_converter:m.url_converter,url_converter_scope:m.url_converter_scope},m.schema);if(h.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(n){l.cssFlicker=true}}if(b&&m.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(p){o.createElement(p)});for(k in m.schema.getCustomElements()){o.createElement(k)}}h.addUnload(l.destroy,l)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.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 h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+"</"+r+">"}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(o){var n=k.settings;switch(m){case"style":if(!e(j,"string")){f(j,function(p,q){k.setStyle(o,q,p)});return}if(n.keep_values){if(j&&!k._isRes(j)){o.setAttribute("data-mce-style",j,2)}else{o.removeAttribute("data-mce-style",2)}}o.style.cssText=j;break;case"class":o.className=j||"";break;case"src":case"href":if(n.keep_values){if(n.url_converter){j=n.url_converter.call(n.url_converter_scope||k,j,m,o)}k.setAttrib(o,"data-mce-"+m,j,2)}break;case"shape":o.setAttribute("data-mce-style",j);break}if(e(j)&&j!==null&&j.length!==0){o.setAttribute(m,""+j,2)}else{o.removeAttribute(m,2)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(m,o,l){var j,k=this;m=k.get(m);if(!m||m.nodeType!==1){return false}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(o)){j=m.getAttribute("data-mce-"+o);if(j){return j}}if(b&&k.props[o]){j=m[k.props[o]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=m.getAttribute(o,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(o)){if(m[k.props[o]]===true&&j===""){return o}return j?o:""}if(m.nodeName==="FORM"&&m.getAttributeNode(o)){return m.getAttributeNode(o).nodeValue}if(o==="style"){j=j||m.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),m.nodeName);if(k.settings.keep_values&&!k._isRes(j)){m.setAttribute("data-mce-style",j)}}}if(d&&o==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(o){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return o}return l;case"shape":j=j.toLowerCase();break;default:if(o.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==undefined&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(s.getBoundingClientRect){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=s.left+(p.documentElement.scrollLeft||p.body.scrollLeft)-o.clientTop;q=s.top+(p.documentElement.scrollTop||p.body.scrollTop)-o.clientLeft;return{x:j,y:q}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="<br />"+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="<br />"+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(o,p){var k=this,m,j,n,q,l;o=o.firstChild;if(o){q=new h.dom.TreeWalker(o);p=p||k.schema?k.schema.getNonEmptyElements():null;do{n=o.nodeType;if(n===1){if(o.getAttribute("data-mce-bogus")){continue}if(p&&p[o.nodeName.toLowerCase()]){return false}j=k.getAttribs(o);m=o.attributes.length;while(m--){l=o.attributes[m].nodeName;if(l==="name"||l.indexOf("data-")===0){return false}}}if((n===3&&!i.test(o.nodeValue))){return false}}while(o=q.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(n,o){var j=0,l,m,k;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){if(k==l||!n.nodeValue.length){continue}}j++;l=k}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(v){var t,r=v.childNodes,u=v.nodeType;if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){k(r[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){if(!s.isBlock(v.parentNode)||h.trim(v.nodeValue).length>0){return}}else{if(u==1){r=v.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(r[0],v)}if(r.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}s.remove(v)}return v}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.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(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}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(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)}k.setEndPoint(j?"EndToStart":"EndToEnd",i);if(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)>0){k=i.duplicate();k.collapse(j);o=-1;while(s==k.parentElement()){if(k.move("character",-1)==0){break}o++}}o=o||k.text.replace("\r\n"," ").length}else{k.collapse(true);k.setEndPoint(j?"StartToStart":"StartToEnd",i);o=k.text.replace("\r\n"," ").length}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){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{t=r.createTextNode("\uFEFF");u.appendChild(t);x.moveToElementText(t.parentNode);x.collapse(c)}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&&p==q-1){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(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)}if(c.isIE&&i.boxModel){this._fixIESelection()}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";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=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(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()}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)}}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.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 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(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(!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}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";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.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\[|<!--|<!\[CDATA\[)[\r\n]*/g,"").replace(/\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").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/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,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(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(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 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")}}})}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.select("#menu_"+g.id)[0];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){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 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(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"},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");c.setAttrib(g.id,"aria-valuenow",i.title)}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null;c.setAttrib(g.id,"aria-valuenow",g.settings.title)}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='<span role="button" aria-haspopup="true" aria-labelledby="'+f.id+'_text" 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;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(j){if(j.value===g.selectedValue){f.items[j.id].setSelected(1);g.oldID=j.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){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,"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,"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&&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","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(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",{id:f.id,role:"presentation",tabindex:"0","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("span",{role:"button","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}},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(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+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="#"+i;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 a.cancel(i)});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(){this.keyNav.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(){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(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",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",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];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&&!m.isIOS5){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&&v.language_load!==false){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(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(z){var y={prefix:"plugins/",resource:z,suffix:"/editor_plugin"+m.suffix+".js"};var z=c.createUrl(y,z);c.load(z.resource,z)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+m.suffix+".js"})}}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,H=this,I=H.settings,E,A,D=H.getElement(),q,p,F,y,C,G,z,v=[];m.add(H);I.aria_label=I.aria_label||n.getAttrib(D,"aria-label",H.getLang("aria.rich_text_area"));if(I.theme){I.theme=I.theme.replace(/-/,"");q=h.get(I.theme);H.theme=new q();if(H.theme.init&&I.init_theme){H.theme.init(H,h.urls[I.theme]||m.documentBaseURL.replace(/\/$/,""))}}function B(J){var K=c.get(J),t=c.urls[J]||m.documentBaseURL.replace(/\/$/,""),s;if(K&&m.inArray(v,J)===-1){i(c.dependencies(J),function(u){B(u)});s=new K(H,t);H.plugins[J]=s;if(s.init){s.init(H,t);v.push(J)}}}i(g(I.plugins.replace(/\-/g,"")),B);if(I.popup_css!==false){if(I.popup_css){I.popup_css=H.documentBaseURI.toAbsolute(I.popup_css)}else{I.popup_css=H.baseURI.toAbsolute("themes/"+I.theme+"/skins/"+I.skin+"/dialog.css")}}if(I.popup_css_add){I.popup_css+=","+H.documentBaseURI.toAbsolute(I.popup_css_add)}H.controlManager=new m.ControlManager(H);if(I.custom_undo_redo){H.onBeforeExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.beforeChange()}});H.onExecCommand.add(function(t,J,u,K,s){if(J!="Undo"&&J!="Redo"&&J!="mceRepaint"&&(!s||!s.skip_undo)){H.undoManager.add()}})}H.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){H.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){H.execCommand("mceRepaint")}}H.onUndo.add(x);H.onRedo.add(x);H.onSetContent.add(x)}H.onBeforeRenderUI.dispatch(H,H.controlManager);if(I.render_ui){E=I.width||D.style.width||D.offsetWidth;A=I.height||D.style.height||D.offsetHeight;H.orgDisplay=D.style.display;G=/^[0-9\.]+(|px)$/i;if(G.test(""+E)){E=Math.max(parseInt(E)+(q.deltaWidth||0),100)}if(G.test(""+A)){A=Math.max(parseInt(A)+(q.deltaHeight||0),100)}q=H.theme.renderUI({targetNode:D,width:E,height:A,deltaWidth:I.delta_width,deltaHeight:I.delta_height});H.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:E,height:A});if(I.content_css){m.each(g(I.content_css),function(s){H.contentCSS.push(H.documentBaseURI.toAbsolute(s))})}A=(q.iframeHeight||A)+(typeof(A)=="number"?(q.deltaHeight||0):"");if(A<100){A=100}H.iframeHTML=I.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(I.document_base_url!=m.documentBaseURL){H.iframeHTML+='<base href="'+H.documentBaseURI.getURI()+'" />'}if(I.ie7_compat){H.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" />'}else{H.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=edge" />'}H.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(!a||!/Firefox\/2/.test(navigator.userAgent)){for(z=0;z<H.contentCSS.length;z++){H.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+H.contentCSS[z]+'" />'}H.contentCSS=[]}y=I.body_id||"tinymce";if(y.indexOf("=")!=-1){y=H.getParam("body_id","","hash");y=y[H.id]||y}C=I.body_class||"";if(C.indexOf("=")!=-1){C=H.getParam("body_class","","hash");C=C[H.id]||""}H.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+C+'"></body></html>';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){F='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+H.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}r=n.add(q.iframeContainer,"iframe",{id:H.id+"_ifr",src:F||'javascript:""',frameBorder:"0",allowTransparency:"true",title:I.aria_label,style:{width:"100%",height:A}});H.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=H.orgDisplay;n.get(H.id).style.display="none";n.setAttrib(H.id,"aria-hidden",true);if(!m.relaxedDomain||!F){H.setupIframe()}D=r=q=null},setupIframe:function(x){var q=this,v=q.settings,y=n.get(q.id),z=q.getDoc(),u,p;if((!b||!m.relaxedDomain)&&!x){if(a&&!v.readonly){q.getWin().onload=function(){window.setTimeout(function(){var s=q.getBody(),t;s.innerHTML="<br>";if(s.contentEditable!==t){s.contentEditable=false;s.contentEditable=true;q.onMouseDown.add(function(A,B){if(B.target.nodeName==="HTML"){z.designMode="on";window.setTimeout(function(){z.designMode="off";q.getBody().focus()},1)}})}else{z.designMode="on"}q.setupIframe(true)},1)}}z.open();z.write(q.iframeHTML);z.close();if(m.relaxedDomain){z.domain=m.relaxedDomain}if(a&&!v.readonly){return}}p=q.getBody();p.disabled=true;if(!a&&!v.readonly){p.contentEditable=true}p.disabled=false;q.schema=new m.html.Schema(v);q.dom=new m.dom.DOMUtils(q.getDoc(),{keep_values:true,url_converter:q.convertURL,url_converter_scope:q,hex_colors:v.force_hex_style_colors,class_filter:v.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:q.schema});q.parser=new m.html.DomParser(v,q.schema);if(!q.settings.allow_html_in_named_anchor){q.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)}}})}q.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,C,E=q.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,q.convertURL(D,t,C.name))}}}});q.parser.addNodeFilter("script",function(s,t){var A=s.length;while(A--){s[A].attr("type","mce-text/javascript")}});q.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+"]]"}});q.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=q.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new m.html.Node("br",1)).shortEnded=true}}});q.serializer=new m.dom.Serializer(v,q.dom,q.schema);q.selection=new m.dom.Selection(q.dom,q.getWin(),q.serializer);q.formatter=new m.Formatter(this);q.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{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"}},{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"}},{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"}}],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"},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){q.formatter.register(s,{block:s,remove:"all"})});q.formatter.register(q.settings.formats);q.undoManager=new m.UndoManager(q);q.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return q.onChange.dispatch(q,s,t)}});q.undoManager.onUndo.add(function(t,s){return q.onUndo.dispatch(q,s,t)});q.undoManager.onRedo.add(function(t,s){return q.onRedo.dispatch(q,s,t)});q.forceBlocks=new m.ForceBlocks(q,{forced_root_block:v.forced_root_block});q.editorCommands=new m.EditorCommands(q);q.serializer.onPreProcess.add(function(s,t){return q.onPreProcess.dispatch(q,t,s)});q.serializer.onPostProcess.add(function(s,t){return q.onPostProcess.dispatch(q,t,s)});q.onPreInit.dispatch(q);if(!v.gecko_spellcheck){q.getBody().spellcheck=0}if(!v.readonly){q._addEvents()}q.controlManager.onPostRender.dispatch(q,q.controlManager);q.onPostRender.dispatch(q);if(v.directionality){q.getBody().dir=v.directionality}if(v.nowrap){q.getBody().style.whiteSpace="nowrap"}if(v.handle_node_change_callback){q.onNodeChange.add(function(t,s,A){q.execCallback("handle_node_change_callback",q.id,A,-1,-1,true,q.selection.isCollapsed())})}if(v.save_callback){q.onSaveContent.add(function(s,A){var t=q.execCallback("save_callback",q.id,A.content,q.getBody());if(t){A.content=t}})}if(v.onchange_callback){q.onChange.add(function(t,s){q.execCallback("onchange_callback",q,s)})}if(v.protect){q.onBeforeSetContent.add(function(s,t){if(v.protect){i(v.protect,function(A){t.content=t.content.replace(A,function(B){return"<!--mce:protected "+escape(B)+"-->"})})}})}if(v.convert_newlines_to_brs){q.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(v.preformatted){q.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(v.verify_css_classes){q.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!q.classesRE){t=q.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});q.classesRE=new RegExp("("+B+")","gi")}}return !q.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||q.classesRE.test(A)?A:""}return A}}if(v.cleanup_callback){q.onBeforeSetContent.add(function(s,t){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)});q.onPreProcess.add(function(s,t){if(t.set){q.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){q.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});q.onPostProcess.add(function(s,t){if(t.set){t.content=q.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=q.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(v.save_callback){q.onGetContent.add(function(s,t){if(t.save){t.content=q.execCallback("save_callback",q.id,t.content,q.getBody())}})}if(v.handle_event_callback){q.onEvent.add(function(s,t,A){if(q.execCallback("handle_event_callback",t,s,A)===false){j.cancel(t)}})}q.onSetContent.add(function(){q.addVisual(q.getBody())});if(v.padd_empty_editor){q.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function r(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})}})}q.onExecCommand.add(function(s,t){if(t==="CreateLink"){r(s)}});q.onSetContent.add(q.selection.onSetContent.add(r))}q.load({initial:true,format:"html"});q.startContent=q.getContent({format:"raw"});q.undoManager.add();q.initialized=true;q.onInit.dispatch(q);q.execCallback("setupcontent_callback",q.id,q.getBody(),q.getDoc());q.execCallback("init_instance_callback",q);q.focus(true);q.nodeChanged({initial:1});i(q.contentCSS,function(s){q.dom.loadCSS(s)});if(v.auto_focus){setTimeout(function(){var s=m.get(v.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getBody().focus();s.getWin().focus()},100)}y=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=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(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||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(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=false;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(u,s){var r=this,q,p=r.getBody(),t;s=s||{};s.format=s.format||"html";s.set=true;s.content=u;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}u=s.content;if(!m.isIE&&(u.length===0||/^\s+$/.test(u))){t=r.settings.forced_root_block;if(t){u="<"+t+'><br data-mce-bogus="1"></'+t+">"}else{u='<br data-mce-bogus="1">'}p.innerHTML=u;r.selection.select(p,true);r.selection.collapse(true);return}if(s.format!=="raw"){u=new m.html.Serializer({},r.schema).serialize(r.parser.parse(u))}s.content=m.trim(u);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.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 B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.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 u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){if(E._isHidden()){try{if(!F.content_editable){G.body.contentEditable=false;G.body.contentEditable=true}}catch(D){}}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(u);B.onMouseDown.add(u)}B.onClick.add(function(s,t){t=t.target;if(m.isWebKit&&t.nodeName=="IMG"){B.selection.getSel().setBaseAndExtent(t,0,t,1)}if(t.nodeName=="A"&&q.hasClass(t,"mceItemAnchor")){B.selection.select(t)}B.nodeChanged()});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||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});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(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.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=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});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){y()}});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));y();return j.cancel(E)}}if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45){if(m.isIE&&D==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}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){y()}})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(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);q("mceRepaint")},"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,Superscript,Subscript":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||"p")},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(A,H,J){var x,I,D,y,E,F,C,B,K,v,z,L,u,G;x=n.parser;I=new c.html.Serializer({},n.schema);u='<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';F={content:J,format:"html"};p.onBeforeSetContent.dispatch(p,F);J=F.content;if(J.indexOf("{$caret}")==-1){J+="{$caret}"}J=J.replace(/\{\$caret\}/,u);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}D=p.getNode();F={context:D.nodeName.toLowerCase()};E=x.parse(J,F);z=E.lastChild;if(z.attr("id")=="mce_marker"){C=z;for(z=z.prev;z;z=z.walk(true)){if(z.type==3||!l.isBlock(z.name)){z.parent.insert(C,z,z.name==="br");break}}}if(!F.invalid){J=I.serialize(E);z=D.firstChild;L=D.lastChild;if(!z||(z===L&&z.nodeName==="BR")){l.setHTML(D,J)}else{p.setContent(J)}}else{p.setContent(u);D=n.selection.getNode();y=n.getBody();if(D.nodeType==9){D=z=y}else{z=D}while(z!==y){D=z;z=z.parentNode}J=D==y?y.innerHTML:l.getOuterHTML(D);J=I.serialize(x.parse(J.replace(/<span (id="mce_marker"|id=mce_marker).+<\/span>/i,function(){return I.serialize(E)})));if(D==y){l.setHTML(y,J)}else{l.setOuterHTML(D,J)}}C=l.get("mce_marker");B=l.getRect(C);K=l.getViewPort(n.getWin());if((B.y+B.h>K.y+K.h||B.y<K.y)||(B.x>K.x+K.w||B.x<K.x)){G=c.isIE?n.getDoc().documentElement:n.getBody();G.scrollLeft=B.x;G.scrollTop=B.y-K.h+25}v=l.createRng();z=C.previousSibling;if(z&&z.nodeType==3){v.setStart(z,z.nodeValue.length)}else{v.setStartBefore(C);v.setEndBefore(C)}l.remove(C);p.setRng(v);p.onSetContent.dispatch(p,F);n.addVisual()},mceInsertRawHTML:function(x,v,u){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,function(){return 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(){n.execCommand("mceInsertContent",false,"<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(x,v,u){n.execCommand("mceInsertContent",false,u.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(B,A,z){var y=l.getParent(p.getNode(),"a"),v,x,u;if(c.is(z,"string")){z={href:z}}z.href=z.href.replace(" ","%20");if(!y){if(c.isWebKit){v=l.getParent(p.getNode(),"img");if(v){x=v.style.cssText;u=v.className;v.style.cssText=null;v.className=null}}f("CreateLink",b,"javascript:mctmp(0);");if(x){v.style.cssText=x}if(u){v.className=u}d(l.select("a[href='javascript:mctmp(0);']"),function(C){l.setAttribs(C,z)})}else{if(z.href){l.setAttribs(y,z)}else{n.dom.remove(y,a)}}},selectAll:function(){var v=l.getRoot(),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,Superscript,Subscript":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(f){var d,e=0,h=[],c;function g(){return b.trim(f.getContent({format:"raw",no_events:1}))}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);(function(l){var j=l.dom.Event,c=l.isIE,a=l.isGecko,b=l.isOpera,i=l.each,h=l.extend,d=true,g=false;function k(o){var p,n,m;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(o.nodeName)){if(p){n=o.cloneNode(false);n.appendChild(p);p=n}else{p=m=o.cloneNode(false)}p.removeAttribute("id")}}while(o=o.parentNode);if(p){return{wrapper:p,inner:m}}}function f(n,o){var m=o.ownerDocument.createRange();m.setStart(n.endContainer,n.endOffset);m.setEndAfter(o);return m.cloneContents().textContent.length==0}function e(o,q,m){var n,p;if(q.isEmpty(m)){n=q.getParent(m,"ul,ol");if(!q.getParent(n.parentNode,"ul,ol")){q.split(n,m);p=q.create("p",0,'<br data-mce-bogus="1" />');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n)},setup:function(){var n=this,m=n.editor,p=m.settings,u=m.dom,o=m.selection,q=m.schema.getBlockElements();if(p.forced_root_block){function v(){var y=o.getStart(),t=m.getBody(),s,z,D,F,E,x,A,B=-16777215;if(!y||y.nodeType!==1){return}while(y!=t){if(q[y.nodeName]){return}y=y.parentNode}s=o.getRng();if(s.setStart){z=s.startContainer;D=s.startOffset;F=s.endContainer;E=s.endOffset}else{if(s.item){s=m.getDoc().body.createTextRange();s.moveToElementText(s.item(0))}tmpRng=s.duplicate();tmpRng.collapse(true);D=tmpRng.move("character",B)*-1;if(!tmpRng.collapsed){tmpRng=s.duplicate();tmpRng.collapse(false);E=(tmpRng.move("character",B)*-1)-D}}for(y=t.firstChild;y;y){if(y.nodeType===3||(y.nodeType==1&&!q[y.nodeName])){if(!x){x=u.create(p.forced_root_block);y.parentNode.insertBefore(x,y)}A=y;y=y.nextSibling;x.appendChild(A)}else{x=null;y=y.nextSibling}}if(s.setStart){s.setStart(z,D);s.setEnd(F,E);o.setRng(s)}else{try{s=m.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(true);s.moveStart("character",D);if(E>0){s.moveEnd("character",E)}s.select()}catch(C){}}m.nodeChanged()}m.onKeyUp.add(v);m.onClick.add(v)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var x;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});x=u.get("__");x.removeAttribute("id");o.select(x);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,y){if(y.keyCode==13&&!y.shiftKey){var x=t.selection.getStart(),s=n._previousFormats;if(!x.hasChildNodes()&&s){x=u.getParent(x,u.isBlock);if(x&&x.nodeName!="LI"){x.innerHTML="";if(n._previousFormats){x.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{x.innerHTML="\uFEFF"}o.select(x,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function r(t){var s=o.getRng(),x,A=u.create("div",null," "),z,y=u.getViewPort(t.getWin()).h;s.insertNode(x=u.create("br"));s.setStartAfter(x);s.setEndAfter(x);o.setRng(s);if(o.getSel().focusNode==x.previousSibling){o.select(u.insertAfter(u.doc.createTextNode("\u00a0"),x));o.collapse(d)}u.insertAfter(A,x);z=u.getPos(A).y;u.remove(A);if(z>y){t.getWin().scrollTo(0,z)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!u.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,x){var z,y=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&y.nodeName=="P"){y=u.rename(y,p.element);o.select(y);o.collapse();t.nodeChanged()}else{if(x.keyCode==13&&!x.shiftKey&&n.lastElm!="P"){z=u.getParent(y,"p");if(z){u.rename(z,p.element);t.nodeChanged()}}}})}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(Q){var E=this,v=E.editor,M=v.dom,R=v.getDoc(),V=v.settings,F=v.selection.getSel(),G=F.getRangeAt(0),U=R.body;var J,K,H,O,N,q,o,u,z,m,C,T,p,x,I,L=M.getViewPort(v.getWin()),B,D,A;v.undoManager.beforeChange();J=R.createRange();J.setStart(F.anchorNode,F.anchorOffset);J.collapse(d);K=R.createRange();K.setStart(F.focusNode,F.focusOffset);K.collapse(d);H=J.compareBoundaryPoints(J.START_TO_END,K)<0;O=H?F.anchorNode:F.focusNode;N=H?F.anchorOffset:F.focusOffset;q=H?F.focusNode:F.anchorNode;o=H?F.focusOffset:F.anchorOffset;if(O===q&&/^(TD|TH)$/.test(O.nodeName)){if(O.firstChild.nodeName=="BR"){M.remove(O.firstChild)}if(O.childNodes.length==0){v.dom.add(O,V.element,null,"<br />");T=v.dom.add(O,V.element,null,"<br />")}else{I=O.innerHTML;O.innerHTML="";v.dom.add(O,V.element,null,I);T=v.dom.add(O,V.element,null,"<br />")}G=R.createRange();G.selectNodeContents(T);G.collapse(1);v.selection.setRng(G);return g}if(O==U&&q==U&&U.firstChild&&v.dom.isBlock(U.firstChild)){O=q=O.firstChild;N=o=0;J=R.createRange();J.setStart(O,0);K=R.createRange();K.setStart(q,0)}O=O.nodeName=="HTML"?R.body:O;O=O.nodeName=="BODY"?O.firstChild:O;q=q.nodeName=="HTML"?R.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=E.getParentBlock(O);z=E.getParentBlock(q);m=u?u.nodeName:V.element;if(I=E.dom.getParent(u,"li,pre")){if(I.nodeName=="LI"){return e(v.selection,E.dom,I)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(M.getStyle(u,"position",1)))){m=V.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(M.getStyle(u,"float",1)))){m=V.element;u=z=null}C=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);T=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);T.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(G,u)){T=v.dom.create(V.element)}I=p=O;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}p=I}while((I=I.previousSibling?I.previousSibling:I.parentNode));I=x=q;do{if(I==U||I.nodeType==9||E.dom.isBlock(I)||/(TD|TABLE|TH|CAPTION)/.test(I.nodeName)){break}x=I}while((I=I.nextSibling?I.nextSibling:I.parentNode));if(p.nodeName==m){J.setStart(p,0)}else{J.setStartBefore(p)}J.setEnd(O,N);C.appendChild(J.cloneContents()||R.createTextNode(""));try{K.setEndAfter(x)}catch(P){}K.setStart(q,o);T.appendChild(K.cloneContents()||R.createTextNode(""));G=R.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){G.setStartBefore(p.parentNode)}else{if(J.startContainer.nodeName==m&&J.startOffset==0){G.setStartBefore(J.startContainer)}else{G.setStart(J.startContainer,J.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){G.setEndAfter(x.parentNode)}else{G.setEnd(K.endContainer,K.endOffset)}G.deleteContents();if(b){v.getWin().scrollTo(0,L.y)}if(C.firstChild&&C.firstChild.nodeName==m){C.innerHTML=C.firstChild.innerHTML}if(T.firstChild&&T.firstChild.nodeName==m){T.innerHTML=T.firstChild.innerHTML}function S(y,s){var r=[],X,W,t;y.innerHTML="";if(V.keep_styles){W=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(W.nodeName)){X=W.cloneNode(g);M.setAttrib(X,"id","");r.push(X)}}while(W=W.parentNode)}if(r.length>0){for(t=r.length-1,X=y;t>=0;t--){X=X.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"<br />";return r[0]}else{y.innerHTML=b?"\u00a0":"<br />"}}if(M.isEmpty(C)){S(C,O)}if(M.isEmpty(T)){A=S(T,q)}if(b&&parseFloat(opera.version())<9.5){G.insertNode(C);G.insertNode(T)}else{G.insertNode(T);G.insertNode(C)}T.normalize();C.normalize();v.selection.select(T,true);v.selection.collapse(true);B=v.dom.getPos(T).y;if(B<L.y||B+25>L.y+L.h){v.getWin().scrollTo(0,B<L.y?B:B-L.h+25)}v.undoManager.add();return g},backspaceDelete:function(u,B){var C=this,s=C.editor,y=s.getBody(),q=s.dom,p,v=s.selection,o=v.getRng(),x=o.startContainer,p,z,A,m;if(!B&&o.collapsed&&x.nodeType==1&&o.startOffset==x.childNodes.length){m=new l.dom.TreeWalker(x.lastChild,x);for(p=x.lastChild;p;p=m.prev()){if(p.nodeType==3){o.setStart(p,p.nodeValue.length);o.collapse(true);v.setRng(o);return}}}if(x&&s.dom.isBlock(x)&&!/^(TD|TH)$/.test(x.nodeName)&&B){if(x.childNodes.length==0||(x.childNodes.length==1&&x.firstChild.nodeName=="BR")){p=x;while((p=p.previousSibling)&&!s.dom.isBlock(p)){}if(p){if(x!=y.firstChild){z=s.dom.doc.createTreeWalker(p,NodeFilter.SHOW_TEXT,null,g);while(A=z.nextNode()){p=A}o=s.getDoc().createRange();o.setStart(p,p.nodeValue?p.nodeValue.length:0);o.setEnd(p,p.nodeValue?p.nodeValue.length:0);v.setRng(o);s.dom.remove(x)}return j.cancel(u)}}}}})})(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,g)}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);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(V){var M={},O=a.each,c=V.dom,q=V.selection,t=a.dom.TreeWalker,K=new a.dom.RangeUtils(c),d=V.schema.isValidChild,F=c.isBlock,l=V.settings.forced_root_block,s=c.nodeIndex,E="\uFEFF",e=/^(src|href|style)$/,S=false,B=true,p,P={apply:[],remove:[]};function z(W){return W instanceof Array}function m(X,W){return c.getParents(X,W,c.getRoot())}function b(W){return W.nodeType===1&&(W.face==="mceinline"||W.style.fontFamily==="mceinline")}function R(W){return W?M[W]:M}function k(W,X){if(W){if(typeof(W)!=="string"){O(W,function(Z,Y){k(Y,Z)})}else{X=X.length?X:[X];O(X,function(Y){if(Y.deep===p){Y.deep=!Y.selector}if(Y.split===p){Y.split=!Y.selector||Y.inline}if(Y.remove===p&&Y.selector&&!Y.inline){Y.remove="none"}if(Y.selector&&Y.inline){Y.mixed=true;Y.block_expand=true}if(typeof(Y.classes)==="string"){Y.classes=Y.classes.split(/\s+/)}});M[W]=X}}}var i=function(X){var W;V.dom.getParent(X,function(Y){W=V.dom.getStyle(Y,"text-decoration");return W&&W!=="none"});return W};var I=function(W){var X;if(W.nodeType===1&&W.parentNode&&W.parentNode.nodeType===1){X=i(W.parentNode);if(V.dom.getStyle(W,"color")&&X){V.dom.setStyle(W,"text-decoration",X)}else{if(V.dom.getStyle(W,"textdecoration")===X){V.dom.setStyle(W,"text-decoration",null)}}}};function T(Y,af,aa){var ab=R(Y),ag=ab[0],ae,X,ad,ac=q.isCollapsed();function Z(ak){var aj=ak.startContainer,an=ak.startOffset,am,al;if(aj.nodeType==1||aj.nodeValue===""){aj=aj.nodeType==1?aj.childNodes[an]:aj;if(aj){am=new t(aj,aj.parentNode);for(al=am.current();al;al=am.next()){if(al.nodeType==3&&!f(al)){ak.setStart(al,0);break}}}}return ak}function W(ak,aj){aj=aj||ag;if(ak){O(aj.styles,function(am,al){c.setStyle(ak,al,r(am,af))});O(aj.attributes,function(am,al){c.setAttrib(ak,al,r(am,af))});O(aj.classes,function(al){al=r(al,af);if(!c.hasClass(ak,al)){c.addClass(ak,al)}})}}function ah(ak){var aj=[],am,al;am=ag.inline||ag.block;al=c.create(am);W(al);K.walk(ak,function(an){var ao;function ap(aq){var au=aq.nodeName.toLowerCase(),at=aq.parentNode.nodeName.toLowerCase(),ar;if(g(au,"br")){ao=0;if(ag.block){c.remove(aq)}return}if(ag.wrapper&&x(aq,Y,af)){ao=0;return}if(ag.block&&!ag.wrapper&&G(au)){aq=c.rename(aq,am);W(aq);aj.push(aq);ao=0;return}if(ag.selector){O(ab,function(av){if("collapsed" in av&&av.collapsed!==ac){return}if(c.is(aq,av.selector)&&!b(aq)){W(aq,av);ar=true}});if(!ag.inline||ar){ao=0;return}}if(d(am,au)&&d(at,am)&&!(aq.nodeType===3&&aq.nodeValue.length===1&&aq.nodeValue.charCodeAt(0)===65279)){if(!ao){ao=al.cloneNode(S);aq.parentNode.insertBefore(ao,aq);aj.push(ao)}ao.appendChild(aq)}else{if(au=="li"){if(!ao){liTextNode=aq.ownerDocument.createTextNode("");O(a.grep(aq.childNodes),function(av){if(av.nodeType==3){liTextNode.nodeValue+=av.nodeValue;av.parentNode.removeChild(av)}});ao=al.cloneNode(S);aq.insertBefore(ao,aq.firstChild);aj.push(ao)}ao.appendChild(liTextNode)}else{ao=0;O(a.grep(aq.childNodes),ap);ao=0}}}O(an,ap)});if(ag.wrap_links===false){O(aj,function(an){function ao(at){var ar,aq,ap;if(at.nodeName==="A"){aq=al.cloneNode(S);aj.push(aq);ap=a.grep(at.childNodes);for(ar=0;ar<ap.length;ar++){aq.appendChild(ap[ar])}at.appendChild(aq)}O(a.grep(at.childNodes),ao)}ao(an)})}O(aj,function(ap){var an;function aq(at){var ar=0;O(at.childNodes,function(au){if(!f(au)&&!H(au)){ar++}});return ar}function ao(ar){var au,at;O(ar.childNodes,function(av){if(av.nodeType==1&&!H(av)&&!b(av)){au=av;return S}});if(au&&h(au,ag)){at=au.cloneNode(S);W(at);c.replace(at,ar,B);c.remove(au,1)}return at||ar}an=aq(ap);if((aj.length>1||!F(ap))&&an===0){c.remove(ap,1);return}if(ag.inline||ag.wrapper){if(!ag.exact&&an===1){ap=ao(ap)}O(ab,function(ar){O(c.select(ar.inline,ap),function(au){var at;if(ar.wrap_links===false){at=au.parentNode;do{if(at.nodeName==="A"){return}}while(at=at.parentNode)}U(ar,af,au,ar.exact?au:null)})});if(x(ap.parentNode,Y,af)){c.remove(ap,1);ap=0;return B}if(ag.merge_with_parents){c.getParent(ap.parentNode,function(ar){if(x(ar,Y,af)){c.remove(ap,1);ap=0;return B}})}if(ap){ap=u(C(ap),ap);ap=u(ap,C(ap,B))}}})}if(ag){if(aa){X=c.createRng();X.setStartBefore(aa);X.setEndAfter(aa);ah(o(X,ab))}else{if(!ac||!ag.inline||c.select("td.mceSelected,th.mceSelected").length){var ai=V.selection.getNode();ae=q.getBookmark();ah(o(q.getRng(B),ab));if(ag.styles&&(ag.styles.color||ag.styles.textDecoration)){a.walk(ai,I,"childNodes");I(ai)}q.moveToBookmark(ae);q.setRng(Z(q.getRng(B)));V.nodeChanged()}else{Q("apply",Y,af)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am<al;am++){if(U(ac[am],ah,ao,ao)){break}}if(aj.deep){for(am=0,al=an.length;am<al;am++){Z(an[am])}}}function ad(al){var am;O(m(al.parentNode).reverse(),function(an){var ao;if(!am&&an.id!="_start"&&an.id!="_end"){ao=x(an,Y,ah);if(ao&&ao.split!==false){am=an}}});return am}function W(ao,al,aq,au){var av,at,ar,an,ap,am;if(ao){am=ao.parentNode;for(av=al.parentNode;av&&av!=am;av=av.parentNode){at=av.cloneNode(S);for(ap=0;ap<ac.length;ap++){if(U(ac[ap],ah,at,at)){at=0;break}}if(at){if(ar){at.appendChild(ar)}if(!an){an=at}ar=at}}if(au&&(!aj.mixed||!F(ao))){al=c.split(ao,al)}if(ar){aq.parentNode.insertBefore(ar,aq);an.appendChild(aq)}}return al}function ai(al){return W(ad(al),al,al,true)}function ae(an){var am=c.get(an?"_start":"_end"),al=am[an?"firstChild":"lastChild"];if(H(al)){al=al[an?"firstChild":"lastChild"]}c.remove(am,true);return al}function ak(al){var am,an;al=o(al,ac,B);if(aj.split){am=J(al,B);an=J(al);if(am!=an){am=N(am,"span",{id:"_start","data-mce-type":"bookmark"});an=N(an,"span",{id:"_end","data-mce-type":"bookmark"});ai(am);ai(an);am=ae(B);an=ae()}else{am=an=ai(am)}al.startContainer=am.parentNode;al.startOffset=s(am);al.endContainer=an.parentNode;al.endOffset=s(an)+1}K.walk(al,function(ao){O(ao,function(ap){Z(ap);if(ap.nodeType===1&&V.dom.getStyle(ap,"text-decoration")==="underline"&&ap.parentNode&&i(ap.parentNode)==="underline"){U({deep:false,exact:true,inline:"span",styles:{textDecoration:"underline"}},null,ap)}})})}if(ab){X=c.createRng();X.setStartBefore(ab);X.setEndAfter(ab);ak(X);return}if(!q.isCollapsed()||!aj.inline||c.select("td.mceSelected,th.mceSelected").length){ag=q.getBookmark();ak(q.getRng(B));q.moveToBookmark(ag);if(j(Y,ah,q.getStart())){aa(q.getRng(true))}V.nodeChanged()}else{Q("remove",Y,ah)}}function D(X,Z,Y){var W=R(X);if(j(X,Z,Y)&&(!("toggle" in W[0])||W[0]["toggle"])){A(X,Z,Y)}else{T(X,Z,Y)}}function x(X,W,ac,aa){var Y=R(W),ad,ab,Z;function ae(ai,ak,al){var ah,aj,af=ak[al],ag;if(af){if(af.length===p){for(ah in af){if(af.hasOwnProperty(ah)){if(al==="attributes"){aj=c.getAttrib(ai,ah)}else{aj=L(ai,ah)}if(aa&&!aj&&!ak.exact){return}if((!aa||ak.exact)&&!g(aj,r(af[ah],ac))){return}}}}else{for(ag=0;ag<af.length;ag++){if(al==="attributes"?c.getAttrib(ai,af[ag]):L(ai,af[ag])){return ak}}}}return ak}if(Y&&X){for(ab=0;ab<Y.length;ab++){ad=Y[ab];if(h(X,ad)&&ae(X,ad,"attributes")&&ae(X,ad,"styles")){if(Z=ad.classes){for(ab=0;ab<Z.length;ab++){if(!c.hasClass(X,Z[ab])){return}}}return ad}}}}function j(Y,ab,aa){var X,Z;function W(ac){ac=c.getParent(ac,function(ad){return !!x(ad,Y,ab,true)});return x(ac,Y,ab)}if(aa){return W(aa)}if(q.isCollapsed()){for(Z=P.apply.length-1;Z>=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X<ad.length;X++){for(Y=P.remove.length-1;Y>=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X<ad.length;X++){W=ad[X];if(!Z[W]&&P.apply[Y].name==W){Z[W]=true;ab.push(W)}}}}aa=q.getStart();c.getParent(aa,function(ag){var af,ae;for(af=0;af<ad.length;af++){ae=ad[af];if(!Z[ae]&&x(ag,ae,ac)){Z[ae]=true;ab.push(ae)}}});return ab}function y(aa){var ac=R(aa),Z,Y,ab,X,W;if(ac){Z=q.getStart();Y=m(Z);for(X=ac.length-1;X>=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;an<am.length;an++){for(ap=0;ap<ag.length;ap++){ao=ag[ap];if("collapsed" in ao&&ao.collapsed!==W.collapsed){continue}if(c.is(am[an],ao.selector)){return am[an]}}}return al}Y=aa(Y,"previousSibling");aj=aa(aj,"nextSibling")}if(ag[0].block||ag[0].selector){function X(al,ak,an){var am;if(!ag[0].wrapper){am=c.getParent(al,ag[0].block)}if(!am){am=c.getParent(al.nodeType==3?al.parentNode:al,F)}if(am&&ag[0].wrapper){am=m(am,"ul,ol").reverse()[0]||am}if(!am){am=al;while(am[ak]&&!F(am[ak])){am=am[ak];if(g(am,"br")){break}}}return am||al}Y=X(Y,"previousSibling");aj=X(aj,"nextSibling");if(ag[0].block){if(!F(Y)){Y=ah(Y,"firstChild","nextSibling")}if(!F(aj)){aj=ah(aj,"lastChild","previousSibling")}}}if(Y.nodeType==1){ad=s(Y);Y=Y.parentNode}if(aj.nodeType==1){ae=s(aj)+1;aj=aj.parentNode}return{startContainer:Y,startOffset:ad,endContainer:aj,endOffset:ae}}function U(ac,ab,Z,W){var Y,X,aa;if(!h(Z,ac)){return S}if(ac.remove!="all"){O(ac.styles,function(ae,ad){ae=r(ae,ab);if(typeof(ad)==="number"){ad=ae;W=0}if(!W||g(L(W,ad),ae)){c.setStyle(Z,ad,"")}aa=1});if(aa&&c.getAttrib(Z,"style")==""){Z.removeAttribute("style");Z.removeAttribute("data-mce-style")}O(ac.attributes,function(af,ad){var ae;af=r(af,ab);if(typeof(ad)==="number"){ad=af;W=0}if(!W||g(c.getAttrib(W,ad),af)){if(ad=="class"){af=c.getAttrib(Z,ad);if(af){ae="";O(af.split(/\s+/),function(ag){if(/mce\w+/.test(ag)){ae+=(ae?" ":"")+ag}});if(ae){c.setAttrib(Z,ad,ae);return}}}if(ad=="class"){Z.removeAttribute("className")}if(e.test(ad)){Z.removeAttribute("data-mce-"+ad)}Z.removeAttribute(ad)}});O(ac.classes,function(ad){ad=r(ad,ab);if(!W||c.hasClass(W,ad)){c.removeClass(Z,ad)}});X=c.getAttribs(Z);for(Y=0;Y<X.length;Y++){if(X[Y].nodeName.indexOf("_")!==0){return S}}}if(ac.remove!="none"){n(Z,ac);return B}}function n(Y,Z){var W=Y.parentNode,X;if(Z.block){if(!l){function aa(ac,ab,ad){ac=C(ac,ab,ad);return !ac||(ac.nodeName=="BR"||F(ac))}if(F(Y)&&!F(W)){if(!aa(Y,S)&&!aa(Y.firstChild,B,1)){Y.insertBefore(c.create("br"),Y.firstChild)}if(!aa(Y,B)&&!aa(Y.lastChild,S,1)){Y.appendChild(c.create("br"))}}}else{if(W==c.getRoot()){if(!Z.list_block||!g(Y,Z.list_block)){O(a.grep(Y.childNodes),function(ab){if(d(l,ab.nodeName.toLowerCase())){if(!X){X=N(ab,l)}else{X.appendChild(ab)}}else{X=0}})}}}}if(Z.selector&&Z.inline&&!g(Z.inline,Y)){return}c.remove(Y,1)}function C(X,W,Y){if(X){W=W?"nextSibling":"previousSibling";for(X=Y?X:X[W];X;X=X[W]){if(X.nodeType==1||!f(X)){return X}}}}function H(W){return W&&W.nodeType==1&&W.getAttribute("data-mce-type")=="bookmark"}function u(aa,Z){var W,Y,X;function ac(af,ae){if(af.nodeName!=ae.nodeName){return S}function ad(ah){var ai={};O(c.getAttribs(ah),function(aj){var ak=aj.nodeName.toLowerCase();if(ak.indexOf("_")!==0&&ak!=="style"){ai[ak]=c.getAttrib(ah,ak)}});return ai}function ag(ak,aj){var ai,ah;for(ah in ak){if(ak.hasOwnProperty(ah)){ai=aj[ah];if(ai===p){return S}if(ak[ah]!=ai){return S}delete aj[ah]}}for(ah in aj){if(aj.hasOwnProperty(ah)){return S}}return B}if(!ag(ad(af),ad(ae))){return S}if(!ag(c.parseStyle(c.getAttrib(af,"style")),c.parseStyle(c.getAttrib(ae,"style")))){return S}return B}if(aa&&Z){function ab(ae,ad){for(Y=ae;Y;Y=Y[ad]){if(Y.nodeType==3&&Y.nodeValue.length!==0){return ae}if(Y.nodeType==1&&!H(Y)){return Y}}return ae}aa=ab(aa,"previousSibling");Z=ab(Z,"nextSibling");if(ac(aa,Z)){for(Y=aa.nextSibling;Y&&Y!=Z;){X=Y;Y=Y.nextSibling;aa.appendChild(X)}c.remove(Z);O(a.grep(Z.childNodes),function(ad){aa.appendChild(ad)});return aa}}return Z}function G(W){return/^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(W)}function J(X,aa){var W,Z,Y;W=X[aa?"startContainer":"endContainer"];Z=X[aa?"startOffset":"endOffset"];if(W.nodeType==1){Y=W.childNodes.length-1;if(!aa&&Z){Z--}W=W.childNodes[Z>Y?Y:Z]}return W}function Q(ab,X,aa){var Y,W=P[ab],ac=P[ab=="apply"?"remove":"apply"];function ad(){return P.apply.length||P.remove.length}function Z(){P.apply=[];P.remove=[]}function ae(af){O(P.apply.reverse(),function(ag){T(ag.name,ag.vars,af);if(ag.name==="forecolor"&&ag.vars.value){I(af.parentNode)}});O(P.remove.reverse(),function(ag){A(ag.name,ag.vars,af)});c.remove(af,1);Z()}for(Y=W.length-1;Y>=0;Y--){if(W[Y].name==X){return}}W.push({name:X,vars:aa});for(Y=ac.length-1;Y>=0;Y--){if(ac[Y].name==X){ac.splice(Y,1)}}if(ad()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ag){var af;if(b(ag)){af=q.getBookmark();ae(ag);q.moveToBookmark(af);V.nodeChanged()}});if(!P.isListening&&ad()){P.isListening=true;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(af){V[af].addToTop(function(ag,ah){if(ad()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){O(c.select("font,span"),function(aj){var ak,ai;if(b(aj)){ak=aj.firstChild;while(ak&&ak.nodeType!=3){ak=ak.firstChild}if(ak){ae(aj);ai=c.createRng();ai.setStart(ak,ak.nodeValue.length);ai.setEnd(ak,ak.nodeValue.length);q.setRng(ai);ag.nodeChanged()}else{c.remove(aj)}}});if(ah.type=="keyup"||ah.type=="mouseup"){Z()}}})})}}}}})(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){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)})}});
\ No newline at end of file
index 3ef3acb1fdc96824b8c7a357dfb4ee4d47ebe2bb..f859d24e6a6788d5890a02f76f96c81ff2749580 100644 (file)
@@ -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);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.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}}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){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
index acc1db528ebe57464f843a1ab93db38f3b3ae74a..bc6aecef0728b292cfead874b7060a11f56577fa 100644 (file)
@@ -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.8',\r
+               minorVersion : '4.3.1',\r
 \r
-               releaseDate : '2010-06-30',\r
+               releaseDate : '2011-06-16',\r
 \r
                _init : function() {\r
                        var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;\r
@@ -27,6 +27,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 +54,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
                },\r
 \r
 \r
+               map : function(a, f) {\r
+                       var o = [];\r
+\r
+                       tinymce.each(a, function(v) {\r
+                               o.push(f(v));\r
+                       });\r
+\r
+                       return o;\r
+               },\r
+\r
+               grep : function(a, f) {\r
+                       var o = [];\r
+\r
+                       tinymce.each(a, function(v) {\r
+                               if (!f || f(v))\r
+                                       o.push(v);\r
+                       });\r
+\r
+                       return o;\r
+               },\r
+\r
+               inArray : function(a, v) {\r
+                       var i, l;\r
+\r
+                       if (a) {\r
+                               for (i = 0, l = a.length; i < l; i++) {\r
+                                       if (a[i] === v)\r
+                                               return i;\r
+                               }\r
+                       }\r
+\r
+                       return -1;\r
+               },\r
+\r
+               extend : function(o, e) {\r
+                       var i, l, a = arguments;\r
+\r
+                       for (i = 1, l = a.length; i < l; i++) {\r
+                               e = a[i];\r
+\r
+                               tinymce.each(e, function(v, n) {\r
+                                       if (v !== undefined)\r
+                                               o[n] = v;\r
+                               });\r
+                       }\r
+\r
+                       return o;\r
+               },\r
+\r
+\r
                trim : function(s) {\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
-               };\r
-\r
-       // Initialize the API\r
-       tinymce._init();\r
-\r
-       // Expose tinymce namespace to the global namespace (window)\r
-       win.tinymce = win.tinyMCE = tinymce;\r
-})(window);\r
-\r
-(function($, tinymce) {\r
-       var is = tinymce.is, attrRegExp = /^(href|src|style)$/i, undefined;\r
-\r
-       // jQuery is undefined\r
-       if (!$)\r
-               return alert("Load jQuery first!");\r
-\r
-       // Stick jQuery into the tinymce namespace\r
-       tinymce.$ = $;\r
-\r
-       // Setup adapter\r
-       tinymce.adapter = {\r
-               patchEditor : function(editor) {\r
-                       var fn = $.fn;\r
-\r
-                       // Adapt the css function to make sure that the _mce_style\r
-                       // attribute gets updated with the new style information\r
-                       function css(name, value) {\r
-                               var self = this;\r
-\r
-                               // Remove _mce_style when set operation occurs\r
-                               if (value)\r
-                                       self.removeAttr('_mce_style');\r
-\r
-                               return fn.css.apply(self, arguments);\r
-                       };\r
-\r
-                       // Apapt the attr function to make sure that it uses the _mce_ prefixed variants\r
-                       function attr(name, value) {\r
-                               var self = this;\r
-\r
-                               // Update/retrive _mce_ attribute variants\r
-                               if (attrRegExp.test(name)) {\r
-                                       if (value !== undefined) {\r
-                                               // Use TinyMCE behavior when setting the specifc attributes\r
-                                               self.each(function(i, node) {\r
-                                                       editor.dom.setAttrib(node, name, value);\r
-                                               });\r
-\r
-                                               return self;\r
-                                       } else\r
-                                               return self.attr('_mce_' + name);\r
-                               }\r
-\r
-                               // Default behavior\r
-                               return fn.attr.apply(self, arguments);\r
-                       };\r
-\r
-                       function htmlPatchFunc(func) {\r
-                               // Returns a modified function that processes\r
-                               // the HTML before executing the action this makes sure\r
-                               // that href/src etc gets moved into the _mce_ variants\r
-                               return function(content) {\r
-                                       if (content)\r
-                                               content = editor.dom.processHTML(content);\r
-\r
-                                       return func.call(this, content);\r
-                               };\r
-                       };\r
-\r
-                       // Patch various jQuery functions to handle tinymce specific attribute and content behavior\r
-                       // we don't patch the jQuery.fn directly since it will most likely break compatibility\r
-                       // with other jQuery logic on the page. Only instances created by TinyMCE should be patched.\r
-                       function patch(jq) {\r
-                               // Patch some functions, only patch the object once\r
-                               if (jq.css !== css) {\r
-                                       // Patch css/attr to use the _mce_ prefixed attribute variants\r
-                                       jq.css = css;\r
-                                       jq.attr = attr;\r
-\r
-                                       // Patch HTML functions to use the DOMUtils.processHTML filter logic\r
-                                       jq.html = htmlPatchFunc(fn.html);\r
-                                       jq.append = htmlPatchFunc(fn.append);\r
-                                       jq.prepend = htmlPatchFunc(fn.prepend);\r
-                                       jq.after = htmlPatchFunc(fn.after);\r
-                                       jq.before = htmlPatchFunc(fn.before);\r
-                                       jq.replaceWith = htmlPatchFunc(fn.replaceWith);\r
-                                       jq.tinymce = editor;\r
-\r
-                                       // Each pushed jQuery instance needs to be patched\r
-                                       // as well for example when traversing the DOM\r
-                                       jq.pushStack = function() {\r
-                                               return patch(fn.pushStack.apply(this, arguments));\r
-                                       };\r
-                               }\r
-\r
-                               return jq;\r
-                       };\r
-\r
-                       // Add a $ function on each editor instance this one is scoped for the editor document object\r
-                       // this way you can do chaining like this tinymce.get(0).$('p').append('text').css('color', 'red');\r
-                       editor.$ = function(selector, scope) {\r
-                               var doc = editor.getDoc();\r
-\r
-                               return patch($(selector || doc, doc || scope));\r
-                       };\r
-               }\r
-       };\r
-\r
-       // Patch in core NS functions\r
-       tinymce.extend = $.extend;\r
-       tinymce.extend(tinymce, {\r
-               map : $.map,\r
-               grep : function(a, f) {return $.grep(a, f || function(){return 1;});},\r
-               inArray : function(a, v) {return $.inArray(v, a || []);}\r
-\r
-               /* Didn't iterate stylesheets\r
-               each : function(o, cb, s) {\r
-                       if (!o)\r
-                               return 0;\r
-\r
-                       var r = 1;\r
-\r
-                       $.each(o, function(nr, el){\r
-                               if (cb.call(s, el, nr, o) === false) {\r
-                                       r = 0;\r
-                                       return false;\r
-                               }\r
-                       });\r
-\r
-                       return r;\r
-               }*/\r
-       });\r
-\r
-       // Patch in functions in various clases\r
-       // Add a "#ifndefjquery" statement around each core API function you add below\r
-       var patches = {\r
-               'tinymce.dom.DOMUtils' : {\r
-                       /*\r
-                       addClass : function(e, c) {\r
-                               if (is(e, 'array') && is(e[0], 'string'))\r
-                                       e = e.join(',#');\r
-                               return (e && $(is(e, 'string') ? '#' + e : e)\r
-                                       .addClass(c)\r
-                                       .attr('class')) || false;\r
-                       },\r
-\r
-                       hasClass : function(n, c) {\r
-                               return $(is(n, 'string') ? '#' + n : n).hasClass(c);\r
-                       },\r
-\r
-                       removeClass : function(e, c) {\r
-                               if (!e)\r
-                                       return false;\r
-\r
-                               var r = [];\r
-\r
-                               $(is(e, 'string') ? '#' + e : e)\r
-                                       .removeClass(c)\r
-                                       .each(function(){\r
-                                               r.push(this.className);\r
-                                       });\r
-\r
-                               return r.length == 1 ? r[0] : r;\r
-                       },\r
-                       */\r
-\r
-                       select : function(pattern, scope) {\r
-                               var t = this;\r
-\r
-                               return $.find(pattern, t.get(scope) || t.get(t.settings.root_element) || t.doc, []);\r
-                       },\r
-\r
-                       is : function(n, patt) {\r
-                               return $(this.get(n)).is(patt);\r
-                       }\r
-\r
-                       /*\r
-                       show : function(e) {\r
-                               if (is(e, 'array') && is(e[0], 'string'))\r
-                                       e = e.join(',#');\r
-\r
-                               $(is(e, 'string') ? '#' + e : e).css('display', 'block');\r
-                       },\r
-\r
-                       hide : function(e) {\r
-                               if (is(e, 'array') && is(e[0], 'string'))\r
-                                       e = e.join(',#');\r
-\r
-                               $(is(e, 'string') ? '#' + e : e).css('display', 'none');\r
-                       },\r
-\r
-                       isHidden : function(e) {\r
-                               return $(is(e, 'string') ? '#' + e : e).is(':hidden');\r
-                       },\r
-\r
-                       insertAfter : function(n, e) {\r
-                               return $(is(e, 'string') ? '#' + e : e).after(n);\r
-                       },\r
-\r
-                       replace : function(o, n, k) {\r
-                               n = $(is(n, 'string') ? '#' + n : n);\r
-\r
-                               if (k)\r
-                                       n.children().appendTo(o);\r
-\r
-                               n.replaceWith(o);\r
-                       },\r
-\r
-                       setStyle : function(n, na, v) {\r
-                               if (is(n, 'array') && is(n[0], 'string'))\r
-                                       n = n.join(',#');\r
-\r
-                               $(is(n, 'string') ? '#' + n : n).css(na, v);\r
-                       },\r
-\r
-                       getStyle : function(n, na, c) {\r
-                               return $(is(n, 'string') ? '#' + n : n).css(na);\r
-                       },\r
-\r
-                       setStyles : function(e, o) {\r
-                               if (is(e, 'array') && is(e[0], 'string'))\r
-                                       e = e.join(',#');\r
-                               $(is(e, 'string') ? '#' + e : e).css(o);\r
-                       },\r
-\r
-                       setAttrib : function(e, n, v) {\r
-                               var t = this, s = t.settings;\r
-\r
-                               if (is(e, 'array') && is(e[0], 'string'))\r
-                                       e = e.join(',#');\r
-\r
-                               e = $(is(e, 'string') ? '#' + e : e);\r
-\r
-                               switch (n) {\r
-                                       case "style":\r
-                                               e.each(function(i, v){\r
-                                                       if (s.keep_values)\r
-                                                               $(v).attr('_mce_style', v);\r
-\r
-                                                       v.style.cssText = v;\r
-                                               });\r
-                                               break;\r
-\r
-                                       case "class":\r
-                                               e.each(function(){\r
-                                                       this.className = v;\r
-                                               });\r
-                                               break;\r
-\r
-                                       case "src":\r
-                                       case "href":\r
-                                               e.each(function(i, v){\r
-                                                       if (s.keep_values) {\r
-                                                               if (s.url_converter)\r
-                                                                       v = s.url_converter.call(s.url_converter_scope || t, v, n, v);\r
-\r
-                                                               t.setAttrib(v, '_mce_' + n, v);\r
-                                                       }\r
-                                               });\r
-\r
-                                               break;\r
-                               }\r
+               },\r
 \r
-                               if (v !== null && v.length !== 0)\r
-                                       e.attr(n, '' + v);\r
-                               else\r
-                                       e.removeAttr(n);\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
-                       setAttribs : function(e, o) {\r
-                               var t = this;\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
-                               $.each(o, function(n, v){\r
-                                       t.setAttrib(e,n,v);\r
+                                       return val;\r
                                });\r
                        }\r
-                       */\r
-               }\r
-\r
-/*\r
-               'tinymce.dom.Event' : {\r
-                       add : function (o, n, f, s) {\r
-                               var lo, cb;\r
 \r
-                               cb = function(e) {\r
-                                       e.target = e.target || this;\r
-                                       f.call(s || this, e);\r
-                               };\r
-\r
-                               if (is(o, 'array') && is(o[0], 'string'))\r
-                                       o = o.join(',#');\r
-                               o = $(is(o, 'string') ? '#' + o : o);\r
-                               if (n == 'init') {\r
-                                       o.ready(cb, s);\r
-                               } else {\r
-                                       if (s) {\r
-                                               o.bind(n, s, cb);\r
-                                       } else {\r
-                                               o.bind(n, cb);\r
-                                       }\r
-                               }\r
-\r
-                               lo = this._jqLookup || (this._jqLookup = []);\r
-                               lo.push({func : f, cfunc : cb});\r
-\r
-                               return cb;\r
-                       },\r
+                       return str.replace(find, replace);\r
+               }\r
 \r
-                       remove : function(o, n, f) {\r
-                               // Find cfunc\r
-                               $(this._jqLookup).each(function() {\r
-                                       if (this.func === f)\r
-                                               f = this.cfunc;\r
-                               });\r
+               };\r
 \r
-                               if (is(o, 'array') && is(o[0], 'string'))\r
-                                       o = o.join(',#');\r
+       // Initialize the API\r
+       tinymce._init();\r
 \r
-                               $(is(o, 'string') ? '#' + o : o).unbind(n,f);\r
+       // Expose tinymce namespace to the global namespace (window)\r
+       win.tinymce = win.tinyMCE = tinymce;\r
 \r
-                               return true;\r
-                       }\r
-               }\r
-*/\r
-       };\r
+       // Describe the different namespaces\r
 \r
-       // Patch functions after a class is created\r
-       tinymce.onCreate = function(ty, c, p) {\r
-               tinymce.extend(p, patches[c]);\r
-       };\r
-})(window.jQuery, tinymce);\r
+       })(window);\r
 \r
 \r
 \r
@@ -772,7 +545,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
@@ -791,8 +564,10 @@ 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
@@ -1079,9 +854,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
@@ -1091,7 +868,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
@@ -1100,13 +881,13 @@ 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
@@ -1114,24 +895,27 @@ tinymce.create('static tinymce.util.JSON', {
                                v = '{';\r
 \r
                                for (i in o)\r
-                                       v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';\r
+                                       v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : '';\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
-               }\r
-       }\r
+       tinymce.util.JSON = {\r
+               serialize: serialize,\r
 \r
-       });\r
+               parse: function(s) {\r
+                       try {\r
+                               return eval('(' + s + ')');\r
+                       } catch (ex) {\r
+                               // Ignore\r
+                       }\r
+               }\r
 \r
+               };\r
+})();\r
 tinymce.create('static tinymce.util.XHR', {\r
        send : function(o) {\r
                var x, t, w = window, c = 0;\r
@@ -1222,7 +1006,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
@@ -1245,1659 +1030,3629 @@ tinymce.create('static tinymce.util.XHR', {
        });\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
-\r
-       function makeMap(str) {\r
-               var map = {}, i;\r
+       var namedEntities, baseEntities, reverseEntities,\r
+               attrsCharsRegExp = /[&<>\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,\r
+               textCharsRegExp = /[<>&\u007E-\uD7FF]|[\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
-               str = str.split(',');\r
-               for (i = str.length; i >= 0; i--)\r
-                       map[str[i]] = 1;\r
+       // Raw entities\r
+       baseEntities = {\r
+               '"' : '&quot;',\r
+               "'" : '&#39;',\r
+               '<' : '&lt;',\r
+               '>' : '&gt;',\r
+               '&' : '&amp;'\r
+       };\r
 \r
-               return map;\r
+       // Reverse lookup table for raw entities\r
+       reverseEntities = {\r
+               '&lt;' : '<',\r
+               '&gt;' : '>',\r
+               '&amp;' : '&',\r
+               '&quot;' : '"',\r
+               '&apos;' : "'"\r
        };\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
+       // Decodes text by using the browser\r
+       function nativeDecode(text) {\r
+               var elm;\r
 \r
-               DOMUtils : function(d, s) {\r
-                       var t = this, globalStyle;\r
+               elm = document.createElement("div");\r
+               elm.innerHTML = text;\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
+               return elm.textContent || elm.innerText || text;\r
+       };\r
 \r
-                       t.settings = s = tinymce.extend({\r
-                               keep_values : false,\r
-                               hex_colors : 1,\r
-                               process_html : 1\r
-                       }, s);\r
+       // Build a two way lookup table for the entities\r
+       function buildEntitiesLookup(items, radix) {\r
+               var i, chr, entity, lookup = {};\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
+               if (items) {\r
+                       items = items.split(',');\r
+                       radix = radix || 10;\r
+\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
-                       // Build styles list\r
-                       if (s.valid_styles) {\r
-                               t._styles = {};\r
+                       return lookup;\r
+               }\r
+       };\r
 \r
-                               // Convert styles into a rule list\r
-                               each(s.valid_styles, function(value, key) {\r
-                                       t._styles[key] = tinymce.explode(value);\r
-                               });\r
-                       }\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
-                       tinymce.addUnload(t.destroy, t);\r
+               encodeAllRaw : function(text) {\r
+                       return ('' + text).replace(rawCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || chr;\r
+                       });\r
                },\r
 \r
-               getRoot : function() {\r
-                       var t = this, s = t.settings;\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
-                       return (s && t.get(s.root_element)) || t.doc.body;\r
+                               return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';\r
+                       });\r
                },\r
 \r
-               getViewPort : function(w) {\r
-                       var d, b;\r
-\r
-                       w = !w ? this.win : w;\r
-                       d = w.document;\r
-                       b = this.boxModel ? d.documentElement : d.body;\r
+               encodeNamed : function(text, attr, entities) {\r
+                       entities = entities || namedEntities;\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
+                       return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {\r
+                               return baseEntities[chr] || entities[chr] || chr;\r
+                       });\r
                },\r
 \r
-               getRect : function(e) {\r
-                       var p, t = this, sr;\r
+               getEncodeFunc : function(name, entities) {\r
+                       var Entities = tinymce.html.Entities;\r
 \r
-                       e = t.get(e);\r
-                       p = t.getPos(e);\r
-                       sr = t.getSize(e);\r
+                       entities = buildEntitiesLookup(entities) || namedEntities;\r
 \r
-                       return {\r
-                               x : p.x,\r
-                               y : p.y,\r
-                               w : sr.w,\r
-                               h : sr.h\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
-\r
-               getSize : function(e) {\r
-                       var t = this, w, h;\r
 \r
-                       e = t.get(e);\r
-                       w = t.getStyle(e, 'width');\r
-                       h = t.getStyle(e, 'height');\r
+                       function encodeCustomNamed(text, attr) {\r
+                               return Entities.encodeNamed(text, attr, entities);\r
+                       };\r
 \r
-                       // Non pixel value, then force offset/clientWidth\r
-                       if (w.indexOf('px') === -1)\r
-                               w = 0;\r
+                       // Replace + with , to be compatible with previous TinyMCE versions\r
+                       name = tinymce.makeMap(name.replace(/\+/g, ','));\r
 \r
-                       // Non pixel value, then force offset/clientWidth\r
-                       if (h.indexOf('px') === -1)\r
-                               h = 0;\r
+                       // Named and numeric encoder\r
+                       if (name.named && name.numeric)\r
+                               return encodeNamedAndNumeric;\r
 \r
-                       return {\r
-                               w : parseInt(w) || e.offsetWidth || e.clientWidth,\r
-                               h : parseInt(h) || e.offsetHeight || e.clientHeight\r
-                       };\r
-               },\r
+                       // Named encoder\r
+                       if (name.named) {\r
+                               // Custom names\r
+                               if (entities)\r
+                                       return encodeCustomNamed;\r
 \r
-               getParent : function(n, f, r) {\r
-                       return this.getParents(n, f, r, false);\r
-               },\r
+                               return Entities.encodeNamed;\r
+                       }\r
 \r
-               getParents : function(n, f, r, c) {\r
-                       var t = this, na, se = t.settings, o = [];\r
+                       // Numeric\r
+                       if (name.numeric)\r
+                               return Entities.encodeNumeric;\r
 \r
-                       n = t.get(n);\r
-                       c = c === undefined;\r
+                       // Raw encoder\r
+                       return Entities.encodeRaw;\r
+               },\r
 \r
-                       if (se.strict_root)\r
-                               r = r || t.getRoot();\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
-                       // Wrap node name as func\r
-                       if (is(f, 'string')) {\r
-                               na = f;\r
+                                       // Support upper UTF\r
+                                       if (value > 0xFFFF) {\r
+                                               value -= 0x10000;\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
+                                               return String.fromCharCode(0xD800 + (value >> 10), 0xDC00 + (value & 0x3FF));\r
+                                       } else\r
+                                               return asciiMap[value] || String.fromCharCode(value);\r
                                }\r
-                       }\r
-\r
-                       while (n) {\r
-                               if (n == r || !n.nodeType || n.nodeType === 9)\r
-                                       break;\r
 \r
-                               if (!f || f(n)) {\r
-                                       if (c)\r
-                                               o.push(n);\r
-                                       else\r
-                                               return n;\r
-                               }\r
+                               return reverseEntities[all] || namedEntities[all] || nativeDecode(all);\r
+                       });\r
+               }\r
+       };\r
+})(tinymce);\r
 \r
-                               n = n.parentNode;\r
-                       }\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
-                       return c ? o : null;\r
-               },\r
+       settings = settings || {};\r
 \r
-               get : function(e) {\r
-                       var n;\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
-                       if (e && this.doc && typeof(e) == 'string') {\r
-                               n = e;\r
-                               e = this.doc.getElementById(e);\r
+       function toHex(match, r, g, b) {\r
+               function hex(val) {\r
+                       val = parseInt(val).toString(16);\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
-                       }\r
+                       return val.length > 1 ? val : '0' + val; // 0 -> 00\r
+               };\r
 \r
-                       return e;\r
-               },\r
+               return '#' + hex(r) + hex(g) + hex(b);\r
+       };\r
 \r
-               getNext : function(node, selector) {\r
-                       return this._findSib(node, selector, 'nextSibling');\r
+       return {\r
+               toHex : function(color) {\r
+                       return color.replace(rgbRegExp, toHex);\r
                },\r
 \r
-               getPrev : function(node, selector) {\r
-                       return this._findSib(node, selector, 'previousSibling');\r
-               },\r
+               parse : function(css) {\r
+                       var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope || this;\r
 \r
+                       function compress(prefix, suffix) {\r
+                               var top, right, bottom, left;\r
 \r
-               add : function(p, n, a, h, c) {\r
-                       var t = this;\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(p, function(p) {\r
-                               var e, k;\r
+                               right = styles[prefix + '-right' + suffix];\r
+                               if (top != right)\r
+                                       return;\r
 \r
-                               e = is(n, 'string') ? t.doc.createElement(n) : n;\r
-                               t.setAttribs(e, a);\r
+                               bottom = styles[prefix + '-bottom' + suffix];\r
+                               if (right != bottom)\r
+                                       return;\r
 \r
-                               if (h) {\r
-                                       if (h.nodeType)\r
-                                               e.appendChild(h);\r
-                                       else\r
-                                               t.setHTML(e, h);\r
-                               }\r
+                               left = styles[prefix + '-left' + suffix];\r
+                               if (bottom != left)\r
+                                       return;\r
 \r
-                               return !c ? p.appendChild(e) : e;\r
-                       });\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
-               create : function(n, a, h) {\r
-                       return this.add(this.doc.createElement(n), n, a, h, 1);\r
-               },\r
+                       function canCompress(key) {\r
+                               var value = styles[key], i;\r
 \r
-               createHTML : function(n, a, h) {\r
-                       var o = '', t = this, k;\r
+                               if (!value || value.indexOf(' ') < 0)\r
+                                       return;\r
 \r
-                       o += '<' + n;\r
+                               value = value.split(' ');\r
+                               i = value.length;\r
+                               while (i--) {\r
+                                       if (value[i] !== value[0])\r
+                                               return false;\r
+                               }\r
 \r
-                       for (k in a) {\r
-                               if (a.hasOwnProperty(k))\r
-                                       o += ' ' + k + '="' + t.encode(a[k]) + '"';\r
-                       }\r
+                               styles[key] = value[0];\r
 \r
-                       if (tinymce.is(h))\r
-                               return o + '>' + h + '</' + n + '>';\r
+                               return true;\r
+                       };\r
 \r
-                       return o + ' />';\r
-               },\r
+                       function compress2(target, a, b, c) {\r
+                               if (!canCompress(a))\r
+                                       return;\r
 \r
-               remove : function(node, keep_children) {\r
-                       return this.run(node, function(node) {\r
-                               var parent, child;\r
+                               if (!canCompress(b))\r
+                                       return;\r
 \r
-                               parent = node.parentNode;\r
+                               if (!canCompress(c))\r
+                                       return;\r
 \r
-                               if (!parent)\r
-                                       return null;\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
-                               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
+                       // Encodes the specified string by replacing all \" \' ; : with _<num>\r
+                       function encode(str) {\r
+                               isEncoded = true;\r
 \r
-                               return parent.removeChild(node);\r
-                       });\r
-               },\r
+                               return encodingLookup[str];\r
+                       };\r
 \r
-               setStyle : function(n, na, v) {\r
-                       var t = this;\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
-                       return t.run(n, function(e) {\r
-                               var s, i;\r
+                               if (!keep_slashes)\r
+                                       str = str.replace(/\\([\'\";:])/g, "$1");\r
 \r
-                               s = e.style;\r
+                               return str;\r
+                       }\r
 \r
-                               // Camelcase it, if needed\r
-                               na = na.replace(/-(\D)/g, function(a, b){\r
-                                       return b.toUpperCase();\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
-                               // Default px suffix on these\r
-                               if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))\r
-                                       v += 'px';\r
+                               // Parse styles\r
+                               while (matches = styleRegExp.exec(css)) {\r
+                                       name = matches[1].replace(trimRightRegExp, '').toLowerCase();\r
+                                       value = matches[2].replace(trimRightRegExp, '');\r
 \r
-                               switch (na) {\r
-                                       case 'opacity':\r
-                                               // IE specific opacity\r
-                                               if (isIE) {\r
-                                                       s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";\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
-                                                       if (!n.currentStyle || !n.currentStyle.hasLayout)\r
-                                                               s.display = 'inline-block';\r
-                                               }\r
+                                               // Convert RGB colors to HEX\r
+                                               value = value.replace(rgbRegExp, toHex);\r
 \r
-                                               // Fix for older browsers\r
-                                               s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';\r
-                                               break;\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
-                                       case 'float':\r
-                                               isIE ? s.styleFloat = v : s.cssFloat = v;\r
-                                               break;\r
-                                       \r
-                                       default:\r
-                                               s[na] = v || '';\r
-                               }\r
+                                                       if (str) {\r
+                                                               str = decode(str);\r
 \r
-                               // Force update of the style data\r
-                               if (t.settings.update_styles)\r
-                                       t.setAttrib(e, '_mce_style');\r
-                       });\r
-               },\r
+                                                               // Force strings into single quote format\r
+                                                               return "'" + str.replace(/\'/g, "\\'") + "'";\r
+                                                       }\r
 \r
-               getStyle : function(n, na, c) {\r
-                       n = this.get(n);\r
+                                                       url = decode(url || url2 || url3);\r
 \r
-                       if (!n)\r
-                               return false;\r
+                                                       // Convert the URL to relative/absolute depending on config\r
+                                                       if (urlConverter)\r
+                                                               url = urlConverter.call(urlConverterScope, url, 'style');\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
+                                                       // Output new URL format\r
+                                                       return "url('" + url.replace(/\'/g, "\\'") + "')";\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
+                                               styles[name] = isEncoded ? decode(value, true) : value;\r
+                                       }\r
 \r
-                       // Camelcase it, if needed\r
-                       na = na.replace(/-(\D)/g, function(a, b){\r
-                               return b.toUpperCase();\r
-                       });\r
+                                       styleRegExp.lastIndex = matches.index + matches[0].length;\r
+                               }\r
 \r
-                       if (na == 'float')\r
-                               na = isIE ? 'styleFloat' : 'cssFloat';\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
-                       // IE & Opera\r
-                       if (n.currentStyle && c)\r
-                               return n.currentStyle[na];\r
+                               // Remove pointless border, IE produces these\r
+                               if (styles.border === 'medium none')\r
+                                       delete styles.border;\r
+                       }\r
 \r
-                       return n.style[na];\r
+                       return styles;\r
                },\r
 \r
-               setStyles : function(e, o) {\r
-                       var t = this, s = t.settings, ol;\r
+               serialize : function(styles, element_name) {\r
+                       var css = '', name, value;\r
 \r
-                       ol = s.update_styles;\r
-                       s.update_styles = 0;\r
+                       function serializeStyles(name) {\r
+                               var styleList, i, l, value;\r
 \r
-                       each(o, function(v, n) {\r
-                               t.setStyle(e, n, v);\r
-                       });\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
-                       // Update style info\r
-                       s.update_styles = ol;\r
-                       if (s.update_styles)\r
-                               t.setAttrib(e, s.cssText);\r
-               },\r
+                                               if (value !== undef && value.length > 0)\r
+                                                       css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                                       }\r
+                               }\r
+                       };\r
 \r
-               setAttrib : function(e, n, v) {\r
-                       var t = this;\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
-                       // Whats the point\r
-                       if (!e || !n)\r
-                               return;\r
+                                       if (value !== undef && value.length > 0)\r
+                                               css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\r
+                               }\r
+                       }\r
 \r
-                       // Strict XML mode\r
-                       if (t.settings.strict)\r
-                               n = n.toLowerCase();\r
+                       return css;\r
+               }\r
+       };\r
+};\r
 \r
-                       return this.run(e, function(e) {\r
-                               var s = t.settings;\r
+(function(tinymce) {\r
+       var transitional = {}, boolAttrMap, blockElementsMap, shortEndedElementsMap, nonEmptyElementsMap, customElementsMap = {},\r
+               whiteSpaceElementsMap, selfClosingElementsMap, makeMap = tinymce.makeMap, each = tinymce.each;\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
+       function split(str, delim) {\r
+               return str.split(delim || ',');\r
+       };\r
 \r
-                                                       return;\r
-                                               }\r
+       function unpack(lookup, data) {\r
+               var key, elements = {};\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
+               function replace(value) {\r
+                       return value.replace(/[A-Z]+/g, function(key) {\r
+                               return replace(lookup[key]);\r
+                       });\r
+               };\r
 \r
-                                               e.style.cssText = v;\r
-                                               break;\r
+               // Unpack lookup\r
+               for (key in lookup) {\r
+                       if (lookup.hasOwnProperty(key))\r
+                               lookup[key] = replace(lookup[key]);\r
+               }\r
 \r
-                                       case "class":\r
-                                               e.className = v || ''; // Fix IE null bug\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
-                                       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
+                       elements[name] = {\r
+                               attributes : makeMap(attributes),\r
+                               attributesOrder : attributes,\r
+                               children : makeMap(children, '|', {'#comment' : {}})\r
+                       }\r
+               });\r
 \r
-                                                       t.setAttrib(e, '_mce_' + n, v, 2);\r
-                                               }\r
+               return elements;\r
+       };\r
 \r
-                                               break;\r
-                                       \r
-                                       case "shape":\r
-                                               e.setAttribute('_mce_style', v);\r
-                                               break;\r
-                               }\r
+       // Build a lookup table for block elements both lowercase and uppercase\r
+       blockElementsMap = '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';\r
+       blockElementsMap = makeMap(blockElementsMap, ',', makeMap(blockElementsMap.toUpperCase()));\r
+\r
+       // This is the XHTML 1.0 transitional elements with it's attributes and children packed to reduce it's size\r
+       transitional = 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
-                               if (is(v) && v !== null && v.length !== 0)\r
-                                       e.setAttribute(n, '' + v, 2);\r
-                               else\r
-                                       e.removeAttribute(n, 2);\r
-                       });\r
-               },\r
+       boolAttrMap = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,preload,autoplay,loop,controls');\r
+       shortEndedElementsMap = makeMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source');\r
+       nonEmptyElementsMap = tinymce.extend(makeMap('td,th,iframe,video,object'), shortEndedElementsMap);\r
+       whiteSpaceElementsMap = makeMap('pre,script,style');\r
+       selfClosingElementsMap = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');\r
 \r
-               setAttribs : function(e, o) {\r
-                       var t = this;\r
+       tinymce.html.Schema = function(settings) {\r
+               var self = this, elements = {}, children = {}, patternElements = [], validStyles;\r
 \r
-                       return this.run(e, function(e) {\r
-                               each(o, function(v, n) {\r
-                                       t.setAttrib(e, n, v);\r
-                               });\r
+               settings = settings || {};\r
+\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
+               // Build styles list\r
+               if (settings.valid_styles) {\r
+                       validStyles = {};\r
+\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
-               getAttrib : function(e, n, dv) {\r
-                       var v, t = this;\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
-                       e = t.get(e);\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
+                               // 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
-                       if (!e || e.nodeType !== 1)\r
-                               return false;\r
+                                               // Padd empty elements prefix\r
+                                               if (prefix === '#')\r
+                                                       element.paddEmpty = true;\r
 \r
-                       if (!is(dv))\r
-                               dv = '';\r
+                                               // Remove empty elements prefix\r
+                                               if (prefix === '-')\r
+                                                       element.removeEmpty = true;\r
 \r
-                       // Try the mce variant for these\r
-                       if (/^(src|href|style|coords|shape)$/.test(n)) {\r
-                               v = e.getAttribute("_mce_" + n);\r
+                                               // Copy attributes from global rule into current rule\r
+                                               if (globalAttributes) {\r
+                                                       for (key in globalAttributes)\r
+                                                               attributes[key] = globalAttributes[key];\r
 \r
-                               if (v)\r
-                                       return v;\r
-                       }\r
+                                                       attributesOrder.push.apply(attributesOrder, globalAttributesOrder);\r
+                                               }\r
 \r
-                       if (isIE && t.props[n]) {\r
-                               v = e[t.props[n]];\r
-                               v = v && v.nodeValue ? v.nodeValue : v;\r
-                       }\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
-                       if (!v)\r
-                               v = e.getAttribute(n, 2);\r
+                                                                       // Denied from global\r
+                                                                       if (attrType === '-') {\r
+                                                                               delete attributes[attrName];\r
+                                                                               attributesOrder.splice(tinymce.inArray(attributesOrder, attrName), 1);\r
+                                                                               continue;\r
+                                                                       }\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
+                                                                       // 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
-                               return v ? n : '';\r
-                       }\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
-                       // Inner input elements will override attributes on form elements\r
-                       if (e.nodeName === "FORM" && e.getAttributeNode(n))\r
-                               return e.getAttributeNode(n).nodeValue;\r
+                                                                               // Required values\r
+                                                                               if (prefix === '<')\r
+                                                                                       attr.validValues = makeMap(value, '?');\r
+                                                                       }\r
 \r
-                       if (n === 'style') {\r
-                               v = v || e.style.cssText;\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
-                               if (v) {\r
-                                       v = t.serializeStyle(t.parseStyle(v), e.nodeName);\r
+                                                                               attributes[attrName] = attr;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
 \r
-                                       if (t.settings.keep_values && !t._isRes(v))\r
-                                               e.setAttribute('_mce_style', v);\r
+                                               // Global rule, store away these for later usage\r
+                                               if (!globalAttributes && elementName == '@') {\r
+                                                       globalAttributes = attributes;\r
+                                                       globalAttributesOrder = attributesOrder;\r
+                                               }\r
+\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
-                       // 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
+               function setValidElements(valid_elements) {\r
+                       elements = {};\r
+                       patternElements = [];\r
 \r
-                                               break;\r
+                       addValidElements(valid_elements);\r
 \r
-                                       case 'size':\r
-                                               // IE returns +0 as default value for size\r
-                                               if (v === '+0' || v === 20 || v === 0)\r
-                                                       v = '';\r
+                       each(transitional, function(element, name) {\r
+                               children[name] = element.children;\r
+                       });\r
+               };\r
 \r
-                                               break;\r
+               // Adds custom non HTML elements to the schema\r
+               function addCustomElements(custom_elements) {\r
+                       var customElementRegExp = /^(~)?(.+)$/;\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
+                       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
-                                               break;\r
+                                       children[name] = children[cloneName];\r
+                                       customElementsMap[name] = cloneName;\r
 \r
-                                       case 'hspace':\r
-                                               // IE returns -1 as default value\r
-                                               if (v === -1)\r
-                                                       v = '';\r
+                                       // If it's not marked as inline then add it to valid block elements\r
+                                       if (!inline)\r
+                                               blockElementsMap[name] = {};\r
 \r
-                                               break;\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
-                                       case 'maxlength':\r
-                                       case 'tabindex':\r
-                                               // IE returns default value\r
-                                               if (v === 32768 || v === 2147483647 || v === '32768')\r
-                                                       v = '';\r
+               // Adds valid children to the schema object\r
+               function addValidChildren(valid_children) {\r
+                       var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;\r
 \r
-                                               break;\r
+                       if (valid_children) {\r
+                               each(split(valid_children), function(rule) {\r
+                                       var matches = childRuleRegExp.exec(rule), parent, prefix;\r
 \r
-                                       case 'multiple':\r
-                                       case 'compact':\r
-                                       case 'noshade':\r
-                                       case 'nowrap':\r
-                                               if (v === 65535)\r
-                                                       return n;\r
+                                       if (matches) {\r
+                                               prefix = matches[1];\r
 \r
-                                               return dv;\r
+                                               // Add/remove items from default\r
+                                               if (prefix)\r
+                                                       parent = children[matches[2]];\r
+                                               else\r
+                                                       parent = children[matches[2]] = {'#comment' : {}};\r
 \r
-                                       case 'shape':\r
-                                               v = v.toLowerCase();\r
-                                               break;\r
+                                               parent = children[matches[2]];\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
+                                               each(split(matches[3], '|'), function(child) {\r
+                                                       if (prefix === '-')\r
+                                                               delete parent[child];\r
+                                                       else\r
+                                                               parent[child] = {};\r
+                                               });\r
+                                       }\r
+                               });\r
                        }\r
+               }\r
 \r
-                       return (v !== undefined && v !== null && v !== '') ? '' + v : dv;\r
-               },\r
+               if (!settings.valid_elements) {\r
+                       // No valid elements defined then clone the elements from the transitional spec\r
+                       each(transitional, function(element, name) {\r
+                               elements[name] = {\r
+                                       attributes : element.attributes,\r
+                                       attributesOrder : element.attributesOrder\r
+                               };\r
 \r
-               getPos : function(n, ro) {\r
-                       var t = this, x = 0, y = 0, e, d = t.doc, r;\r
+                               children[name] = element.children;\r
+                       });\r
 \r
-                       n = t.get(n);\r
-                       ro = ro || d.body;\r
+                       // Switch these\r
+                       each(split('strong/b,em/i'), function(item) {\r
+                               item = split(item, '/');\r
+                               elements[item[1]].outputName = item[0];\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
+                       // Add default alt attribute for images\r
+                       elements.img.attributesDefault = [{name: 'alt', value: ''}];\r
 \r
-                                       return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};\r
-                               }\r
+                       // Remove these if they are empty by default\r
+                       each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr'), function(name) {\r
+                               elements[name].removeEmpty = true;\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
+                       // 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
+               } else\r
+                       setValidElements(settings.valid_elements);\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
+               addCustomElements(settings.custom_elements);\r
+               addValidChildren(settings.valid_children);\r
+               addValidElements(settings.extended_valid_elements);\r
 \r
-                       return {x : x, y : y};\r
-               },\r
+               // Todo: Remove this when we fix list handling to be valid\r
+               addValidChildren('+ol[ul|ol],+ul[ul|ol]');\r
 \r
-               parseStyle : function(st) {\r
-                       var t = this, s = t.settings, o = {};\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
-                       if (!st)\r
-                               return o;\r
+               self.children = children;\r
 \r
-                       function compress(p, s, ot) {\r
-                               var t, r, b, l;\r
+               self.styles = validStyles;\r
 \r
-                               // Get values and check it it needs compressing\r
-                               t = o[p + '-top' + s];\r
-                               if (!t)\r
-                                       return;\r
+               self.getBoolAttrs = function() {\r
+                       return boolAttrMap;\r
+               };\r
 \r
-                               r = o[p + '-right' + s];\r
-                               if (t != r)\r
-                                       return;\r
+               self.getBlockElements = function() {\r
+                       return blockElementsMap;\r
+               };\r
 \r
-                               b = o[p + '-bottom' + s];\r
-                               if (r != b)\r
-                                       return;\r
+               self.getShortEndedElements = function() {\r
+                       return shortEndedElementsMap;\r
+               };\r
 \r
-                               l = o[p + '-left' + s];\r
-                               if (b != l)\r
-                                       return;\r
+               self.getSelfClosingElements = function() {\r
+                       return selfClosingElementsMap;\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
+               self.getNonEmptyElements = function() {\r
+                       return nonEmptyElementsMap;\r
+               };\r
 \r
-                       function compress2(ta, a, b, c) {\r
-                               var t;\r
+               self.getWhiteSpaceElements = function() {\r
+                       return whiteSpaceElementsMap;\r
+               };\r
 \r
-                               t = o[a];\r
-                               if (!t)\r
-                                       return;\r
+               self.isValidChild = function(name, child) {\r
+                       var parent = children[name];\r
 \r
-                               t = o[b];\r
-                               if (!t)\r
-                                       return;\r
+                       return !!(parent && parent[child]);\r
+               };\r
 \r
-                               t = o[c];\r
-                               if (!t)\r
-                                       return;\r
+               self.getElementRule = function(name) {\r
+                       var element = elements[name], i;\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
+                       // Exact match found\r
+                       if (element)\r
+                               return element;\r
 \r
-                       st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities\r
+                       // No exact match then try the patterns\r
+                       i = patternElements.length;\r
+                       while (i--) {\r
+                               element = patternElements[i];\r
 \r
-                       each(st.split(';'), function(v) {\r
-                               var sv, ur = [];\r
+                               if (element.pattern.test(name))\r
+                                       return element;\r
+                       }\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
+               self.getCustomElements = function() {\r
+                       return customElementsMap;\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
+               self.addValidElements = addValidElements;\r
 \r
-                                       o[tinymce.trim(v[0]).toLowerCase()] = sv;\r
-                               }\r
-                       });\r
+               self.setValidElements = setValidElements;\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
+               self.addCustomElements = addCustomElements;\r
 \r
-                       if (isIE) {\r
-                               // Remove pointless border\r
-                               if (o.border == 'medium none')\r
-                                       o.border = '';\r
-                       }\r
+               self.addValidChildren = addValidChildren;\r
+       };\r
 \r
-                       return o;\r
-               },\r
+       // Expose boolMap and blockElementMap as static properties for usage in DOMUtils\r
+       tinymce.html.Schema.boolAttrMap = boolAttrMap;\r
+       tinymce.html.Schema.blockElementsMap = blockElementsMap;\r
+})(tinymce);\r
 \r
-               serializeStyle : function(o, name) {\r
-                       var t = this, s = '';\r
+(function(tinymce) {\r
+       tinymce.html.SaxParser = function(settings, schema) {\r
+               var self = this, noop = function() {};\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
+               settings = settings || {};\r
+               self.schema = schema = schema || new tinymce.html.Schema();\r
 \r
-                                       switch (k) {\r
-                                               case 'font-weight':\r
-                                                       // Opera will output bold as 700\r
-                                                       if (v == 700)\r
-                                                               v = 'bold';\r
+               if (settings.fix_self_closing !== false)\r
+                       settings.fix_self_closing = true;\r
 \r
-                                                       break;\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
-                                               case 'color':\r
-                                               case 'background-color':\r
-                                                       v = v.toLowerCase();\r
-                                                       break;\r
+               self.parse = function(html) {\r
+                       var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name,\r
+                               shortEndedElements, fillAttrsMap, isShortEnded, validate, elementRule, isValidElement, attr, attribsValue,\r
+                               validAttributesMap, validAttributePatterns, attributesRequired, attributesDefault, attributesForced, selfClosing,\r
+                               tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0, decode = tinymce.html.Entities.decode, fixSelfClosing;\r
+\r
+                       function processEndTag(name) {\r
+                               var pos, i;\r
+\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
+                               // 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 (name.valid)\r
+                                                       self.end(name.name);\r
                                        }\r
 \r
-                                       s += (s ? ' ' : '') + k + ': ' + v + ';';\r
+                                       // Remove the open elements from the stack\r
+                                       stack.length = pos;\r
                                }\r
                        };\r
 \r
-                       // Validate style output\r
-                       if (name && t._styles) {\r
-                               each(t._styles['*'], function(name) {\r
-                                       add(o[name], name);\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
+                               '(?:([^\\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
-                               each(t._styles[name.toLowerCase()], function(name) {\r
-                                       add(o[name], name);\r
-                               });\r
-                       } else\r
-                               each(o, add);\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
+                       fixSelfClosing = settings.fix_self_closing;\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
+                                       processEndTag(value.toLowerCase());\r
+                               } else if (value = matches[7]) { // Start element\r
+                                       value = value.toLowerCase();\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
-                       return s;\r
-               },\r
+                                               // Parse attributes\r
+                                               if (attribsValue = matches[8]) {\r
+                                                       attrList = [];\r
+                                                       attrList.map = {};\r
 \r
-               loadCSS : function(u) {\r
-                       var t = this, d = t.doc, head;\r
+                                                       attribsValue.replace(attrRegExp, function(match, name, value, val2, val3) {\r
+                                                               var attrRule, i;\r
 \r
-                       if (!u)\r
-                               u = '';\r
+                                                               name = name.toLowerCase();\r
+                                                               value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute\r
 \r
-                       head = t.select('head')[0];\r
+                                                               // Validate name and value\r
+                                                               if (validate && name.indexOf('data-') !== 0) {\r
+                                                                       attrRule = validAttributesMap[name];\r
 \r
-                       each(u.split(','), function(u) {\r
-                               var link;\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
-                               if (t.files[u])\r
-                                       return;\r
+                                                                               // No rule matched\r
+                                                                               if (i === -1)\r
+                                                                                       attrRule = null;\r
+                                                                       }\r
 \r
-                               t.files[u] = true;\r
-                               link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});\r
+                                                                       // No attribute rule found\r
+                                                                       if (!attrRule)\r
+                                                                               return;\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
-                               }\r
+                                                                       // Validate value\r
+                                                                       if (attrRule.validValues && !(value in attrRule.validValues))\r
+                                                                               return;\r
+                                                               }\r
 \r
-                               head.appendChild(link);\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
-               addClass : function(e, c) {\r
-                       return this.run(e, function(e) {\r
-                               var o;\r
+                                               // Process attributes if validation is enabled\r
+                                               if (validate) {\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
-                               if (!c)\r
-                                       return 0;\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 (this.hasClass(e, c))\r
-                                       return e.className;\r
+                                                                       if (!(name in attrList.map)) {\r
+                                                                               attrValue = attr.value;\r
 \r
-                               o = this.removeClass(e, c);\r
+                                                                               if (attrValue === '{$uid}')\r
+                                                                                       attrValue = 'mce_' + idCount++;\r
 \r
-                               return e.className = (o != '' ? (o + ' ') : '') + c;\r
-                       });\r
-               },\r
+                                                                               attrList.map[name] = attrValue;\r
+                                                                               attrList.push({name: name, value: attrValue});\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
 \r
-               removeClass : function(e, c) {\r
-                       var t = this, re;\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
-                       return t.run(e, function(e) {\r
-                               var v;\r
+                                                               // None of the required attributes where found\r
+                                                               if (i === -1)\r
+                                                                       isValidElement = false;\r
+                                                       }\r
 \r
-                               if (t.hasClass(e, c)) {\r
-                                       if (!re)\r
-                                               re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");\r
+                                                       // Invalidate element if it's marked as bogus\r
+                                                       if (attrList.map['data-mce-bogus'])\r
+                                                               isValidElement = false;\r
+                                               }\r
 \r
-                                       v = e.className.replace(re, ' ');\r
-                                       v = tinymce.trim(v != ' ' ? v : '');\r
+                                               if (isValidElement)\r
+                                                       self.start(value, attrList, isShortEnded);\r
+                                       } else\r
+                                               isValidElement = false;\r
 \r
-                                       e.className = v;\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
-                                       // Empty class attr\r
-                                       if (!v) {\r
-                                               e.removeAttribute('class');\r
-                                               e.removeAttribute('className');\r
+                                               if (matches = endRegExp.exec(html)) {\r
+                                                       if (isValidElement)\r
+                                                               text = html.substr(index, matches.index - index);\r
+\r
+                                                       index = matches.index + matches[0].length;\r
+                                               } else {\r
+                                                       text = html.substr(index);\r
+                                                       index = html.length;\r
+                                               }\r
+\r
+                                               if (isValidElement && text.length > 0)\r
+                                                       self.text(text, true);\r
+\r
+                                               if (isValidElement)\r
+                                                       self.end(value);\r
+\r
+                                               tokenRegExp.lastIndex = index;\r
+                                               continue;\r
                                        }\r
 \r
-                                       return v;\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
-                               return e.className;\r
-                       });\r
-               },\r
+                               index = matches.index + matches[0].length;\r
+                       }\r
 \r
-               hasClass : function(n, c) {\r
-                       n = this.get(n);\r
+                       // Text\r
+                       if (index < html.length)\r
+                               self.text(decode(html.substr(index)));\r
 \r
-                       if (!n || !c)\r
-                               return false;\r
+                       // Close any open elements\r
+                       for (i = stack.length - 1; i >= 0; i--) {\r
+                               value = stack[i];\r
 \r
-                       return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;\r
-               },\r
+                               if (value.valid)\r
+                                       self.end(value.name);\r
+                       }\r
+               };\r
+       }\r
+})(tinymce);\r
 \r
-               show : function(e) {\r
-                       return this.setStyle(e, 'display', 'block');\r
-               },\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
-               hide : function(e) {\r
-                       return this.setStyle(e, 'display', 'none');\r
-               },\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
-               isHidden : function(e) {\r
-                       e = this.get(e);\r
+               // Walk into nodes if it has a start\r
+               if (node[startName])\r
+                       return node[startName];\r
 \r
-                       return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';\r
-               },\r
+               // Return the sibling if it has one\r
+               if (node !== root_node) {\r
+                       sibling = node[siblingName];\r
 \r
-               uniqueId : function(p) {\r
-                       return (!p ? 'mce_' : p) + (this.counter++);\r
-               },\r
+                       if (sibling)\r
+                               return sibling;\r
 \r
-               setHTML : function(e, h) {\r
-                       var t = this;\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
-                       return this.run(e, function(e) {\r
-                               var x, i, nl, n, p, x;\r
+                               if (sibling)\r
+                                       return sibling;\r
+                       }\r
+               }\r
+       };\r
 \r
-                               h = t.processHTML(h);\r
+       function Node(name, type) {\r
+               this.name = name;\r
+               this.type = type;\r
 \r
-                               if (isIE) {\r
-                                       function set() {\r
-                                               // Remove all child nodes\r
-                                               while (e.firstChild)\r
-                                                       e.firstChild.removeNode();\r
+               if (type === 1) {\r
+                       this.attributes = [];\r
+                       this.attributes.map = {};\r
+               }\r
+       }\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
+       tinymce.extend(Node.prototype, {\r
+               replace : function(node) {\r
+                       var self = this;\r
+\r
+                       if (node.parent)\r
+                               node.remove();\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
+                       self.insert(node, self);\r
+                       self.remove();\r
 \r
-                                       set();\r
+                       return self;\r
+               },\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
+               attr : function(name, value) {\r
+                       var self = this, attrs, i, undef;\r
 \r
-                                                       if (!n.hasChildNodes()) {\r
-                                                               if (!n._mce_keep) {\r
-                                                                       x = 1; // Is broken\r
-                                                                       break;\r
-                                                               }\r
+                       if (typeof name !== "string") {\r
+                               for (i in name)\r
+                                       self.attr(i, name[i]);\r
+\r
+                               return self;\r
+                       }\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
-                                                               n.removeAttribute('_mce_keep');\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
 \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
+                                               return self;\r
+                                       }\r
 \r
-                                               // Set the new HTML with DIVs\r
-                                               set();\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
+                                               attrs.push({name: name, value: value});\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
+                                       attrs.map[name] = value;\r
 \r
-                                                               // Is it a temp div\r
-                                                               if (n._mce_tmp) {\r
-                                                                       // Create new paragraph\r
-                                                                       p = t.doc.createElement('p');\r
+                                       return self;\r
+                               } else {\r
+                                       return attrs.map[name];\r
+                               }\r
+                       }\r
+               },\r
 \r
-                                                                       // Copy all attributes\r
-                                                                       n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {\r
-                                                                               var v;\r
+               clone : function() {\r
+                       var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;\r
 \r
-                                                                               if (b !== '_mce_tmp') {\r
-                                                                                       v = n.getAttribute(b);\r
+                       // Clone element attributes\r
+                       if (selfAttrs = self.attributes) {\r
+                               cloneAttrs = [];\r
+                               cloneAttrs.map = {};\r
 \r
-                                                                                       if (!v && b === 'class')\r
-                                                                                               v = n.className;\r
+                               for (i = 0, l = selfAttrs.length; i < l; i++) {\r
+                                       selfAttr = selfAttrs[i];\r
 \r
-                                                                                       p.setAttribute(b, v);\r
-                                                                               }\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
-                                                                       // Append all children to new paragraph\r
-                                                                       for (x = 0; x<n.childNodes.length; x++)\r
-                                                                               p.appendChild(n.childNodes[x].cloneNode(true));\r
+                               clone.attributes = cloneAttrs;\r
+                       }\r
 \r
-                                                                       // Replace div with new paragraph\r
-                                                                       n.swapNode(p);\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               } else\r
-                                       e.innerHTML = h;\r
+                       clone.value = self.value;\r
+                       clone.shortEnded = self.shortEnded;\r
 \r
-                               return h;\r
-                       });\r
+                       return clone;\r
                },\r
 \r
-               processHTML : function(h) {\r
-                       var t = this, s = t.settings, codeBlocks = [];\r
+               wrap : function(wrapper) {\r
+                       var self = this;\r
 \r
-                       if (!s.process_html)\r
-                               return h;\r
+                       self.parent.insert(wrapper, self);\r
+                       wrapper.append(self);\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
+                       return self;\r
+               },\r
+\r
+               unwrap : function() {\r
+                       var self = this, node, next;\r
+\r
+                       for (node = self.firstChild; node; ) {\r
+                               next = node.next;\r
+                               self.insert(node, self, true);\r
+                               node = next;\r
                        }\r
 \r
-                       // Fix some issues\r
-                       h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open\r
+                       self.remove();\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
+               remove : function() {\r
+                       var self = this, parent = self.parent, next = self.next, prev = self.prev;\r
 \r
-                                               return s;\r
-                                       };\r
+                       if (parent) {\r
+                               if (parent.firstChild === self) {\r
+                                       parent.firstChild = next;\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 (next)\r
+                                               next.prev = null;\r
+                               } else {\r
+                                       prev.next = next;\r
+                               }\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
+                               if (parent.lastChild === self) {\r
+                                       parent.lastChild = prev;\r
 \r
-                                                       return '_mce_src="' + url + '"';\r
-                                               });\r
+                                       if (prev)\r
+                                               prev.next = null;\r
+                               } else {\r
+                                       next.prev = prev;\r
+                               }\r
 \r
-                                               // Wrap text contents\r
-                                               if (tinymce.trim(text)) {\r
-                                                       codeBlocks.push(trim(text));\r
-                                                       text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n// -->';\r
-                                               }\r
+                               self.parent = self.next = self.prev = null;\r
+                       }\r
 \r
-                                               return '<mce:script' + attribs + '>' + text + '</mce:script>';\r
-                                       });\r
+                       return self;\r
+               },\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
+               append : function(node) {\r
+                       var self = this, last;\r
 \r
-                                               return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' _mce_bogus="1">' + text + '</style>';\r
-                                       });\r
+                       if (node.parent)\r
+                               node.remove();\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
-                               }\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
-                               h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');\r
+                       node.parent = self;\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
+                       return node;\r
+               },\r
 \r
-                                                       name = name.toLowerCase();\r
-                                                       value = value || val2 || val3 || "";\r
+               insert : function(node, ref_node, before) {\r
+                       var parent;\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
+                       if (node.parent)\r
+                               node.remove();\r
 \r
-                                                               return name + '="' + name + '"';\r
-                                                       }\r
+                       parent = ref_node.parent || this;\r
 \r
-                                                       // Is attribute one that needs special treatment\r
-                                                       if (mceAttribs[name] && attrs.indexOf('_mce_' + name) == -1) {\r
-                                                               mceValue = t.decode(value);\r
+                       if (before) {\r
+                               if (ref_node === parent.firstChild)\r
+                                       parent.firstChild = node;\r
+                               else\r
+                                       ref_node.prev.next = node;\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
+                               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
-                                                               // Process styles lowercases them and compresses them\r
-                                                               if (name == 'style')\r
-                                                                       mceValue = t.serializeStyle(t.parseStyle(mceValue), name);\r
+                               node.next = ref_node.next;\r
+                               node.prev = ref_node;\r
+                               ref_node.next = node;\r
+                       }\r
 \r
-                                                               return name + '="' + value + '"' + ' _mce_' + name + '="' + t.encode(mceValue) + '"';\r
-                                                       }\r
+                       node.parent = parent;\r
 \r
-                                                       return match;\r
-                                               }) + end + '>';\r
-                                       });\r
-                               };\r
+                       return node;\r
+               },\r
 \r
-                               h = processTags(h);\r
+               getAll : function(name) {\r
+                       var self = this, node, collection = [];\r
 \r
-                               // Restore script blocks\r
-                               h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) {\r
-                                       return codeBlocks[idx];\r
-                               });\r
+                       for (node = self.firstChild; node; node = walk(node, self)) {\r
+                               if (node.name === name)\r
+                                       collection.push(node);\r
                        }\r
 \r
-                       return h;\r
+                       return collection;\r
                },\r
 \r
-               getOuterHTML : function(e) {\r
-                       var d;\r
+               empty : function() {\r
+                       var self = this, nodes, i, node;\r
 \r
-                       e = this.get(e);\r
+                       // Remove all children\r
+                       if (self.firstChild) {\r
+                               nodes = [];\r
 \r
-                       if (!e)\r
-                               return null;\r
+                               // Collect the children\r
+                               for (node = self.firstChild; node; node = walk(node, self))\r
+                                       nodes.push(node);\r
 \r
-                       if (e.outerHTML !== undefined)\r
-                               return e.outerHTML;\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
-                       d = (e.ownerDocument || this.doc).createElement("body");\r
-                       d.appendChild(e.cloneNode(true));\r
+                       self.firstChild = self.lastChild = null;\r
 \r
-                       return d.innerHTML;\r
+                       return self;\r
                },\r
 \r
-               setOuterHTML : function(e, h, d) {\r
-                       var t = this;\r
+               isEmpty : function(elements) {\r
+                       var self = this, node = self.firstChild, i, name;\r
 \r
-                       function setHTML(e, h, d) {\r
-                               var n, tp;\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
-                               tp = d.createElement("body");\r
-                               tp.innerHTML = h;\r
+                                               // Keep empty elements like <img />\r
+                                               if (elements[node.name])\r
+                                                       return false;\r
 \r
-                               n = tp.lastChild;\r
-                               while (n) {\r
-                                       t.insertAfter(n.cloneNode(true), e);\r
-                                       n = n.previousSibling;\r
-                               }\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
-                               t.remove(e);\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
-                       return this.run(e, function(e) {\r
-                               e = t.get(e);\r
+                       return true;\r
+               },\r
 \r
-                               // Only set HTML on elements\r
-                               if (e.nodeType == 1) {\r
-                                       d = d || e.ownerDocument || t.doc;\r
+               walk : function(prev) {\r
+                       return walk(this, null, prev);\r
+               }\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
-                                               }\r
-                                       } else\r
-                                               setHTML(e, h, d);\r
-                               }\r
-                       });\r
-               },\r
+       tinymce.extend(Node, {\r
+               create : function(name, attrs) {\r
+                       var node, attrName;\r
 \r
-               decode : function(s) {\r
-                       var e, n, v;\r
+                       // Create node\r
+                       node = new Node(name, typeLookup[name] || 1);\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
+                       // Add attributes if needed\r
+                       if (attrs) {\r
+                               for (attrName in attrs)\r
+                                       node.attr(attrName, attrs[attrName]);\r
+                       }\r
 \r
-                               if (n) {\r
-                                       do {\r
-                                               v += n.nodeValue;\r
-                                       } while (n = n.nextSibling);\r
-                               }\r
+                       return node;\r
+               }\r
+       });\r
 \r
-                               return v || s;\r
-                       }\r
+       tinymce.html.Node = Node;\r
+})(tinymce);\r
 \r
-                       return s;\r
-               },\r
+(function(tinymce) {\r
+       var Node = tinymce.html.Node;\r
 \r
-               encode : function(str) {\r
-                       return ('' + str).replace(encodeCharsRe, function(chr) {\r
-                               return encodedChars[chr];\r
-                       });\r
-               },\r
+       tinymce.html.DomParser = function(settings, schema) {\r
+               var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};\r
 \r
-               insertAfter : function(node, reference_node) {\r
-                       reference_node = this.get(reference_node);\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
-                       return this.run(node, function(node) {\r
-                               var parent, nextSibling;\r
+               function fixInvalidChildren(nodes) {\r
+                       var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,\r
+                               childClone, nonEmptyElements, nonSplitableElements, sibling, nextNode;\r
 \r
-                               parent = reference_node.parentNode;\r
-                               nextSibling = reference_node.nextSibling;\r
+                       nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');\r
+                       nonEmptyElements = schema.getNonEmptyElements();\r
 \r
-                               if (nextSibling)\r
-                                       parent.insertBefore(node, nextSibling);\r
-                               else\r
-                                       parent.appendChild(node);\r
+                       for (ni = 0; ni < nodes.length; ni++) {\r
+                               node = nodes[ni];\r
 \r
-                               return node;\r
-                       });\r
-               },\r
+                               // Already removed\r
+                               if (!node.parent)\r
+                                       continue;\r
 \r
-               isBlock : function(n) {\r
-                       if (n.nodeType && n.nodeType !== 1)\r
-                               return false;\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
-                       n = n.nodeName || n;\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 blockRe.test(n);\r
-               },\r
+                                       // Clone the related parent and insert that after the moved node\r
+                                       newParent = currentNode = self.filterNode(parents[0].clone());\r
 \r
-               replace : function(n, o, k) {\r
-                       var t = this;\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
-                       if (is(o, 'array'))\r
-                               n = n.cloneNode(true);\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
-                       return t.run(o, function(o) {\r
-                               if (k) {\r
-                                       each(tinymce.grep(o.childNodes), function(c) {\r
-                                               n.appendChild(c);\r
-                                       });\r
-                               }\r
+                                               currentNode = tempNode;\r
+                                       }\r
 \r
-                               return o.parentNode.replaceChild(n, o);\r
-                       });\r
-               },\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
-               rename : function(elm, name) {\r
-                       var t = this, newElm;\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
-                       if (elm.nodeName != name.toUpperCase()) {\r
-                               // Rename block element\r
-                               newElm = t.create(name);\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
-                               // 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
+                                               node.wrap(self.filterNode(new Node('ul', 1)));\r
+                                               continue;\r
+                                       }\r
 \r
-                               // Replace block\r
-                               t.replace(newElm, elm, 1);\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
-                       return newElm || elm;\r
-               },\r
+               self.filterNode = function(node) {\r
+                       var i, name, list;\r
 \r
-               findCommonAncestor : function(a, b) {\r
-                       var ps = a, pe;\r
+                       // Run element filters\r
+                       if (name in nodeFilters) {\r
+                               list = matchedNodes[name];\r
 \r
-                       while (ps) {\r
-                               pe = b;\r
+                               if (list)\r
+                                       list.push(node);\r
+                               else\r
+                                       matchedNodes[name] = [node];\r
+                       }\r
 \r
-                               while (pe && ps != pe)\r
-                                       pe = pe.parentNode;\r
+                       // Run attribute filters\r
+                       i = attributeFilters.length;\r
+                       while (i--) {\r
+                               name = attributeFilters[i].name;\r
 \r
-                               if (ps == pe)\r
-                                       break;\r
+                               if (name in node.attributes.map) {\r
+                                       list = matchedAttributes[name];\r
 \r
-                               ps = ps.parentNode;\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedAttributes[name] = [node];\r
+                               }\r
                        }\r
 \r
-                       if (!ps && a.ownerDocument)\r
-                               return a.ownerDocument.documentElement;\r
-\r
-                       return ps;\r
-               },\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
+               self.addNodeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var list = nodeFilters[name];\r
 \r
-                       function hex(s) {\r
-                               s = parseInt(s).toString(16);\r
+                               if (!list)\r
+                                       nodeFilters[name] = list = [];\r
 \r
-                               return s.length > 1 ? s : '0' + s; // 0 -> 00\r
-                       };\r
+                               list.push(callback);\r
+                       });\r
+               };\r
 \r
-                       if (c) {\r
-                               s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);\r
+               self.addAttributeFilter = function(name, callback) {\r
+                       tinymce.each(tinymce.explode(name), function(name) {\r
+                               var i;\r
 \r
-                               return s;\r
-                       }\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
-                       return s;\r
-               },\r
+                               attributeFilters.push({name: name, callbacks: [callback]});\r
+                       });\r
+               };\r
 \r
-               getClasses : function() {\r
-                       var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;\r
+               self.parse = function(html, args) {\r
+                       var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate,\r
+                               blockElements, startWhiteSpaceRegExp, invalidChildren = [],\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
-                       if (t.classes)\r
-                               return t.classes;\r
+                                       node = next;\r
+                               };\r
+                       };\r
 \r
-                       function addClasses(s) {\r
-                               // IE style imports\r
-                               each(s.imports, function(r) {\r
-                                       addClasses(r);\r
-                               });\r
+                       function createNode(name, type) {\r
+                               var node = new Node(name, type), list;\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
+                               if (name in nodeFilters) {\r
+                                       list = matchedNodes[name];\r
 \r
-                                                                       // Is internal or it doesn't contain a class\r
-                                                                       if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))\r
-                                                                               return;\r
+                                       if (list)\r
+                                               list.push(node);\r
+                                       else\r
+                                               matchedNodes[name] = [node];\r
+                               }\r
 \r
-                                                                       // Remove everything but class name\r
-                                                                       ov = v;\r
-                                                                       v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1');\r
+                               return node;\r
+                       };\r
 \r
-                                                                       // Filter classes\r
-                                                                       if (f && !(v = f(v, ov)))\r
-                                                                               return;\r
+                       function removeWhitespaceBefore(node) {\r
+                               var textNode, textVal, sibling;\r
 \r
-                                                                       if (!lo[v]) {\r
-                                                                               cl.push({'class' : v});\r
-                                                                               lo[v] = 1;\r
-                                                                       }\r
-                                                               });\r
-                                                       }\r
-                                                       break;\r
+                               for (textNode = node.prev; textNode && textNode.type === 3; ) {\r
+                                       textVal = textNode.value.replace(endWhiteSpaceRegExp, '');\r
 \r
-                                               // Import\r
-                                               case 3:\r
-                                                       addClasses(r.styleSheet);\r
-                                                       break;\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
 \r
-                       try {\r
-                               each(t.doc.styleSheets, addClasses);\r
-                       } catch (ex) {\r
-                               // Ignore\r
-                       }\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
-                       if (cl.length > 0)\r
-                               t.classes = cl;\r
+                               cdata: function(text) {\r
+                                       node.append(createNode('#cdata', 4)).value = text;\r
+                               },\r
 \r
-                       return cl;\r
-               },\r
+                               text: function(text, raw) {\r
+                                       var textNode;\r
 \r
-               run : function(e, f, s) {\r
-                       var t = this, o;\r
+                                       // Trim all redundant whitespace on non white space elements\r
+                                       if (!whiteSpaceElements[node.name]) {\r
+                                               text = text.replace(allWhiteSpaceRegExp, ' ');\r
 \r
-                       if (t.doc && typeof(e) === 'string')\r
-                               e = t.get(e);\r
+                                               if (node.lastChild && blockElements[node.lastChild.name])\r
+                                                       text = text.replace(startWhiteSpaceRegExp, '');\r
+                                       }\r
 \r
-                       if (!e)\r
-                               return false;\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
-                       s = s || this;\r
-                       if (!e.nodeType && (e.length || e.length === 0)) {\r
-                               o = [];\r
+                               comment: function(text) {\r
+                                       node.append(createNode('#comment', 8)).value = text;\r
+                               },\r
 \r
-                               each(e, function(e, i) {\r
-                                       if (e) {\r
-                                               if (typeof(e) == 'string')\r
-                                                       e = t.doc.getElementById(e);\r
+                               pi: function(name, text) {\r
+                                       node.append(createNode(name, 7)).value = text;\r
+                                       removeWhitespaceBefore(node);\r
+                               },\r
 \r
-                                               o.push(f.call(s, e, i));\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
-                               return o;\r
-                       }\r
+                               start: function(name, attrs, empty) {\r
+                                       var newNode, attrFiltersLen, elementRule, textNode, attrName, text, sibling, parent;\r
 \r
-                       return f.call(s, e);\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
-               getAttribs : function(n) {\r
-                       var o;\r
+                                               node.append(newNode);\r
 \r
-                       n = this.get(n);\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
-                       if (!n)\r
-                               return [];\r
+                                               attrFiltersLen = attributeFilters.length;\r
+                                               while (attrFiltersLen--) {\r
+                                                       attrName = attributeFilters[attrFiltersLen].name;\r
 \r
-                       if (isIE) {\r
-                               o = [];\r
+                                                       if (attrName in attrs.map) {\r
+                                                               list = matchedAttributes[attrName];\r
 \r
-                               // Object will throw exception in IE\r
-                               if (n.nodeName == 'OBJECT')\r
-                                       return n.attributes;\r
+                                                               if (list)\r
+                                                                       list.push(newNode);\r
+                                                               else\r
+                                                                       matchedAttributes[attrName] = [newNode];\r
+                                                       }\r
+                                               }\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
+                                               // Trim whitespace before block\r
+                                               if (blockElements[name])\r
+                                                       removeWhitespaceBefore(newNode);\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
+                                               // Change current node if the element wasn't empty i.e not <br /> or <img />\r
+                                               if (!empty)\r
+                                                       node = newNode;\r
+                                       }\r
+                               },\r
 \r
-                               return o;\r
-                       }\r
+                               end: function(name) {\r
+                                       var textNode, elementRule, text, sibling, tempNode;\r
 \r
-                       return n.attributes;\r
-               },\r
+                                       elementRule = validate ? schema.getElementRule(name) : {};\r
+                                       if (elementRule) {\r
+                                               if (blockElements[name]) {\r
+                                                       if (!whiteSpaceElements[node.name]) {\r
+                                                               // Trim whitespace at beginning of block\r
+                                                               for (textNode = node.firstChild; textNode && textNode.type === 3; ) {\r
+                                                                       text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
 \r
-               destroy : function(s) {\r
-                       var t = this;\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
-                       if (t.events)\r
-                               t.events.destroy();\r
+                                                               // Trim whitespace at end of block\r
+                                                               for (textNode = node.lastChild; textNode && textNode.type === 3; ) {\r
+                                                                       text = textNode.value.replace(endWhiteSpaceRegExp, '');\r
 \r
-                       t.win = t.doc = t.root = t.events = null;\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
-                       // Manual destroy then remove unload handler\r
-                       if (!s)\r
-                               tinymce.removeUnload(t.destroy);\r
-               },\r
+                                                       // Trim start white space\r
+                                                       textNode = node.prev;\r
+                                                       if (textNode && textNode.type === 3) {\r
+                                                               text = textNode.value.replace(startWhiteSpaceRegExp, '');\r
 \r
-               createRng : function() {\r
-                       var d = this.doc;\r
+                                                               if (text.length > 0)\r
+                                                                       textNode.value = text;\r
+                                                               else\r
+                                                                       textNode.remove();\r
+                                                       }\r
+                                               }\r
 \r
-                       return d.createRange ? d.createRange() : new tinymce.dom.Range(this);\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
-               nodeIndex : function(node, normalized) {\r
-                       var idx = 0, lastNodeType, lastNode, nodeType;\r
+                                               node = node.parent;\r
+                                       }\r
+                               }\r
+                       }, schema);\r
 \r
-                       if (node) {\r
-                               for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {\r
-                                       nodeType = node.nodeType;\r
+                       rootNode = node = new Node(args.context || settings.root_name, 11);\r
 \r
-                                       // Normalize text nodes\r
-                                       if (normalized && nodeType == 3) {\r
-                                               if (nodeType == lastNodeType || !node.nodeValue.length)\r
-                                                       continue;\r
-                                       }\r
+                       parser.parse(html);\r
 \r
-                                       idx++;\r
-                                       lastNodeType = nodeType;\r
-                               }\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
-                       return idx;\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
-               split : function(pe, e, re) {\r
-                       var t = this, r = t.createRng(), bef, aft, pa;\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
-                       // 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
+                                       // Remove already removed children\r
+                                       fi = nodes.length;\r
+                                       while (fi--) {\r
+                                               if (!nodes[fi].parent)\r
+                                                       nodes.splice(fi, 1);\r
+                                       }\r
 \r
-                               if (node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark')\r
-                                       return;\r
+                                       for (i = 0, l = list.length; i < l; i++)\r
+                                               list[i](nodes, name, args);\r
+                               }\r
 \r
-                               for (i = children.length - 1; i >= 0; i--)\r
-                                       trim(children[i]);\r
+                               // Run attribute filters\r
+                               for (i = 0, l = attributeFilters.length; i < l; i++) {\r
+                                       list = attributeFilters[i];\r
 \r
-                               if (node.nodeType != 9) {\r
-                                       // Keep non whitespace text nodes\r
-                                       if (node.nodeType == 3 && node.nodeValue.length > 0)\r
-                                               return;\r
+                                       if (list.name in matchedAttributes) {\r
+                                               nodes = matchedAttributes[list.name];\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
+                                               // Remove already removed children\r
+                                               fi = nodes.length;\r
+                                               while (fi--) {\r
+                                                       if (!nodes[fi].parent)\r
+                                                               nodes.splice(fi, 1);\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
+                                               for (fi = 0, fl = list.callbacks.length; fi < fl; fi++)\r
+                                                       list.callbacks[fi](nodes, list.name, args);\r
                                        }\r
+                               }\r
+                       }\r
 \r
-                                       t.remove(node);\r
+                       return rootNode;\r
+               };\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
+                                                       prev = prev.prev;\r
+                                               }\r
+\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.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
+               }\r
+       }\r
+})(tinymce);\r
 \r
-                               return node;\r
-                       };\r
+tinymce.html.Writer = function(settings) {\r
+       var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;\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
+       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
-                               // 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
+       return {\r
+               start: function(name, attrs, empty) {\r
+                       var i, l, attr, value;\r
 \r
-                               // Insert before chunk\r
-                               pa = pe.parentNode;\r
-                               pa.insertBefore(trim(bef), pe);\r
+                       if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-                               // Insert middle chunk\r
-                               if (re)\r
-                                       pa.replaceChild(re, e);\r
-                               else\r
-                                       pa.insertBefore(e, pe);\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
 \r
-                               // Insert after chunk\r
-                               pa.insertBefore(trim(aft), pe);\r
-                               t.remove(pe);\r
+                       html.push('<', name);\r
 \r
-                               return re || e;\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
 \r
-               bind : function(target, name, func, scope) {\r
-                       var t = this;\r
+                       if (!empty || htmlOutput)\r
+                               html[html.length] = '>';\r
+                       else\r
+                               html[html.length] = ' />';\r
 \r
-                       if (!t.events)\r
-                               t.events = new tinymce.dom.EventUtils();\r
+                       if (empty && indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-                       return t.events.add(target, name, func, scope || this);\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
                },\r
 \r
-               unbind : function(target, name, func) {\r
-                       var t = this;\r
+               end: function(name) {\r
+                       var value;\r
 \r
-                       if (!t.events)\r
-                               t.events = new tinymce.dom.EventUtils();\r
+                       /*if (indent && indentBefore[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
 \r
-                       return t.events.remove(target, name, func);\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }*/\r
+\r
+                       html.push('</', name, '>');\r
+\r
+                       if (indent && indentAfter[name] && html.length > 0) {\r
+                               value = html[html.length - 1];\r
+\r
+                               if (value.length > 0 && value !== '\n')\r
+                                       html.push('\n');\r
+                       }\r
                },\r
 \r
+               text: function(text, raw) {\r
+                       if (text.length > 0)\r
+                               html[html.length] = raw ? text : encode(text);\r
+               },\r
 \r
-               _findSib : function(node, selector, name) {\r
-                       var t = this, f = selector;\r
+               cdata: function(text) {\r
+                       html.push('<![CDATA[', text, ']]>');\r
+               },\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
+               comment: function(text) {\r
+                       html.push('<!--', text, '-->');\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
+               pi: function(name, text) {\r
+                       if (text)\r
+                               html.push('<?', name, ' ', text, '?>');\r
+                       else\r
+                               html.push('<?', name, '?>');\r
 \r
-                       return null;\r
+                       if (indent)\r
+                               html.push('\n');\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
+               doctype: function(text) {\r
+                       html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');\r
+               },\r
+\r
+               reset: function() {\r
+                       html.length = 0;\r
+               },\r
+\r
+               getContent: function() {\r
+                       return html.join('').replace(/\n$/, '');\r
                }\r
+       };\r
+};\r
 \r
-               /*\r
-               walk : function(n, f, s) {\r
-                       var d = this.doc, w;\r
+(function(tinymce) {\r
+       tinymce.html.Serializer = function(settings, schema) {\r
+               var self = this, writer = new tinymce.html.Writer(settings);\r
 \r
-                       if (d.createTreeWalker) {\r
-                               w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);\r
+               settings = settings || {};\r
+               settings.validate = "validate" in settings ? settings.validate : true;\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
+               self.schema = schema = schema || new tinymce.html.Schema();\r
+               self.writer = writer;\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
+               self.serialize = function(node) {\r
+                       var handlers, validate;\r
 \r
-                       if (c) {\r
-                               // #FFF -> #FFFFFF\r
-                               if (!is(c[3]))\r
-                                       c[3] = c[2] = c[1];\r
+                       validate = settings.validate;\r
 \r
-                               return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";\r
-                       }\r
+                       handlers = {\r
+                               // #text\r
+                               3: function(node, raw) {\r
+                                       writer.text(node.value, node.raw);\r
+                               },\r
 \r
-                       return s;\r
-               }\r
-               */\r
-       });\r
+                               // #comment\r
+                               8: function(node) {\r
+                                       writer.comment(node.value);\r
+                               },\r
 \r
-       tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});\r
-})(tinymce);\r
+                               // Processing instruction\r
+                               7: function(node) {\r
+                                       writer.pi(node.name, node.value);\r
+                               },\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
+                               // Doctype\r
+                               10: function(node) {\r
+                                       writer.doctype(node.value);\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
+                               // CDATA\r
+                               4: function(node) {\r
+                                       writer.cdata(node.value);\r
+                               },\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
+                               // 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
-                       // 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
+                       writer.reset();\r
 \r
-               function setStart(n, o) {\r
-                       _setEndPoint(TRUE, n, o);\r
-               };\r
+                       function walk(node) {\r
+                               var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;\r
 \r
-               function setEnd(n, o) {\r
-                       _setEndPoint(FALSE, n, o);\r
-               };\r
+                               if (!handler) {\r
+                                       name = node.name;\r
+                                       isEmpty = node.shortEnded;\r
+                                       attrs = node.attributes;\r
 \r
-               function setStartBefore(n) {\r
-                       setStart(n.parentNode, nodeIndex(n));\r
-               };\r
+                                       // Sort attributes\r
+                                       if (validate && attrs && attrs.length > 1) {\r
+                                               sortedAttrs = [];\r
+                                               sortedAttrs.map = {};\r
 \r
-               function setStartAfter(n) {\r
-                       setStart(n.parentNode, nodeIndex(n) + 1);\r
-               };\r
+                                               elementRule = schema.getElementRule(node.name);\r
+                                               for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {\r
+                                                       attrName = elementRule.attributesOrder[i];\r
 \r
-               function setEndBefore(n) {\r
-                       setEnd(n.parentNode, nodeIndex(n));\r
-               };\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
-               function setEndAfter(n) {\r
-                       setEnd(n.parentNode, nodeIndex(n) + 1);\r
-               };\r
+                                               for (i = 0, l = attrs.length; i < l; i++) {\r
+                                                       attrName = attrs[i].name;\r
 \r
-               function collapse(ts) {\r
-                       if (ts) {\r
-                               t[END_CONTAINER] = t[START_CONTAINER];\r
-                               t[END_OFFSET] = t[START_OFFSET];\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
+                                               attrs = sortedAttrs;\r
+                                       }\r
+\r
+                                       writer.start(node.name, attrs, isEmpty);\r
+\r
+                                       if (!isEmpty) {\r
+                                               if ((node = node.firstChild)) {\r
+                                                       do {\r
+                                                               walk(node);\r
+                                                       } while (node = node.next);\r
+                                               }\r
+\r
+                                               writer.end(name);\r
+                                       }\r
+                               } else\r
+                                       handler(node);\r
+                       }\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 writer.getContent();\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
+               Entities = tinymce.html.Entities,\r
+               simpleSelectorRe = /^([a-z0-9],?)+$/i,\r
+               blockElementsMap = tinymce.html.Schema.blockElementsMap,\r
+               whiteSpaceRegExp = /^[ \t\r\n]*$/;\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
+               DOMUtils : function(d, s) {\r
+                       var t = this, globalStyle, name;\r
+\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
+                       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
+                       if (isIE && s.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
+                                       d.createElement(name);\r
+                               });\r
+\r
+                               // Create all custom elements\r
+                               for (name in s.schema.getCustomElements()) {\r
+                                       d.createElement(name);\r
+                               }\r
+                       }\r
+\r
+                       tinymce.addUnload(t.destroy, t);\r
+               },\r
+\r
+               getRoot : function() {\r
+                       var t = this, s = t.settings;\r
+\r
+                       return (s && t.get(s.root_element)) || t.doc.body;\r
+               },\r
+\r
+               getViewPort : function(w) {\r
+                       var d, b;\r
+\r
+                       w = !w ? this.win : w;\r
+                       d = w.document;\r
+                       b = this.boxModel ? d.documentElement : d.body;\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
+\r
+               getRect : function(e) {\r
+                       var p, t = this, sr;\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
+               getSize : function(e) {\r
+                       var t = this, w, h;\r
+\r
+                       e = t.get(e);\r
+                       w = t.getStyle(e, 'width');\r
+                       h = t.getStyle(e, 'height');\r
+\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (w.indexOf('px') === -1)\r
+                               w = 0;\r
+\r
+                       // Non pixel value, then force offset/clientWidth\r
+                       if (h.indexOf('px') === -1)\r
+                               h = 0;\r
+\r
+                       return {\r
+                               w : parseInt(w) || e.offsetWidth || e.clientWidth,\r
+                               h : parseInt(h) || e.offsetHeight || e.clientHeight\r
+                       };\r
+               },\r
+\r
+               getParent : function(n, f, r) {\r
+                       return this.getParents(n, f, r, false);\r
+               },\r
+\r
+               getParents : function(n, f, r, c) {\r
+                       var t = this, na, se = t.settings, o = [];\r
+\r
+                       n = t.get(n);\r
+                       c = c === undefined;\r
+\r
+                       if (se.strict_root)\r
+                               r = r || t.getRoot();\r
+\r
+                       // Wrap node name as func\r
+                       if (is(f, 'string')) {\r
+                               na = f;\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
+                       }\r
+\r
+                       while (n) {\r
+                               if (n == r || !n.nodeType || n.nodeType === 9)\r
+                                       break;\r
+\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
+                       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
+\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
+\r
+                       return e;\r
+               },\r
+\r
+               getNext : function(node, selector) {\r
+                       return this._findSib(node, selector, 'nextSibling');\r
+               },\r
+\r
+               getPrev : function(node, selector) {\r
+                       return this._findSib(node, selector, 'previousSibling');\r
+               },\r
+\r
+\r
+               select : function(pa, s) {\r
+                       var t = this;\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
+\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
+                       return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;\r
+               },\r
+\r
+\r
+               add : function(p, n, a, h, c) {\r
+                       var t = this;\r
+\r
+                       return this.run(p, function(p) {\r
+                               var e, k;\r
+\r
+                               e = is(n, 'string') ? t.doc.createElement(n) : n;\r
+                               t.setAttribs(e, a);\r
+\r
+                               if (h) {\r
+                                       if (h.nodeType)\r
+                                               e.appendChild(h);\r
+                                       else\r
+                                               t.setHTML(e, h);\r
+                               }\r
+\r
+                               return !c ? p.appendChild(e) : e;\r
+                       });\r
+               },\r
+\r
+               create : function(n, a, h) {\r
+                       return this.add(this.doc.createElement(n), n, a, h, 1);\r
+               },\r
+\r
+               createHTML : function(n, a, h) {\r
+                       var o = '', t = this, k;\r
+\r
+                       o += '<' + n;\r
+\r
+                       for (k in a) {\r
+                               if (a.hasOwnProperty(k))\r
+                                       o += ' ' + k + '="' + t.encode(a[k]) + '"';\r
+                       }\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
+                       return o + ' />';\r
+               },\r
+\r
+               remove : function(node, keep_children) {\r
+                       return this.run(node, function(node) {\r
+                               var child, parent = node.parentNode;\r
+\r
+                               if (!parent)\r
+                                       return null;\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
+                               return parent.removeChild(node);\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
+\r
+                               s = e.style;\r
+\r
+                               // Camelcase it, if needed\r
+                               na = na.replace(/-(\D)/g, function(a, b){\r
+                                       return b.toUpperCase();\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
+\r
+                               switch (na) {\r
+                                       case 'opacity':\r
+                                               // IE specific opacity\r
+                                               if (isIE) {\r
+                                                       s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";\r
+\r
+                                                       if (!n.currentStyle || !n.currentStyle.hasLayout)\r
+                                                               s.display = 'inline-block';\r
+                                               }\r
+\r
+                                               // Fix for older browsers\r
+                                               s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';\r
+                                               break;\r
+\r
+                                       case 'float':\r
+                                               isIE ? s.styleFloat = v : s.cssFloat = v;\r
+                                               break;\r
+                                       \r
+                                       default:\r
+                                               s[na] = v || '';\r
+                               }\r
+\r
+                               // Force update of the style data\r
+                               if (t.settings.update_styles)\r
+                                       t.setAttrib(e, 'data-mce-style');\r
+                       });\r
+               },\r
+\r
+               getStyle : function(n, na, c) {\r
+                       n = this.get(n);\r
+\r
+                       if (!n)\r
+                               return;\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
+\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
+                       // Camelcase it, if needed\r
+                       na = na.replace(/-(\D)/g, function(a, b){\r
+                               return b.toUpperCase();\r
+                       });\r
+\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
+\r
+               setStyles : function(e, o) {\r
+                       var t = this, s = t.settings, ol;\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
+\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
+               },\r
+\r
+               setAttrib : function(e, n, v) {\r
+                       var t = this;\r
+\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
+\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
+                               if (is(v) && v !== null && v.length !== 0)\r
+                                       e.setAttribute(n, '' + v, 2);\r
+                               else\r
+                                       e.removeAttribute(n, 2);\r
+                       });\r
+               },\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
+\r
+               getAttrib : function(e, n, dv) {\r
+                       var v, t = this;\r
+\r
+                       e = t.get(e);\r
+\r
+                       if (!e || e.nodeType !== 1)\r
+                               return false;\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 (isIE && t.props[n]) {\r
+                               v = e[t.props[n]];\r
+                               v = v && v.nodeValue ? v.nodeValue : v;\r
+                       }\r
+\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
+                       }\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 !== undefined && v !== null && v !== '') ? '' + v : dv;\r
+               },\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
+\r
+               parseStyle : function(st) {\r
+                       return this.styles.parse(st);\r
+               },\r
+\r
+               serializeStyle : function(o, name) {\r
+                       return this.styles.serialize(o, name);\r
+               },\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
+\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
+\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
+\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
+\r
+               show : function(e) {\r
+                       return this.setStyle(e, 'display', 'block');\r
+               },\r
+\r
+               hide : function(e) {\r
+                       return this.setStyle(e, 'display', 'none');\r
+               },\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
+\r
+               uniqueId : function(p) {\r
+                       return (!p ? 'mce_' : p) + (this.counter++);\r
+               },\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
+\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
+\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
+\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
+\r
+               isBlock : function(node) {\r
+                       var type = node.nodeType;\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
+                       return !!blockElementsMap[node];\r
+               },\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
+\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
+\r
+               findCommonAncestor : function(a, b) {\r
+                       var ps = a, pe;\r
+\r
+                       while (ps) {\r
+                               pe = b;\r
+\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
+\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
+\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
+\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
+\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
+\r
+               isEmpty : function(node, elements) {\r
+                       var self = this, i, attributes, type, walker, name;\r
+\r
+                       node = node.firstChild;\r
+                       if (node) {\r
+                               walker = new tinymce.dom.TreeWalker(node);\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
+                                               if (elements && elements[node.nodeName.toLowerCase()])\r
+                                                       return false;\r
+\r
+                                               // Keep elements with data 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.indexOf('data-') === 0)\r
+                                                               return false;\r
+                                               }\r
+                                       }\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 true;\r
+               },\r
+\r
+               destroy : function(s) {\r
+                       var t = this;\r
+\r
+                       if (t.events)\r
+                               t.events.destroy();\r
+\r
+                       t.win = t.doc = t.root = t.events = 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
+                       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
+                               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
+                                               if (!t.isBlock(node.parentNode) || tinymce.trim(node.nodeValue).length > 0)\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
+                       var t = this;\r
+\r
+                       if (!t.events)\r
+                               t.events = new tinymce.dom.EventUtils();\r
+\r
+                       return t.events.add(target, name, func, scope || this);\r
+               },\r
+\r
+               unbind : function(target, name, func) {\r
+                       var t = this;\r
+\r
+                       if (!t.events)\r
+                               t.events = new tinymce.dom.EventUtils();\r
+\r
+                       return t.events.remove(target, name, func);\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 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
@@ -2917,23 +4672,24 @@ tinymce.create('static tinymce.util.XHR', {
                };\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
+                       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, sc, so);\r
-\r
+                               return _compareBoundaryPoints(sc, so, rsc, rso);\r
+       \r
                        // Check START_TO_END\r
                        if (h === 1)\r
-                               return _compareBoundaryPoints(sc, so, ec, eo);\r
-\r
+                               return _compareBoundaryPoints(ec, eo, rsc, rso);\r
+       \r
                        // Check END_TO_END\r
                        if (h === 2)\r
-                               return _compareBoundaryPoints(ec, eo, ec, eo);\r
-\r
+                               return _compareBoundaryPoints(ec, eo, rec, reo);\r
+       \r
                        // Check END_TO_START\r
-                       if (h === 3)\r
-                               return _compareBoundaryPoints(ec, eo, sc, so);\r
+                       if (h === 3) \r
+                               return _compareBoundaryPoints(sc, so, rec, reo);\r
                };\r
 \r
                function deleteContents() {\r
@@ -3025,7 +4781,7 @@ tinymce.create('static tinymce.util.XHR', {
 \r
                function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {\r
                        var c, offsetC, n, cmnRoot, childA, childB;\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
@@ -3311,7 +5067,7 @@ tinymce.create('static tinymce.util.XHR', {
                                frag.appendChild(n);\r
 \r
                        startIdx = nodeIndex(startAncestor);\r
-                       ++startIdx;  // Because we already traversed it....\r
+                       ++startIdx; // Because we already traversed it\r
 \r
                        cnt = t[END_OFFSET] - startIdx;\r
                        n = startAncestor.nextSibling;\r
@@ -3498,2438 +5254,2975 @@ tinymce.create('static tinymce.util.XHR', {
 \r
 (function() {\r
        function Selection(selection) {\r
-               var t = this, invisibleChar = '\uFEFF', range, lastIERng, dom = selection.dom, TRUE = true, FALSE = false;\r
+               var self = this, dom = selection.dom, TRUE = true, FALSE = false;\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
+               function getPosition(rng, start) {\r
+                       var checkRng, startIndex = 0, endIndex, inside,\r
+                               children, child, offset, index, position = -1, parent;\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
+                       // Setup test range, collapse it and get the parent\r
+                       checkRng = rng.duplicate();\r
+                       checkRng.collapse(start);\r
+                       parent = checkRng.parentElement();\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
+                       // Check if the selection is within the right document\r
+                       if (parent.ownerDocument !== selection.dom.doc)\r
+                               return;\r
 \r
-                               return domRange;\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
-                       collapsed = selection.isCollapsed();\r
-\r
-                       function findEndPoint(start) {\r
-                               var marker, container, offset, nodes, startIndex = 0, endIndex, index, parent, checkRng, position;\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
-                               // Setup temp range and collapse it\r
-                               checkRng = ieRange.duplicate();\r
-                               checkRng.collapse(start);\r
+                       // Setup node list and endIndex\r
+                       children = parent.children;\r
+                       endIndex = children.length - 1;\r
 \r
-                               // Create marker and insert it at the end of the endpoints parent\r
-                               marker = dom.create('a');\r
-                               parent = checkRng.parentElement();\r
+                       // Perform a binary search for the position\r
+                       while (startIndex <= endIndex) {\r
+                               index = Math.floor((startIndex + endIndex) / 2);\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
-                               }\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
-                               parent.appendChild(marker);\r
-                               checkRng.moveToElementText(marker);\r
-                               position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);\r
+                               // Before/after or an exact match\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
+                                       endIndex = index - 1;\r
+                               } else if (position < 0) {\r
+                                       startIndex = index + 1;\r
+                               } else {\r
+                                       return {node : child};\r
                                }\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
+                       // 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
-                               // Setup container\r
-                               container = position > 0 || index == 0 ? marker.nextSibling : marker.previousSibling;\r
+                               checkRng.setEndPoint(start ? 'EndToStart' : 'EndToEnd', rng);\r
 \r
-                               // Handle element selection\r
-                               if (container.nodeType == 1) {\r
-                                       dom.remove(marker);\r
+                               // Fix for edge case: <div style="width: 100px; height:100px;"><table>..</table>ab|c</div>\r
+                               if (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) > 0) {\r
+                                       checkRng = rng.duplicate();\r
+                                       checkRng.collapse(start);\r
 \r
-                                       // Find offset and container\r
-                                       offset = dom.nodeIndex(container);\r
-                                       container = container.parentNode;\r
+                                       offset = -1;\r
+                                       while (parent == checkRng.parentElement()) {\r
+                                               if (checkRng.move('character', -1) == 0)\r
+                                                       break;\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
-\r
-                                       dom.remove(marker);\r
                                }\r
 \r
-                               domRange[start ? 'setStart' : 'setEnd'](container, offset);\r
-                       };\r
-\r
-                       // Find start point\r
-                       findEndPoint(true);\r
+                               offset = offset || checkRng.text.replace('\r\n', ' ').length;\r
+                       } else {\r
+                               // Child position is after the selection endpoint\r
+                               checkRng.collapse(true);\r
+                               checkRng.setEndPoint(start ? 'StartToStart' : 'StartToEnd', rng);\r
 \r
-                       // Find end point if needed\r
-                       if (!collapsed)\r
-                               findEndPoint();\r
+                               // Get the length of the text to find where the endpoint is relative to it's container\r
+                               offset = checkRng.text.replace('\r\n', ' ').length;\r
+                       }\r
 \r
-                       return domRange;\r
+                       return {node : child, position : position, offset : offset, inside : inside};\r
                };\r
 \r
-               this.addRange = function(rng) {\r
-                       var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, doc = selection.dom.doc, body = doc.body;\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
-                       function setEndPoint(start) {\r
-                               var container, offset, marker, tmpRng, nodes;\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
-                               marker = dom.create('a');\r
-                               container = start ? startContainer : endContainer;\r
-                               offset = start ? startOffset : endOffset;\r
-                               tmpRng = ieRng.duplicate();\r
+                       collapsed = selection.isCollapsed();\r
 \r
-                               if (container == doc) {\r
-                                       container = body;\r
-                                       offset = 0;\r
-                               }\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
-                               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
+                               return domRange;\r
+                       }\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
+                       function findEndPoint(start) {\r
+                               var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue;\r
 \r
-                                               tmpRng.moveToElementText(marker);\r
-                                       } else {\r
-                                               // Empty node selection for example <div>|</div>\r
-                                               marker = doc.createTextNode(invisibleChar);\r
-                                               container.appendChild(marker);\r
-                                               tmpRng.moveToElementText(marker.parentNode);\r
-                                               tmpRng.collapse(TRUE);\r
-                                       }\r
+                               container = endPoint.node;\r
+                               offset = endPoint.offset;\r
 \r
-                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
-                                       dom.remove(marker);\r
+                               if (endPoint.inside && !container.hasChildNodes()) {\r
+                                       domRange[start ? 'setStart' : 'setEnd'](container, 0);\r
+                                       return;\r
                                }\r
-                       }\r
 \r
-                       // Destroy cached range\r
-                       this.destroy();\r
+                               if (offset === undef) {\r
+                                       domRange[start ? 'setStartBefore' : 'setEndAfter'](container);\r
+                                       return;\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
+                               if (endPoint.position < 0) {\r
+                                       sibling = endPoint.inside ? container.firstChild : container.nextSibling;\r
 \r
-                       // If single element selection then try making a control selection out of it\r
-                       if (startContainer == endContainer && startContainer.nodeType == 1 && startOffset == endOffset - 1) {\r
-                               if (startOffset == endOffset - 1) {\r
-                                       try {\r
-                                               ctrlRng = body.createControlRange();\r
-                                               ctrlRng.addElement(startContainer.childNodes[startOffset]);\r
-                                               ctrlRng.select();\r
-                                               ctrlRng.scrollIntoView();\r
+                                       if (!sibling) {\r
+                                               domRange[start ? 'setStartAfter' : 'setEndAfter'](container);\r
                                                return;\r
-                                       } catch (ex) {\r
-                                               // Ignore\r
                                        }\r
-                               }\r
-                       }\r
-\r
-                       // Set start/end point of selection\r
-                       setEndPoint(true);\r
-                       setEndPoint();\r
-\r
-                       // Select the new range and scroll it into view\r
-                       ieRng.select();\r
-                       ieRng.scrollIntoView();\r
-               };\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
-\r
-                               // Store away text range for next call\r
-                               lastIERng = selection.getRng();\r
-                       }\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
-\r
-                       // Return cached range\r
-                       return range;\r
-               };\r
-\r
-               this.destroy = function() {\r
-                       // Destroy cached range and last IE range to avoid memory leaks\r
-                       lastIERng = range = null;\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
-\r
-                               // Make HTML element unselectable since we are going to handle selection by hand\r
-                               doc.documentElement.unselectable = TRUE;\r
-\r
-                               // Return range from point or null if it failed\r
-                               function rngFromPoint(x, y) {\r
-                                       var rng = body.createTextRange();\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
-                                       try {\r
-                                               rng.moveToPoint(x, y);\r
-                                       } catch (ex) {\r
-                                               // IE sometimes throws and exception, so lets just ignore it\r
-                                               rng = null;\r
+                                               return;\r
                                        }\r
 \r
-                                       return rng;\r
-                               };\r
-\r
-                               // Fires while the selection is changing\r
-                               function selectionChange(e) {\r
-                                       var pointRng;\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
-\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
+                                       // Find the text node and offset\r
+                                       while (sibling) {\r
+                                               nodeValue = sibling.nodeValue;\r
+                                               textNodeOffset += nodeValue.length;\r
 \r
-                                                       pointRng.select();\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
-                                       } else\r
-                                               endSelection();\r
-                               }\r
 \r
-                               // Removes listeners\r
-                               function endSelection() {\r
-                                       dom.unbind(doc, 'mouseup', endSelection);\r
-                                       dom.unbind(doc, 'mousemove', selectionChange);\r
-                                       started = 0;\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
+                                               sibling = sibling.nextSibling;\r
+                                       }\r
+                               } else {\r
+                                       // Find the text node and offset\r
+                                       sibling = container.previousSibling;\r
 \r
-                                               started = 1;\r
+                                       if (!sibling)\r
+                                               return domRange[start ? 'setStartBefore' : 'setEndBefore'](container);\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
+                                       // 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
-                                                       startRng.select();\r
-                                               }\r
+                                               return;\r
                                        }\r
-                               });\r
-                       })();\r
-               }\r
-       };\r
 \r
-       // Expose the selection object\r
-       tinymce.dom.TridentSelection = Selection;\r
-})();\r
+                                       while (sibling) {\r
+                                               textNodeOffset += sibling.nodeValue.length;\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
-(function(tinymce) {\r
-       // Shorten names\r
-       var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;\r
+                                               sibling = sibling.previousSibling;\r
+                                       }\r
+                               }\r
 \r
-       tinymce.create('tinymce.dom.EventUtils', {\r
-               EventUtils : function() {\r
-                       this.inits = [];\r
-                       this.events = [];\r
-               },\r
+                               domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset);\r
+                       };\r
 \r
-               add : function(o, n, f, s) {\r
-                       var cb, t = this, el = t.events, r;\r
+                       try {\r
+                               // Find start point\r
+                               findEndPoint(true);\r
 \r
-                       if (n instanceof Array) {\r
-                               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
-                               each(n, function(n) {\r
-                                       r.push(t.add(o, n, f, s));\r
-                               });\r
+                                       // Remove the broken elements\r
+                                       element.innerHTML = element.innerHTML;\r
 \r
-                               return r;\r
-                       }\r
+                                       // Restore the selection\r
+                                       self.moveToBookmark(bookmark);\r
 \r
-                       // Handle array\r
-                       if (o && o.hasOwnProperty && o instanceof Array) {\r
-                               r = [];\r
+                                       // Since the range has moved we need to re-get it\r
+                                       ieRange = selection.getRng();\r
 \r
-                               each(o, function(o) {\r
-                                       o = DOM.get(o);\r
-                                       r.push(t.add(o, n, f, s));\r
-                               });\r
+                                       // Find start point\r
+                                       findEndPoint(true);\r
 \r
-                               return r;\r
+                                       // Find end point if needed\r
+                                       if (!collapsed)\r
+                                               findEndPoint();\r
+                               } else\r
+                                       throw ex; // Throw other errors\r
                        }\r
 \r
-                       o = DOM.get(o);\r
+                       return domRange;\r
+               };\r
 \r
-                       if (!o)\r
-                               return;\r
+               this.getBookmark = function(type) {\r
+                       var rng = selection.getRng(), start, end, bookmark = {};\r
 \r
-                       // Setup event callback\r
-                       cb = function(e) {\r
-                               // Is all events disabled\r
-                               if (t.disabled)\r
-                                       return;\r
+                       function getIndexes(node) {\r
+                               var node, parent, root, children, i, indexes = [];\r
 \r
-                               e = e || window.event;\r
+                               parent = node.parentNode;\r
+                               root = dom.getRoot().parentNode;\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
+                               while (parent != root) {\r
+                                       children = parent.children;\r
 \r
-                                       // Patch in preventDefault, stopPropagation methods for W3C compatibility\r
-                                       tinymce.extend(e, t._stoppers);\r
-                               }\r
+                                       i = children.length;\r
+                                       while (i--) {\r
+                                               if (node === children[i]) {\r
+                                                       indexes.push(i);\r
+                                                       break;\r
+                                               }\r
+                                       }\r
 \r
-                               if (!s)\r
-                                       return f(e);\r
+                                       node = parent;\r
+                                       parent = parent.parentNode;\r
+                               }\r
 \r
-                               return f.call(s, e);\r
+                               return indexes;\r
                        };\r
 \r
-                       if (n == 'unload') {\r
-                               tinymce.unloads.unshift({func : cb});\r
-                               return cb;\r
-                       }\r
-\r
-                       if (n == 'init') {\r
-                               if (t.domLoaded)\r
-                                       cb();\r
-                               else\r
-                                       t.inits.push(cb);\r
+                       function getBookmarkEndPoint(start) {\r
+                               var position;\r
 \r
-                               return cb;\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
-                       // Store away listener reference\r
-                       el.push({\r
-                               obj : o,\r
-                               name : n,\r
-                               func : f,\r
-                               cfunc : cb,\r
-                               scope : s\r
-                       });\r
+                       // Non ubstructive bookmark\r
+                       if (type === 2) {\r
+                               // Handle text selection\r
+                               if (!rng.item) {\r
+                                       bookmark.start = getBookmarkEndPoint(true);\r
 \r
-                       t._add(o, n, cb);\r
+                                       if (!selection.isCollapsed())\r
+                                               bookmark.end = getBookmarkEndPoint();\r
+                               } else\r
+                                       bookmark.start = {ctrl : true, indexes : getIndexes(rng.item(0))};\r
+                       }\r
 \r
-                       return f;\r
-               },\r
+                       return bookmark;\r
+               };\r
 \r
-               remove : function(o, n, f) {\r
-                       var t = this, a = t.events, s = false, r;\r
+               this.moveToBookmark = function(bookmark) {\r
+                       var rng, body = dom.doc.body;\r
 \r
-                       // Handle array\r
-                       if (o && o.hasOwnProperty && o instanceof Array) {\r
-                               r = [];\r
+                       function resolveIndexes(indexes) {\r
+                               var node, i, idx, children;\r
 \r
-                               each(o, function(o) {\r
-                                       o = DOM.get(o);\r
-                                       r.push(t.remove(o, n, f));\r
-                               });\r
+                               node = dom.getRoot();\r
+                               for (i = indexes.length - 1; i >= 0; i--) {\r
+                                       children = node.children;\r
+                                       idx = indexes[i];\r
 \r
-                               return r;\r
-                       }\r
+                                       if (idx <= children.length - 1) {\r
+                                               node = children[idx];\r
+                                       }\r
+                               }\r
 \r
-                       o = DOM.get(o);\r
+                               return node;\r
+                       };\r
+                       \r
+                       function setBookmarkEndPoint(start) {\r
+                               var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef;\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
-                               }\r
-                       });\r
+                               if (endPoint) {\r
+                                       moveLeft = endPoint.position > 0;\r
 \r
-                       return s;\r
-               },\r
+                                       moveRng = body.createTextRange();\r
+                                       moveRng.moveToElementText(resolveIndexes(endPoint.indexes));\r
 \r
-               clear : function(o) {\r
-                       var t = this, a = t.events, i, e;\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
-                       if (o) {\r
-                               o = DOM.get(o);\r
+                                       rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng);\r
 \r
-                               for (i = a.length - 1; i >= 0; i--) {\r
-                                       e = a[i];\r
+                                       if (start)\r
+                                               rng.collapse(true);\r
+                               }\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 (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
-               cancel : function(e) {\r
-                       if (!e)\r
-                               return false;\r
-\r
-                       this.stop(e);\r
+               };\r
 \r
-                       return this.prevent(e);\r
-               },\r
+               this.addRange = function(rng) {\r
+                       var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, doc = selection.dom.doc, body = doc.body;\r
 \r
-               stop : function(e) {\r
-                       if (e.stopPropagation)\r
-                               e.stopPropagation();\r
-                       else\r
-                               e.cancelBubble = true;\r
+                       function setEndPoint(start) {\r
+                               var container, offset, marker, tmpRng, nodes;\r
 \r
-                       return false;\r
-               },\r
+                               marker = dom.create('a');\r
+                               container = start ? startContainer : endContainer;\r
+                               offset = start ? startOffset : endOffset;\r
+                               tmpRng = ieRng.duplicate();\r
 \r
-               prevent : function(e) {\r
-                       if (e.preventDefault)\r
-                               e.preventDefault();\r
-                       else\r
-                               e.returnValue = false;\r
+                               if (container == doc || container == doc.documentElement) {\r
+                                       container = body;\r
+                                       offset = 0;\r
+                               }\r
 \r
-                       return false;\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
-               destroy : function() {\r
-                       var t = this;\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
-                       each(t.events, function(e, i) {\r
-                               t._remove(e.obj, e.name, e.cfunc);\r
-                               e.obj = e.cfunc = null;\r
-                       });\r
+                                               tmpRng.moveToElementText(marker);\r
+                                       } else {\r
+                                               // Empty node selection for example <div>|</div>\r
+                                               marker = doc.createTextNode('\uFEFF');\r
+                                               container.appendChild(marker);\r
+                                               tmpRng.moveToElementText(marker.parentNode);\r
+                                               tmpRng.collapse(TRUE);\r
+                                       }\r
 \r
-                       t.events = [];\r
-                       t = null;\r
-               },\r
+                                       ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);\r
+                                       dom.remove(marker);\r
+                               }\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
+                       // 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
-               _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
+                       // If single element selection then try making a control selection out of it\r
+                       if (startContainer == endContainer && startContainer.nodeType == 1 && startOffset == endOffset - 1) {\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
 \r
-               _pageInit : function(win) {\r
-                       var t = this;\r
+                       // Set start/end point of selection\r
+                       setEndPoint(true);\r
+                       setEndPoint();\r
 \r
-                       // Keep it from running more than once\r
-                       if (t.domLoaded)\r
-                               return;\r
+                       // Select the new range and scroll it into view\r
+                       ieRng.select();\r
+               };\r
 \r
-                       t.domLoaded = true;\r
+               // Expose range method\r
+               this.getRangeAt = getRange;\r
+       };\r
 \r
-                       each(t.inits, function(c) {\r
-                               c();\r
-                       });\r
+       // Expose the selection object\r
+       tinymce.dom.TridentSelection = Selection;\r
+})();\r
 \r
-                       t.inits = [];\r
-               },\r
 \r
-               _wait : function(win) {\r
-                       var t = this, doc = win.document;\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
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,\r
+       done = 0,\r
+       toString = Object.prototype.toString,\r
+       hasDuplicate = false,\r
+       baseHasDuplicate = true;\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
-                       // No need since the document is already loaded\r
-                       if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {\r
-                               t.domLoaded = 1;\r
-                               return;\r
-                       }\r
+var Sizzle = function(selector, context, results, seed) {\r
+       results = results || [];\r
+       context = context || document;\r
+\r
+       var origContext = context;\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
-                       // 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
+       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
+               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
-                               if (doc.documentElement.doScroll && win == win.top) {\r
-                                       (function() {\r
-                                               if (t.domLoaded)\r
-                                                       return;\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
-                                               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
+                       while ( parts.length ) {\r
+                               selector = parts.shift();\r
 \r
-                                               t._pageInit(win);\r
-                                       })();\r
+                               if ( Expr.relative[ selector ] ) {\r
+                                       selector += parts.shift();\r
                                }\r
-                       } else if (doc.addEventListener) {\r
-                               t._add(win, 'DOMContentLoaded', function() {\r
-                                       t._pageInit(win);\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
+\r
+                       if ( parts.length > 0 ) {\r
+                               checkSet = makeArray(set);\r
+                       } else {\r
+                               prune = false;\r
                        }\r
 \r
-                       t._add(win, 'load', function() {\r
-                               t._pageInit(win);\r
-                       });\r
-               },\r
+                       while ( parts.length ) {\r
+                               cur = parts.pop();\r
+                               pop = cur;\r
 \r
-               _stoppers : {\r
-                       preventDefault :  function() {\r
-                               this.returnValue = false;\r
-                       },\r
+                               if ( !Expr.relative[ cur ] ) {\r
+                                       cur = "";\r
+                               } else {\r
+                                       pop = parts.pop();\r
+                               }\r
 \r
-                       stopPropagation : function() {\r
-                               this.cancelBubble = true;\r
+                               if ( pop == null ) {\r
+                                       pop = context;\r
+                               }\r
+\r
+                               Expr.relative[ cur ]( checkSet, pop, contextXML );\r
                        }\r
+               } else {\r
+                       checkSet = parts = [];\r
                }\r
-       });\r
+       }\r
 \r
-       Event = tinymce.dom.Event = new tinymce.dom.EventUtils();\r
+       if ( !checkSet ) {\r
+               checkSet = set;\r
+       }\r
 \r
-       // Dispatch DOM content loaded event for IE and Safari\r
-       Event._wait(window);\r
+       if ( !checkSet ) {\r
+               Sizzle.error( cur || selector );\r
+       }\r
 \r
-       tinymce.addUnload(function() {\r
-               Event.destroy();\r
-       });\r
-})(tinymce);\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
 \r
-(function(tinymce) {\r
-       tinymce.dom.Element = function(id, settings) {\r
-               var t = this, dom, el;\r
+       if ( extra ) {\r
+               Sizzle( extra, origContext, results, seed );\r
+               Sizzle.uniqueSort( results );\r
+       }\r
 \r
-               t.settings = settings = settings || {};\r
-               t.id = id;\r
-               t.dom = dom = settings.dom || tinymce.DOM;\r
+       return results;\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.uniqueSort = function(results){\r
+       if ( sortOrder ) {\r
+               hasDuplicate = baseHasDuplicate;\r
+               results.sort(sortOrder);\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
+               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
-                                       for (i = 0; i < arguments.length; i++)\r
-                                               a.push(arguments[i]);\r
+       return results;\r
+};\r
 \r
-                                       a = dom[k].apply(dom, a);\r
-                                       t.update(k);\r
+Sizzle.matches = function(expr, set){\r
+       return Sizzle(expr, null, null, set);\r
+};\r
 \r
-                                       return a;\r
-                               };\r
-               });\r
+Sizzle.find = function(expr, context, isXML){\r
+       var set;\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 ) {\r
+               return [];\r
+       }\r
 \r
-                       getXY : function() {\r
-                               return {\r
-                                       x : parseInt(t.getStyle('left')),\r
-                                       y : parseInt(t.getStyle('top'))\r
-                               };\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
+                       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
-                       getSize : function() {\r
-                               var n = dom.get(t.id);\r
+       if ( !set ) {\r
+               set = context.getElementsByTagName("*");\r
+       }\r
 \r
-                               return {\r
-                                       w : parseInt(t.getStyle('width') || n.clientWidth),\r
-                                       h : parseInt(t.getStyle('height') || n.clientHeight)\r
-                               };\r
-                       },\r
+       return {set: set, expr: expr};\r
+};\r
 \r
-                       moveTo : function(x, y) {\r
-                               t.setStyles({left : x, top : y});\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
 \r
-                       moveBy : function(x, y) {\r
-                               var p = t.getXY();\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
-                               t.moveTo(p.x + x, p.y + y);\r
-                       },\r
+                               match.splice(1,1);\r
 \r
-                       resizeTo : function(w, h) {\r
-                               t.setStyles({width : w, height : h});\r
-                       },\r
+                               if ( left.substr( left.length - 1 ) === "\\" ) {\r
+                                       continue;\r
+                               }\r
 \r
-                       resizeBy : function(w, h) {\r
-                               var s = t.getSize();\r
+                               if ( curLoop === result ) {\r
+                                       result = [];\r
+                               }\r
 \r
-                               t.resizeTo(s.w + w, s.h + h);\r
-                       },\r
+                               if ( Expr.preFilter[ type ] ) {\r
+                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\r
 \r
-                       update : function(k) {\r
-                               var b;\r
+                                       if ( !match ) {\r
+                                               anyFound = found = true;\r
+                                       } else if ( match === true ) {\r
+                                               continue;\r
+                                       }\r
+                               }\r
 \r
-                               if (tinymce.isIE6 && settings.blocker) {\r
-                                       k = k || '';\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
-                                       // Ignore getters\r
-                                       if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)\r
-                                               return;\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
-                                       // Remove blocker on remove\r
-                                       if (k == 'remove') {\r
-                                               dom.remove(t.blocker);\r
-                                               return;\r
+                               if ( found !== undefined ) {\r
+                                       if ( !inplace ) {\r
+                                               curLoop = result;\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
+                                       expr = expr.replace( Expr.match[ type ], "" );\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
+                                       if ( !anyFound ) {\r
+                                               return [];\r
+                                       }\r
+\r
+                                       break;\r
                                }\r
                        }\r
-               });\r
-       };\r
-})(tinymce);\r
+               }\r
 \r
-(function(tinymce) {\r
-       function trimNl(s) {\r
-               return s.replace(/[\n\r]+/g, '');\r
-       };\r
+               // Improper expression\r
+               if ( expr === old ) {\r
+                       if ( anyFound == null ) {\r
+                               Sizzle.error( expr );\r
+                       } else {\r
+                               break;\r
+                       }\r
+               }\r
 \r
-       // Shorten names\r
-       var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;\r
+               old = expr;\r
+       }\r
 \r
-       tinymce.create('tinymce.dom.Selection', {\r
-               Selection : function(dom, win, serializer) {\r
-                       var t = this;\r
+       return curLoop;\r
+};\r
 \r
-                       t.dom = dom;\r
-                       t.win = win;\r
-                       t.serializer = serializer;\r
+Sizzle.error = function( msg ) {\r
+       throw "Syntax error, unrecognized expression: " + msg;\r
+};\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
+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
-                       // No W3C Range support\r
-                       if (!t.win.getSelection)\r
-                               t.tridentSel = new tinymce.dom.TridentSelection(t);\r
+                       if ( isTag ) {\r
+                               part = part.toLowerCase();\r
+                       }\r
 \r
-                       // Prevent leaks\r
-                       tinymce.addUnload(t.destroy, t);\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
+                                       checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\r
+                                               elem || false :\r
+                                               elem === part;\r
+                               }\r
+                       }\r
+\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
-               getContent : function(s) {\r
-                       var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;\r
+                       if ( isPartStr && !/\W/.test(part) ) {\r
+                               part = part.toLowerCase();\r
 \r
-                       s = s || {};\r
-                       wb = wa = '';\r
-                       s.get = true;\r
-                       s.format = s.format || 'html';\r
-                       t.onBeforeGetContent.dispatch(t, s);\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
-                       if (s.format == 'text')\r
-                               return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));\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
-                       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("parentNode", part, doneName, checkSet, nodeCheck, isXML);\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
+\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
+                       } 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
+               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
+                       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
+                               for ( var j = 0, l = not.length; j < l; j++ ) {\r
+                                       if ( not[j] === elem ) {\r
+                                               return false;\r
+                                       }\r
                                }\r
 \r
-                               r.pasteHTML(h);\r
+                               return true;\r
+                       } else {\r
+                               Sizzle.error( "Syntax error, unrecognized expression: " + name );\r
                        }\r
-\r
-                       // Dispatch set content event\r
-                       t.onSetContent.dispatch(t, s);\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
-               getStart : function() {\r
-                       var rng = this.getRng(), startElement, parentElement, checkRng, node;\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
+                       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
+                       if ( filter ) {\r
+                               return filter( elem, i, match, array );\r
+                       }\r
+               }\r
+       }\r
+};\r
 \r
-                       if (rng.duplicate || rng.item) {\r
-                               // Control selection, return first item\r
-                               if (rng.item)\r
-                                       return rng.item(0);\r
+var origPOS = Expr.match.POS,\r
+       fescape = function(all, num){\r
+               return "\\" + (num - 0 + 1);\r
+       };\r
 \r
-                               // Get start element\r
-                               checkRng = rng.duplicate();\r
-                               checkRng.collapse(1);\r
-                               startElement = checkRng.parentElement();\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
-                               // 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
+var makeArray = function(array, results) {\r
+       array = Array.prototype.slice.call( array, 0 );\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
+       if ( results ) {\r
+               results.push.apply( results, array );\r
+               return results;\r
+       }\r
+       \r
+       return array;\r
+};\r
 \r
-                               return startElement;\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
+// 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
+               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
-                               startElement = rng.startContainer;\r
+                               for ( ; array[i]; i++ ) {\r
+                                       ret.push( array[i] );\r
+                               }\r
+                       }\r
+               }\r
 \r
-                               if (startElement.nodeType == 1 && startElement.hasChildNodes())\r
-                                       startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];\r
+               return ret;\r
+       };\r
+}\r
 \r
-                               if (startElement && startElement.nodeType == 3)\r
-                                       return startElement.parentNode;\r
+var sortOrder;\r
 \r
-                               return startElement;\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
-               },\r
+                       return a.compareDocumentPosition ? -1 : 1;\r
+               }\r
 \r
-               getEnd : function() {\r
-                       var t = this, r = t.getRng(), e, eo;\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
-                       if (r.duplicate || r.item) {\r
-                               if (r.item)\r
-                                       return r.item(0);\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
-                               r = r.duplicate();\r
-                               r.collapse(0);\r
-                               e = r.parentElement();\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
-                               if (e && e.nodeName == 'BODY')\r
-                                       return e.lastChild || e;\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
-                               return e;\r
-                       } else {\r
-                               e = r.endContainer;\r
-                               eo = r.endOffset;\r
+       for ( var i = 0; elems[i]; i++ ) {\r
+               elem = elems[i];\r
 \r
-                               if (e.nodeType == 1 && e.hasChildNodes())\r
-                                       e = e.childNodes[eo > 0 ? eo - 1 : eo];\r
+               // Get the text from text nodes and CDATA nodes\r
+               if ( elem.nodeType === 3 || elem.nodeType === 4 ) {\r
+                       ret += elem.nodeValue;\r
 \r
-                               if (e && e.nodeType == 3)\r
-                                       return e.parentNode;\r
+               // Traverse everything else, except comment nodes\r
+               } else if ( elem.nodeType !== 8 ) {\r
+                       ret += Sizzle.getText( elem.childNodes );\r
+               }\r
+       }\r
 \r
-                               return e;\r
+       return ret;\r
+};\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
+\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
+       // 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
 \r
-               getBookmark : function(type, normalized) {\r
-                       var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;\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
-                       function findIndex(name, element) {\r
-                               var index = 0;\r
+       root.removeChild( form );\r
+       root = form = null; // release memory in IE\r
+})();\r
 \r
-                               each(dom.select(name), function(node, i) {\r
-                                       if (node == element)\r
-                                               index = i;\r
-                               });\r
+(function(){\r
+       // Check to see if the browser returns only elements\r
+       // when doing getElementsByTagName("*")\r
 \r
-                               return index;\r
-                       };\r
+       // Create a fake element\r
+       var div = document.createElement("div");\r
+       div.appendChild( document.createComment("") );\r
 \r
-                       if (type == 2) {\r
-                               function getLocation() {\r
-                                       var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};\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 getPoint(rng, start) {\r
-                                               var container = rng[start ? 'startContainer' : 'endContainer'],\r
-                                                       offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;\r
+                       // Filter out possible comments\r
+                       if ( match[1] === "*" ) {\r
+                               var tmp = [];\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
+                               for ( var i = 0; results[i]; i++ ) {\r
+                                       if ( results[i].nodeType === 1 ) {\r
+                                               tmp.push( results[i] );\r
+                                       }\r
+                               }\r
 \r
-                                                       point.push(offset);\r
-                                               } else {\r
-                                                       childNodes = container.childNodes;\r
+                               results = tmp;\r
+                       }\r
 \r
-                                                       if (offset >= childNodes.length && childNodes.length) {\r
-                                                               after = 1;\r
-                                                               offset = Math.max(0, childNodes.length - 1);\r
-                                                       }\r
+                       return results;\r
+               };\r
+       }\r
 \r
-                                                       point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);\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
 \r
-                                               for (; container && container != root; container = container.parentNode)\r
-                                                       point.push(t.dom.nodeIndex(container, normalized));\r
+       div = null; // release memory in IE\r
+})();\r
 \r
-                                               return point;\r
-                                       };\r
+if ( document.querySelectorAll ) {\r
+       (function(){\r
+               var oldSizzle = Sizzle, div = document.createElement("div");\r
+               div.innerHTML = "<p class='TEST'></p>";\r
 \r
-                                       bookmark.start = getPoint(rng, true);\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
-                                       if (!t.isCollapsed())\r
-                                               bookmark.end = getPoint(rng);\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
-                                       return bookmark;\r
-                               };\r
+               for ( var prop in oldSizzle ) {\r
+                       Sizzle[ prop ] = oldSizzle[ prop ];\r
+               }\r
 \r
-                               return getLocation();\r
-                       }\r
+               div = null; // release memory in IE\r
+       })();\r
+}\r
 \r
-                       // Handle simple range\r
-                       if (type)\r
-                               return {rng : t.getRng()};\r
+(function(){\r
+       var div = document.createElement("div");\r
 \r
-                       rng = t.getRng();\r
-                       id = dom.uniqueId();\r
-                       collapsed = tinyMCE.activeEditor.selection.isCollapsed();\r
-                       styles = 'overflow:hidden;line-height:0px';\r
+       div.innerHTML = "<div class='test e'></div><div class='test'></div>";\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
+\r
+       // Safari caches class attributes, doesn't catch changes (in 3.2)\r
+       div.lastChild.className = "e";\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
+\r
+       div = null; // release memory in IE\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
 \r
-                       // Explorer method\r
-                       if (rng.duplicate || rng.item) {\r
-                               // Text selection\r
-                               if (!rng.item) {\r
-                                       rng2 = rng.duplicate();\r
+                       while ( elem ) {\r
+                               if ( elem.sizcache === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\r
+                               }\r
 \r
-                                       // Insert start marker\r
-                                       rng.collapse();\r
-                                       rng.pasteHTML('<span _mce_type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');\r
+                               if ( elem.nodeType === 1 && !isXML ){\r
+                                       elem.sizcache = doneName;\r
+                                       elem.sizset = i;\r
+                               }\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
+                               if ( elem.nodeName.toLowerCase() === cur ) {\r
+                                       match = elem;\r
+                                       break;\r
+                               }\r
 \r
-                                       return {name : name, index : findIndex(name, element)};\r
+                               elem = elem[dir];\r
+                       }\r
+\r
+                       checkSet[i] = match;\r
+               }\r
+       }\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
+\r
+                       while ( elem ) {\r
+                               if ( elem.sizcache === doneName ) {\r
+                                       match = checkSet[elem.sizset];\r
+                                       break;\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
-                               // W3C method\r
-                               rng2 = rng.cloneRange();\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
 \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
+                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\r
+                                               match = elem;\r
+                                               break;\r
+                                       }\r
                                }\r
 \r
-                               rng.collapse(true);\r
-                               rng.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_start', style : styles}, chr));\r
+                               elem = elem[dir];\r
                        }\r
 \r
-                       t.moveToBookmark({id : id, keep : 1});\r
+                       checkSet[i] = match;\r
+               }\r
+       }\r
+}\r
 \r
-                       return {id : id};\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
-               moveToBookmark : function(bookmark) {\r
-                       var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;\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
-                       // Clear selection cache\r
-                       if (t.tridentSel)\r
-                               t.tridentSel.destroy();\r
+var posProcess = function(selector, context){\r
+       var tmpSet = [], later = "", match,\r
+               root = context.nodeType ? [context] : context;\r
 \r
-                       if (bookmark) {\r
-                               if (bookmark.start) {\r
-                                       rng = dom.createRng();\r
-                                       root = dom.getRoot();\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
-                                       function setEndPoint(start) {\r
-                                               var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;\r
+       selector = Expr.relative[selector] ? selector + "*" : selector;\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, l = root.length; i < l; i++ ) {\r
+               Sizzle( selector, root[i], tmpSet );\r
+       }\r
 \r
-                                                               if (children.length)\r
-                                                                       node = children[point[i]];\r
-                                                       }\r
+       return Sizzle.filter( later, tmpSet );\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
+// EXPOSE\r
 \r
-                                       setEndPoint(true);\r
-                                       setEndPoint();\r
+window.tinymce.dom.Sizzle = Sizzle;\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
+})();\r
 \r
-                                               if (marker) {\r
-                                                       node = marker.parentNode;\r
 \r
-                                                       if (suffix == 'start') {\r
-                                                               if (!keep) {\r
-                                                                       idx = dom.nodeIndex(marker);\r
-                                                               } else {\r
-                                                                       node = marker.firstChild;\r
-                                                                       idx = 1;\r
-                                                               }\r
+(function(tinymce) {\r
+       // Shorten names\r
+       var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;\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
+       tinymce.create('tinymce.dom.EventUtils', {\r
+               EventUtils : function() {\r
+                       this.inits = [];\r
+                       this.events = [];\r
+               },\r
 \r
-                                                               endContainer = node;\r
-                                                               endOffset = idx;\r
-                                                       }\r
+               add : function(o, n, f, s) {\r
+                       var cb, t = this, el = t.events, r;\r
 \r
-                                                       if (!keep) {\r
-                                                               prev = marker.previousSibling;\r
-                                                               next = marker.nextSibling;\r
+                       if (n instanceof Array) {\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
+                               each(n, function(n) {\r
+                                       r.push(t.add(o, n, f, s));\r
+                               });\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
+                               return r;\r
+                       }\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
+                       // Handle array\r
+                       if (o && o.hasOwnProperty && o instanceof Array) {\r
+                               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
+                               each(o, function(o) {\r
+                                       o = DOM.get(o);\r
+                                       r.push(t.add(o, n, f, s));\r
+                               });\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
+                               return r;\r
+                       }\r
 \r
-                                               return node;\r
-                                       };\r
+                       o = DOM.get(o);\r
 \r
-                                       // Restore start/end points\r
-                                       restoreEndPoint('start');\r
-                                       restoreEndPoint('end');\r
+                       if (!o)\r
+                               return;\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
+                       // Setup event callback\r
+                       cb = function(e) {\r
+                               // Is all events disabled\r
+                               if (t.disabled)\r
+                                       return;\r
+\r
+                               e = e || window.event;\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
+                               if (!s)\r
+                                       return f(e);\r
+\r
+                               return f.call(s, e);\r
+                       };\r
+\r
+                       if (n == 'unload') {\r
+                               tinymce.unloads.unshift({func : cb});\r
+                               return cb;\r
                        }\r
-               },\r
 \r
-               select : function(node, content) {\r
-                       var t = this, dom = t.dom, rng = dom.createRng(), idx;\r
+                       if (n == 'init') {\r
+                               if (t.domLoaded)\r
+                                       cb();\r
+                               else\r
+                                       t.inits.push(cb);\r
+\r
+                               return cb;\r
+                       }\r
 \r
-                       idx = dom.nodeIndex(node);\r
-                       rng.setStart(node.parentNode, idx);\r
-                       rng.setEnd(node.parentNode, idx + 1);\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
 \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
+                       t._add(o, n, cb);\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
+                       return f;\r
+               },\r
 \r
-                                                       return;\r
-                                               }\r
+               remove : function(o, n, f) {\r
+                       var t = this, a = t.events, s = false, r;\r
 \r
-                                               // BR element\r
-                                               if (node.nodeName == 'BR') {\r
-                                                       if (start)\r
-                                                               rng.setStartBefore(node);\r
-                                                       else\r
-                                                               rng.setEndBefore(node);\r
+                       // Handle array\r
+                       if (o && o.hasOwnProperty && o instanceof Array) {\r
+                               r = [];\r
 \r
-                                                       return;\r
-                                               }\r
-                                       } while (node = (start ? walker.next() : walker.prev()));\r
-                               };\r
+                               each(o, function(o) {\r
+                                       o = DOM.get(o);\r
+                                       r.push(t.remove(o, n, f));\r
+                               });\r
 \r
-                               setPoint(node, 1);\r
-                               setPoint(node);\r
+                               return r;\r
                        }\r
 \r
-                       t.setRng(rng);\r
+                       o = DOM.get(o);\r
 \r
-                       return node;\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
+                               }\r
+                       });\r
+\r
+                       return s;\r
                },\r
 \r
-               isCollapsed : function() {\r
-                       var t = this, r = t.getRng(), s = t.getSel();\r
+               clear : function(o) {\r
+                       var t = this, a = t.events, i, e;\r
 \r
-                       if (!r || r.item)\r
-                               return false;\r
+                       if (o) {\r
+                               o = DOM.get(o);\r
 \r
-                       if (r.compareEndPoints)\r
-                               return r.compareEndPoints('StartToEnd', r) === 0;\r
+                               for (i = a.length - 1; i >= 0; i--) {\r
+                                       e = a[i];\r
 \r
-                       return !s || r.collapsed;\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
+                               }\r
+                       }\r
                },\r
 \r
-               collapse : function(b) {\r
-                       var t = this, r = t.getRng(), n;\r
+               cancel : function(e) {\r
+                       if (!e)\r
+                               return false;\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
+                       this.stop(e);\r
 \r
-                       r.collapse(!!b);\r
-                       t.setRng(r);\r
+                       return this.prevent(e);\r
                },\r
 \r
-               getSel : function() {\r
-                       var t = this, w = this.win;\r
+               stop : function(e) {\r
+                       if (e.stopPropagation)\r
+                               e.stopPropagation();\r
+                       else\r
+                               e.cancelBubble = true;\r
 \r
-                       return w.getSelection ? w.getSelection() : w.document.selection;\r
+                       return false;\r
                },\r
 \r
-               getRng : function(w3c) {\r
-                       var t = this, s, r;\r
+               prevent : function(e) {\r
+                       if (e.preventDefault)\r
+                               e.preventDefault();\r
+                       else\r
+                               e.returnValue = false;\r
 \r
-                       // Found tridentSel object then we need to use that one\r
-                       if (w3c && t.tridentSel)\r
-                               return t.tridentSel.getRangeAt(0);\r
+                       return false;\r
+               },\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
+               destroy : function() {\r
+                       var t = this;\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
+                       each(t.events, function(e, i) {\r
+                               t._remove(e.obj, e.name, e.cfunc);\r
+                               e.obj = e.cfunc = null;\r
+                       });\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
+                       t.events = [];\r
+                       t = null;\r
                },\r
 \r
-               setRng : function(r) {\r
-                       var s, t = this;\r
-                       \r
-                       if (!t.tridentSel) {\r
-                               s = t.getSel();\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
+               _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
-                               // Is IE specific range\r
+               _remove : function(o, n, f) {\r
+                       if (o) {\r
                                try {\r
-                                       r.select();\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
-                                       // Needed for some odd IE bug #1843306\r
+                                       // Might fail with permission denined on IE so we just ignore that\r
                                }\r
                        }\r
                },\r
 \r
-               setNode : function(n) {\r
+               _pageInit : function(win) {\r
                        var t = this;\r
 \r
-                       t.setContent(t.dom.getOuterHTML(n));\r
+                       // Keep it from running more than once\r
+                       if (t.domLoaded)\r
+                               return;\r
 \r
-                       return n;\r
+                       t.domLoaded = true;\r
+\r
+                       each(t.inits, function(c) {\r
+                               c();\r
+                       });\r
+\r
+                       t.inits = [];\r
                },\r
 \r
-               getNode : function() {\r
-                       var t = this, rng = t.getRng(), sel = t.getSel(), elm;\r
+               _wait : function(win) {\r
+                       var t = this, doc = win.document;\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
+                       // No need since the document is already loaded\r
+                       if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {\r
+                               t.domLoaded = 1;\r
+                               return;\r
+                       }\r
 \r
-                               elm = rng.commonAncestorContainer;\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
-                               // 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
+                               if (doc.documentElement.doScroll && win == win.top) {\r
+                                       (function() {\r
+                                               if (t.domLoaded)\r
+                                                       return;\r
+\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
 \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
+                                               t._pageInit(win);\r
+                                       })();\r
                                }\r
+                       } else if (doc.addEventListener) {\r
+                               t._add(win, 'DOMContentLoaded', function() {\r
+                                       t._pageInit(win);\r
+                               });\r
+                       }\r
 \r
-                               if (elm && elm.nodeType == 3)\r
-                                       return elm.parentNode;\r
+                       t._add(win, 'load', function() {\r
+                               t._pageInit(win);\r
+                       });\r
+               },\r
 \r
-                               return elm;\r
+               _stoppers : {\r
+                       preventDefault : function() {\r
+                               this.returnValue = false;\r
+                       },\r
+\r
+                       stopPropagation : function() {\r
+                               this.cancelBubble = true;\r
                        }\r
+               }\r
+       });\r
 \r
-                       return rng.item ? rng.item(0) : rng.parentElement();\r
-               },\r
+       Event = tinymce.dom.Event = new tinymce.dom.EventUtils();\r
 \r
-               getSelectedBlocks : function(st, en) {\r
-                       var t = this, dom = t.dom, sb, eb, n, bl = [];\r
+       // Dispatch DOM content loaded event for IE and Safari\r
+       Event._wait(window);\r
 \r
-                       sb = dom.getParent(st || t.getStart(), dom.isBlock);\r
-                       eb = dom.getParent(en || t.getEnd(), dom.isBlock);\r
+       tinymce.addUnload(function() {\r
+               Event.destroy();\r
+       });\r
+})(tinymce);\r
 \r
-                       if (sb)\r
-                               bl.push(sb);\r
+(function(tinymce) {\r
+       tinymce.dom.Element = function(id, settings) {\r
+               var t = this, dom, el;\r
 \r
-                       if (sb && eb && sb != eb) {\r
-                               n = sb;\r
+               t.settings = settings = settings || {};\r
+               t.id = id;\r
+               t.dom = dom = settings.dom || tinymce.DOM;\r
 \r
-                               while ((n = n.nextSibling) && n != eb) {\r
-                                       if (dom.isBlock(n))\r
-                                               bl.push(n);\r
-                               }\r
-                       }\r
+               // Only IE leaks DOM references, this is a lot faster\r
+               if (!tinymce.isIE)\r
+                       el = dom.get(t.id);\r
 \r
-                       if (eb && sb != eb)\r
-                               bl.push(eb);\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
-                       return bl;\r
-               },\r
+                                       for (i = 0; i < arguments.length; i++)\r
+                                               a.push(arguments[i]);\r
 \r
-               destroy : function(s) {\r
-                       var t = this;\r
+                                       a = dom[k].apply(dom, a);\r
+                                       t.update(k);\r
+\r
+                                       return a;\r
+                               };\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
+\r
+                       getXY : function() {\r
+                               return {\r
+                                       x : parseInt(t.getStyle('left')),\r
+                                       y : parseInt(t.getStyle('top'))\r
+                               };\r
+                       },\r
+\r
+                       getSize : function() {\r
+                               var n = dom.get(t.id);\r
+\r
+                               return {\r
+                                       w : parseInt(t.getStyle('width') || n.clientWidth),\r
+                                       h : parseInt(t.getStyle('height') || n.clientHeight)\r
+                               };\r
+                       },\r
+\r
+                       moveTo : function(x, y) {\r
+                               t.setStyles({left : x, top : y});\r
+                       },\r
+\r
+                       moveBy : function(x, y) {\r
+                               var p = t.getXY();\r
+\r
+                               t.moveTo(p.x + x, p.y + y);\r
+                       },\r
+\r
+                       resizeTo : function(w, h) {\r
+                               t.setStyles({width : w, height : h});\r
+                       },\r
+\r
+                       resizeBy : function(w, h) {\r
+                               var s = t.getSize();\r
 \r
-                       t.win = null;\r
+                               t.resizeTo(s.w + w, s.h + h);\r
+                       },\r
 \r
-                       if (t.tridentSel)\r
-                               t.tridentSel.destroy();\r
+                       update : function(k) {\r
+                               var b;\r
 \r
-                       // Manual destroy then remove unload handler\r
-                       if (!s)\r
-                               tinymce.removeUnload(t.destroy);\r
-               }\r
-       });\r
-})(tinymce);\r
+                               if (tinymce.isIE6 && settings.blocker) {\r
+                                       k = k || '';\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
+                                       // Ignore getters\r
+                                       if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)\r
+                                               return;\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
+                                       // Remove blocker on remove\r
+                                       if (k == 'remove') {\r
+                                               dom.remove(t.blocker);\r
+                                               return;\r
+                                       }\r
 \r
-                       this.reset();\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
 \r
-               reset : function() {\r
-                       var t = this, d = t.doc;\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 (d.firstChild)\r
-                               d.removeChild(d.firstChild);\r
+(function(tinymce) {\r
+       function trimNl(s) {\r
+               return s.replace(/[\n\r]+/g, '');\r
+       };\r
 \r
-                       t.node = d.appendChild(d.createElement("html"));\r
-               },\r
+       // Shorten names\r
+       var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;\r
 \r
-               writeStartElement : function(n) {\r
+       tinymce.create('tinymce.dom.Selection', {\r
+               Selection : function(dom, win, serializer) {\r
                        var t = this;\r
 \r
-                       t.node = t.node.appendChild(t.doc.createElement(n));\r
-               },\r
+                       t.dom = dom;\r
+                       t.win = win;\r
+                       t.serializer = serializer;\r
 \r
-               writeAttribute : function(n, v) {\r
-                       if (this.valid)\r
-                               v = v.replace(/>/g, '%MCGT%');\r
+                       // Add events\r
+                       each([\r
+                               'onBeforeSetContent',\r
 \r
-                       this.node.setAttribute(n, v);\r
-               },\r
+                               'onBeforeGetContent',\r
 \r
-               writeEndElement : function() {\r
-                       this.node = this.node.parentNode;\r
-               },\r
+                               'onSetContent',\r
 \r
-               writeFullEndElement : function() {\r
-                       var t = this, n = t.node;\r
+                               'onGetContent'\r
+                       ], function(e) {\r
+                               t[e] = new tinymce.util.Dispatcher(t);\r
+                       });\r
 \r
-                       n.appendChild(t.doc.createTextNode(""));\r
-                       t.node = n.parentNode;\r
-               },\r
+                       // No W3C Range support\r
+                       if (!t.win.getSelection)\r
+                               t.tridentSel = new tinymce.dom.TridentSelection(t);\r
 \r
-               writeText : function(v) {\r
-                       if (this.valid)\r
-                               v = v.replace(/>/g, '%MCGT%');\r
+                       if (tinymce.isIE && dom.boxModel)\r
+                               this._fixIESelection();\r
 \r
-                       this.node.appendChild(this.doc.createTextNode(v));\r
+                       // Prevent leaks\r
+                       tinymce.addUnload(t.destroy, t);\r
                },\r
 \r
-               writeCDATA : function(v) {\r
-                       this.node.appendChild(this.doc.createCDATASection(v));\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
-               writeComment : function(v) {\r
-                       // Fix for bug #2035694\r
-                       if (tinymce.isIE)\r
-                               v = v.replace(/^\-|\-$/g, ' ');\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
-                       this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));\r
-               },\r
+                       if (s.format == 'text')\r
+                               return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));\r
 \r
-               getContent : function() {\r
-                       var h;\r
+                       if (r.cloneContents) {\r
+                               n = r.cloneContents();\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
+                               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
 \r
-                       if (this.valid)\r
-                               h = h.replace(/\%MCGT%/g, '&gt;');\r
+                       // Keep whitespace before and after\r
+                       if (/^\s/.test(e.innerHTML))\r
+                               wb = ' ';\r
 \r
-                       return h;\r
-               }\r
-       });\r
-})(tinymce);\r
+                       if (/\s+$/.test(e.innerHTML))\r
+                               wa = ' ';\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
+                       s.getInner = true;\r
 \r
-                       this.reset();\r
-               },\r
+                       s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;\r
+                       t.onGetContent.dispatch(t, s);\r
 \r
-               reset : function() {\r
-                       this.indent = '';\r
-                       this.str = "";\r
-                       this.tags = [];\r
-                       this.count = 0;\r
+                       return s.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
-               },\r
+               setContent : function(content, args) {\r
+                       var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;\r
 \r
-               writeAttribute : function(n, v) {\r
-                       var t = this;\r
+                       args = args || {format : 'html'};\r
+                       args.set = true;\r
+                       content = args.content = content;\r
 \r
-                       t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"');\r
-               },\r
+                       // Dispatch before set content event\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
 \r
-               writeEndElement : function() {\r
-                       var n;\r
+                       content = args.content;\r
 \r
-                       if (this.tags.length > 0) {\r
-                               n = this.tags.pop();\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
-                               if (this._writeAttributesEnd(1))\r
-                                       this.writeRaw('</' + n + '>');\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
-                               if (this.settings.indentation > 0)\r
-                                       this.writeRaw('\n');\r
-                       }\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
-               writeFullEndElement : function() {\r
-                       if (this.tags.length > 0) {\r
-                               this._writeAttributesEnd();\r
-                               this.writeRaw('</' + this.tags.pop() + '>');\r
+                                                       frag.appendChild(temp);\r
+                                                       temp.outerHTML = content;\r
 \r
-                               if (this.settings.indentation > 0)\r
-                                       this.writeRaw('\n');\r
-                       }\r
-               },\r
+                                                       rng.insertNode(frag);\r
+                                               }\r
+                                       }\r
+                               }\r
 \r
-               writeText : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw(this.encode(v));\r
-                       this.count++;\r
-               },\r
+                               // Move to caret marker\r
+                               caretNode = self.dom.get('__caret');\r
 \r
-               writeCDATA : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw('<![CDATA[' + v + ']]>');\r
-                       this.count++;\r
-               },\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
-               writeComment : function(v) {\r
-                       this._writeAttributesEnd();\r
-                       this.writeRaw('<!-- ' + v + '-->');\r
-                       this.count++;\r
-               },\r
+                               // Remove the caret position\r
+                               self.dom.remove('__caret');\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
+                               rng.pasteHTML(content);\r
+                       }\r
 \r
-               writeRaw : function(v) {\r
-                       this.str += v;\r
+                       // Dispatch set content event\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
                },\r
 \r
-               encode : function(s) {\r
-                       return s.replace(/[<>&"]/g, function(v) {\r
-                               switch (v) {\r
-                                       case '<':\r
-                                               return '&lt;';\r
+               getStart : function() {\r
+                       var rng = this.getRng(), startElement, parentElement, checkRng, node;\r
 \r
-                                       case '>':\r
-                                               return '&gt;';\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Control selection, return first item\r
+                               if (rng.item)\r
+                                       return rng.item(0);\r
 \r
-                                       case '&':\r
-                                               return '&amp;';\r
+                               // Get start element\r
+                               checkRng = rng.duplicate();\r
+                               checkRng.collapse(1);\r
+                               startElement = checkRng.parentElement();\r
 \r
-                                       case '"':\r
-                                               return '&quot;';\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
-                               return v;\r
-                       });\r
-               },\r
-\r
-               getContent : function() {\r
-                       return this.str;\r
-               },\r
+                               return startElement;\r
+                       } else {\r
+                               startElement = rng.startContainer;\r
 \r
-               _writeAttributesEnd : function(s) {\r
-                       if (!this.inAttr)\r
-                               return;\r
+                               if (startElement.nodeType == 1 && startElement.hasChildNodes())\r
+                                       startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];\r
 \r
-                       this.inAttr = false;\r
+                               if (startElement && startElement.nodeType == 3)\r
+                                       return startElement.parentNode;\r
 \r
-                       if (s && this.elementCount == this.count) {\r
-                               this.writeRaw(' />');\r
-                               return false;\r
+                               return startElement;\r
                        }\r
+               },\r
 \r
-                       this.writeRaw('>');\r
+               getEnd : function() {\r
+                       var t = this, r = t.getRng(), e, eo;\r
 \r
-                       return true;\r
-               }\r
-       });\r
-})(tinymce);\r
+                       if (r.duplicate || r.item) {\r
+                               if (r.item)\r
+                                       return r.item(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
+                               r = r.duplicate();\r
+                               r.collapse(0);\r
+                               e = r.parentElement();\r
 \r
-       function wildcardToRE(s) {\r
-               return s.replace(/([?+*])/g, '.$1');\r
-       };\r
+                               if (e && e.nodeName == 'BODY')\r
+                                       return e.lastChild || e;\r
 \r
-       tinymce.create('tinymce.dom.Serializer', {\r
-               Serializer : function(s) {\r
-                       var t = this;\r
+                               return e;\r
+                       } else {\r
+                               e = r.endContainer;\r
+                               eo = r.endOffset;\r
 \r
-                       t.key = 0;\r
-                       t.onPreProcess = new Dispatcher(t);\r
-                       t.onPostProcess = new Dispatcher(t);\r
+                               if (e.nodeType == 1 && e.hasChildNodes())\r
+                                       e = e.childNodes[eo > 0 ? eo - 1 : eo];\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
+                               if (e && e.nodeType == 3)\r
+                                       return e.parentNode;\r
+\r
+                               return e;\r
                        }\r
+               },\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
+               getBookmark : function(type, normalized) {\r
+                       var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;\r
 \r
-                       t.dom = s.dom;\r
-                       t.schema = s.schema;\r
+                       function findIndex(name, element) {\r
+                               var index = 0;\r
 \r
-                       // Use raw entities if no entities are defined\r
-                       if (s.entity_encoding == 'named' && !s.entities)\r
-                               s.entity_encoding = 'raw';\r
+                               each(dom.select(name), function(node, i) {\r
+                                       if (node == element)\r
+                                               index = i;\r
+                               });\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 index;\r
+                       };\r
 \r
-                                               return a;\r
-                                       });\r
-                               });\r
-                       }\r
+                       if (type == 2) {\r
+                               function getLocation() {\r
+                                       var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};\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
-                       }\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
-                       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
+                                               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 prevNode(e, n) {\r
-                                               var a = n.split(','), i;\r
+                                                       point.push(offset);\r
+                                               } else {\r
+                                                       childNodes = container.childNodes;\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
+                                                       if (offset >= childNodes.length && childNodes.length) {\r
+                                                               after = 1;\r
+                                                               offset = Math.max(0, childNodes.length - 1);\r
                                                        }\r
+\r
+                                                       point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);\r
                                                }\r
 \r
-                                               return null;\r
-                                       };\r
+                                               for (; container && container != root; container = container.parentNode)\r
+                                                       point.push(t.dom.nodeIndex(container, normalized));\r
 \r
-                                       for (x=0; x<a.length; x++) {\r
-                                               nl = t.dom.select(a[x], o.node);\r
+                                               return point;\r
+                                       };\r
 \r
-                                               for (i=0; i<nl.length; i++) {\r
-                                                       n = nl[i];\r
-                                                       p = n.parentNode;\r
+                                       bookmark.start = getPoint(rng, true);\r
 \r
-                                                       if (r.test(p.nodeName)) {\r
-                                                               np = prevNode(n, 'LI');\r
+                                       if (!t.isCollapsed())\r
+                                               bookmark.end = getPoint(rng);\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
-                                               }\r
-                                       }\r
-                               });\r
-                       }\r
+                                       return bookmark;\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
+                               if (t.tridentSel)\r
+                                       return t.tridentSel.getBookmark(type);\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
+                               return getLocation();\r
                        }\r
-               },\r
 \r
-               setEntities : function(s) {\r
-                       var t = this, a, i, l = {}, v;\r
-\r
-                       // No need to setup more than once\r
-                       if (t.entityLookup)\r
-                               return;\r
+                       // Handle simple range\r
+                       if (type)\r
+                               return {rng : t.getRng()};\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
+                       rng = t.getRng();\r
+                       id = dom.uniqueId();\r
+                       collapsed = tinyMCE.activeEditor.selection.isCollapsed();\r
+                       styles = 'overflow:hidden;line-height:0px';\r
 \r
-                               // Don't add default &amp; &quot; etc.\r
-                               if (v == 34 || v == 38 || v == 60 || v == 62)\r
-                                       continue;\r
+                       // Explorer method\r
+                       if (rng.duplicate || rng.item) {\r
+                               // Text selection\r
+                               if (!rng.item) {\r
+                                       rng2 = rng.duplicate();\r
 \r
-                               l[String.fromCharCode(a[i])] = a[i + 1];\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
-                               v = parseInt(a[i]).toString(16);\r
-                       }\r
+                                               // Insert end marker\r
+                                               if (!collapsed) {\r
+                                                       rng2.collapse(false);\r
 \r
-                       t.entityLookup = l;\r
-               },\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
-               setRules : function(s) {\r
-                       var t = this;\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
+                               } else {\r
+                                       // Control selection\r
+                                       element = rng.item(0);\r
+                                       name = element.nodeName;\r
 \r
-                       t._setup();\r
-                       t.rules = {};\r
-                       t.wildRules = [];\r
-                       t.validElements = {};\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
-                       return t.addRules(s);\r
-               },\r
+                               // W3C method\r
+                               rng2 = rng.cloneRange();\r
 \r
-               addRules : function(s) {\r
-                       var t = this, dr;\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
-                       if (!s)\r
-                               return;\r
+                               rng.collapse(true);\r
+                               rng.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_start', style : styles}, chr));\r
+                       }\r
 \r
-                       t._setup();\r
+                       t.moveToBookmark({id : id, keep : 1});\r
 \r
-                       each(s.split(','), function(s) {\r
-                               var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];\r
+                       return {id : id};\r
+               },\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
+                                                       if (!keep) {\r
+                                                               prev = marker.previousSibling;\r
+                                                               next = marker.nextSibling;\r
 \r
-                                       tn[i] = s = s.substring(x);\r
-                                       t.validElements[s] = 1;\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
-                                       // 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 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
-                                               // Store away default rule\r
-                                               if (tn[0] == '@')\r
-                                                       dr = ru;\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
-                                               t.rules[s] = ru;\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
-                               // set the new document in DOMUtils so createElement etc works\r
-                               oldDoc = t.dom.doc;\r
-                               t.dom.doc = doc;\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
-                       t.key = '' + (parseInt(t.key) + 1);\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
-                       // Pre process\r
-                       if (!o.no_events) {\r
-                               o.node = n;\r
-                               t.onPreProcess.dispatch(t, o);\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
+                       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
-                       // Post process\r
-                       o.content = t.writer.getContent();\r
+               setRng : function(r) {\r
+                       var s, t = this;\r
+                       \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
+                                       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
 \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
-\r
-                               // Restore CDATA sections\r
-                               h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');\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
+                               if (elm && elm.nodeType == 3)\r
+                                       return elm.parentNode;\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
+                               return elm;\r
                        }\r
 \r
-                       o.content = h;\r
+                       return rng.item ? rng.item(0) : rng.parentElement();\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, scopeName;\r
+               getSelectedBlocks : function(st, en) {\r
+                       var t = this, dom = t.dom, sb, eb, n, bl = [];\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
+                       sb = dom.getParent(st || t.getStart(), dom.isBlock);\r
+                       eb = dom.getParent(en || t.getEnd(), dom.isBlock);\r
 \r
-                                               iv = keep = false;\r
-                                               hc = n.hasChildNodes();\r
-                                               nn = n.getAttribute('_mce_name') || n.nodeName.toLowerCase();\r
+                       if (sb)\r
+                               bl.push(sb);\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
+                       if (sb && eb && sb != eb) {\r
+                               n = sb;\r
 \r
-                                               // Add correct prefix on IE\r
-                                               if (isIE) {\r
-                                                       scopeName = n.scopeName;\r
-                                                       if (scopeName && scopeName !== 'HTML' && scopeName !== 'html')\r
-                                                               nn = scopeName + ':' + nn;\r
-                                               }\r
+                               while ((n = n.nextSibling) && n != eb) {\r
+                                       if (dom.isBlock(n))\r
+                                               bl.push(n);\r
+                               }\r
+                       }\r
+\r
+                       if (eb && sb != eb)\r
+                               bl.push(eb);\r
 \r
-                                               // Remove mce prefix on IE needed for the abbr element\r
-                                               if (nn.indexOf('mce:') === 0)\r
-                                                       nn = nn.substring(4);\r
+                       return bl;\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
+               destroy : function(s) {\r
+                       var t = this;\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
+                       t.win = null;\r
 \r
-                                                               n._mce_serialized = t.key;\r
-                                                       }\r
+                       // Manual destroy then remove unload handler\r
+                       if (!s)\r
+                               tinymce.removeUnload(t.destroy);\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
-                                               }\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
-                                               // 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
+                       // Make HTML element unselectable since we are going to handle selection by hand\r
+                       doc.documentElement.unselectable = true;\r
 \r
-                                                       t.elementName = nn;\r
-                                               }\r
+                       // Return range from point or null if it failed\r
+                       function rngFromPoint(x, y) {\r
+                               var rng = body.createTextRange();\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
+                               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
-                                               nn = ru.name || nn;\r
-                                               closed = s.closed.test(nn);\r
+                               return rng;\r
+                       };\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
+                       // Fires while the selection is changing\r
+                       function selectionChange(e) {\r
+                               var pointRng;\r
 \r
-                                               // Check required\r
-                                               if (ru.requiredAttribs) {\r
-                                                       a = ru.requiredAttribs;\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
-                                                       for (i = a.length - 1; i >= 0; i--) {\r
-                                                               if (this.dom.getAttrib(n, a[i]) !== '')\r
-                                                                       break;\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
-                                                       // None of the required was there\r
-                                                       if (i == -1) {\r
-                                                               iv = true;\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
+                                               pointRng.select();\r
+                                       }\r
+                               } else\r
+                                       endSelection();\r
+                       }\r
 \r
-                                               w.writeStartElement(nn);\r
+                       // Removes listeners\r
+                       function endSelection() {\r
+                               var rng = doc.selection.createRange();\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
+                               // 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
-                                                               if (v !== null)\r
-                                                                       w.writeAttribute(a.name, v);\r
-                                                       }\r
-                                               }\r
+                               dom.unbind(doc, 'mouseup', endSelection);\r
+                               dom.unbind(doc, 'mousemove', selectionChange);\r
+                               startRng = started = 0;\r
+                       };\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
+                       // 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
+                                       // 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
-                                                               if (no.specified) {\r
-                                                                       a = no.nodeName.toLowerCase();\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
-                                                                       if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))\r
-                                                                               continue;\r
+                                               dom.win.focus();\r
+                                               startRng.select();\r
+                                       }\r
+                               }\r
+                       });\r
+               }\r
+       });\r
+})(tinymce);\r
 \r
-                                                                       ar = t.findAttribRule(ru, a);\r
-                                                                       v = t._getAttrib(n, ar, a);\r
+(function(tinymce) {\r
+       tinymce.dom.Serializer = function(settings, dom, schema) {\r
+               var onPreProcess, onPostProcess, isIE = tinymce.isIE, each = tinymce.each, htmlParser;\r
 \r
-                                                                       if (v !== null)\r
-                                                                               w.writeAttribute(a, v);\r
-                                                               }\r
-                                                       }\r
-                                               }\r
+               // Support the old apply_source_formatting option\r
+               if (!settings.apply_source_formatting)\r
+                       settings.indent = false;\r
 \r
-                                               // Keep type attribute\r
-                                               if (type && keep)\r
-                                                       w.writeAttribute('_mce_type', type);\r
+               settings.remove_trailing_brs = true;\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
+               // 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
 \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
+               onPreProcess = new tinymce.util.Dispatcher(self);\r
 \r
-                                               break;\r
+               onPostProcess = new tinymce.util.Dispatcher(self);\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
+               htmlParser = new tinymce.html.DomParser(settings, schema);\r
 \r
-                                               return w.writeText(n.nodeValue);\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
-                                       case 4: // CDATA\r
-                                               return w.writeCDATA(n.nodeValue);\r
+                       while (i--) {\r
+                               node = nodes[i];\r
 \r
-                                       case 8: // Comment\r
-                                               return w.writeComment(n.nodeValue);\r
-                               }\r
-                       } else if (n.nodeType == 1)\r
-                               hc = n.hasChildNodes();\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
-                       if (hc && !closed) {\r
-                               cn = n.firstChild;\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
-                               while (cn) {\r
-                                       t._serializeNode(cn);\r
-                                       t.elementName = nn;\r
-                                       cn = cn.nextSibling;\r
+                                       node.attr(name, value.length > 0 ? value : null);\r
                                }\r
                        }\r
+               });\r
 \r
-                       // Write element end\r
-                       if (!iv) {\r
-                               if (!closed)\r
-                                       w.writeFullEndElement();\r
-                               else\r
-                                       w.writeEndElement();\r
-                       }\r
-               },\r
+               // Remove internal classes mceItem<..>\r
+               htmlParser.addAttributeFilter('class', function(nodes, name) {\r
+                       var i = nodes.length, node, value;\r
 \r
-               _protect : function(o) {\r
-                       var t = this;\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
-                       o.items = o.items || [];\r
+               // Remove bookmark elements\r
+               htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) {\r
+                       var i = nodes.length, node;\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
+                       while (i--) {\r
+                               node = nodes[i];\r
 \r
-                                       return '\\r';\r
-                               });\r
-                       };\r
+                               if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup)\r
+                                       node.remove();\r
+                       }\r
+               });\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
+               // 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
-                                       return '\r';\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\[|<!--|<!\[CDATA\[)[\r\n]*/g, '')\r
+                                               .replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');\r
                        };\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
-\r
-                                       if (p.encode)\r
-                                               b = t._encode(b);\r
+                       while (i--) {\r
+                               node = nodes[i];\r
+                               value = node.firstChild ? node.firstChild.value : '';\r
 \r
-                                       o.items.push(b);\r
-                                       return a + '<!--mce:' + (o.items.length - 1) + '-->' + c;\r
-                               }));\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
-                       return o;\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
-               _unprotect : function(h, o) {\r
-                       h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {\r
-                               return o.items[parseInt(b)];\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
-                       o.items = [];\r
+                       while (i--) {\r
+                               node = nodes[i];\r
 \r
-                       return h;\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
-               _encode : function(h) {\r
-                       var t = this, s = t.settings, l;\r
+               htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) {\r
+                       var i = nodes.length, node;\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
+                               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
-                                       h = h.replace(/[\u007E-\uFFFF]/g, function(a) {\r
-                                               var v;\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
-                                               if (v = l[a])\r
-                                                       a = '&' + v + ';';\r
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       parentNode = node.parent;\r
 \r
-                                               return a;\r
-                                       });\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.entity_encoding.indexOf('numeric') != -1) {\r
-                                       h = h.replace(/[\u007E-\uFFFF]/g, function(a) {\r
-                                               return '&#' + a.charCodeAt(0) + ';';\r
-                                       });\r
-                               }\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
+                       while (i--) {\r
+                               nodes[i].attr(name, null);\r
                        }\r
+               });\r
 \r
-                       return h;\r
-               },\r
+               // Return public methods\r
+               return {\r
+                       schema : schema,\r
 \r
-               _setup : function() {\r
-                       var t = this, s = this.settings;\r
+                       addNodeFilter : htmlParser.addNodeFilter,\r
 \r
-                       if (t.done)\r
-                               return;\r
+                       addAttributeFilter : htmlParser.addAttributeFilter,\r
 \r
-                       t.done = 1;\r
+                       onPreProcess : onPreProcess,\r
 \r
-                       t.setRules(s.valid_elements);\r
-                       t.addRules(s.extended_valid_elements);\r
+                       onPostProcess : onPostProcess,\r
 \r
-                       if (s.invalid_elements)\r
-                               t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');\r
+                       serialize : function(node, args) {\r
+                               var impl, doc, oldDoc, htmlSerializer, content;\r
 \r
-                       if (s.attrib_value_filter)\r
-                               t.attribValueFilter = s.attribValueFilter;\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').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
-               _getAttrib : function(n, a, na) {\r
-                       var i, v;\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
-                       na = na || a.name;\r
+                                       // set the new document in DOMUtils so createElement etc works\r
+                                       oldDoc = dom.doc;\r
+                                       dom.doc = doc;\r
+                               }\r
 \r
-                       if (a.forcedVal && (v = a.forcedVal)) {\r
-                               if (v === '{$uid}')\r
-                                       return this.dom.uniqueId();\r
+                               args = args || {};\r
+                               args.format = args.format || 'html';\r
 \r
-                               return v;\r
-                       }\r
+                               // Pre process\r
+                               if (!args.no_events) {\r
+                                       args.node = node;\r
+                                       onPreProcess.dispatch(self, args);\r
+                               }\r
 \r
-                       v = this.dom.getAttrib(n, na);\r
+                               // Setup serializer\r
+                               htmlSerializer = new tinymce.html.Serializer(settings, schema);\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
+                               // 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
-                                       break;\r
-                       }\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/g, '');\r
 \r
-                       if (this.attribValueFilter)\r
-                               v = this.attribValueFilter(na, v, n);\r
+                               // Post process\r
+                               if (!args.no_events)\r
+                                       onPostProcess.dispatch(self, args);\r
 \r
-                       if (a.validVals) {\r
-                               for (i = a.validVals.length - 1; i >= 0; i--) {\r
-                                       if (v == a.validVals[i])\r
-                                               break;\r
-                               }\r
+                               // Restore the old document if it was changed\r
+                               if (oldDoc)\r
+                                       dom.doc = oldDoc;\r
 \r
-                               if (i == -1)\r
-                                       return null;\r
-                       }\r
+                               args.node = null;\r
 \r
-                       if (v === '' && typeof(a.defaultVal) != 'undefined') {\r
-                               v = a.defaultVal;\r
+                               return args.content;\r
+                       },\r
 \r
-                               if (v === '{$uid}')\r
-                                       return this.dom.uniqueId();\r
+                       addRules : function(rules) {\r
+                               schema.addValidElements(rules);\r
+                       },\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
+                       setRules : function(rules) {\r
+                               schema.setValidElements(rules);\r
                        }\r
-\r
-                       if (v === '')\r
-                               return null;\r
-\r
-\r
-                       return v;\r
-               }\r
-       });\r
+               };\r
+       };\r
 })(tinymce);\r
-\r
 (function(tinymce) {\r
        tinymce.dom.ScriptLoader = function(settings) {\r
                var QUEUED = 0,\r
@@ -5954,6 +8247,17 @@ tinymce.create('static tinymce.util.XHR', {
 \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
@@ -5963,7 +8267,7 @@ tinymce.create('static tinymce.util.XHR', {
 \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
@@ -5978,7 +8282,9 @@ tinymce.create('static tinymce.util.XHR', {
                                                        dom.remove(script);\r
 \r
                                                        done();\r
-                                               }\r
+                                               },\r
+                                               \r
+                                               error : error\r
                                        });\r
 \r
                                        return;\r
@@ -5992,17 +8298,26 @@ tinymce.create('static tinymce.util.XHR', {
                                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
@@ -6123,191 +8438,37 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
                if (node) {\r
                        // Walk into nodes if it has a start\r
                        if (!shallow && node[start_name])\r
-                               return node[start_name];\r
-\r
-                       // Return the sibling if it has one\r
-                       if (node != root_node) {\r
-                               sibling = node[sibling_name];\r
-                               if (sibling)\r
-                                       return sibling;\r
-\r
-                               // Walk up the parents to look for siblings\r
-                               for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {\r
-                                       sibling = parent[sibling_name];\r
-                                       if (sibling)\r
-                                               return sibling;\r
-                               }\r
-                       }\r
-               }\r
-       };\r
-\r
-       this.current = function() {\r
-               return node;\r
-       };\r
-\r
-       this.next = function(shallow) {\r
-               return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));\r
-       };\r
-\r
-       this.prev = function(shallow) {\r
-               return (node = findSibling(node, 'lastChild', 'lastSibling', 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
+                               return node[start_name];\r
 \r
-                       for (i = children.length - 1; i >= 0; i--)\r
-                               map[children[i]] = 1;\r
+                       // Return the sibling if it has one\r
+                       if (node != root_node) {\r
+                               sibling = node[sibling_name];\r
+                               if (sibling)\r
+                                       return sibling;\r
 \r
-                       transitional[name] = map;\r
-               });\r
+                               // Walk up the parents to look for siblings\r
+                               for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {\r
+                                       sibling = parent[sibling_name];\r
+                                       if (sibling)\r
+                                               return sibling;\r
+                               }\r
+                       }\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
+       this.current = function() {\r
+               return node;\r
+       };\r
 \r
-               t.isValid = function(name, child_name) {\r
-                       var element = elements[name];\r
+       this.next = function(shallow) {\r
+               return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));\r
+       };\r
 \r
-                       return !!(element && (!child_name || element[child_name]));\r
-               };\r
+       this.prev = function(shallow) {\r
+               return (node = findSibling(node, 'lastChild', 'previousSibling', shallow));\r
        };\r
-})();\r
+};\r
+\r
 (function(tinymce) {\r
        tinymce.dom.RangeUtils = function(dom) {\r
                var INVISIBLE_CHAR = '\uFEFF';\r
@@ -6371,7 +8532,7 @@ 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
+                               endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)];\r
 \r
                        // Find common ancestor and end points\r
                        ancestor = dom.findCommonAncestor(startContainer, endContainer);\r
@@ -6491,12 +8652,158 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
        };\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
+                       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
 (function(tinymce) {\r
        // Shorten class names\r
        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
@@ -6505,22 +8812,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
@@ -6536,6 +8844,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
@@ -6593,8 +8902,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
@@ -6618,10 +8927,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
@@ -6636,6 +8946,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
@@ -6783,12 +9094,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
@@ -6912,13 +9231,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
@@ -6928,6 +9247,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
@@ -6972,8 +9292,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
@@ -6984,15 +9307,18 @@ 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
+                       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
@@ -7005,33 +9331,36 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                },\r
 \r
                // Internal functions\r
+               _setupKeyboardNav : function(){\r
+                       var contextMenu, menuItems, t=this; \r
+                       contextMenu = DOM.select('#menu_' + t.id)[0];\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
-               _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
+               _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
@@ -7049,8 +9378,13 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        }\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
+                       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
+                       if (s.parent) {\r
+                               DOM.setAttrib(a, 'aria-haspopup', 'true');\r
+                               DOM.setAttrib(a, 'aria-owns', 'menu_' + o.id);\r
+                       }\r
 \r
                        DOM.addClass(it, s['class']);\r
 //                     n = DOM.add(n, 'span', {'class' : 'item'});\r
@@ -7085,8 +9419,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        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
+               Button : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
                        this.classPrefix = 'mceButton';\r
                },\r
 \r
@@ -7094,13 +9428,14 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        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
+                       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>' : '') + '</a>';\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
@@ -7119,10 +9454,10 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        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
+               ListBox : function(id, s, ed) {\r
                        var t = this;\r
 \r
-                       t.parent(id, s);\r
+                       t.parent(id, s, ed);\r
 \r
                        t.items = [];\r
 \r
@@ -7180,12 +9515,13 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                        t.selectedIndex = idx;\r
                                        DOM.setHTML(e, DOM.encode(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.addClass(e, 'mceTitle');\r
                                        t.selectedValue = t.selectedIndex = null;\r
+                                       DOM.setAttrib(t.id, 'aria-valuenow', t.settings.title);\r
                                }\r
-\r
                                e = 0;\r
                        }\r
                },\r
@@ -7210,16 +9546,17 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                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
+                       h = '<span role="button" aria-haspopup="true" aria-labelledby="' + t.id +'_text" 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(this.id), m;\r
+                       var t = this, p2, e = DOM.get(this.id), m;\r
 \r
                        if (t.isDisabled() || t.items.length == 0)\r
                                return;\r
@@ -7232,7 +9569,6 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                t.isMenuRendered = true;\r
                        }\r
 \r
-                       p1 = DOM.getPos(this.settings.menu_container);\r
                        p2 = DOM.getPos(e);\r
 \r
                        m = t.menu;\r
@@ -7263,6 +9599,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        var t = this;\r
 \r
                        if (t.menu && t.menu.isMenuVisible) {\r
+                               DOM.removeClass(t.id, t.classPrefix + 'Selected');\r
+\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
@@ -7285,7 +9623,10 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                max_height : 150\r
                        });\r
 \r
-                       m.onHideMenu.add(t.hideMenu, t);\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
 \r
                        m.add({\r
                                title : t.settings.title,\r
@@ -7326,40 +9667,39 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        var t = this, cp = t.classPrefix;\r
 \r
                        Event.add(t.id, 'click', t.showMenu, t);\r
-                       Event.add(t.id + '_text', 'focus', function() {\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
+                       Event.add(t.id, '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
-\r
-                                               // Find current index\r
-                                               each(t.items, function(v, i) {\r
-                                                       if (t.selectedValue == v.value)\r
-                                                               idx = i;\r
-                                               });\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
+                                       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
-                                                       return Event.cancel(e);\r
-                                               }\r
-\r
-                                               if (v) {\r
-                                                       t.hideMenu();\r
-                                                       t.select(v.value);\r
                                                }\r
                                        });\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
+                       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
                        // Old IE doesn't have hover on all elements\r
                        if (tinymce.isIE6 || !DOM.boxModel) {\r
@@ -7396,6 +9736,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
 \r
                setDisabled : function(s) {\r
                        DOM.get(this.id).disabled = s;\r
+                       this.setAriaProperty('disabled', s);\r
                },\r
 \r
                isDisabled : function() {\r
@@ -7470,13 +9811,13 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                h += DOM.createHTML('option', {value : it.value}, it.title);\r
                        });\r
 \r
-                       h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h);\r
-\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
                postRender : function() {\r
-                       var t = this, ch;\r
+                       var t = this, ch, changeListenerAdded = true;\r
 \r
                        t.rendered = true;\r
 \r
@@ -7498,8 +9839,11 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                var bf;\r
 \r
                                Event.remove(t.id, 'change', ch);\r
+                               changeListenerAdded = false;\r
 \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
@@ -7518,8 +9862,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;\r
 \r
        tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {\r
-               MenuButton : function(id, s) {\r
-                       this.parent(id, s);\r
+               MenuButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
 \r
                        this.onRenderMenu = new tinymce.util.Dispatcher(this);\r
 \r
@@ -7566,7 +9910,10 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                icons : t.settings.icons\r
                        });\r
 \r
-                       m.onHideMenu.add(t.hideMenu, t);\r
+                       m.onHideMenu.add(function() {\r
+                               t.hideMenu();\r
+                               t.focus();\r
+                       });\r
 \r
                        t.onRenderMenu.dispatch(t, m);\r
                        t.menu = m;\r
@@ -7608,8 +9955,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        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
+               SplitButton : function(id, s, ed) {\r
+                       this.parent(id, s, ed);\r
                        this.classPrefix = 'mceSplitButton';\r
                },\r
 \r
@@ -7619,33 +9966,50 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        h = '<tbody><tr>';\r
 \r
                        if (s.image)\r
-                               h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']});\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
-                       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
+                       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']});\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
+                       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
                        h += '</tr></tbody>';\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
+                       h = DOM.createHTML('table', {id : t.id, role: 'presentation', tabindex: '0',  'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', title : s.title}, h);\r
+                       return DOM.createHTML('span', {role: 'button', 'aria-labelledby': t.id + '_voice', 'aria-haspopup': 'true'}, h);\r
                },\r
 \r
                postRender : function() {\r
-                       var t = this, s = t.settings;\r
+                       var t = this, s = t.settings, activate;\r
 \r
                        if (s.onclick) {\r
-                               Event.add(t.id + '_action', 'click', function() {\r
-                                       if (!t.isDisabled())\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
-                       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
+                       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
                        // Old IE doesn't have hover on all elements\r
                        if (tinymce.isIE6 || !DOM.boxModel) {\r
@@ -7666,6 +10030,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
 \r
                        Event.clear(this.id + '_action');\r
                        Event.clear(this.id + '_open');\r
+                       Event.clear(this.id);\r
                }\r
        });\r
 })(tinymce);\r
@@ -7674,10 +10039,10 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        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
+               ColorSplitButton : function(id, s, ed) {\r
                        var t = this;\r
 \r
-                       t.parent(id, s);\r
+                       t.parent(id, s, ed);\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
@@ -7735,30 +10100,30 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                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
-\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
+                       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
-                       t.onHideMenu.dispatch(t);\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
-                       t.isMenuVisible = 0;\r
+                               t.isMenuVisible = 0;\r
+                       }\r
                },\r
 \r
                renderMenu : function() {\r
-                       var t = this, m, i = 0, s = t.settings, n, tb, tr, w;\r
+                       var t = this, m, i = 0, s = t.settings, n, tb, tr, w, context;\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
+                       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
-                       n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'});\r
+                       n = DOM.add(m, 'table', {role: 'presentation', 'class' : 'mceColorSplitMenu'});\r
                        tb = DOM.add(n, 'tbody');\r
 \r
                        // Generate color grid\r
@@ -7772,20 +10137,32 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                                }\r
 \r
                                n = DOM.add(tr, 'td');\r
-\r
                                n = DOM.add(n, 'a', {\r
+                                       role : 'option',\r
                                        href : 'javascript:;',\r
                                        style : {\r
                                                backgroundColor : '#' + c\r
                                        },\r
-                                       _mce_color : '#' + c\r
+                                       'title': t.editor.getLang('colors.' + c, c),\r
+                                       'data-mce-color' : '#' + c\r
                                });\r
+\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', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);\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
@@ -7794,13 +10171,25 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                        }\r
 \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
+                       // 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
                        Event.add(t.id + '_menu', 'click', function(e) {\r
                                var c;\r
 \r
-                               e = e.target;\r
+                               e = DOM.getParent(e.target, 'a', tb);\r
 \r
-                               if (e.nodeName == 'A' && (c = e.getAttribute('_mce_color')))\r
+                               if (e && e.nodeName.toLowerCase() == 'a' && (c = e.getAttribute('data-mce-color')))\r
                                        t.setColor(c);\r
 \r
                                return Event.cancel(e); // Prevent IE auto save warning\r
@@ -7810,13 +10199,17 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
                },\r
 \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
                        DOM.setStyle(t.id + '_preview', 'backgroundColor', c);\r
 \r
                        t.value = c;\r
-                       t.hideMenu();\r
-                       t.settings.onselect(c);\r
                },\r
 \r
                postRender : function() {\r
@@ -7837,9 +10230,67 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
        });\r
 })(tinymce);\r
 \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
+               return h.join('');\r
+       },\r
+       \r
+       focus : function() {\r
+               this.keyNav.focus();\r
+       },\r
+       \r
+       postRender : function() {\r
+               var t = this, items = [];\r
+\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
+               t.keyNav = new tinymce.ui.KeyboardNavigation({\r
+                       root: t.id,\r
+                       items: items,\r
+                       onCancel: function() {\r
+                               t.editor.focus();\r
+                       },\r
+                       excludeFromTabOrder: !t.settings.tab_focus_toolbar\r
+               });\r
+       },\r
+       \r
+       destroy : function() {\r
+               var self = this;\r
+\r
+               self.parent();\r
+               self.keyNav.destroy();\r
+               Event.clear(self.id);\r
+       }\r
+});\r
+})(tinymce);\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, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;\r
+               var t = this, h = '', c, co, s = t.settings, i, pr, nx, cl;\r
 \r
                cl = t.controls;\r
                for (i=0; i<cl.length; i++) {\r
@@ -7896,50 +10347,102 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \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 || ''}, '<tbody><tr>' + h + '</tr></tbody>');\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
 (function(tinymce) {\r
        var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;\r
 \r
        tinymce.create('tinymce.AddOnManager', {\r
-               items : [],\r
-               urls : {},\r
-               lookup : {},\r
+               AddOnManager : function() {\r
+                       var self = this;\r
 \r
-               onAdd : new Dispatcher(this),\r
+                       self.items = [];\r
+                       self.urls = {};\r
+                       self.lookup = {};\r
+                       self.onAdd = new Dispatcher(self);\r
+               },\r
 \r
                get : function(n) {\r
-                       return this.lookup[n];\r
+                       if (this.lookup[n]) {\r
+                               return this.lookup[n].instance;\r
+                       } else {\r
+                               return undefined;\r
+                       }\r
+               },\r
+\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
                requireLangPack : function(n) {\r
                        var s = tinymce.settings;\r
 \r
-                       if (s && s.language)\r
+                       if (s && s.language && s.language_load !== false)\r
                                tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');\r
                },\r
 \r
-               add : function(id, o) {\r
+               add : function(id, o, dependencies) {\r
                        this.items.push(o);\r
-                       this.lookup[id] = o;\r
+                       this.lookup[id] = {instance:o, dependencies:dependencies};\r
                        this.onAdd.dispatch(this, id, o);\r
 \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
+               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
                load : function(n, u, cb, s) {\r
-                       var t = this;\r
+                       var t = this, url = u;\r
+\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
                        if (t.urls[n])\r
                                return;\r
+                       if (typeof u === "object")\r
+                               url = u.prefix + u.resource + u.suffix;\r
 \r
-                       if (u.indexOf('/') != 0 && u.indexOf('://') == -1)\r
-                               u = tinymce.baseURL + '/' +  u;\r
+                       if (url.indexOf('/') != 0 && url.indexOf('://') == -1)\r
+                               url = tinymce.baseURL + '/' + url;\r
 \r
-                       t.urls[n] = u.substring(0, u.lastIndexOf('/'));\r
-                       tinymce.ScriptLoader.add(u, cb, s);\r
+                       t.urls[n] = url.substring(0, url.lastIndexOf('/'));\r
+\r
+                       if (t.lookup[n]) {\r
+                               loadDependencies();\r
+                       } else {\r
+                               tinymce.ScriptLoader.add(url, loadDependencies, s);\r
+                       }\r
                }\r
        });\r
 \r
@@ -8122,11 +10625,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        self.onAddEditor.dispatch(self, editor);\r
 \r
 \r
-                       // Patch the tinymce.Editor instance with jQuery adapter logic\r
-                       if (tinymce.adapter)\r
-                               tinymce.adapter.patchEditor(editor);\r
-\r
-\r
                        return editor;\r
                },\r
 \r
@@ -8401,7 +10899,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                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
@@ -8411,7 +10908,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                keep_styles : 1,\r
                                fix_table_elements : 1,\r
                                inline_styles : 1,\r
-                               convert_fonts_to_spans : true\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',\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',\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
                        t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {\r
@@ -8420,6 +10925,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        t.baseURI = tinymce.baseURI;\r
 \r
+                       t.contentCSS = [];\r
+\r
                        // Call setup\r
                        t.execCallback('setup', t);\r
                },\r
@@ -8441,10 +10948,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (!t.getElement())\r
                                return;\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
+                       // 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
                        // Add hidden input for non input elements inside form elements\r
@@ -8509,19 +11016,30 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        // Load scripts\r
                        function loadScripts() {\r
-                               if (s.language)\r
+                               if (s.language && s.language_load !== false)\r
                                        sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');\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
 \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
-\r
-                                               PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');\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
@@ -8536,10 +11054,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                },\r
 \r
                init : function() {\r
-                       var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;\r
+                       var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re, i, initializedPlugins = [];\r
 \r
                        tinymce.add(t);\r
 \r
+                       s.aria_label = s.aria_label || DOM.getAttrib(e, 'aria-label', t.getLang('aria.rich_text_area'));\r
+\r
                        if (s.theme) {\r
                                s.theme = s.theme.replace(/-/, '');\r
                                o = ThemeManager.get(s.theme);\r
@@ -8548,20 +11068,25 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                if (t.theme.init && s.init_theme)\r
                                        t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));\r
                        }\r
-\r
-                       // Create all plugins\r
-                       each(explode(s.plugins.replace(/\-/g, '')), function(p) {\r
+                       function initPlugin(p) {\r
                                var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;\r
-\r
-                               if (c) {\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
                                        t.plugins[p] = po;\r
 \r
-                                       if (po.init)\r
+                                       if (po.init) {\r
                                                po.init(t, u);\r
+                                               initializedPlugins.push(p);\r
+                                       }\r
                                }\r
-                       });\r
+                       }\r
+                       \r
+                       // Create all plugins\r
+                       each(explode(s.plugins.replace(/\-/g, '')), initPlugin);\r
 \r
                        // Setup popup CSS path(s)\r
                        if (s.popup_css !== false) {\r
@@ -8577,12 +11102,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        t.controlManager = new tinymce.ControlManager(t);\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
-                                       }\r
+                                       if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))\r
+                                               t.undoManager.beforeChange();\r
                                });\r
 \r
                                t.onExecCommand.add(function(ed, cmd, ui, val, a) {\r
@@ -8648,6 +11170,13 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                height : h\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
                        h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');\r
                        if (h < 100)\r
                                h = 100;\r
@@ -8659,10 +11188,21 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (s.document_base_url != tinymce.documentBaseURL)\r
                                t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';\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
+                       // 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
+                       t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';\r
+\r
+                       // Firefox 2 doesn't load stylesheets correctly this way\r
+                       if (!isGecko || !/Firefox\/2/.test(navigator.userAgent)) {\r
+                               for (i = 0; i < t.contentCSS.length; i++)\r
+                                       t.iframeHTML += '<link type="text/css" rel="stylesheet" href="' + t.contentCSS[i] + '" />';\r
 \r
-                       if (tinymce.relaxedDomain)\r
-                               t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';\r
+                               t.contentCSS = [];\r
+                       }\r
 \r
                        bi = s.body_id || 'tinymce';\r
                        if (bi.indexOf('=') != -1) {\r
@@ -8679,19 +11219,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';\r
 \r
                        // Domain relaxing enabled, then set document domain\r
-                       if (tinymce.relaxedDomain) {\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
-                               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
+                               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
                        // Create iframe\r
-                       n = DOM.add(o.iframeContainer, '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
@@ -8701,45 +11241,78 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
-                       if (!isIE || !tinymce.relaxedDomain)\r
+                       if (!tinymce.relaxedDomain || !u)\r
                                t.setupIframe();\r
 \r
                        e = n = o = null; // Cleanup\r
                },\r
 \r
-               setupIframe : function() {\r
+               setupIframe : function(filled) {\r
                        var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;\r
 \r
                        // Setup iframe body\r
-                       if (!isIE || !tinymce.relaxedDomain) {\r
+                       if ((!isIE || !tinymce.relaxedDomain) && !filled) {\r
+                               // We need to wait for the load event on Gecko\r
+                               if (isGecko && !s.readonly) {\r
+                                       t.getWin().onload = function() {\r
+                                               window.setTimeout(function() {\r
+                                                       var b = t.getBody(), undef;\r
+\r
+                                                       // Editable element needs to have some contents or backspace/delete won't work properly for some odd reason on FF 3.6 or older\r
+                                                       b.innerHTML = '<br>';\r
+\r
+                                                       // Check if Gecko supports contentEditable mode FF2 doesn't\r
+                                                       if (b.contentEditable !== undef) {\r
+                                                               // Setting the contentEditable off/on seems to force caret mode in the editor and enabled auto focus\r
+                                                               b.contentEditable = false;\r
+                                                               b.contentEditable = true;\r
+\r
+                                                               // Caret doesn't get rendered when you mousedown on the HTML element on FF 3.x\r
+                                                               t.onMouseDown.add(function(ed, e) {\r
+                                                                       if (e.target.nodeName === "HTML") {\r
+                                                                               d.designMode = 'on'; // Render the caret\r
+\r
+                                                                               // Remove design mode again after a while so it has some time to execute\r
+                                                                               window.setTimeout(function() {\r
+                                                                                       d.designMode = 'off';\r
+                                                                                       t.getBody().focus();\r
+                                                                               }, 1);\r
+                                                                       }\r
+                                                               });\r
+                                                       } else\r
+                                                               d.designMode = 'on';\r
+\r
+                                                       // Call setup frame once the contentEditable/designMode has been initialized\r
+                                                       // since the caret won't be rendered some times otherwise.\r
+                                                       t.setupIframe(true);\r
+                                               }, 1);\r
+                                       };\r
+                               }\r
+\r
                                d.open();\r
                                d.write(t.iframeHTML);\r
                                d.close();\r
-                       }\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
+                               if (tinymce.relaxedDomain)\r
+                                       d.domain = tinymce.relaxedDomain;\r
+\r
+                               // Wait for iframe onload event on Gecko\r
+                               if (isGecko && !s.readonly)\r
+                                       return;\r
                        }\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
+                       // It will not steal focus while setting contentEditable\r
+                       b = t.getBody();\r
+                       b.disabled = true;\r
 \r
-                               if (!s.readonly)\r
-                                       b.contentEditable = true;\r
+                       if (!isGecko && !s.readonly)\r
+                               b.contentEditable = true;\r
 \r
-                               DOM.show(b);\r
-                       }\r
+                       b.disabled = false;\r
+\r
+                       t.schema = new tinymce.html.Schema(s);\r
 \r
                        t.dom = new tinymce.dom.DOMUtils(t.getDoc(), {\r
                                keep_values : true,\r
@@ -8749,16 +11322,83 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                class_filter : s.class_filter,\r
                                update_styles : 1,\r
                                fix_ie_paragraphs : 1,\r
-                               valid_styles : s.valid_styles\r
+                               schema : t.schema\r
                        });\r
 \r
-                       t.schema = new tinymce.dom.Schema();\r
+                       t.parser = new tinymce.html.DomParser(s, t.schema);\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
+                       // 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
+                       // 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
+                               while (i--) {\r
+                                       node = nodes[i];\r
+                                       value = node.attr(name);\r
+                                       internalName = 'data-mce-' + name;\r
+\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
+                                                       node.attr(internalName, t.convertURL(value, name, node.name));\r
+                                       }\r
+                               }\r
+                       });\r
+\r
+                       // Keep scripts from executing\r
+                       t.parser.addNodeFilter('script', function(nodes, name) {\r
+                               var i = nodes.length;\r
+\r
+                               while (i--)\r
+                                       nodes[i].attr('type', 'mce-text/javascript');\r
+                       });\r
+\r
+                       t.parser.addNodeFilter('#cdata', function(nodes, name) {\r
+                               var i = nodes.length, node;\r
+\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
+                       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
+                               while (i--) {\r
+                                       node = nodes[i];\r
+\r
+                                       if (node.isEmpty(nonEmptyElements))\r
+                                               node.empty().append(new tinymce.html.Node('br', 1)).shortEnded = true;\r
+                               }\r
+                       });\r
+\r
+                       t.serializer = new tinymce.dom.Serializer(s, t.dom, t.schema);\r
 \r
                        t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);\r
 \r
@@ -8768,18 +11408,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}\r
                                ],\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
+                                       {selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},\r
+                                       {selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}\r
                                ],\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
+                                       {selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}\r
                                ],\r
 \r
                                alignfull : [\r
@@ -8787,33 +11427,35 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                ],\r
 \r
                                bold : [\r
-                                       {inline : 'strong'},\r
+                                       {inline : 'strong', remove : 'all'},\r
                                        {inline : 'span', styles : {fontWeight : 'bold'}},\r
-                                       {inline : 'b'}\r
+                                       {inline : 'b', remove : 'all'}\r
                                ],\r
 \r
                                italic : [\r
-                                       {inline : 'em'},\r
+                                       {inline : 'em', remove : 'all'},\r
                                        {inline : 'span', styles : {fontStyle : 'italic'}},\r
-                                       {inline : 'i'}\r
+                                       {inline : 'i', remove : 'all'}\r
                                ],\r
 \r
                                underline : [\r
                                        {inline : 'span', styles : {textDecoration : 'underline'}, exact : true},\r
-                                       {inline : 'u'}\r
+                                       {inline : 'u', remove : 'all'}\r
                                ],\r
 \r
                                strikethrough : [\r
                                        {inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},\r
-                                       {inline : 'u'}\r
+                                       {inline : 'strike', remove : 'all'}\r
                                ],\r
 \r
-                               forecolor : {inline : 'span', styles : {color : '%value'}},\r
-                               hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}},\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
                                removeformat : [\r
                                        {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},\r
@@ -8834,7 +11476,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        // Pass through\r
                        t.undoManager.onAdd.add(function(um, l) {\r
-                               if (!l.initial)\r
+                               if (um.hasUndo())\r
                                        return t.onChange.dispatch(t, l, um);\r
                        });\r
 \r
@@ -8878,29 +11520,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (s.nowrap)\r
                                t.getBody().style.whiteSpace = "nowrap";\r
 \r
-                       if (s.custom_elements) {\r
-                               function handleCustom(ed, o) {\r
-                                       each(explode(s.custom_elements), function(v) {\r
-                                               var n;\r
-\r
-                                               if (v.indexOf('~') === 0) {\r
-                                                       v = v.substring(1);\r
-                                                       n = 'span';\r
-                                               } else\r
-                                                       n = 'div';\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
-\r
-                               t.onBeforeSetContent.add(handleCustom);\r
-                               t.onPostProcess.add(function(ed, o) {\r
-                                       if (o.set)\r
-                                               handleCustom(ed, o);\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
@@ -8922,16 +11541,22 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                });\r
                        }\r
 \r
-                       if (s.convert_newlines_to_brs) {\r
+                       if (s.protect) {\r
                                t.onBeforeSetContent.add(function(ed, o) {\r
-                                       if (o.initial)\r
-                                               o.content = o.content.replace(/\r?\n/g, '<br />');\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
-                       if (s.fix_nesting && isIE) {\r
+                       if (s.convert_newlines_to_brs) {\r
                                t.onBeforeSetContent.add(function(ed, o) {\r
-                                       o.content = t._fixNesting(o.content);\r
+                                       if (o.initial)\r
+                                               o.content = o.content.replace(/\r?\n/g, '<br />');\r
                                });\r
                        }\r
 \r
@@ -9028,7 +11653,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                var pn = n.parentNode;\r
 \r
                                                if (ed.dom.isBlock(pn) && pn.lastChild === n)\r
-                                                       ed.dom.add(pn, 'br', {'_mce_bogus' : 1});\r
+                                                       ed.dom.add(pn, 'br', {'data-mce-bogus' : 1});\r
                                        });\r
                                };\r
 \r
@@ -9038,54 +11663,36 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                });\r
 \r
                                t.onSetContent.add(t.selection.onSetContent.add(fixLinks));\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
                        }\r
 \r
-                       // A small timeout was needed since firefox will remove. Bug: #1838304\r
-                       setTimeout(function () {\r
-                               if (t.removed)\r
-                                       return;\r
+                       t.load({initial : true, format : 'html'});\r
+                       t.startContent = t.getContent({format : 'raw'});\r
+                       t.undoManager.add();\r
+                       t.initialized = true;\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
+                       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
-                               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
+                       // Load specified content CSS last\r
+                       each(t.contentCSS, function(u) {\r
+                               t.dom.loadCSS(u);\r
+                       });\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
+                       // Handle auto focus\r
+                       if (s.auto_focus) {\r
+                               setTimeout(function () {\r
+                                       var ed = tinymce.get(s.auto_focus);\r
 \r
-                               // Handle auto focus\r
-                               if (s.auto_focus) {\r
-                                       setTimeout(function () {\r
-                                               var ed = tinymce.get(s.auto_focus);\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
-                                               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
 \r
@@ -9188,7 +11795,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                },\r
 \r
                nodeChanged : function(o) {\r
-                       var t = this, s = t.selection, n = (isIE ? s.getNode() : s.getStart()) || t.getBody();\r
+                       var t = this, s = t.selection, n = s.getStart() || t.getBody();\r
 \r
                        // Fix for bug #1896577 it seems that this can not be fired while the editor is loading\r
                        if (t.initialized) {\r
@@ -9221,16 +11828,16 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        t.buttons[n] = s;\r
                },\r
 \r
-               addCommand : function(n, f, s) {\r
-                       this.execCommands[n] = {func : f, scope : s || this};\r
+               addCommand : function(name, callback, scope) {\r
+                       this.execCommands[name] = {func : callback, scope : scope || this};\r
                },\r
 \r
-               addQueryStateHandler : function(n, f, s) {\r
-                       this.queryStateCommands[n] = {func : f, scope : s || this};\r
+               addQueryStateHandler : function(name, callback, scope) {\r
+                       this.queryStateCommands[name] = {func : callback, scope : scope || this};\r
                },\r
 \r
-               addQueryValueHandler : function(n, f, s) {\r
-                       this.queryValueCommands[n] = {func : f, scope : s || this};\r
+               addQueryValueHandler : function(name, callback, scope) {\r
+                       this.queryValueCommands[name] = {func : callback, scope : scope || this};\r
                },\r
 \r
                addShortcut : function(pa, desc, cmd_func, sc) {\r
@@ -9333,12 +11940,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                return true;\r
                        }\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
-\r
                        // Editor commands\r
                        if (t.editorCommands.execCommand(cmd, ui, val)) {\r
                                t.onExecCommand.dispatch(t, cmd, ui, val, a);\r
@@ -9470,7 +12071,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        // Add undo level will trigger onchange event\r
                        if (!o.no_events) {\r
-                               t.undoManager.typing = 0;\r
+                               t.undoManager.typing = false;\r
                                t.undoManager.add();\r
                        }\r
 \r
@@ -9502,66 +12103,85 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        return h;\r
                },\r
 \r
-               setContent : function(h, o) {\r
-                       var t = this;\r
+               setContent : function(content, args) {\r
+                       var self = this, rootNode, body = self.getBody(), forcedRootBlockName;\r
 \r
-                       o = o || {};\r
-                       o.format = o.format || 'html';\r
-                       o.set = true;\r
-                       o.content = h;\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.set = true;\r
+                       args.content = content;\r
 \r
-                       if (!o.no_events)\r
-                               t.onBeforeSetContent.dispatch(t, o);\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeSetContent.dispatch(self, args);\r
+\r
+                       content = args.content;\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
+                       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
-                       o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content));\r
+                               body.innerHTML = content;\r
+                               self.selection.select(body, true);\r
+                               self.selection.collapse(true);\r
+                               return;\r
+                       }\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
+                       // 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
-                       if (!o.no_events)\r
-                               t.onSetContent.dispatch(t, o);\r
+                       // Set the new cleaned contents to the editor\r
+                       args.content = tinymce.trim(content);\r
+                       self.dom.setHTML(body, args.content);\r
 \r
-                       return o.content;\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onSetContent.dispatch(self, args);\r
+\r
+                       return args.content;\r
                },\r
 \r
-               getContent : function(o) {\r
-                       var t = this, h;\r
+               getContent : function(args) {\r
+                       var self = this, content;\r
 \r
-                       o = o || {};\r
-                       o.format = o.format || 'html';\r
-                       o.get = true;\r
+                       // Setup args object\r
+                       args = args || {};\r
+                       args.format = args.format || 'html';\r
+                       args.get = true;\r
 \r
-                       if (!o.no_events)\r
-                               t.onBeforeGetContent.dispatch(t, o);\r
+                       // Do preprocessing\r
+                       if (!args.no_events)\r
+                               self.onBeforeGetContent.dispatch(self, args);\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
+                       // 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
-                       h = h.replace(/^\s*|\s*$/g, '');\r
-                       o.content = h;\r
+                       args.content = tinymce.trim(content);\r
 \r
-                       if (!o.no_events)\r
-                               t.onGetContent.dispatch(t, o);\r
+                       // Do post processing\r
+                       if (!args.no_events)\r
+                               self.onGetContent.dispatch(self, args);\r
 \r
-                       return o.content;\r
+                       return args.content;\r
                },\r
 \r
                isDirty : function() {\r
-                       var t = this;\r
+                       var self = this;\r
 \r
-                       return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;\r
+                       return tinymce.trim(self.startContent) != tinymce.trim(self.getContent({format : 'raw', no_events : 1})) && !self.isNotDirty;\r
                },\r
 \r
                getContainer : function() {\r
@@ -9739,7 +12359,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                _addEvents : function() {\r
                        // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset\r
-                       var t = this, i, s = t.settings, lo = {\r
+                       var t = this, i, s = t.settings, dom = t.dom, lo = {\r
                                mouseup : 'onMouseUp',\r
                                mousedown : 'onMouseDown',\r
                                click : 'onClick',\r
@@ -9771,35 +12391,26 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
+                                               dom.bind(t.getDoc(), k, eventHandler);\r
                                                break;\r
 \r
                                        case 'paste':\r
-                                               t.dom.bind(t.getBody(), k, function(e) {\r
+                                               dom.bind(t.getBody(), k, function(e) {\r
                                                        eventHandler(e);\r
                                                });\r
                                                break;\r
 \r
                                        case 'submit':\r
                                        case 'reset':\r
-                                               t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);\r
+                                               dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);\r
                                                break;\r
 \r
                                        default:\r
-                                               t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);\r
+                                               dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);\r
                                }\r
                        });\r
 \r
-                       t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {\r
+                       dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {\r
                                t.focus(true);\r
                        });\r
 \r
@@ -9807,22 +12418,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        // 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
-\r
-                                               if (v = e.getAttribute('_mce_src'))\r
-                                                       e.src = t.documentBaseURI.toAbsolute(v);\r
-                                       })\r
-                               });*/\r
-\r
-                               t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {\r
+                               dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {\r
                                        var v;\r
 \r
                                        e = e.target;\r
 \r
-                                       if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('_mce_src')))\r
+                                       if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('data-mce-src')))\r
                                                e.src = t.documentBaseURI.toAbsolute(v);\r
                                });\r
                        }\r
@@ -9835,8 +12436,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                        if (isGecko && !s.readonly) {\r
                                                if (t._isHidden()) {\r
                                                        try {\r
-                                                               if (!s.content_editable)\r
-                                                                       d.designMode = 'On';\r
+                                                               if (!s.content_editable) {\r
+                                                                       d.body.contentEditable = false;\r
+                                                                       d.body.contentEditable = true;\r
+                                                               }\r
                                                        } catch (ex) {\r
                                                                // Fails if it's hidden\r
                                                        }\r
@@ -9863,18 +12466,20 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                t.onMouseDown.add(setOpts);\r
                        }\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
+                       t.onClick.add(function(ed, e) {\r
+                               e = e.target;\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
+                               // 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 (tinymce.isWebKit && e.nodeName == 'IMG')\r
+                                       t.selection.getSel().setBaseAndExtent(e, 0, e, 1);\r
+\r
+                               if (e.nodeName == 'A' && dom.hasClass(e, 'mceItemAnchor'))\r
+                                       t.selection.select(e);\r
+\r
+                               t.nodeChanged();\r
+                       });\r
 \r
                        // Add node change handlers\r
                        t.onMouseUp.add(t.nodeChanged);\r
@@ -9965,7 +12570,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
+                               dom.bind(t.getDoc(), 'controlselect', function(e) {\r
                                        var re = t.resizeInfo, cb;\r
 \r
                                        e = e.target;\r
@@ -9975,28 +12580,28 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                return;\r
 \r
                                        if (re)\r
-                                               t.dom.unbind(re.node, re.ev, re.cb);\r
+                                               dom.unbind(re.node, re.ev, re.cb);\r
 \r
-                                       if (!t.dom.hasClass(e, 'mceItemNoResize')) {\r
+                                       if (!dom.hasClass(e, 'mceItemNoResize')) {\r
                                                ev = 'resizeend';\r
-                                               cb = t.dom.bind(e, ev, function(e) {\r
+                                               cb = dom.bind(e, ev, function(e) {\r
                                                        var v;\r
 \r
                                                        e = e.target;\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
+                                                       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 = t.dom.getStyle(e, 'height')) {\r
-                                                               t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));\r
-                                                               t.dom.setStyle(e, 'height', '');\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 = t.dom.bind(e, 'resizestart', Event.cancel, Event);\r
+                                               cb = dom.bind(e, 'resizestart', Event.cancel, Event);\r
                                        }\r
 \r
                                        re = t.resizeInfo = {\r
@@ -10005,27 +12610,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                cb : cb\r
                                        };\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
-\r
-                               /*if (t.dom.boxModel) {\r
-                                       t.getBody().style.height = '100%';\r
-\r
-                                       Event.add(t.getWin(), 'resize', function(e) {\r
-                                               var docElm = t.getDoc().documentElement;\r
-\r
-                                               docElm.style.height = (docElm.offsetHeight - 10) + 'px';\r
-                                       });\r
-                               }*/\r
                        }\r
 \r
                        if (tinymce.isOpera) {\r
@@ -10037,74 +12621,61 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        // Add custom undo/redo handlers\r
                        if (s.custom_undo_redo) {\r
                                function addUndo() {\r
-                                       t.undoManager.typing = 0;\r
+                                       t.undoManager.typing = false;\r
                                        t.undoManager.add();\r
                                };\r
 \r
-                               t.dom.bind(t.getDoc(), 'focusout', function(e) {\r
+                               dom.bind(t.getDoc(), 'focusout', function(e) {\r
                                        if (!t.removed && t.undoManager.typing)\r
                                                addUndo();\r
                                });\r
 \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
                                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
+                                       var keyCode = e.keyCode;\r
+\r
+                                       if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 13 || keyCode == 45 || e.ctrlKey)\r
                                                addUndo();\r
                                });\r
 \r
                                t.onKeyDown.add(function(ed, e) {\r
-                                       var rng, parent, bookmark;\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
-                                                       // 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
-\r
-                                                       // Delete contents\r
-                                                       t.selection.getSel().clear();\r
-\r
-                                                       // Check if we are within the same parent\r
-                                                       if (rng.parentElement() == parent) {\r
-                                                               bookmark = t.selection.getBookmark();\r
+                                       var keyCode = e.keyCode, sel;\r
 \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 (keyCode == 8) {\r
+                                               sel = t.getDoc().selection;\r
 \r
-                                                               // Restore the caret position\r
-                                                               t.selection.moveToBookmark(bookmark);\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
-                                                       // Block the default delete behavior since it might be broken\r
-                                                       e.preventDefault();\r
-                                                       return;\r
+                                                       return Event.cancel(e);\r
                                                }\r
                                        }\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
+                                       // 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 (t.undoManager.typing)\r
                                                        addUndo();\r
 \r
                                                return;\r
                                        }\r
 \r
-                                       if (!t.undoManager.typing) {\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
-                                               t.undoManager.typing = 1;\r
                                        }\r
                                });\r
 \r
@@ -10113,68 +12684,64 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                addUndo();\r
                                });\r
                        }\r
-               },\r
 \r
-               _isHidden : function() {\r
-                       var s;\r
+                       // Bug fix for FireFox keeping styles from end of selection instead of start.\r
+                       if (tinymce.isGecko) {\r
+                               function getAttributeApplyFunction() {\r
+                                       var template = t.dom.getAttribs(t.selection.getStart().cloneNode(false));\r
+\r
+                                       return function() {\r
+                                               var target = t.selection.getStart();\r
+                                               t.dom.removeAllAttribs(target);\r
+                                               each(template, function(attr) {\r
+                                                       target.setAttributeNode(attr.cloneNode(true));\r
+                                               });\r
+                                       };\r
+                               }\r
 \r
-                       if (!isGecko)\r
-                               return 0;\r
+                               function isSelectionAcrossElements() {\r
+                                       var s = t.selection;\r
 \r
-                       // Weird, wheres that cursor selection?\r
-                       s = this.selection.getSel();\r
-                       return (!s || !s.rangeCount || s.rangeCount == 0);\r
-               },\r
+                                       return !s.isCollapsed() && s.getStart() != s.getEnd();\r
+                               }\r
 \r
-               // Fix for bug #1867292\r
-               _fixNesting : function(s) {\r
-                       var d = [], i;\r
+                               t.onKeyPress.add(function(ed, e) {\r
+                                       var applyAttributes;\r
 \r
-                       s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {\r
-                               var e;\r
+                                       if ((e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {\r
+                                               applyAttributes = getAttributeApplyFunction();\r
+                                               t.getDoc().execCommand('delete', false, null);\r
+                                               applyAttributes();\r
 \r
-                               // Handle end element\r
-                               if (b === '/') {\r
-                                       if (!d.length)\r
-                                               return '';\r
+                                               return Event.cancel(e);\r
+                                       }\r
+                               });\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
+                               t.dom.bind(t.getDoc(), 'cut', function(e) {\r
+                                       var applyAttributes;\r
 \r
-                                               return '';\r
-                                       } else {\r
-                                               d.pop();\r
+                                       if (isSelectionAcrossElements()) {\r
+                                               applyAttributes = getAttributeApplyFunction();\r
+                                               t.onKeyUp.addToTop(Event.cancel, Event);\r
 \r
-                                               if (d.length && d[d.length - 1].close) {\r
-                                                       a = a + '</' + d[d.length - 1].tag + '>';\r
-                                                       d.pop();\r
-                                               }\r
+                                               setTimeout(function() {\r
+                                                       applyAttributes();\r
+                                                       t.onKeyUp.remove(Event.cancel, Event);\r
+                                               }, 0);\r
                                        }\r
-                               } else {\r
-                                       // Ignore these\r
-                                       if (/^(br|hr|input|meta|img|link|param)$/i.test(c))\r
-                                               return a;\r
-\r
-                                       // Ignore closed ones\r
-                                       if (/\/>$/.test(a))\r
-                                               return a;\r
-\r
-                                       d.push({tag : c}); // Push start element\r
-                               }\r
+                               });\r
+                       }\r
+               },\r
 \r
-                               return a;\r
-                       });\r
+               _isHidden : function() {\r
+                       var s;\r
 \r
-                       // End all open tags\r
-                       for (i=d.length - 1; i>=0; i--)\r
-                               s += '</' + d[i].tag + '>';\r
+                       if (!isGecko)\r
+                               return 0;\r
 \r
-                       return s;\r
+                       // Weird, wheres that cursor selection?\r
+                       s = this.selection.getSel();\r
+                       return (!s || !s.rangeCount || s.rangeCount == 0);\r
                }\r
        });\r
 })(tinymce);\r
@@ -10321,6 +12888,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                });\r
 \r
                                toggleFormat('align' + align);\r
+                               execCommand('mceRepaint');\r
                        },\r
 \r
                        // Override list commands to fix WebKit bug\r
@@ -10346,7 +12914,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        },\r
 \r
                        // Override commands to use the text formatter engine\r
-                       'Bold,Italic,Underline,Strikethrough' : function(command) {\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
                                toggleFormat(command);\r
                        },\r
 \r
@@ -10387,44 +12955,170 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        mceCleanup : function() {\r
                                var bookmark = selection.getBookmark();\r
 \r
-                               editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});\r
+                               editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});\r
+\r
+                               selection.moveToBookmark(bookmark);\r
+                       },\r
+\r
+                       mceRemoveNode : function(command, ui, value) {\r
+                               var node = value || selection.getNode();\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
+\r
+                       mceSelectNodeDepth : function(command, ui, value) {\r
+                               var counter = 0;\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
+\r
+                       mceSelectNode : function(command, ui, value) {\r
+                               selection.select(value);\r
+                       },\r
+\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
+                               // 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
+                               // 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
+                               // Add caret at end of contents if it's missing\r
+                               if (value.indexOf('{$caret}') == -1)\r
+                                       value += '{$caret}';\r
+\r
+                               // Replace the caret marker with a span bookmark element\r
+                               value = value.replace(/\{\$caret\}/, bookmarkHtml);\r
+\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
+                               parentNode = selection.getNode();\r
+\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
+                               // Move the caret to a more suitable location\r
+                               node = fragment.lastChild;\r
+                               if (node.attr('id') == 'mce_marker') {\r
+                                       marker = node;\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
+                               // If parser says valid we can insert the contents into that parent\r
+                               if (!args.invalid) {\r
+                                       value = serializer.serialize(fragment);\r
+\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 bookmark node and get the parent\r
+                                       selection.setContent(bookmarkHtml);\r
+                                       parentNode = editor.selection.getNode();\r
+                                       rootNode = editor.getBody();\r
+\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
+                                       // Find the ancestor just before the root element\r
+                                       while (node !== rootNode) {\r
+                                               parentNode = node;\r
+                                               node = node.parentNode;\r
+                                       }\r
+\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
-                               selection.moveToBookmark(bookmark);\r
-                       },\r
+                               marker = dom.get('mce_marker');\r
 \r
-                       mceRemoveNode : function(command, ui, value) {\r
-                               var node = value || selection.getNode();\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
-                               // 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
+                               // 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
 \r
-                       mceSelectNodeDepth : function(command, ui, value) {\r
-                               var counter = 0;\r
+                               // Move selection before marker and remove it\r
+                               rng = dom.createRng();\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
+                               // 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
-                       mceSelectNode : function(command, ui, value) {\r
-                               selection.select(value);\r
-                       },\r
+                               // Remove the marker node and set the new range\r
+                               dom.remove(marker);\r
+                               selection.setRng(rng);\r
 \r
-                       mceInsertContent : function(command, ui, value) {\r
-                               selection.setContent(value);\r
+                               // Dispatch after event and add any visual elements needed\r
+                               selection.onSetContent.dispatch(selection, args);\r
+                               editor.addVisual();\r
                        },\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
+                               editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, function() { return value }));\r
                        },\r
 \r
                        mceSetContent : function(command, ui, value) {\r
@@ -10474,7 +13168,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        },\r
 \r
                        InsertHorizontalRule : function() {\r
-                               selection.setContent('<hr />');\r
+                               editor.execCommand('mceInsertContent', false, '<hr />');\r
                        },\r
 \r
                        mceToggleVisualAid : function() {\r
@@ -10483,18 +13177,41 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        },\r
 \r
                        mceReplaceContent : function(command, ui, value) {\r
-                               selection.setContent(value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));\r
+                               editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));\r
                        },\r
 \r
                        mceInsertLink : function(command, ui, value) {\r
-                               var link = dom.getParent(selection.getNode(), 'a');\r
+                               var link = dom.getParent(selection.getNode(), 'a'), img, style, cls;\r
 \r
                                if (tinymce.is(value, 'string'))\r
                                        value = {href : value};\r
 \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
                                if (!link) {\r
+                                       // WebKit can't create links on floated images for some odd reason\r
+                                       // So, just remove styles and restore it later\r
+                                       if (tinymce.isWebKit) {\r
+                                               img = dom.getParent(selection.getNode(), 'img');\r
+\r
+                                               if (img) {\r
+                                                       style = img.style.cssText;\r
+                                                       cls = img.className;\r
+                                                       img.style.cssText = null;\r
+                                                       img.className = null;\r
+                                               }\r
+                                       }\r
+\r
                                        execNativeCommand('CreateLink', FALSE, 'javascript:mctmp(0);');\r
-                                       each(dom.select('a[href=javascript:mctmp(0);]'), function(link) {\r
+\r
+                                       // Restore styles\r
+                                       if (style)\r
+                                               img.style.cssText = style;\r
+                                       if (cls)\r
+                                               img.className = cls;\r
+\r
+                                       each(dom.select("a[href='javascript:mctmp(0);']"), function(link) {\r
                                                dom.setAttribs(link, value);\r
                                        });\r
                                } else {\r
@@ -10522,7 +13239,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                return isFormatMatch('align' + command.substring(7));\r
                        },\r
 \r
-                       'Bold,Italic,Underline,Strikethrough' : function(command) {\r
+                       'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {\r
                                return isFormatMatch(command);\r
                        },\r
 \r
@@ -10579,23 +13296,30 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                }\r
        };\r
 })(tinymce);\r
+\r
 (function(tinymce) {\r
        var Dispatcher = tinymce.util.Dispatcher;\r
 \r
        tinymce.UndoManager = function(editor) {\r
-               var self, index = 0, data = [];\r
+               var self, index = 0, data = [], beforeBookmark;\r
 \r
                function getContent() {\r
                        return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}));\r
                };\r
 \r
                return self = {\r
-                       typing : 0,\r
+                       typing : false,\r
 \r
                        onAdd : new Dispatcher(self),\r
+\r
                        onUndo : new Dispatcher(self),\r
+\r
                        onRedo : new Dispatcher(self),\r
 \r
+                       beforeChange : function() {\r
+                               beforeBookmark = editor.selection.getBookmark(2, true);\r
+                       },\r
+\r
                        add : function(level) {\r
                                var i, settings = editor.settings, lastLevel;\r
 \r
@@ -10604,10 +13328,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \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
+                               if (lastLevel && lastLevel.content == level.content)\r
+                                       return null;\r
+\r
+                               // Set before bookmark on previous level\r
+                               if (data[index])\r
+                                       data[index].beforeBookmark = beforeBookmark;\r
 \r
                                // Time to compress\r
                                if (settings.custom_undo_redo_levels) {\r
@@ -10624,13 +13350,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                level.bookmark = editor.selection.getBookmark(2, true);\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
+                               if (index < data.length - 1)\r
+                                       data.length = index + 1;\r
 \r
                                data.push(level);\r
                                index = data.length - 1;\r
@@ -10646,14 +13367,14 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                if (self.typing) {\r
                                        self.add();\r
-                                       self.typing = 0;\r
+                                       self.typing = false;\r
                                }\r
 \r
                                if (index > 0) {\r
                                        level = data[--index];\r
 \r
                                        editor.setContent(level.content, {format : 'raw'});\r
-                                       editor.selection.moveToBookmark(level.bookmark);\r
+                                       editor.selection.moveToBookmark(level.beforeBookmark);\r
 \r
                                        self.onUndo.dispatch(self, level);\r
                                }\r
@@ -10678,15 +13399,16 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                        clear : function() {\r
                                data = [];\r
-                               index = self.typing = 0;\r
+                               index = 0;\r
+                               self.typing = false;\r
                        },\r
 \r
                        hasUndo : function() {\r
-                               return index > 0 || self.typing;\r
+                               return index > 0 || this.typing;\r
                        },\r
 \r
                        hasRedo : function() {\r
-                               return index < data.length - 1;\r
+                               return index < data.length - 1 && !this.typing;\r
                        }\r
                };\r
        };\r
@@ -10735,24 +13457,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                return rng2.cloneContents().textContent.length == 0;\r
        };\r
 \r
-       function isEmpty(n) {\r
-               n = n.innerHTML;\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
-\r
-               return n.replace(/[ \u00a0\t\r\n]+/g, '') == '';\r
-       };\r
-\r
        function splitList(selection, dom, li) {\r
                var listBlock, block;\r
 \r
-               if (isEmpty(li)) {\r
+               if (dom.isEmpty(li)) {\r
                        listBlock = dom.getParent(li, 'ul,ol');\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
+                               block = dom.create('p', 0, '<br data-mce-bogus="1" />');\r
                                dom.replace(block, li);\r
                                selection.select(block, 1);\r
                        }\r
@@ -10773,45 +13486,94 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        s.element = elm.toUpperCase();\r
 \r
                        ed.onPreInit.add(t.setup, t);\r
+               },\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
+               setup : function() {\r
+                       var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection, blockElements = ed.schema.getBlockElements();\r
 \r
-                       function padd(ed, o) {\r
-                               if (isOpera)\r
-                                       o.content = o.content.replace(t.reOpera, '</' + elm + '>');\r
+                       // Force root blocks\r
+                       if (s.forced_root_block) {\r
+                               function addRootBlocks() {\r
+                                       var node = selection.getStart(), rootNode = ed.getBody(), rng, startContainer, startOffset, endContainer, endOffset, rootBlockNode, tempNode, offset = -0xFFFFFF;\r
 \r
-                               o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>');\r
+                                       if (!node || node.nodeType !== 1)\r
+                                               return;\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
+                                       // Check if node is wrapped in block\r
+                                       while (node != rootNode) {\r
+                                               if (blockElements[node.nodeName])\r
+                                                       return;\r
 \r
-                       ed.onBeforeSetContent.add(padd);\r
-                       ed.onPostProcess.add(padd);\r
+                                               node = node.parentNode;\r
+                                       }\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
+                                       // 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
+                                                       rng = ed.getDoc().body.createTextRange();\r
+                                                       rng.moveToElementText(rng.item(0));\r
+                                               }\r
 \r
-               setup : function() {\r
-                       var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection;\r
+                                               tmpRng = rng.duplicate();\r
+                                               tmpRng.collapse(true);\r
+                                               startOffset = tmpRng.move('character', offset) * -1;\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
+                                               if (!tmpRng.collapsed) {\r
+                                                       tmpRng = rng.duplicate();\r
+                                                       tmpRng.collapse(false);\r
+                                                       endOffset = (tmpRng.move('character', offset) * -1) - startOffset;\r
+                                               }\r
+                                       }\r
+\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(s.forced_root_block);\r
+                                                               node.parentNode.insertBefore(rootBlockNode, node);\r
+                                                       }\r
+\r
+                                                       tempNode = node;\r
+                                                       node = node.nextSibling;\r
+                                                       rootBlockNode.appendChild(tempNode);\r
+                                               } else {\r
+                                                       rootBlockNode = null;\r
+                                                       node = node.nextSibling;\r
+                                               }\r
+                                       }\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 = ed.getDoc().body.createTextRange();\r
+                                                       rng.moveToElementText(rootNode);\r
+                                                       rng.collapse(true);\r
+                                                       rng.moveStart('character', startOffset);\r
+\r
+                                                       if (endOffset > 0)\r
+                                                               rng.moveEnd('character', endOffset);\r
+\r
+                                                       rng.select();\r
+                                               } catch (ex) {\r
+                                                       // Ignore\r
+                                               }\r
+                                       }\r
+\r
+                                       ed.nodeChanged();\r
+                               };\r
+\r
+                               ed.onKeyUp.add(addRootBlocks);\r
+                               ed.onClick.add(addRootBlocks);\r
                        }\r
 \r
                        if (s.force_br_newlines) {\r
@@ -10861,12 +13623,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                        var parent = ed.selection.getStart(), fmt = t._previousFormats;\r
 \r
                                                        // Parent is an empty block\r
-                                                       if (!parent.hasChildNodes()) {\r
+                                                       if (!parent.hasChildNodes() && fmt) {\r
                                                                parent = dom.getParent(parent, dom.isBlock);\r
 \r
-                                                               if (parent) {\r
+                                                               if (parent && parent.nodeName != 'LI') {\r
                                                                        parent.innerHTML = '';\r
-       \r
+\r
                                                                        if (t._previousFormats) {\r
                                                                                parent.appendChild(fmt.wrapper);\r
                                                                                fmt.inner.innerHTML = '\uFEFF';\r
@@ -10874,7 +13636,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                                                parent.innerHTML = '\uFEFF';\r
 \r
                                                                        selection.select(parent, 1);\r
+                                                                       selection.collapse(true);\r
                                                                        ed.getDoc().execCommand('Delete', false, null);\r
+                                                                       t._previousFormats = 0;\r
                                                                }\r
                                                        }\r
                                                }\r
@@ -10927,21 +13691,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                });\r
                        }\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
-\r
                        // IE specific fixes\r
                        if (isIE) {\r
                                // Replaces IE:s auto generated paragraphs with the specified element name\r
@@ -10971,155 +13720,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        }\r
                },\r
 \r
-               find : function(n, t, s) {\r
-                       var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, FALSE), c = -1;\r
-\r
-                       while (n = w.nextNode()) {\r
-                               c++;\r
-\r
-                               // Index by node\r
-                               if (t == 0 && n == s)\r
-                                       return c;\r
-\r
-                               // Node by index\r
-                               if (t == 1 && c == s)\r
-                                       return n;\r
-                       }\r
-\r
-                       return -1;\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
-\r
-                       // Fix for bug #1863847\r
-                       //if (e && e.keyCode == 13)\r
-                       //      return TRUE;\r
-\r
-                       // Wrap non blocks into blocks\r
-                       for (i = nl.length - 1; i >= 0; i--) {\r
-                               nx = nl[i];\r
-\r
-                               // Ignore internal elements\r
-                               if (nx.nodeType === 1 && nx.getAttribute('_mce_type')) {\r
-                                       bl = null;\r
-                                       continue;\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
-\r
-                                                                       tr = d.body.createTextRange();\r
-                                                                       tr.moveToElementText(b);\r
-                                                                       tr.collapse(1);\r
-                                                                       bp = tr.move('character', c) * -1;\r
-\r
-                                                                       tr = r.duplicate();\r
-                                                                       tr.collapse(1);\r
-                                                                       sp = tr.move('character', c) * -1;\r
-\r
-                                                                       tr = r.duplicate();\r
-                                                                       tr.collapse(0);\r
-                                                                       le = (tr.move('character', c) * -1) - sp;\r
-\r
-                                                                       si = sp - bp;\r
-                                                                       ei = le;\r
-                                                               }\r
-                                                       }\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
-\r
-                       // Restore selection\r
-                       if (si != -2) {\r
-                               if (!isIE) {\r
-                                       bl = b.getElementsByTagName(ed.settings.element)[0];\r
-                                       r = d.createRange();\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
-\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
-\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
-                               }\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
-                               // Move caret before selected element\r
-                               r = d.createRange();\r
-                               r.setStartBefore(n);\r
-                               r.setEndBefore(n);\r
-                               se.setRng(r);\r
-                       }\r
-               },\r
-\r
                getParentBlock : function(n) {\r
                        var d = this.dom;\r
 \r
@@ -11130,6 +13730,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
 \r
+                       ed.undoManager.beforeChange();\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
@@ -11305,10 +13907,6 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (aft.firstChild && aft.firstChild.nodeName == bn)\r
                                aft.innerHTML = aft.firstChild.innerHTML;\r
 \r
-                       // Padd empty blocks\r
-                       if (isEmpty(bef))\r
-                               bef.innerHTML = '<br />';\r
-\r
                        function appendStyles(e, en) {\r
                                var nl = [], nn, n, i;\r
 \r
@@ -11333,14 +13931,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                nn = nn.appendChild(nl[i]);\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
+                                       nl[0].innerHTML = isOpera ? '\u00a0' : '<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
+                                       e.innerHTML = isOpera ? '\u00a0' : '<br />'; // Extra space for Opera so that the caret can move there\r
                        };\r
+                               \r
+                       // Padd empty blocks\r
+                       if (dom.isEmpty(bef))\r
+                               appendStyles(bef, sn);\r
 \r
                        // Fill empty afterblook with current style\r
-                       if (isEmpty(aft))\r
+                       if (dom.isEmpty(aft))\r
                                car = appendStyles(aft, en);\r
 \r
                        // Opera needs this one backwards for older versions\r
@@ -11356,27 +13958,26 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        aft.normalize();\r
                        bef.normalize();\r
 \r
-                       function first(n) {\r
-                               return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE).nextNode() || n;\r
-                       };\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
+                       ed.selection.select(aft, true);\r
+                       ed.selection.collapse(true);\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
+                       //ch = aft.clientHeight;\r
 \r
                        // Is element within viewport\r
-                       if (y < vp.y || y + ch > vp.y + vp.h) {\r
+                       if (y < vp.y || y + 25 > 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
+\r
+                               /*console.debug(\r
+                                       'Element: y=' + y + ', h=' + ch + ', ' +\r
+                                       'Viewport: y=' + vp.y + ", h=" + vp.h + ', bottom=' + (vp.y + vp.h)\r
+                               );*/\r
                        }\r
 \r
+                       ed.undoManager.add();\r
+\r
                        return FALSE;\r
                },\r
 \r
@@ -11591,7 +14192,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                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
@@ -11646,11 +14247,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
@@ -11693,7 +14294,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
@@ -11733,7 +14334,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
@@ -11765,13 +14366,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
@@ -11908,53 +14521,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
@@ -11963,7 +14529,7 @@ 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
@@ -12032,8 +14598,31 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        }\r
                };\r
 \r
+               var getTextDecoration = function(node) {\r
+                       var decoration;\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
                function apply(name, vars, node) {\r
-                       var formatList = get(name), format = formatList[0], bookmark, rng, i;\r
+                       var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed();\r
 \r
                        function moveStart(rng) {\r
                                var container = rng.startContainer,\r
@@ -12124,6 +14713,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
@@ -12138,7 +14732,8 @@ 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 (isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&\r
+                                                               !(node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279)) {\r
                                                        // Start wrapping\r
                                                        if (!currentWrapElm) {\r
                                                                // Wrap the node\r
@@ -12148,6 +14743,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                        }\r
 \r
                                                        currentWrapElm.appendChild(node);\r
+                                               } else if (nodeName == 'li') {\r
+                                                       // Start wrapping\r
+                                                       if (!currentWrapElm) {\r
+                                                               // Wrap the node\r
+                                                               liTextNode = node.ownerDocument.createTextNode('');\r
+                                                               each(tinymce.grep(node.childNodes), function(n) { if (n.nodeType == 3) { liTextNode.nodeValue += n.nodeValue; n.parentNode.removeChild(n); } });\r
+                                                               currentWrapElm = wrapElm.cloneNode(FALSE);\r
+                                                               node.insertBefore(currentWrapElm, node.firstChild);\r
+                                                               newWrappers.push(currentWrapElm);\r
+                                                       }\r
+\r
+                                                       currentWrapElm.appendChild(liTextNode);\r
+                                                       \r
                                                } else {\r
                                                        // Start a new wrapper for possible children\r
                                                        currentWrapElm = 0;\r
@@ -12163,6 +14771,30 @@ 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 = wrapElm.cloneNode(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
                                each(newWrappers, function(node) {\r
                                        var childCount;\r
@@ -12202,8 +14834,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
@@ -12219,6 +14852,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
@@ -12259,11 +14905,20 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 \r
                                        applyRngStyle(expandRng(rng, formatList));\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
                                                // Apply formatting to selection\r
                                                bookmark = selection.getBookmark();\r
                                                applyRngStyle(expandRng(selection.getRng(TRUE), formatList));\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
                                                ed.nodeChanged();\r
@@ -12427,8 +15082,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
@@ -12451,6 +15106,11 @@ 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
@@ -12464,7 +15124,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                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
@@ -12480,7 +15140,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                };\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
@@ -12744,7 +15406,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        var startContainer = rng.startContainer,\r
                                startOffset = rng.startOffset,\r
                                endContainer = rng.endContainer,\r
-                               endOffset = rng.endOffset, sibling, lastIdx;\r
+                               endOffset = rng.endOffset, sibling, lastIdx, leaf;\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
@@ -12774,6 +15436,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                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
@@ -12799,12 +15474,36 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        if (isBookmarkNode(startContainer))\r
                                startContainer = startContainer.nextSibling || startContainer;\r
 \r
-                       if (isBookmarkNode(endContainer.parentNode))\r
+                       if (isBookmarkNode(endContainer.parentNode)) {\r
+                               endOffset = dom.nodeIndex(endContainer);\r
                                endContainer = endContainer.parentNode;\r
+                       }\r
 \r
-                       if (isBookmarkNode(endContainer))\r
-                               endContainer = endContainer.previousSibling || endContainer;\r
+                       if (isBookmarkNode(endContainer) && endContainer.previousSibling) {\r
+                               endContainer = endContainer.previousSibling;\r
+                               endOffset = endContainer.length;\r
+                       }\r
+\r
+                       if (format[0].inline) {\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
+                                                       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
@@ -12817,7 +15516,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        // 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
@@ -12825,7 +15524,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
@@ -12935,7 +15640,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
@@ -12976,7 +15681,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
@@ -13061,7 +15766,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
@@ -13132,7 +15837,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                        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
+                                               if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0)\r
                                                        return node;\r
 \r
                                                if (sibling.nodeType == 1 && !isBookmarkNode(sibling))\r
@@ -13209,6 +15914,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                // Apply pending formats\r
                                each(pendingFormats.apply.reverse(), function(item) {\r
                                        apply(item.name, item.vars, caret_node);\r
+\r
+                                       // Colored nodes should be underlined so that the color of the underline matches the text color.\r
+                                       if (item.name === 'forecolor' && item.vars.value)\r
+                                               processUnderlineAndColor(caret_node.parentNode);\r
                                });\r
 \r
                                // Remove pending formats\r
@@ -13266,6 +15975,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
                                                                        if (isCaretNode(node)) {\r
                                                                                textNode = node.firstChild;\r
 \r
+                                                                               // Find the first text node within node\r
+                                                                               while (textNode && textNode.nodeType != 3)\r
+                                                                                       textNode = textNode.firstChild;\r
+\r
                                                                                if (textNode) {\r
                                                                                        perform(node);\r
 \r
@@ -13298,9 +16011,12 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
                fontSizes = tinymce.explode(settings.font_size_style_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
@@ -13337,6 +16053,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
index 2617a26edb2b0a60f2fc986c586214a6e3fa56bb..59da01399e1e7c2fe9025f20db26b300ecf06015 100644 (file)
 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
index 825d4c143357516f0be55e2b8e9c8be10c429ceb..458ec86da60a46b3831ac23f9fe981b06bff2089 100644 (file)
@@ -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
index a6fcf970153598b4acb9db56ff55f49e7fdca72f..27cbfab811e317865dfbda1c690b09c88d3b7b9b 100644 (file)
@@ -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